drivers: sensor: adxl372: FIFO mode from DT
Adds support for setting FIFO mode and water-mark from DT. Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
This commit is contained in:
parent
c1bce30fe5
commit
e72e1c1c44
5 changed files with 75 additions and 8 deletions
|
@ -900,9 +900,11 @@ static int adxl372_init(const struct device *dev)
|
|||
.inactivity_th.enable = 1, \
|
||||
.inactivity_time = CONFIG_ADXL372_INACTIVITY_TIME, \
|
||||
.filter_settle = ADXL372_FILTER_SETTLE_370, \
|
||||
.fifo_config.fifo_mode = ADXL372_FIFO_STREAMED, \
|
||||
.fifo_config.fifo_format = ADXL372_XYZ_PEAK_FIFO, \
|
||||
.fifo_config.fifo_samples = 128, \
|
||||
.fifo_config.fifo_mode = \
|
||||
DT_INST_PROP_OR(inst, fifo_mode, ADXL372_FIFO_BYPASSED), \
|
||||
.fifo_config.fifo_format = ADXL372_XYZ_FIFO, \
|
||||
.fifo_config.fifo_samples = \
|
||||
DT_INST_PROP_OR(inst, fifo_watermark, 0x80), \
|
||||
.op_mode = ADXL372_FULL_BW_MEASUREMENT, \
|
||||
|
||||
#define ADXL372_CONFIG_SPI(inst) \
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <zephyr/drivers/gpio.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/sys/util.h>
|
||||
#include <zephyr/dt-bindings/sensor/adxl372.h>
|
||||
|
||||
#ifdef CONFIG_ADXL372_STREAM
|
||||
#include <zephyr/rtio/rtio.h>
|
||||
|
@ -268,10 +269,10 @@ enum adxl372_fifo_format {
|
|||
};
|
||||
|
||||
enum adxl372_fifo_mode {
|
||||
ADXL372_FIFO_BYPASSED,
|
||||
ADXL372_FIFO_STREAMED,
|
||||
ADXL372_FIFO_TRIGGERED,
|
||||
ADXL372_FIFO_OLD_SAVED
|
||||
ADXL372_FIFO_BYPASSED = ADXL372_FIFO_MODE_BYPASSED,
|
||||
ADXL372_FIFO_STREAMED = ADXL372_FIFO_MODE_STREAMED,
|
||||
ADXL372_FIFO_TRIGGERED = ADXL372_FIFO_MODE_TRIGGERED,
|
||||
ADXL372_FIFO_OLD_SAVED = ADXL372_FIFO_MODE_OLD_SAVED
|
||||
};
|
||||
|
||||
struct adxl372_fifo_config {
|
||||
|
|
|
@ -107,7 +107,8 @@ void adxl372_submit_stream(const struct device *dev, struct rtio_iodev_sqe *iode
|
|||
data->fifo_config.fifo_samples);
|
||||
|
||||
if (current_fifo_mode == ADXL372_FIFO_BYPASSED) {
|
||||
current_fifo_mode = ADXL372_FIFO_STREAMED;
|
||||
LOG_ERR("ERROR: FIFO BYPASSED");
|
||||
return;
|
||||
}
|
||||
|
||||
adxl372_configure_fifo(dev, current_fifo_mode, data->fifo_config.fifo_format,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue