nuttx/drivers/sensors
Justin Hammond cc2edca964 sensors/ina226: Add a uORB interface.
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>
2026-10-09 13:37:13 +08:00
..
adt7320.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
adt7320.h
adxl345.h
adxl345_base.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
adxl345_i2c.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
adxl345_spi.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
adxl362_uorb.c sensors/adxl362_uorb: support for fixed-point data 2026-05-02 00:56:42 +08:00
adxl367.c sensors/adxl367: add I2C accelerometer support 2026-10-06 14:47:12 -03:00
adxl372.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
adxl372_uorb.c drivers/sensors/adxl372_uorb.c: fix compilation error 2026-06-10 08:49:14 -03:00
aht10.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
ak09912.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
amg88xx.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
apds9922.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
apds9960.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
as726x.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
as5048a.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
as5048b.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
bh1749nuc.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
bh1749nuc_base.c
bh1749nuc_base.h include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
bh1749nuc_uorb.c sensors/bh1749nuc_uorb: support for fixed-point data 2026-05-02 00:56:42 +08:00
bh1750fvi.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
bme680_uorb.c sensors/bme680_uorb.c: always allow temperature topic registration 2026-06-10 09:52:00 +08:00
bme688_uorb.c drivers/sensors: add initial support for fixed-point data for sensors 2026-05-02 00:56:42 +08:00
bmg160.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
bmi088.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
bmi088_base.c
bmi088_base.h include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
bmi088_uorb.c drivers/sensors: add initial support for fixed-point data for sensors 2026-05-02 00:56:42 +08:00
bmi160.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
bmi160_base.c drivers/sensors: fix misplaced endif in bmi160_base.c 2026-04-15 17:47:46 +02:00
bmi160_base.h include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
bmi160_uorb.c drivers/sensors: add initial support for fixed-point data for sensors 2026-05-02 00:56:42 +08:00
bmi270.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
bmi270_base.c
bmi270_base.h include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
bmi270_uorb.c sensors/bmi270_uorb: support for fixed-point data 2026-05-02 00:56:42 +08:00
bmm150_uorb.c sensors/bmm150_uorb: support for fixed-point data 2026-05-02 00:56:42 +08:00
bmp180.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
bmp180_base.c sensors/bmp180_uorb: support for fixed-point data 2026-05-02 00:56:42 +08:00
bmp180_base.h sensors/bmp180_uorb: support for fixed-point data 2026-05-02 00:56:42 +08:00
bmp180_uorb.c sensors/bmp180_uorb: support for fixed-point data 2026-05-02 00:56:42 +08:00
bmp280_uorb.c sensors/bmp280_uorb: support for fixed-point data 2026-05-02 00:56:42 +08:00
CMakeLists.txt sensors/ina226: Add a uORB interface. 2026-10-09 13:37:13 +08:00
cxd5602pwbimu.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
dhtxx.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
ds18b20_uorb.c drivers/sensors: add initial support for fixed-point data for sensors 2026-05-02 00:56:42 +08:00
fakesensor_uorb.c drivers/sensors: add initial support for fixed-point data for sensors 2026-05-02 00:56:42 +08:00
fs3000_uorb.c drivers/sensors: add initial support for fixed-point data for sensors 2026-05-02 00:56:42 +08:00
fxos8700cq.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
gnss_uorb.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
goldfish_gnss_uorb.c drivers/sensors: add initial support for fixed-point data for sensors 2026-05-02 00:56:42 +08:00
goldfish_sensor_uorb.c drivers/sensors: add initial support for fixed-point data for sensors 2026-05-02 00:56:42 +08:00
hall3ph.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
hc_sr04.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
hdc1008.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
hts221.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
hyt271_uorb.c sensors/hyt271_uorb: support for fixed-point data 2026-05-02 00:56:42 +08:00
ina219.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
ina226.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
ina226_uorb.c sensors/ina226: Add a uORB interface. 2026-10-09 13:37:13 +08:00
ina3221.c drivers/: Multiple Drivers Are Registered With World Writable Part 3 2026-07-16 09:49:07 -03:00
isl29023.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
Kconfig sensors/ina226: Add a uORB interface. 2026-10-09 13:37:13 +08:00
kxtj9.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
l3gd20_uorb.c drivers/sensors/l3gd20: always deliver samples with push_event 2026-08-05 12:50:12 +02:00
l86xxx_uorb.c sched/semaphore: Fix pre-existing nxstyle issues in the touched files 2026-09-25 10:37:43 +02:00
lis2dh.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
lis2mdl_uorb.c sched/semaphore: Fix pre-existing nxstyle issues in the touched files 2026-09-25 10:37:43 +02:00
lis3dh.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
lis3dsh.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
lis3dsh_uorb.c drivers/sensors: add LIS3DSH accelerometer uORB driver 2026-07-25 14:45:40 +02:00
lis3mdl.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
lis331dl.c
lm75.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
lm92.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
lps25h.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
lsm6ds3trc_uorb.c sched/semaphore: Remove the return value check of nxsem_init/nxmutex_init 2026-09-25 10:37:43 +02:00
lsm6dsl.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
lsm6dso32_uorb.c sched/semaphore: Fix pre-existing nxstyle issues in the touched files 2026-09-25 10:37:43 +02:00
lsm9ds1.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
lsm9ds1_base.c
lsm9ds1_base.h include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
lsm9ds1_uorb.c drivers/sensors: add initial support for fixed-point data for sensors 2026-05-02 00:56:42 +08:00
lsm303agr.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
lsm330_spi.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
ltc4151.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
ltr308_uorb.c drivers/sensors: add initial support for fixed-point data for sensors 2026-05-02 00:56:42 +08:00
Make.defs sensors/ina226: Add a uORB interface. 2026-10-09 13:37:13 +08:00
max6675.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
max31855.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
max31865.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
max44009.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
mb7040.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
mcp9600_uorb.c sched/semaphore: Fix pre-existing nxstyle issues in the touched files 2026-09-25 10:37:43 +02:00
mcp9844.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
mlx90393.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
mlx90614.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
mpl115a.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
mpu60x0.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
mpu6050_uorb.c drivers/sensors/mpu6050: deliver samples from the data ready interrupt 2026-08-04 17:40:28 -03:00
mpu9250_uorb.c drivers/sensors: add initial support for fixed-point data for sensors 2026-05-02 00:56:42 +08:00
ms56xx_uorb.c !nuttx: drop redundant casts on tv_sec/tv_nsec and fix printf formats 2026-05-19 16:21:28 +08:00
ms58xx.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
msa301.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
mt6816.c drivers/sensors: Add support to MT6816 2026-05-03 07:56:38 -03:00
nau7802.c sched/semaphore: Fix pre-existing nxstyle issues in the touched files 2026-09-25 10:37:43 +02:00
qencoder.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
qmi8658_uorb.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
scd30.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
scd41.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
sensor.c drivers/sensors/sensor: cancel fetch watchdog on close to fix UAF 2026-09-15 09:41:11 +08:00
sensor_monitor.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
sensor_rpmsg.c !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
sgp30.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
sht3x.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
sht4x_uorb.c sched/semaphore: Fix pre-existing nxstyle issues in the touched files 2026-09-25 10:37:43 +02:00
sht21.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
sps30.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
t67xx.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
tc74.c drivers/sensors: add Microchip TC74 temperature sensor driver 2026-09-18 16:04:32 +08:00
tmp112.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
tmp112_uorb.c sensors/tmp112: Add a uORB interface. 2026-08-18 10:35:28 -03:00
usensor.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
veml6070.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
vl53l1x.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
wtgahrs2_uorb.c drivers/sensors: add initial support for fixed-point data for sensors 2026-05-02 00:56:42 +08:00
xen1210.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
xen1210.h
zerocross.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00