The INA226 driver was character mode only, and stayed that way after everything around it moved, because the sensor framework had no type it could publish: there was nothing for volts or amps until now. Add the framework version beside it, in the shape the tree uses for a part with both. The old driver is untouched and still builds by default; the new one replaces it when SENSORS_INA226_UORB is set. The part publishes three topics, voltage, current and power, from a single reading that they all share the timestamp of. Reading once per topic would put three transfers on the bus for one sample and, worse, would leave the three values describing three different instants, which is the wrong property for a power measurement: the product of a voltage and a current measured at different moments is not the power at either. The power is computed here rather than read from the part, because the part's own power register needs its calibration register given a current scale first, and multiplying two values already in hand does not. One worker feeds all three, so it starts when the first topic is subscribed and stops when the last goes away, and the part is left powered down until then rather than converting into a void. Each topic keeps the interval it asked for and the worker runs at the shortest of them, since one reading serves all three. Neither is taken at face value: asking faster than the part converts returns the same reading twice, and a period shorter than a clock tick rounds down to no delay at all, which would leave the worker re-queueing itself with the bus never idle. Both floors are applied and the caller is told what it will actually get, which is what the interface is for. The shunt is rejected if it is zero or negative, which would otherwise divide by zero on the first reading. Assisted-by: Claude:claude-opus-5 Signed-off-by: Justin Hammond <justin@dynam.ac> |
||
|---|---|---|
| .github | ||
| arch | ||
| audio | ||
| binfmt | ||
| boards | ||
| cmake | ||
| crypto | ||
| Documentation | ||
| drivers | ||
| dummy | ||
| fs | ||
| graphics | ||
| include | ||
| libs | ||
| mm | ||
| net | ||
| openamp | ||
| pass1 | ||
| sched | ||
| syscall | ||
| tools | ||
| video | ||
| wireless | ||
| .asf.yaml | ||
| .codespell-ignore-lines | ||
| .codespellrc | ||
| .editorconfig | ||
| .gitignore | ||
| .gitmessage | ||
| .mcp.json | ||
| .pre-commit-config.yaml | ||
| .yamllint | ||
| AUTHORS | ||
| CMakeLists.txt | ||
| CONTRIBUTING.md | ||
| INVIOLABLES.md | ||
| Kconfig | ||
| LICENSE | ||
| Makefile | ||
| NOTICE | ||
| README.md | ||
| ReleaseNotes | ||
Apache NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOSs (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).
For brevity, many parts of the documentation will refer to Apache NuttX as simply NuttX.
Getting Started
First time on NuttX? Read the Getting Started guide! If you don't have a board available, NuttX has its own simulator that you can run on terminal.
Documentation
You can find the current NuttX documentation on the Documentation Page.
Alternatively, you can build the documentation yourself by following the Documentation Build Instructions.
The old NuttX documentation is still available in the Apache wiki.
Supported Boards
NuttX supports a wide variety of platforms. See the full list on the Supported Platforms page.
Contributing
If you wish to contribute to the NuttX project, read the Contributing guidelines for information on Git usage, coding standard, workflow and the NuttX principles.
License
The code in this repository is under either the Apache 2 license, or a license compatible with the Apache 2 license. See the License Page for more information.