sensor: adxl345: Only enable FIFO Stream with Sensor Stream is enabled

Otherwise with its default configuration (25-Hz, 32-level FIFO),
getting individual samples could be up to 1-second old.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
This commit is contained in:
Luis Ubieda 2025-01-14 19:26:53 -05:00 committed by Benjamin Cabé
parent 283b5197e6
commit 2a59a0282c

View file

@ -457,11 +457,13 @@ static int adxl345_init(const struct device *dev)
return -ENODEV;
}
#if CONFIG_ADXL345_STREAM
rc = adxl345_reg_write_byte(dev, ADXL345_FIFO_CTL_REG, ADXL345_FIFO_STREAM_MODE);
if (rc < 0) {
LOG_ERR("FIFO enable failed\n");
return -EIO;
}
#endif
rc = adxl345_reg_write_byte(dev, ADXL345_DATA_FORMAT_REG, ADXL345_RANGE_8G);
if (rc < 0) {