zephyr/drivers/sensor/lis2dh
Marcin Niestroj 59648bd1a5 sensors: lis2dh: fix raw value scaling
All values were scaled by 8 instead of 12 for 16g compile-time selected
range. This resulted with values around 6.5 m/s^2. Scaling for runtime
configurable ranges was broken for all except 2g range option due to
totally broken lis2dh_range_to_reg_val().

Fix wrong scaling for 16g compile-time and all runtime selectable ranges
by reworking code that scales raw value. While doing this, change
lis2dh->scale type from 16 to 32 bits. This allows to slightly increase
final result precision by using the fact that raw values have maximum 12
bits precision, allowing us to multiply lis2dh->scale by (1 << 4)
compared to previous implementation.

Fix bug #19872.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2019-11-13 14:43:25 -06:00
..
CMakeLists.txt
Kconfig kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
lis2dh_trigger.c sensor: lis2dh: fix SPI burst transfers 2019-10-14 17:16:03 -05:00
lis2dh.c sensors: lis2dh: fix raw value scaling 2019-11-13 14:43:25 -06:00
lis2dh.h sensors: lis2dh: fix raw value scaling 2019-11-13 14:43:25 -06:00