Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions drivers/sensor/adi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ add_subdirectory_ifdef(CONFIG_ADLTC2990 adltc2990)
add_subdirectory_ifdef(CONFIG_ADT7310 adt7310)
add_subdirectory_ifdef(CONFIG_ADT7420 adt7420)
add_subdirectory_ifdef(CONFIG_ADXL345 adxl345)
add_subdirectory_ifdef(CONFIG_ADXL34X adxl34x)
add_subdirectory_ifdef(CONFIG_ADXL362 adxl362)
add_subdirectory_ifdef(CONFIG_ADXL367 adxl367)
add_subdirectory_ifdef(CONFIG_ADXL372 adxl372)
Expand Down
1 change: 1 addition & 0 deletions drivers/sensor/adi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ source "drivers/sensor/adi/adltc2990/Kconfig"
source "drivers/sensor/adi/adt7310/Kconfig"
source "drivers/sensor/adi/adt7420/Kconfig"
source "drivers/sensor/adi/adxl345/Kconfig"
source "drivers/sensor/adi/adxl34x/Kconfig"
source "drivers/sensor/adi/adxl362/Kconfig"
source "drivers/sensor/adi/adxl367/Kconfig"
source "drivers/sensor/adi/adxl372/Kconfig"
Expand Down
20 changes: 20 additions & 0 deletions drivers/sensor/adi/adxl34x/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright (c) 2024 Chaim Zax
# SPDX-License-Identifier: Apache-2.0
#

zephyr_library()

zephyr_library_sources(
adxl34x.c
adxl34x_configure.c
adxl34x_attr.c
)
zephyr_library_sources_ifdef(CONFIG_ADXL34X_BUS_I2C adxl34x_i2c.c)
zephyr_library_sources_ifdef(CONFIG_ADXL34X_BUS_SPI adxl34x_spi.c)
zephyr_library_sources_ifdef(CONFIG_ADXL34X_TRIGGER adxl34x_trigger.c)
zephyr_library_sources_ifdef(CONFIG_ADXL34X_DECODER adxl34x_decoder.c)
zephyr_library_sources_ifdef(CONFIG_ADXL34X_ASYNC_API adxl34x_rtio.c)

zephyr_library_sources_ifdef(CONFIG_EMUL_ADXL34X adxl34x_emul.c)
zephyr_include_directories_ifdef(CONFIG_EMUL_ADXL34X .)
143 changes: 143 additions & 0 deletions drivers/sensor/adi/adxl34x/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
#
# Copyright (c) 2024 Chaim Zax
# SPDX-License-Identifier: Apache-2.0
#

menuconfig ADXL34X
bool "ADXL343, ADXL344, ADXL345 and ADXL346 accelerometers"
default y
depends on DT_HAS_ADI_ADXL34X_ENABLED
select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL34X),i2c)
select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL34X),spi)
help
Enable support for the ADXL343, ADXL344, ADXL345 and ADXL346 Three
Axis accelerometer

if ADXL34X

config ADXL34X_BUS_I2C
bool
default y
depends on $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL34X),i2c)

config ADXL34X_BUS_SPI
bool
default y
depends on $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL34X),spi)

config ADXL34X_DECODER
bool "Decoder logic"
default y
select ADXL34X_ASYNC_API
depends on SENSOR_ASYNC_API
help
Compile the ADXL34X decoder API which allows decoding raw data
returned from the sensor.

if ADXL34X_DECODER

choice
prompt "Decoder data type"
default ADXL34X_DATA_TYPE_Q31
help
Data type returned by the decoder.

config ADXL34X_DATA_TYPE_Q31
bool "q31"
help
Return q31 sensor type values from the decoder

config ADXL34X_DATA_TYPE_SENSOR_VALUE
bool "sensor_value"
help
Return sensor_value sensor type values from the decoder

config ADXL34X_DATA_TYPE_DOUBLE
bool "double"
help
Return double sensor type values from the decoder

endchoice

endif # ADXL34X_DECODER

choice ADXL34X_FIFO_MODE
prompt "FIFO mode"
default ADXL34X_FIFO_MODE_BYPASS
help
Specify the FIFO mode to be used by the driver

config ADXL34X_FIFO_MODE_BYPASS
bool "Bypass"
help
No FIFO, the FIFO of the adxl34x is bypassed. The sensor can only be
used in polling mode, no triggers are available. Use this mode when
the interrupt line of the adxl34x is not connected.

config ADXL34X_FIFO_MODE_FIFO
bool "FIFO"
select ADXL34X_TRIGGER
select ADXL34X_ASYNC_API
depends on SENSOR_ASYNC_API
help
FIFO collects up to 32 values and then stops collecting data,
collecting new data only when FIFO is not full. Use this config option
to enable streaming sensor data via RTIO subsystem. This mode requires
the interrupt line of the adxl34x to be connected.

config ADXL34X_FIFO_MODE_STREAM
bool "Stream"
select ADXL34X_TRIGGER
select ADXL34X_ASYNC_API
depends on SENSOR_ASYNC_API
help
FIFO holds the last 32 data values. When FIFO is full, the oldest data
is overwritten with newer data. This mode requires the interrupt line
of the adxl34x to be connected.

config ADXL34X_FIFO_MODE_TRIGGER
bool "Trigger"
select ADXL34X_TRIGGER
select ADXL34X_ASYNC_API
depends on SENSOR_ASYNC_API
help
When triggered by the trigger bit, FIFO holds the last data samples
before the trigger event and then continues to collect data until
full. New data is collected only when FIFO is not full. This mode
requires the interrupt line of the adxl34x to be connected.

endchoice

config EMUL_ADXL34X
bool "Emulator for the ADXL34X"
default y
depends on EMUL
help
Enable the hardware emulator for the ADXL34X. Doing so allows
exercising sensor APIs for this driver in native_sim and qemu.

config ADXL34X_EXTENDED_API
bool "Extended API"
default y
help
Enable the extended API for the ADXL34X. This option gives access to
all registers of the adxl34x when not using user space.

config ADXL34X_ADXL345_COMPATIBLE
bool "ADXL345 compatible"
default n
help
Enable compatibility with the (old) ADXL345 driver. Enable this
feature when the (existing) application was written for the ADXL345
driver. The ADXL345 driver uses the FIFO when calling
sensor_sample_fetch, and will return the number of samples collected
(which is not the official API). This allows sensor_sample_get to be
called multiple times to read all FIFO data.

config ADXL34X_TRIGGER
bool

config ADXL34X_ASYNC_API
bool

endif # ADXL34X
Loading