|
| 1 | +# |
| 2 | +# Copyright (c) 2024 Chaim Zax |
| 3 | +# SPDX-License-Identifier: Apache-2.0 |
| 4 | +# |
| 5 | + |
| 6 | +menuconfig ADXL34X |
| 7 | + bool "ADXL343, ADXL344, ADXL345 and ADXL346 accelerometers" |
| 8 | + default y |
| 9 | + depends on DT_HAS_ADI_ADXL34X_ENABLED |
| 10 | + select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL34X),i2c) |
| 11 | + select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL34X),spi) |
| 12 | + help |
| 13 | + Enable support for the ADXL343, ADXL344, ADXL345 and ADXL346 Three |
| 14 | + Axis accelerometer |
| 15 | + |
| 16 | +if ADXL34X |
| 17 | + |
| 18 | +config ADXL34X_BUS_I2C |
| 19 | + bool |
| 20 | + default y |
| 21 | + depends on $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL34X),i2c) |
| 22 | + |
| 23 | +config ADXL34X_BUS_SPI |
| 24 | + bool |
| 25 | + default y |
| 26 | + depends on $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL34X),spi) |
| 27 | + |
| 28 | +config ADXL34X_DECODER |
| 29 | + bool "Decoder logic" |
| 30 | + default y |
| 31 | + select ADXL34X_ASYNC_API |
| 32 | + depends on SENSOR_ASYNC_API |
| 33 | + help |
| 34 | + Compile the ADXL34X decoder API which allows decoding raw data |
| 35 | + returned from the sensor. |
| 36 | + |
| 37 | +if ADXL34X_DECODER |
| 38 | + |
| 39 | +choice |
| 40 | + prompt "Decoder data type" |
| 41 | + default ADXL34X_DATA_TYPE_Q31 |
| 42 | + help |
| 43 | + Data type returned by the decoder. |
| 44 | + |
| 45 | +config ADXL34X_DATA_TYPE_Q31 |
| 46 | + bool "q31" |
| 47 | + help |
| 48 | + Return q31 sensor type values from the decoder |
| 49 | + |
| 50 | +config ADXL34X_DATA_TYPE_SENSOR_VALUE |
| 51 | + bool "sensor_value" |
| 52 | + help |
| 53 | + Return sensor_value sensor type values from the decoder |
| 54 | + |
| 55 | +config ADXL34X_DATA_TYPE_DOUBLE |
| 56 | + bool "double" |
| 57 | + help |
| 58 | + Return double sensor type values from the decoder |
| 59 | + |
| 60 | +endchoice |
| 61 | + |
| 62 | +endif # ADXL34X_DECODER |
| 63 | + |
| 64 | +choice ADXL34X_FIFO_MODE |
| 65 | + prompt "FIFO mode" |
| 66 | + default ADXL34X_FIFO_MODE_BYPASS |
| 67 | + help |
| 68 | + Specify the FIFO mode to be used by the driver |
| 69 | + |
| 70 | +config ADXL34X_FIFO_MODE_BYPASS |
| 71 | + bool "Bypass" |
| 72 | + help |
| 73 | + No FIFO, the FIFO of the adxl34x is bypassed. The sensor can only be |
| 74 | + used in polling mode, no triggers are available. Use this mode when |
| 75 | + the interrupt line of the adxl34x is not connected. |
| 76 | + |
| 77 | +config ADXL34X_FIFO_MODE_FIFO |
| 78 | + bool "FIFO" |
| 79 | + select ADXL34X_TRIGGER |
| 80 | + select ADXL34X_ASYNC_API |
| 81 | + depends on SENSOR_ASYNC_API |
| 82 | + help |
| 83 | + FIFO collects up to 32 values and then stops collecting data, |
| 84 | + collecting new data only when FIFO is not full. Use this config option |
| 85 | + to enable streaming sensor data via RTIO subsystem. This mode requires |
| 86 | + the interrupt line of the adxl34x to be connected. |
| 87 | + |
| 88 | +config ADXL34X_FIFO_MODE_STREAM |
| 89 | + bool "Stream" |
| 90 | + select ADXL34X_TRIGGER |
| 91 | + select ADXL34X_ASYNC_API |
| 92 | + depends on SENSOR_ASYNC_API |
| 93 | + help |
| 94 | + FIFO holds the last 32 data values. When FIFO is full, the oldest data |
| 95 | + is overwritten with newer data. This mode requires the interrupt line |
| 96 | + of the adxl34x to be connected. |
| 97 | + |
| 98 | +config ADXL34X_FIFO_MODE_TRIGGER |
| 99 | + bool "Trigger" |
| 100 | + select ADXL34X_TRIGGER |
| 101 | + select ADXL34X_ASYNC_API |
| 102 | + depends on SENSOR_ASYNC_API |
| 103 | + help |
| 104 | + When triggered by the trigger bit, FIFO holds the last data samples |
| 105 | + before the trigger event and then continues to collect data until |
| 106 | + full. New data is collected only when FIFO is not full. This mode |
| 107 | + requires the interrupt line of the adxl34x to be connected. |
| 108 | + |
| 109 | +endchoice |
| 110 | + |
| 111 | +config EMUL_ADXL34X |
| 112 | + bool "Emulator for the ADXL34X" |
| 113 | + default y |
| 114 | + depends on EMUL |
| 115 | + help |
| 116 | + Enable the hardware emulator for the ADXL34X. Doing so allows |
| 117 | + exercising sensor APIs for this driver in native_sim and qemu. |
| 118 | + |
| 119 | +config ADXL34X_EXTENDED_API |
| 120 | + bool "Extended API" |
| 121 | + default y |
| 122 | + help |
| 123 | + Enable the extended API for the ADXL34X. This option gives access to |
| 124 | + all registers of the adxl34x when not using user space. |
| 125 | + |
| 126 | +config ADXL34X_ADXL345_COMPATIBLE |
| 127 | + bool "ADXL345 compatible" |
| 128 | + default n |
| 129 | + help |
| 130 | + Enable compatibility with the (old) ADXL345 driver. Enable this |
| 131 | + feature when the (existing) application was written for the ADXL345 |
| 132 | + driver. The ADXL345 driver uses the FIFO when calling |
| 133 | + sensor_sample_fetch, and will return the number of samples collected |
| 134 | + (which is not the official API). This allows sensor_sample_get to be |
| 135 | + called multiple times to read all FIFO data. |
| 136 | + |
| 137 | +config ADXL34X_TRIGGER |
| 138 | + bool |
| 139 | + |
| 140 | +config ADXL34X_ASYNC_API |
| 141 | + bool |
| 142 | + |
| 143 | +endif # ADXL34X |
0 commit comments