Skip to content
Permalink
Browse files

driver/sensor: lsm6dso: Add support

Add support to STM LSM6DSO 6-axis IMU sensor driver.
This driver supports communication with device though both
I2C and SPI bus and both polling and drdy trigger mode.

This driver supports also the sensorhub mode with the possibility
to connect a maximum of two external devices, typically a
magnetometer and an environmental sensor, currently selected among
following devices: lis2mdl magnetometer, lps22hh or lps22hb
pressure and temperature sensors, HTS221 humidity sensor.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
  • Loading branch information...
avisconti authored and MaureenHelm committed Feb 18, 2019
1 parent 9dbdd81 commit 72ae24d8d59793bc327024b88e6a8baa09b154d6
@@ -36,6 +36,7 @@ add_subdirectory_ifdef(CONFIG_LPS25HB lps25hb)
add_subdirectory_ifdef(CONFIG_LSM303DLHC_MAGN lsm303dlhc_magn)
add_subdirectory_ifdef(CONFIG_LSM6DS0 lsm6ds0)
add_subdirectory_ifdef(CONFIG_LSM6DSL lsm6dsl)
add_subdirectory_ifdef(CONFIG_LSM6DSO lsm6dso)
add_subdirectory_ifdef(CONFIG_LSM9DS0_GYRO lsm9ds0_gyro)
add_subdirectory_ifdef(CONFIG_LSM9DS0_MFD lsm9ds0_mfd)
add_subdirectory_ifdef(CONFIG_MAX30101 max30101)
@@ -97,6 +97,8 @@ source "drivers/sensor/lsm6ds0/Kconfig"

source "drivers/sensor/lsm6dsl/Kconfig"

source "drivers/sensor/lsm6dso/Kconfig"

source "drivers/sensor/lsm9ds0_gyro/Kconfig"

source "drivers/sensor/lsm9ds0_mfd/Kconfig"
@@ -0,0 +1,13 @@
# ST Microelectronics LSM6DSO 6-axis IMU sensor driver
#
# Copyright (c) 2019 STMicroelectronics
#
# SPDX-License-Identifier: Apache-2.0
#
zephyr_library()

zephyr_library_sources_ifdef(CONFIG_LSM6DSO lsm6dso.c)
zephyr_library_sources_ifdef(CONFIG_LSM6DSO lsm6dso_i2c.c)
zephyr_library_sources_ifdef(CONFIG_LSM6DSO lsm6dso_spi.c)
zephyr_library_sources_ifdef(CONFIG_LSM6DSO_SENSORHUB lsm6dso_shub.c)
zephyr_library_sources_ifdef(CONFIG_LSM6DSO_TRIGGER lsm6dso_trigger.c)
@@ -0,0 +1,171 @@
# ST Microelectronics LSM6DSO 6-axis IMU sensor driver
#
# Copyright (c) 2019 STMicroelectronics
#
# SPDX-License-Identifier: Apache-2.0
#
menuconfig LSM6DSO
bool "LSM6DSO I2C/SPI accelerometer and gyroscope Chip"
depends on (I2C && HAS_DTS_I2C) || (SPI && HAS_DTS_SPI)
select HAS_STMEMSC
select USE_STDC_LSM6DSO
help
Enable driver for LSM6DSO accelerometer and gyroscope
sensor.

if LSM6DSO

choice LSM6DSO_TRIGGER_MODE
prompt "Trigger mode"
help
Specify the type of triggering to be used by the driver.

config LSM6DSO_TRIGGER_NONE
bool "No trigger"

config LSM6DSO_TRIGGER_GLOBAL_THREAD
bool "Use global thread"
depends on GPIO
select LSM6DSO_TRIGGER

config LSM6DSO_TRIGGER_OWN_THREAD
bool "Use own thread"
depends on GPIO
select LSM6DSO_TRIGGER

endchoice

config LSM6DSO_TRIGGER
bool

if LSM6DSO_TRIGGER

config LSM6DSO_THREAD_PRIORITY
int "Thread priority"
depends on LSM6DSO_TRIGGER_OWN_THREAD
default 10
help
Priority of thread used by the driver to handle interrupts.

config LSM6DSO_THREAD_STACK_SIZE
int "Thread stack size"
depends on LSM6DSO_TRIGGER_OWN_THREAD
default 1024
help
Stack size of thread used by the driver to handle interrupts.

choice LSM6DSO_INT_PIN
prompt "Sensor INT pin number"
default LSM6DSO_INT_PIN_1
help
The number of LSM6DSO int pin used to generate interrupt to cpu.
Supported values are int1 or int2

config LSM6DSO_INT_PIN_1
bool "int1"

config LSM6DSO_INT_PIN_2
bool "int2"
endchoice

endif # LSM6DSO_TRIGGER

config LSM6DSO_ENABLE_TEMP
bool "Enable temperature"
help
Enable/disable temperature

config LSM6DSO_SENSORHUB
bool "Enable I2C sensorhub feature"
help
Enable/disable internal sensorhub. You can enable
a maximum of two external sensors (if more than two are enabled
the system would enumerate only the first two found)

if LSM6DSO_SENSORHUB

config LSM6DSO_EXT_LIS2MDL
bool "Enable LIS2MDL as external sensor"
default y

config LSM6DSO_EXT_LPS22HH
bool "Enable LPS22HH as external sensor"
default y

config LSM6DSO_EXT_HTS221
bool "Enable HTS221 as external sensor"

config LSM6DSO_EXT_LPS22HB
bool "Enable LPS22HB as external sensor"

endif #LSM6DSO_SENSORHUB

menu "Attributes"

config LSM6DSO_GYRO_FS
int "Gyroscope full-scale range"
default 0
help
Specify the default gyroscope full-scale range.
An X value for the config represents a range of +/- X degree per
second. Valid values are:
0: Full Scale selected at runtime
125: +/- 125dps
250: +/- 250dps
500: +/- 500dps
1000: +/- 1000dps
2000: +/- 2000dps

config LSM6DSO_GYRO_ODR
int "Gyroscope Output data rate frequency"
range 0 10
default 0
help
Specify the default accelerometer output data rate expressed in
samples per second (Hz).
0: ODR selected at runtime
1: 12.5Hz
2: 26Hz
3: 52Hz
4: 104Hz
5: 208Hz
6: 416Hz
7: 833Hz
8: 1660Hz
9: 3330Hz
10: 6660Hz

config LSM6DSO_ACCEL_FS
int "Accelerometer full-scale range"
default 0
help
Specify the default accelerometer full-scale range.
An X value for the config represents a range of +/- X G. Valid values
are:
0: Full Scale selected at runtime
2: +/- 2g
4: +/- 4g
8: +/- 8g
16: +/- 16g

config LSM6DSO_ACCEL_ODR
int "Accelerometer Output data rate frequency"
range 0 10
default 0
help
Specify the default accelerometer output data rate expressed in
samples per second (Hz).
0: ODR selected at runtime
1: 12.5Hz
2: 26Hz
3: 52Hz
4: 104Hz
5: 208Hz
6: 416Hz
7: 833Hz
8: 1660Hz
9: 3330Hz
10: 6660Hz
endmenu

endif # LSM6DSO

0 comments on commit 72ae24d

Please sign in to comment.
You can’t perform that action at this time.