# Kconfig - FXOS8700 6-axis accelerometer/magnetometer
#
# Copyright (c) 2016 Freescale Semiconductor, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#

menuconfig FXOS8700
	bool "FXOS8700 accelerometer/magnetometer driver"
	depends on SENSOR && I2C
	default n
	help
	Enable driver for the FXOS8700 accelerometer/magnetometer

config FXOS8700_NAME
	string "Device name"
	depends on FXOS8700
	default "FXOS8700"

config FXOS8700_I2C_NAME
	string "I2C device name"
	depends on FXOS8700
	default I2C_0_NAME

config FXOS8700_I2C_ADDRESS
	hex "I2C address"
	depends on FXOS8700
	range 0x1c 0x1f
	default 0x1d
	help
	The I2C slave address can be configured by the SA0 and SA1 input pins.
	This option should usually be set by the board defconfig.

config FXOS8700_WHOAMI
	hex "WHOAMI value"
	depends on FXOS8700
	range 0x00 0xff
	default 0xc7
	help
	The datasheet defines the value of the WHOAMI register, but some
	pre-production devices can have a different value. It is unlikely you
	should need to change this configuration option from the default.

choice
	prompt "Mode"
	depends on FXOS8700
	default FXOS8700_MODE_ACCEL

config FXOS8700_MODE_ACCEL
	bool "Accelerometer-only mode"

config FXOS8700_MODE_MAGN
	bool "Magnetometer-only mode"

config FXOS8700_MODE_HYBRID
	bool "Hybrid (accel+mag) mode"

endchoice

choice
	prompt "Range"
	depends on FXOS8700
	default FXOS8700_RANGE_8G

config FXOS8700_RANGE_8G
	bool "8g (0.976 mg/LSB)"

config FXOS8700_RANGE_4G
	bool "4g (0.488 mg/LSB)"

config FXOS8700_RANGE_2G
	bool "2g (0.244 mg/LSB)"

endchoice

choice
	prompt "Trigger mode"
	depends on FXOS8700
	default FXOS8700_TRIGGER_NONE

config FXOS8700_TRIGGER_NONE
	bool "No trigger"

config FXOS8700_TRIGGER_GLOBAL_THREAD
	bool "Use global thread"
	select FXOS8700_TRIGGER

config FXOS8700_TRIGGER_OWN_THREAD
	bool "Use own thread"
	select FXOS8700_TRIGGER

endchoice

config FXOS8700_TRIGGER
	bool
	depends on FXOS8700
	default n

config FXOS8700_GPIO_NAME
	string "GPIO device name"
	depends on FXOS8700_TRIGGER

config FXOS8700_GPIO_PIN
	int "GPIO pin"
	depends on FXOS8700_TRIGGER

config FXOS8700_DRDY_INT1
	bool "Data ready interrupt to INT1 pin"
	depends on FXOS8700_TRIGGER
	default n
	help
	Say Y to route data ready interrupt to INT1 pin. Say N to route to INT2
	pin.

if FXOS8700_TRIGGER

config FXOS8700_THREAD_PRIORITY
	int "Own thread priority"
	depends on FXOS8700_TRIGGER_OWN_THREAD
	default 10

config FXOS8700_THREAD_STACK_SIZE
	int "Own thread stack size"
	depends on FXOS8700_TRIGGER_OWN_THREAD
	default 1024

menuconfig FXOS8700_PULSE
	bool "Pulse detection"
	default n
	help
	Enable pulse detection

if FXOS8700_PULSE

config FXOS8700_PULSE_INT1
	bool "Pulse interrupt to INT1 pin"
	default n
	help
	Say Y to route pulse interrupt to INT1 pin. Say N to route to INT2 pin.

config FXOS8700_PULSE_CFG
	hex "Pulse configuration register"
	range 0 0xff
	default 0x3f

config FXOS8700_PULSE_THSX
	hex "Pulse X-axis threshold"
	range 0 0x7f
	default 0x20
	help
	Threshold to start the pulse-event detection procedure on the X-axis.
	Threshold values for each axis are unsigned 7-bit numbers with a fixed
	resolution of 0.063 g/LSB, corresponding to an 8g acceleration
	full-scale range.

config FXOS8700_PULSE_THSY
	hex "Pulse Y-axis threshold"
	range 0 0x7f
	default 0x20
	help
	Threshold to start the pulse-event detection procedure on the Y-axis.
	Threshold values for each axis are unsigned 7-bit numbers with a fixed
	resolution of 0.063 g/LSB, corresponding to an 8g acceleration
	full-scale range.

config FXOS8700_PULSE_THSZ
	hex "Pulse Z-axis threshold"
	range 0 0x7f
	default 0x40
	help
	Threshold to start the pulse-event detection procedure on the Z-axis.
	Threshold values for each axis are unsigned 7-bit numbers with a fixed
	resolution of 0.063 g/LSB, corresponding to an 8g acceleration
	full-scale range.

config FXOS8700_PULSE_TMLT
	hex "Pulse time limit"
	range 0 0x7f
	default 0x18
	help
	The maximum time interval that can elapse between the start of the
	acceleration on the selected channel exceeding the specified threshold
	and the end when the channel acceleration goes back below the specified
	threshold. The resolution depends upon the sample rate (ODR) and the
	highpass filter configuration (HP_FILTER_CUTOFF[pls_hpf_en]). For
	ODR=800 Hz and pls_hpf_en=0, the resolution is 0.625 ms/LSB.

config FXOS8700_PULSE_LTCY
	hex "Pulse latency"
	range 0 0xff
	default 0x28
	help
	The time interval that starts after the first pulse detection where the
	pulse-detection function ignores the start of a new pulse. The
	resolution depends upon the sample rate (ODR) and the highpass filter
	configuration (HP_FILTER_CUTOFF[pls_hpf_en]). For ODR=800 Hz and
	pls_hpf_en=0, the resolution is 1.25 ms/LSB.

config FXOS8700_PULSE_WIND
	hex "Pulse window"
	range 0 0xff
	default 0x3c
	help
	The maximum interval of time that can elapse after the end of the
	latency interval in which the start of the second pulse event must be
	detected provided the device has been configured for double pulse
	detection. The detected second pulse width must be shorter than the
	time limit constraint specified by the PULSE_TMLT register, but the end
	of the double pulse need not finish within the time specified by the
	PULSE_WIND register. The resolution depends upon the sample rate (ODR)
	and the highpass filter configuration (HP_FILTER_CUTOFF[pls_hpf_en]).
	For ODR=800 Hz and pls_hpf_en=0, the resolution is 1.25 ms/LSB.

endif # FXOS8700_PULSE

endif # FXOS8700_TRIGGER
