Skip to content

Commit

Permalink
sensor: adxl345: Only enable FIFO Stream with Sensor Stream is enabled
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ubieda authored and kartben committed Jan 20, 2025
1 parent 283b519 commit 2a59a02
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/sensor/adi/adxl345/adxl345.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2a59a02

Please sign in to comment.