zephyr/drivers/sensor/lis2mdl/Kconfig
Mario Tesi 5d8834bee4 driver: sensor: Add support for LIS2MDL Mag sensor
Added support to LIS2MDL Magnetometer sensor provided
with following features:
	- I2C interface
	- Mag data
	- Temperature data
	- ODR configurable by config or at runtime
	- Trigger mode selectable by menuconfig
	- IRQ pin configurable (by dts or Kconfig)
	- Hard Iron offset setting at runtime
	- Include yaml file

Tested on ST MEMS IKS01A2 + NUCLEO STM32F411RE board.
LIS2MDL connected to I2C master interface (SPI 3 wire not
supported yet).
Test run with all ODR {10, 20, 50, 100} Hz in poll and
trigger mode.

GPIO IRQ dts configuration has been tested by adding
to boards/arm/nucleo_f411re/nucleo_f411re.dts file
this patch:

&i2c1 {
        status = "ok";
        clock-frequency = <I2C_BITRATE_FAST>;
+
+       /* ST Microelectronics LIS2MDL mag sensor */
+       lis2mdl-magn@1e {
+               compatible = "st,lis2mdl-magn";
+               reg = <0x1e>;
+               irq-gpios = <&gpioa 4 0>;
+               label = "LIS2MDL";
+               status = "ok";
+       };
};

and adding boards/arm/nucleo_f411re/dts.fixup with following
content:

	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_LABEL
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_BASE_ADDRESS
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_BUS_NAME
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_IRQ_GPIOS_CONTROLLER
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_IRQ_GPIOS_PIN

For more info on this LIS2MDL please follow this link:
http://www.st.com/en/mems-and-sensors/lis2mdl.html

Signed-off-by: Mario Tesi <mario.tesi@st.com>
2018-10-12 14:13:50 -05:00

118 lines
2.2 KiB
Plaintext

# Copyright (c) 2018 STMicroelectronics
#
# SPDX-License-Identifier: Apache-2.0
#
menuconfig LIS2MDL
bool "LIS2MDL Magnetometer"
depends on I2C
help
Enable driver for LIS2MDL I2C-based magnetometer sensor.
if LIS2MDL
config LIS2MDL_DEV_NAME
string "Driver name"
default "LIS2MDL"
help
Device name with which the LIS2MDL sensor is identified.
if !HAS_DTS_I2C
config LIS2MDL_I2C_ADDR
hex "I2C address"
default 0x1E
help
I2C address of the LIS2MDL sensor.
config LIS2MDL_I2C_MASTER_DEV_NAME
string "I2C master where LIS2MDL is connected"
default "I2C_0"
help
Specify the device name of the I2C master device to which LIS2MDL is
connected.
endif # LIS2MDL_I2C_ADDR
choice
prompt "Trigger mode"
default LIS2MDL_TRIGGER_GLOBAL_THREAD
help
Specify the type of triggering to be used by the driver.
config LIS2MDL_TRIGGER_NONE
bool "No trigger"
config LIS2MDL_TRIGGER_GLOBAL_THREAD
bool "Use global thread"
depends on GPIO
select LIS2MDL_TRIGGER
config LIS2MDL_TRIGGER_OWN_THREAD
bool "Use own thread"
depends on GPIO
select LIS2MDL_TRIGGER
endchoice
config LIS2MDL_TRIGGER
bool
if !HAS_DTS_GPIO
config LIS2MDL_GPIO_DEV_NAME
string "GPIO device"
default "GPIO_0"
depends on LIS2MDL_TRIGGER
help
The device name of the GPIO device to which the LIS2MDL interrupt pins
are connected.
config LIS2MDL_GPIO_PIN_NUM
int "Interrupt GPIO pin number"
default 0
depends on LIS2MDL_TRIGGER
help
The number of the GPIO on which the interrupt signal from the LIS2MDL
chip will be received.
endif # !HAS_DTS_GPIO
config LIS2MDL_THREAD_PRIORITY
int "Thread priority"
depends on LIS2MDL_TRIGGER_OWN_THREAD
default 10
help
Priority of thread used by the driver to handle interrupts.
config LIS2MDL_THREAD_STACK_SIZE
int "Thread stack size"
depends on LIS2MDL_TRIGGER_OWN_THREAD
default 1024
help
Stack size of thread used by the driver to handle interrupts.
choice
prompt "Magnetometer sampling frequency (ODR)"
default LIS2MDL_MAG_ODR_RUNTIME
config LIS2MDL_MAG_ODR_RUNTIME
bool "Set ODR at runtime (default 10 Hz)"
config LIS2MDL_MAG_ODR_10
bool "10 Hz"
config LIS2MDL_MAG_ODR_20
bool "20 Hz"
config LIS2MDL_MAG_ODR_50
bool "50 Hz"
config LIS2MDL_MAG_ODR_100
bool "100 Hz"
endchoice
endif # LIS2MDL