-
Notifications
You must be signed in to change notification settings - Fork 8.2k
samples: sensor: adt7420: correct devicetree and improve sample #21558
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
samples: sensor: adt7420: correct devicetree and improve sample #21558
Conversation
2aa3d08 to
4a1d2bb
Compare
samples/sensor/adt7420/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.
change to:
... a |plusminus| 1 |deg| C window ...
The device address can only be 0x48 through 0x1B. C6 is connected to the FXOS870 and is not exposed on a header: switch to Arduino D0. Move this to a boards subdirectory so we can add other overlays without cluttering the root. Signed-off-by: Peter Bigot <[email protected]>
Expand the set of hardware this can be tested with. Signed-off-by: Peter Bigot <[email protected]>
When a trigger was enabled the original implementation would do nothing more than print "Waiting for a threshold event", without describing what such an event would look like. Rework to maintain a window of +/- 0.5 Cel around the most recent in-window temperature, and reset that window whenever a trigger occurs or a non-trigger reading is outside the window. Time-out and display the temperature if no event occurs in a reasonable time. Signed-off-by: Peter Bigot <[email protected]>
4a1d2bb to
aaa774a
Compare
| reg = <0x48>; | ||
| label = "ADT7420"; | ||
| int-gpios = <&gpioc 6 0>; | ||
| int-gpios = <&gpioc 16 0>; |
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.
Let's replace with <&arduino_header 6 0> /* D0 */.
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.
Makes sense, but this propagated from the original conversion to devicetree, and isn't specific to this sample: there are at least twelve samples that bypass the Ardunio alias and nexus map for this platform, probably more that do it for other platforms.
Can we do this in a separate PR that fixes it for all samples at once, after the dust settles on topic-gpio and it won't create conflicts?
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.
Sure
| */ | ||
|
|
||
| &i2c1 { | ||
| &i2c0 { |
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.
Let's replace with arduino_i2c
| compatible = "adi,adt7420"; | ||
| reg = <0x48>; | ||
| label = "ADT7420"; | ||
| int-gpios = <&gpio0 11 0>; |
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 arduino here too
The frdm_k64f devicetree overlay specified the wrong (probably) I2C bus, device address, and pin for the alert signal. Fix that.
Add an overlay for the nrf52_pca10040.
Update the sample so that it can be used for testing triggered alerts.
FWIW: As far as I can tell the alert infrastructure does not work correctly: the sensor seems to never indicate an out-of-window temperature, whether in the status register or through the
INTnorCTnsignals. The MCU-side trigger detection has been tested with manual jiggling of the signal level.