1# Micropower, 3-Axis, +/-200g Digital Accelerometer
2
3# Copyright (c) 2018 Analog Devices Inc.
4# SPDX-License-Identifier: Apache-2.0
5
6menuconfig ADXL372
7	bool "ADXL372 Three Axis High-g I2C/SPI accelerometer"
8	default y
9	depends on DT_HAS_ADI_ADXL372_ENABLED
10	select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL372),i2c)
11	select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL372),spi)
12	select RTIO_WORKQ if SENSOR_ASYNC_API
13	help
14	  Enable driver for ADXL372 Three-Axis Digital Accelerometers.
15
16if ADXL372
17
18choice ADXL372_OP_MODE
19	prompt "Operating mode"
20	default ADXL372_PEAK_DETECT_MODE
21
22config ADXL372_PEAK_DETECT_MODE
23	bool "Max Peak detect mode"
24	help
25	  In most high-g applications, a single (3-axis) acceleration sample at
26	  the peak of an impact event contains sufficient information
27	  about the event, and the full acceleration history is not required.
28	  In this mode the device returns only the over threshold
29	  Peak Acceleration between two consecutive sample fetches.
30
31config ADXL372_MEASUREMENT_MODE
32	bool "Measurement Mode"
33	help
34	  In this mode, acceleration data is provided continuously at the
35	  output data rate (ODR).
36
37endchoice
38
39config ADXL372_ACTIVITY_THRESHOLD
40	int "Activity threshold in mg"
41	range 0 200000
42	default 500
43	help
44	  Threshold for activity detection.
45
46config ADXL372_INACTIVITY_THRESHOLD
47	int "In-activity threshold in mg"
48	range 0 200000
49	default 400
50	help
51	  Threshold for in-activity detection.
52
53config ADXL372_ACTIVITY_TIME
54	int "Activity time"
55	range 0 $(UINT8_MAX)
56	default 1
57	help
58	  The activity timer implements a robust activity detection that
59	  minimizes false positive motion triggers. When the timer is used,
60	  only sustained motion can trigger activity detection.
61	  Number of multiples of 3.3 ms activity timer for which above threshold
62	  acceleration is required to detect activity. It is 3.3 ms per code
63	  for 6400 Hz ODR, and it is 6.6 ms per code for 3200 Hz ODR and below.
64
65config ADXL372_INACTIVITY_TIME
66	int "In-activity time"
67	range 0 $(UINT8_MAX)
68	default 2
69	help
70	  The time that all enabled axes must be lower than the inactivity
71	  threshold for an inactivity event to be detected. Number of multiples
72	  of 26 ms inactivity timer for which below threshold acceleration is
73	  required to detect inactivity. It is 26 ms per code for 3200 Hz ODR
74	  and below, and it is 13 ms per code for 6400 Hz ODR.
75
76config ADXL372_REFERENCED_ACTIVITY_DETECTION_MODE
77	bool "Use referenced activity/in-activity detection"
78	default y
79	help
80	  Activity detection can be configured as referenced or absolute.
81	  When using absolute activity detection, acceleration samples are
82	  compared directly to a user set threshold to determine whether
83	  motion is present. In many applications, it is advantageous for
84	  activity detection to be based not on an absolute threshold,
85	  but on a deviation from a reference point or orientation.
86
87choice ADXL372_TRIGGER_MODE
88	prompt "Trigger mode"
89	default ADXL372_TRIGGER_NONE
90	help
91	  Specify the type of triggering used by the driver.
92
93config ADXL372_TRIGGER_NONE
94	bool "No trigger"
95
96config ADXL372_TRIGGER_GLOBAL_THREAD
97	bool "Use global thread"
98	depends on GPIO
99	depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADXL372),int1-gpios)
100	select ADXL372_TRIGGER
101
102config ADXL372_TRIGGER_OWN_THREAD
103	bool "Use own thread"
104	depends on GPIO
105	depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADXL372),int1-gpios)
106	select ADXL372_TRIGGER
107
108endchoice
109
110config ADXL372_STREAM
111	bool "Use FIFO to stream data"
112	select ADXL372_TRIGGER
113	default y
114	depends on SPI_RTIO
115	depends on SENSOR_ASYNC_API
116	help
117	  Use this configuration option to enable streaming sensor data via RTIO.
118
119config ADXL372_TRIGGER
120	bool
121
122config ADXL372_THREAD_PRIORITY
123	int "Thread priority"
124	depends on ADXL372_TRIGGER_OWN_THREAD && ADXL372_TRIGGER
125	default 10
126	help
127	  Priority of thread used by the driver to handle interrupts.
128
129config ADXL372_THREAD_STACK_SIZE
130	int "Thread stack size"
131	depends on ADXL372_TRIGGER_OWN_THREAD && ADXL372_TRIGGER
132	default 1024
133	help
134	  Stack size of thread used by the driver to handle interrupts.
135
136endif # ADXL372
137