-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: DPS310 driver #463
feat: DPS310 driver #463
Conversation
Requested at UncleRus#456 Sponserd by beriberikix Implemented I2C digital interface.
Thank you Sakurai-san. Very nice and neat code, as always with you. |
while here, fix a bug in the example by initializing the device descriptor with zeros.
* configure the device, and warn when something looks incorrect * fix bugs in two_complement_of(). * rewrite the example for more realistic use cases` while here, replace all the `DSP` and `dsp`.
pointed out at: UncleRus#463 (review)
components/dps310/src/dps310.c
Outdated
esp_err_t dps310_is_ready_for(dps310_t *dev, uint8_t reg, uint8_t mask, bool *ready) | ||
{ | ||
esp_err_t err = ESP_FAIL; | ||
uint8_t reg_value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initialize the variable (and do audit in other places).
components/dps310/src/helper_i2c.c
Outdated
static const char *TAG = "dps310/helper_i2c"; | ||
|
||
/* count the number of trailing zero in a value, usually bitmasks. */ | ||
static uint8_t count_trailing_zero_bits(uint8_t v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefix it with _
(and document what it means).
I was able to test the sample on a ESP32-S3 & Adafruit sensor board and had no issues! |
also add more comments
compensation can be skipped for performance. i believe the use case is not common. no plan to implement faster-but-less-accurate versions. there are bits and pieces in the public header for that.
and document the function
ae852c4
to
6ff7b98
Compare
run measurements in the loop, which is what most users expect from an example.
with `_oversampling_[tp]` and `_rate_[tp]`. and fix a cirtical bug, in which sampling rate was incorrectly used (instead of oversampling).
30e3d33
to
d7ad7d9
Compare
@beriberikix the public APIs are considered as stable now. please have a look at the public header, and the example. I would like to request for your comment, specifically; do the naming conventions in functions, enum, and typedef look clear? I kept original words where appropriate, but modified some (such as I will continue to work on background mode and interrupt, but the driver is now usable for simple use cases. SPI mode is a bit complicated because incompatible SPI APIs in ESP8266 RTOS SDK and esp-idf. the SPI interface is probably designed for use cases in which performance is critical (such as drones). but command mode is enough for your use case, i guess (and if you really need it, it is possible to implement your own by using public APIs). |
@UncleRus I believe that everything you mentioned is fixed. if you are okay with the PR. please merge. I have already noticed that some functions do not have necessary |
Thank you! |
Requested at #456
Sponserd by beriberikix.
Implemented I2C digital interface.