Conversation
Fishwaldo
requested review from
acassis,
jerpelea,
linguini1 and
raiden00pl
as code owners
September 28, 2026 03:19
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>
Fishwaldo
force-pushed
the
upstream-sensors-ina226-uorb-pr
branch
from
September 28, 2026 04:41
f23f1b4 to
8510c6c
Compare
acassis
approved these changes
Sep 28, 2026
acassis
requested changes
Sep 28, 2026
acassis
left a comment
Contributor
There was a problem hiding this comment.
@Fishwaldo please include Documentation to this new sensor driver
jerpelea
approved these changes
Sep 28, 2026
xiaoxiang781216
approved these changes
Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a uORB interface for the INA226, publishing voltage, current and power from a single reading. It sits beside the existing character driver and replaces it when
CONFIG_SENSORS_INA226_UORBis set.Impact
New file behind
CONFIG_SENSORS_INA226_UORB, defaultn, depending onSENSORS_INA226andUORB. With it set,ina226_uorb.cis built in place ofina226.candina226_register_uorb()replacesina226_register(). Unset, nothing changes.Testing
ESWIN EIC7700 EVB, four INA226 rails on i2c11:
12.03V x 0.73A is 8.78W against the 8.79W reported, so the three values are consistent with having been measured together. Built for
eic7700-evb:nshwith-Wno-cpp -Werror, with the uORB driver selected andina226.cexcluded.