-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: sensor: sdp3x: add driver #74376
base: main
Are you sure you want to change the base?
Conversation
Hello @ygaillard, and thank you very much for your first pull request to the Zephyr project! |
Thanks for the PR! Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. |
This comment was marked as outdated.
This comment was marked as outdated.
3064a11
to
b614b2e
Compare
@carlescufi , finally fixed my issues. |
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.
Thanks for the contribution!
Please add this sensor to tests/drivers/build_all/sensor
const struct sdp3x_config *cfg = dev->config; | ||
int rc = 0; | ||
|
||
if (!device_is_ready(cfg->bus.bus)) { |
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.
Use i2c_is_ready_dt
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.
This seems to cause an invalid pointer. Could you provide more information on how to use this function? Note that the other implemented sensirion drivers use device_is_ready
.
Log:
In function 'sdp3x_init':
/home/ygaillard/ML_sens_board/external/zephyr/drivers/sensor/sdp3x/sdp3x.c:168:38: warning: passing argument 1 of 'i2c_is_ready_dt' from incompatible pointer type [-Wincompatible-pointer-types]
168 | if (!i2c_is_ready_dt(cfg->bus.bus)) {
| ~~~~~~~~^~~~
| |
| const struct device *
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.
Reference:
zephyr/drivers/mfd/mfd_max20335.c
Line 26 in 18fb3f9
if (!i2c_is_ready_dt(&config->bus)) { |
Can you please point in the coding guidelines how to implement the test? I could not find any for the other sensirion sensors and therefore difficult how to implement them. |
I implemented the changes. Did I miss something in the workflow? |
Add device driver for the SDP3x temperature and differential pressure sensors. Datasheet https://sensirion.com/media/documents/4D045D69/6375F34F/DP_DS_SDP3x_digital_D1.pdf Signed-off-by: Yann Gaillard <yann@gaillard.onl>
rebased to re-trigger stuck CI |
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.
Thanks for your contribution! Code looks good but needs the indentation fixed and address Maureen's comment.
const struct sdp3x_config *cfg = dev->config; | ||
int rc = 0; | ||
|
||
if (!device_is_ready(cfg->bus.bus)) { |
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.
Reference:
zephyr/drivers/mfd/mfd_max20335.c
Line 26 in 18fb3f9
if (!i2c_is_ready_dt(&config->bus)) { |
#define SDP3X_CRC_INIT 0xFF | ||
|
||
struct sdp3x_config { | ||
struct i2c_dt_spec bus; |
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.
Please fix indentation (various places): spaces -> tabs
This is a proposition for a driver using the SDP3x family differential pressure sensors. The related documentation can be found via https://sensirion.com/media/documents/4D045D69/6375F34F/DP_DS_SDP3x_digital_D1.pdf. The code was tested using a SDP31 chip on custom hardware in ambient conditions and return plausible data.
Trigger and continous mode can be selected via project file. The board file select the different mesure mode provided by the sensor.