driver/sensor: lsm6dsl: Fix attribute setting for gyroscope fs

The API for setting the gyroscope full scale attruibute requires
the argument in radians/s.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
Armando Visconti 2019-01-28 13:20:08 +01:00 committed by Maureen Helm
parent c81efe25d5
commit 5ad0d27bd1
2 changed files with 2 additions and 2 deletions

View file

@ -282,7 +282,7 @@ static int lsm6dsl_gyro_config(struct device *dev, enum sensor_channel chan,
switch (attr) {
#ifdef LSM6DSL_GYRO_FS_RUNTIME
case SENSOR_ATTR_FULL_SCALE:
return lsm6dsl_gyro_range_set(dev, sensor_ms2_to_g(val));
return lsm6dsl_gyro_range_set(dev, sensor_rad_to_degrees(val));
#endif
#ifdef LSM6DSL_GYRO_ODR_RUNTIME
case SENSOR_ATTR_SAMPLING_FREQUENCY:

View file

@ -223,7 +223,7 @@ void main(void)
struct sensor_value g_fs_attr;
/* set full scale to 245dps for accel */
sensor_g_to_ms2(245, &g_fs_attr);
sensor_degrees_to_rad(245, &g_fs_attr);
if (sensor_attr_set(accel_dev, SENSOR_CHAN_GYRO_XYZ,
SENSOR_ATTR_FULL_SCALE, &g_fs_attr) < 0) {