Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
9 changes: 6 additions & 3 deletions drivers/sensor/tdk/icm45686/icm45686_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

#include <zephyr/drivers/sensor_clock.h>
#include <zephyr/sys/check.h>

#include "icm45686.h"
#include "icm45686_reg.h"
Expand Down Expand Up @@ -489,11 +490,13 @@ static int icm45686_fifo_decode(const uint8_t *buffer,
/** This driver assumes 20-byte fifo packets, with both accel and gyro,
* and no auxiliary sensors.
*/
__ASSERT(!(fdata->header & FIFO_HEADER_EXT_HEADER_EN(true)) &&
CHECKIF(!(!(fdata->header & FIFO_HEADER_EXT_HEADER_EN(true)) &&
(fdata->header & FIFO_HEADER_ACCEL_EN(true)) &&
(fdata->header & FIFO_HEADER_GYRO_EN(true)) &&
(fdata->header & FIFO_HEADER_HIRES_EN(true)),
"Unsupported FIFO packet format");
(fdata->header & FIFO_HEADER_HIRES_EN(true)))) {
LOG_ERR("Unsupported FIFO packet format 0x%02x", fdata->header);
return -ENOTSUP;
}

switch (chan_spec.chan_type) {
case SENSOR_CHAN_ACCEL_XYZ:
Expand Down
10 changes: 9 additions & 1 deletion drivers/sensor/tdk/icm45686/icm45686_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,16 @@ void icm45686_stream_submit(const struct device *dev,

if (data->stream.settings.enabled.fifo_ths ||
data->stream.settings.enabled.fifo_full) {
/** AN-000364: When operating in FIFO streaming mode, if FIFO threshold
* interrupt is triggered with M number of FIFO frames accumulated in the
* FIFO buffer, the host should only read the first M-1 number of FIFO
* frames.
*
* To avoid the case where M == 1 and M-- would be 0,
* M + 1 threshold is used so M count is read.
*/
uint16_t fifo_ths = data->stream.settings.enabled.fifo_ths ?
cfg->settings.fifo_watermark : 0;
cfg->settings.fifo_watermark + 1 : 0;

val = REG_FIFO_CONFIG2_FIFO_WM_GT_THS(true) |
REG_FIFO_CONFIG2_FIFO_FLUSH(true);
Expand Down