-
Notifications
You must be signed in to change notification settings - Fork 8.2k
drivers: sensor: mcp9808: fix various problems and improve test #21547
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
Conversation
|
All checks passed. checkpatch (informational only, not a failure)Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
1b54f1a to
de9f42d
Compare
dbkinder
left a comment
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.
doc changes in #21427 should win
samples/sensor/mcp9808/README.rst
Outdated
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.
The doc changes in #21427 are preferred.
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.
Updates made (plus-minus, explanation of interleaved output). Please continue documentation review here; #21427 will be rebased on top of this change when it goes in.
de9f42d to
22c62e3
Compare
samples/sensor/mcp9808/src/main.c
Outdated
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.
nit: C instead of Cel, all other samples use C.
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.
All other samples are "wrong" because the unit is degrees Celsius, not coulombs, but I'll change this.
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.
:)
some sample actually have °C, but those have some kind of display.
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.
Remove this line
samples/sensor/mcp9808/README.rst
Outdated
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.
Typo?
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.
No, interleaved output from unsynchronized printf from thread and ISR.
nashif
left a comment
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.
tested with sensor breakout on disco_l475_iot1, works for me.
Correct handling of device encoded temperature values, which combine a 12-bit 2s complement signed value with a separate sign bit. Rework conversion between device and sensor temperature representations to support negative temperatures in both domains. Use a much simpler trigger configuration where the alert is driven by comparator output, rather than as an interrupt that requires a pair of I2C transactions to read and clear the flag. Refactor the trigger infrastructure to use the setup/handle/process idiom, which reduces duplicated code and to correctly detect alerts present when the triggers are set. Completely replace the sample with something that demonstrates updating upper and lower threshold values to track moving temperatures. Signed-off-by: Peter A. Bigot <[email protected]>
22c62e3 to
5f08738
Compare
|
Changes complete. |
While attempting to port to the new GPIO API I found the sample to be highly unreliable: The Adafruit breakout does not in fact have pull-ups on the alert signal, only on the I2C signals. A variety of other problems were identified, and resolving those issues resulted in a near complete rework:
Tested with all three trigger options, and with temperatures below zero Celsius.