drivers/sensor: lis2dw12: Remove odr values from Kconfig

Remove all odr values from Kconfig and always init it
at 12.5Hz. It is responsibility of application to set
the rate to a different value using SENSOR_ATTR_SAMPLING_FREQUENCY.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
Armando Visconti 2021-05-31 17:20:41 +02:00 committed by Anas Nashif
commit 77b74f1b85
3 changed files with 3 additions and 59 deletions

View file

@ -59,40 +59,4 @@ config LIS2DW12_TAP
endif # LIS2DW12_TRIGGER
choice
prompt "Accelerometer sampling frequency (ODR)"
default LIS2DW12_ODR_RUNTIME
config LIS2DW12_ODR_RUNTIME
bool "Set at runtime (Default 100 Hz)"
config LIS2DW12_ODR_1_6
bool "1.6 Hz"
config LIS2DW12_ODR_12_5
bool "12.5 Hz"
config LIS2DW12_ODR_25
bool "25 Hz"
config LIS2DW12_ODR_50
bool "50 Hz"
config LIS2DW12_ODR_100
bool "100 Hz"
config LIS2DW12_ODR_200
bool "200 Hz"
config LIS2DW12_ODR_400
bool "400 Hz"
config LIS2DW12_ODR_800
bool "800 Hz"
config LIS2DW12_ODR_1600
bool "1600 Hz"
endchoice
endif # LIS2DW12

View file

@ -292,8 +292,9 @@ static int lis2dw12_init(const struct device *dev)
return -EIO;
}
/* set default odr and full scale for acc */
if (lis2dw12_data_rate_set(lis2dw12->ctx, LIS2DW12_DEFAULT_ODR) < 0) {
/* set default odr to 12.5Hz acc */
if (lis2dw12_set_odr(dev, 12) < 0) {
LOG_ERR("odr init error (12.5 Hz)");
return -EIO;
}

View file

@ -17,27 +17,6 @@
#include <drivers/sensor.h>
#include "lis2dw12_reg.h"
#if defined(CONFIG_LIS2DW12_ODR_1_6)
#define LIS2DW12_DEFAULT_ODR LIS2DW12_XL_ODR_1Hz6_LP_ONLY
#elif defined(CONFIG_LIS2DW12_ODR_12_5)
#define LIS2DW12_DEFAULT_ODR LIS2DW12_XL_ODR_12Hz5
#elif defined(CONFIG_LIS2DW12_ODR_25)
#define LIS2DW12_DEFAULT_ODR LIS2DW12_XL_ODR_25Hz
#elif defined(CONFIG_LIS2DW12_ODR_50)
#define LIS2DW12_DEFAULT_ODR LIS2DW12_XL_ODR_50Hz
#elif defined(CONFIG_LIS2DW12_ODR_100) || \
defined(CONFIG_LIS2DW12_ODR_RUNTIME)
#define LIS2DW12_DEFAULT_ODR LIS2DW12_XL_ODR_100Hz
#elif defined(CONFIG_LIS2DW12_ODR_200)
#define LIS2DW12_DEFAULT_ODR LIS2DW12_XL_ODR_200Hz
#elif defined(CONFIG_LIS2DW12_ODR_400)
#define LIS2DW12_DEFAULT_ODR LIS2DW12_XL_ODR_400Hz
#elif defined(CONFIG_LIS2DW12_ODR_800)
#define LIS2DW12_DEFAULT_ODR LIS2DW12_XL_ODR_800Hz
#elif defined(CONFIG_LIS2DW12_ODR_1600)
#define LIS2DW12_DEFAULT_ODR LIS2DW12_XL_ODR_1k6Hz
#endif
/* Return ODR reg value based on data rate set */
#define LIS2DW12_ODR_TO_REG(_odr) \
((_odr <= 1) ? LIS2DW12_XL_ODR_1Hz6_LP_ONLY : \