dt-bindings: sensor: lps2xdf: make macros sensor agnostic The possible settings for the lps22df and lps28dfw sensor are overlapping, except the Full-Scale mode setting. Threrefore we can change the macros from LPS22DF_DT_[..] to LPS2xDF_DT_[..]. Signed-off-by: Jonas Remmert <j.remmert@phytec.de>
diff --git a/dts/bindings/sensor/st,lps22df-common.yaml b/dts/bindings/sensor/st,lps22df-common.yaml index f8b5496..779d877 100644 --- a/dts/bindings/sensor/st,lps22df-common.yaml +++ b/dts/bindings/sensor/st,lps22df-common.yaml
@@ -1,4 +1,5 @@ # Copyright (c) 2023 STMicroelectronics +# Copyright (c) 2023 PHYTEC Messtechnik GmbH # SPDX-License-Identifier: Apache-2.0 description: | @@ -11,9 +12,9 @@ lps22df@5d { ... - odr = <LPS22DF_DT_ODR_10HZ>; - lpf = <LPS22DF_DT_LP_FILTER_ODR_4>; - avg = <LPS22DF_DT_AVG_128_SAMPLES>; + odr = <LPS2xDF_DT_ODR_10HZ>; + lpf = <LPS2xDF_DT_LP_FILTER_ODR_4>; + avg = <LPS2xDF_DT_AVG_128_SAMPLES>; }; include: sensor-device.yaml @@ -41,15 +42,15 @@ Specify the output data rate expressed in samples per second (Hz). The default is the power-on reset value. - - 0 # LPS22DF_DT_ODR_POWER_DOWN - - 1 # LPS22DF_DT_ODR_1HZ - - 2 # LPS22DF_DT_ODR_4HZ - - 3 # LPS22DF_DT_ODR_10HZ - - 4 # LPS22DF_DT_ODR_25HZ - - 5 # LPS22DF_DT_ODR_50HZ - - 6 # LPS22DF_DT_ODR_75HZ - - 7 # LPS22DF_DT_ODR_100HZ - - 8 # LPS22DF_DT_ODR_200HZ + - 0 # LPS2xDF_DT_ODR_POWER_DOWN + - 1 # LPS2xDF_DT_ODR_1HZ + - 2 # LPS2xDF_DT_ODR_4HZ + - 3 # LPS2xDF_DT_ODR_10HZ + - 4 # LPS2xDF_DT_ODR_25HZ + - 5 # LPS2xDF_DT_ODR_50HZ + - 6 # LPS2xDF_DT_ODR_75HZ + - 7 # LPS2xDF_DT_ODR_100HZ + - 8 # LPS2xDF_DT_ODR_200HZ enum: [0, 1, 2, 3, 4, 5, 6, 7, 8] @@ -60,9 +61,9 @@ Specify the low pass filter value to be applied to pressure data. The default is the power-on reset value. - - 0 # LPS22DF_DT_LP_FILTER_OFF - - 1 # LPS22DF_DT_LP_FILTER_ODR_4 - - 3 # LPS22DF_DT_LP_FILTER_ODR_9 + - 0 # LPS2xDF_DT_LP_FILTER_OFF + - 1 # LPS2xDF_DT_LP_FILTER_ODR_4 + - 3 # LPS2xDF_DT_LP_FILTER_ODR_9 enum: [0, 1, 3] @@ -74,13 +75,13 @@ to pressure and temperature data. The default is the power-on reset value. - - 0 # LPS22DF_DT_AVG_4_SAMPLES - - 1 # LPS22DF_DT_AVG_8_SAMPLES - - 2 # LPS22DF_DT_AVG_16_SAMPLES - - 3 # LPS22DF_DT_AVG_32_SAMPLES - - 4 # LPS22DF_DT_AVG_64_SAMPLES - - 5 # LPS22DF_DT_AVG_128_SAMPLES - - 6 # LPS22DF_DT_AVG_256_SAMPLES - - 7 # LPS22DF_DT_AVG_512_SAMPLES + - 0 # LPS2xDF_DT_AVG_4_SAMPLES + - 1 # LPS2xDF_DT_AVG_8_SAMPLES + - 2 # LPS2xDF_DT_AVG_16_SAMPLES + - 3 # LPS2xDF_DT_AVG_32_SAMPLES + - 4 # LPS2xDF_DT_AVG_64_SAMPLES + - 5 # LPS2xDF_DT_AVG_128_SAMPLES + - 6 # LPS2xDF_DT_AVG_256_SAMPLES + - 7 # LPS2xDF_DT_AVG_512_SAMPLES enum: [0, 1, 2, 3, 4, 5, 6, 7]
diff --git a/dts/bindings/sensor/st,lps28dfw-common.yaml b/dts/bindings/sensor/st,lps28dfw-common.yaml index cf33148..1ca646f 100644 --- a/dts/bindings/sensor/st,lps28dfw-common.yaml +++ b/dts/bindings/sensor/st,lps28dfw-common.yaml
@@ -6,6 +6,17 @@ STMicroelectronics LPS28DFW pressure and temperature sensor. This is an extension of st,lps22df driver binding. + Example: + #include <zephyr/dt-bindings/sensor/lps2xdf.h> + + lps28dfw@5d { + ... + + odr = <LPS2xDF_DT_ODR_10HZ>; + lpf = <LPS2xDF_DT_LP_FILTER_ODR_4>; + avg = <LPS2xDF_DT_AVG_128_SAMPLES>; + }; + include: st,lps22df-common.yaml properties: @@ -16,8 +27,6 @@ Specify the full-scale mode. The default is the power-on reset value. - 0 = Mode 0, full scale up to 1260 hPa - 1 = Mode 1, full scale up to 4060 hPa - enum: - - 0 - - 1 + - 0 # LPS28DFW_DT_FS_MODE_1_1260 + - 1 # LPS28DFW_DT_FS_MODE_2_4060 + enum: [0, 1]
diff --git a/include/zephyr/dt-bindings/sensor/lps22df.h b/include/zephyr/dt-bindings/sensor/lps22df.h deleted file mode 100644 index 95668ae..0000000 --- a/include/zephyr/dt-bindings/sensor/lps22df.h +++ /dev/null
@@ -1,35 +0,0 @@ -/* - * Copyright (c) 2023 STMicroelectronics - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_ST_LPS22DF_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_ST_LPS22DF_H_ - -/* Data rate */ -#define LPS22DF_DT_ODR_POWER_DOWN 0 -#define LPS22DF_DT_ODR_1HZ 1 -#define LPS22DF_DT_ODR_4HZ 2 -#define LPS22DF_DT_ODR_10HZ 3 -#define LPS22DF_DT_ODR_25HZ 4 -#define LPS22DF_DT_ODR_50HZ 5 -#define LPS22DF_DT_ODR_75HZ 6 -#define LPS22DF_DT_ODR_100HZ 7 -#define LPS22DF_DT_ODR_200HZ 8 - -/* Low Pass filter */ -#define LPS22DF_DT_LP_FILTER_OFF 0 -#define LPS22DF_DT_LP_FILTER_ODR_4 1 -#define LPS22DF_DT_LP_FILTER_ODR_9 3 - -/* Average (number of samples) filter */ -#define LPS22DF_DT_AVG_4_SAMPLES 0 -#define LPS22DF_DT_AVG_8_SAMPLES 1 -#define LPS22DF_DT_AVG_16_SAMPLES 2 -#define LPS22DF_DT_AVG_32_SAMPLES 3 -#define LPS22DF_DT_AVG_64_SAMPLES 4 -#define LPS22DF_DT_AVG_128_SAMPLES 5 -#define LPS22DF_DT_AVG_256_SAMPLES 6 -#define LPS22DF_DT_AVG_512_SAMPLES 7 - -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_ST_LPS22DF_H_ */
diff --git a/include/zephyr/dt-bindings/sensor/lps2xdf.h b/include/zephyr/dt-bindings/sensor/lps2xdf.h new file mode 100644 index 0000000..bcbb831 --- /dev/null +++ b/include/zephyr/dt-bindings/sensor/lps2xdf.h
@@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 STMicroelectronics + * Copyright (c) 2023 PHYTEC Messtechnik GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_ST_LPS2xDF_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_ST_LPS2xDF_H_ + +/* Data rate */ +#define LPS2xDF_DT_ODR_POWER_DOWN 0 +#define LPS2xDF_DT_ODR_1HZ 1 +#define LPS2xDF_DT_ODR_4HZ 2 +#define LPS2xDF_DT_ODR_10HZ 3 +#define LPS2xDF_DT_ODR_25HZ 4 +#define LPS2xDF_DT_ODR_50HZ 5 +#define LPS2xDF_DT_ODR_75HZ 6 +#define LPS2xDF_DT_ODR_100HZ 7 +#define LPS2xDF_DT_ODR_200HZ 8 + +/* Low Pass filter */ +#define LPS2xDF_DT_LP_FILTER_OFF 0 +#define LPS2xDF_DT_LP_FILTER_ODR_4 1 +#define LPS2xDF_DT_LP_FILTER_ODR_9 3 + +/* Average (number of samples) filter */ +#define LPS2xDF_DT_AVG_4_SAMPLES 0 +#define LPS2xDF_DT_AVG_8_SAMPLES 1 +#define LPS2xDF_DT_AVG_16_SAMPLES 2 +#define LPS2xDF_DT_AVG_32_SAMPLES 3 +#define LPS2xDF_DT_AVG_64_SAMPLES 4 +#define LPS2xDF_DT_AVG_128_SAMPLES 5 +#define LPS2xDF_DT_AVG_256_SAMPLES 6 +#define LPS2xDF_DT_AVG_512_SAMPLES 7 + +/* Full Scale Pressure Mode */ +#define LPS28DFW_DT_FS_MODE_1_1260 0 +#define LPS28DFW_DT_FS_MODE_2_4060 1 + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_ST_LPS22DF_H_ */