# LIS2DH Three Axis Accelerometer configuration options

# Copyright (c) 2017 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

menuconfig LIS2DH
	bool "LIS2DH Three Axis Accelerometer"
	default y
	depends on DT_HAS_ST_LIS2DH_ENABLED
	select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ST_LIS2DH),i2c)
	select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ST_LIS2DH),spi)
	help
	  Enable SPI/I2C-based driver for LIS2DH, LIS3DH, LSM303DLHC,
	  LIS2DH12, LSM303AGR triaxial accelerometer sensors.

if LIS2DH

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

config LIS2DH_TRIGGER_NONE
	bool "No trigger"

config LIS2DH_TRIGGER_GLOBAL_THREAD
	bool "Use global thread"
	depends on GPIO
	depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LIS2DH),irq-gpios)
	select LIS2DH_TRIGGER

config LIS2DH_TRIGGER_OWN_THREAD
	bool "Use own thread"
	depends on GPIO
	depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LIS2DH),irq-gpios)
	select LIS2DH_TRIGGER

endchoice

config LIS2DH_TRIGGER
	bool

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

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

choice LIS2DH_ACCEL_RANGE
	prompt "Acceleration measurement range"
	default LIS2DH_ACCEL_RANGE_RUNTIME
	help
	  Initial measurement full scale range for acceleration values.

config LIS2DH_ACCEL_RANGE_RUNTIME
	bool "Set at runtime"

config LIS2DH_ACCEL_RANGE_2G
	bool "+/-2g"

config LIS2DH_ACCEL_RANGE_4G
	bool "+/-4g"

config LIS2DH_ACCEL_RANGE_8G
	bool "+/-8g"

config LIS2DH_ACCEL_RANGE_16G
	bool "+/-16g"

endchoice

choice LIS2DH_OPER_MODE
	prompt "Operation mode"
	default LIS2DH_OPER_MODE_NORMAL
	help
	  Choose between high resolution, normal or low power operation
	  mode for chip at init.

config LIS2DH_OPER_MODE_HIGH_RES
	bool "high resolution (12 bit)"

config LIS2DH_OPER_MODE_NORMAL
	bool "normal (10 bit)"

config LIS2DH_OPER_MODE_LOW_POWER
	bool "low power (8 bit)"

endchoice

choice LIS2DH_ODR
	prompt "Output data rate frequency"
	default LIS2DH_ODR_RUNTIME
	help
	  Initial data rate frequency of acceleration data at initialization.
	  Supported values:
	  1Hz, 10Hz, 25Hz, 50Hz, 100Hz, 200Hz, 400Hz in all power modes
	  1620Hz, 5376Hz in low power mode only
	  1344Hz in normal power mode

config LIS2DH_ODR_RUNTIME
	bool "Set at runtime"

config LIS2DH_ODR_1
	bool "1Hz"

config LIS2DH_ODR_2
	bool "10Hz"

config LIS2DH_ODR_3
	bool "25Hz"

config LIS2DH_ODR_4
	bool "50Hz"

config LIS2DH_ODR_5
	bool "100Hz"

config LIS2DH_ODR_6
	bool "200Hz"

config LIS2DH_ODR_7
	bool "400Hz"

config LIS2DH_ODR_8
	bool "1.6KHz"
	depends on LIS2DH_OPER_MODE_LOW_POWER

config LIS2DH_ODR_9_NORMAL
	bool "1.25KHz"
	depends on LIS2DH_OPER_MODE_NORMAL || LIS2DH_OPER_MODE_HIGH_RES

config LIS2DH_ODR_9_LOW
	bool "5KHz"
	depends on LIS2DH_OPER_MODE_LOW_POWER

endchoice

config LIS2DH_ACCEL_HP_FILTERS
	bool "Set High Pass filters for AOI functions on interrupt lines"

config LIS2DH_BLOCK_DATA_UPDATE
	bool "Output registers not updated until MSB and LSB read"

config LIS2DH_MEASURE_TEMPERATURE
	bool "Temperature measurements"
	select LIS2DH_BLOCK_DATA_UPDATE
	help
	  The temperature sensor is most suitable for measuring
	  relative temperature. For example, it is X degrees C
	  cooler or warmer.
	  Each chip has an offset.  This offset must be applied
	  to the result. The offset can be obtained by comparing
	  the reported temperature to a reference.
	  This option does not apply to the LSM330DLHC.

config LIS2DH_SELF_TEST
	bool "Self test attribute"
	help
	  Enable support for configuring the sensor self test bits.
	  Refer to the datasheet of the sensor for a description of
	  the appropriate self test procedure.

endif # LIS2DH
