mirror of
https://github.com/apache/nuttx.git
synced 2026-08-20 04:58:28 +00:00
The TMP112 driver was character mode only, and carried the warning that says so: a read returns a bare float, at a size the driver chose, and nothing but code written for this one part can make sense of it. Add the sensor framework version beside it, in the shape the tree already uses for a part that has both. The old driver is untouched and still builds by default; the new one replaces it when SENSORS_TMP112_UORB is set, and the part then appears as a temperature topic that the common sensor tools can read without knowing what a TMP112 is. It reads on the low priority work queue at whatever interval the caller asks for. The part converts continuously out of reset, so nothing is configured and the temperature register always holds the last completed conversion: a reading is one bus transaction with nothing to wait for. Reading faster than the part converts repeats a value, which costs bus traffic and nothing else, so the interval is taken as given: the upper half treats a lower half that hands back a longer interval than it was given as a failed request, so clamping here would refuse a fast caller rather than serve it slowly. get_info reports what the part is and what its readings mean, so a consumer need not know it is talking to a TMP112 to know the range and the resolution. It also sign extends the reading. The register holds twelve bits, and the character mode driver treats them as unsigned, so anything below freezing comes back as a large positive temperature; the part is specified down to -40C. Fixing that in the old driver would change what existing callers see, so it is fixed here, where there are no callers yet to surprise. This driver also covers the TMP102, which differs in accuracy rather than in its registers: only the two both parts have are touched. Documented under the sensors section, beside the other parts with a page of their own, and listed among the uORB drivers. Assisted-by: Claude:claude-opus-5 Signed-off-by: Justin Hammond <justin@dynam.ac> |
||
|---|---|---|
| .. | ||
| arch | ||
| audio | ||
| concurrency | ||
| drivers | ||
| filesystem | ||
| libs | ||
| mm | ||
| net | ||
| nxgraphics | ||
| tools | ||
| binfmt.rst | ||
| boards.rst | ||
| cmake.rst | ||
| crypto.rst | ||
| index.rst | ||
| nxflat.rst | ||
| openamp.rst | ||
| paging.rst | ||
| syscall.rst | ||
| video.rst | ||
| wireless.rst | ||