Skip to content

Commit 7c22c01

Browse files
drivers: sensor: st: Add driver for lsm6dsr
This driver adds initial support for the ST lsm6dsr inertial measurement unit (IMU). Supported interface are I2C and SPI. It supports polling measurement mode. Setting/modifying attributes for output data rate (ODR) and full scale range (FS) is supported too. Origin: Original Signed-off-by: Marco Schuler <[email protected]>
1 parent c8d9103 commit 7c22c01

File tree

11 files changed

+1168
-0
lines changed

11 files changed

+1168
-0
lines changed

drivers/sensor/st/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ add_subdirectory_ifdef(CONFIG_LSM303DLHC_MAGN lsm303dlhc_magn)
2929
add_subdirectory_ifdef(CONFIG_LSM6DS0 lsm6ds0)
3030
add_subdirectory_ifdef(CONFIG_LSM6DSL lsm6dsl)
3131
add_subdirectory_ifdef(CONFIG_LSM6DSO lsm6dso)
32+
add_subdirectory_ifdef(CONFIG_LSM6DSR lsm6dsr)
3233
add_subdirectory_ifdef(CONFIG_LSM6DSO16IS lsm6dso16is)
3334
add_subdirectory_ifdef(CONFIG_LSM6DSV16X lsm6dsv16x)
3435
add_subdirectory_ifdef(CONFIG_LSM9DS0_GYRO lsm9ds0_gyro)

drivers/sensor/st/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ source "drivers/sensor/st/lsm303dlhc_magn/Kconfig"
2828
source "drivers/sensor/st/lsm6ds0/Kconfig"
2929
source "drivers/sensor/st/lsm6dsl/Kconfig"
3030
source "drivers/sensor/st/lsm6dso/Kconfig"
31+
source "drivers/sensor/st/lsm6dsr/Kconfig"
3132
source "drivers/sensor/st/lsm6dso16is/Kconfig"
3233
source "drivers/sensor/st/lsm6dsv16x/Kconfig"
3334
source "drivers/sensor/st/lsm9ds0_gyro/Kconfig"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
zephyr_library()
4+
5+
zephyr_library_sources(lsm6dsr.c)
6+
zephyr_library_sources(lsm6dsr_spi.c)
7+
zephyr_library_sources(lsm6dsr_i2c.c)

drivers/sensor/st/lsm6dsr/Kconfig

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# LSM6DSR accelerometer and gyroscope sensor configuration
2+
# options
3+
4+
# Copyright (c) 2025 Helbling Technik AG
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
menuconfig LSM6DSR
8+
bool "LSM6DSR I2C/SPI accelerometer and gyroscope Chip"
9+
default y
10+
depends on DT_HAS_ST_LSM6DSR_ENABLED
11+
select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ST_LSM6DSR),i2c)
12+
select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ST_LSM6DSR),spi)
13+
help
14+
Enable driver for LSM6DSR accelerometer and gyroscope
15+
sensor.
16+
17+
if LSM6DSR
18+
19+
menu "Attributes"
20+
21+
config LSM6DSR_GYRO_FS
22+
int "Gyroscope full-scale range"
23+
default 0
24+
help
25+
Specify the default gyroscope full-scale range.
26+
An X value for the config represents a range of +/- X degree per
27+
second. Valid values are:
28+
0: Full Scale selected at runtime
29+
125: +/- 125dps
30+
250: +/- 250dps
31+
500: +/- 500dps
32+
1000: +/- 1000dps
33+
2000: +/- 2000dps
34+
4000: +/- 4000dps
35+
36+
config LSM6DSR_GYRO_ODR
37+
int "Gyroscope Output data rate frequency"
38+
range 0 10
39+
default 0
40+
help
41+
Specify the default accelerometer output data rate expressed in
42+
samples per second (Hz).
43+
0: ODR selected at runtime
44+
1: 12.5Hz
45+
2: 26Hz
46+
3: 52Hz
47+
4: 104Hz
48+
5: 208Hz
49+
6: 416Hz
50+
7: 833Hz
51+
8: 1660Hz
52+
9: 3330Hz
53+
10: 6660Hz
54+
55+
config LSM6DSR_ACCEL_FS
56+
int "Accelerometer full-scale range"
57+
default 0
58+
help
59+
Specify the default accelerometer full-scale range.
60+
An X value for the config represents a range of +/- X G. Valid values
61+
are:
62+
0: Full Scale selected at runtime
63+
2: +/- 2g
64+
4: +/- 4g
65+
8: +/- 8g
66+
16: +/- 16g
67+
68+
config LSM6DSR_ACCEL_ODR
69+
int "Accelerometer Output data rate frequency"
70+
range 0 11
71+
default 0
72+
help
73+
Specify the default accelerometer output data rate expressed in
74+
samples per second (Hz).
75+
0: ODR selected at runtime
76+
1: 12.5Hz
77+
2: 26Hz
78+
3: 52Hz
79+
4: 104Hz
80+
5: 208Hz
81+
6: 416Hz
82+
7: 833Hz
83+
8: 1666Hz
84+
9: 3332Hz
85+
10: 6664Hz
86+
11: 1.6Hz
87+
endmenu
88+
89+
endif # LSM6DSR

0 commit comments

Comments
 (0)