altos: Update sensor data atomically
authorKeith Packard <keithp@keithp.com>
Mon, 12 Jun 2017 05:31:17 +0000 (22:31 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 12 Jun 2017 05:54:22 +0000 (22:54 -0700)
commitfed48732828c85ae56106cd72c5aeaaad47c552f
tree07154a8f5c925d70706ecda937d1daa73e4ff8b3
parent171adbe7db8520f5ff52a5fe2c54fe165c6f91f8
altos: Update sensor data atomically

Read data into a temp variable, block interrupts, then update the
published value.

The bug is easy to see with the HMC5883 which has to byte-swap the
output of the chip, and hence can occasionally get caught with the
wrong byte order data.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_hmc5883.c
src/drivers/ao_mpu6000.c
src/drivers/ao_ms5607.c