sensors: lis2dh: use proper scale factor for lsm303agr

LSM303AGR is a special one in terms of raw value scale among all devices
supported by lis2dh.c driver. Apply proper scale factor based on
sensitivity scale provided in LIS2DH and LSM303AGR datasheets.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
Marcin Niestroj 2019-10-28 14:22:25 +01:00 committed by Maureen Helm
parent ea0b6a80a8
commit 44841646a1

View file

@ -21,10 +21,17 @@ LOG_MODULE_REGISTER(lis2dh, CONFIG_SENSOR_LOG_LEVEL);
* multiplied by 100.
*/
static const u32_t lis2dh_reg_val_to_scale[] = {
#if defined(DT_INST_0_ST_LSM303AGR_ACCEL)
ACCEL_SCALE(1563),
ACCEL_SCALE(3126),
ACCEL_SCALE(6252),
ACCEL_SCALE(18758),
#else
ACCEL_SCALE(1600),
ACCEL_SCALE(3200),
ACCEL_SCALE(6400),
ACCEL_SCALE(19200),
#endif
};
#if defined(DT_ST_LIS2DH_BUS_SPI)