-
Notifications
You must be signed in to change notification settings - Fork 2.1k
drivers: bmx280: adapt to new I2C api. #9206
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: bmx280: adapt to new I2C api. #9206
Conversation
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.
Needs an update to latest API.
Otherwise I tested this PR with #9198 on an Arduino Zero board and it works.
drivers/bmx280/bmx280.c
Outdated
result = i2c_read_regs(dev->params.i2c_dev, dev->params.i2c_addr, offset, | ||
buffer, nr_bytes_to_read, 0); | ||
i2c_release(dev->params.i2c_dev); | ||
if (result != I2C_ACK) { |
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.
I2C_ACK
'return code was removed from the API, prefer a check like !=
or <0
.
drivers/bmx280/bmx280.c
Outdated
result = i2c_read_regs(dev->params.i2c_dev, dev->params.i2c_addr, | ||
offset, measurement_regs, nr_bytes_to_read, 0); | ||
i2c_release(dev->params.i2c_dev); | ||
if (result != I2C_ACK) { |
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.
Same here.
@basilfx can you rebase onto the latest new_i2c_if? |
77e3618
to
ec65df2
Compare
Sorry for the delay. I have rebased and adapted, but I cannot test this one since I have to fix EFM32 first (which will take some time). |
Thanks |
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.
I'm a bit puzzled because sometimes return codes are used and rest of the time you used (void) function and you're returning other data.
As I know, the coding lines did not say anything about that but this is a bit inconsistent from my point of view.
@aabadie what do you think ?
@dylad Can you tell me which lines? Note that I only adapted this driver to make it work with the new interface, so most code was already in place. |
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.
ec65df2
to
1393890
Compare
Squashed. |
@aabadie Can we dismiss your review ? |
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.
My requested changes were addressed.
ACK and go
drivers: bmx280: adapt to new I2C api.
drivers: bmx280: adapt to new I2C api.
drivers: bmx280: adapt to new I2C api.
Contribution description
This PR updates the BMx280 driver. Tested this one on the SLTB001A (EFM32, adapted).
It's probably better to wait for #8383, but it was easy to adapt for the time being.
Issues/PRs references
#6577