BMI323_SensorAPI
BMI323_SensorAPI copied to clipboard
bmi3_extract_temperature and bmi3_extract_gyro bad operation ordering
In bmi3_extract_temperature and bmi3_extract_gyro the data_index is first updated conditionally and then the index is checked using check_data_index. This is incorrect as check_data_index also updates the data_index for it's check causing it to fail even when there is a frame the code is capable of reading.
Therefore the following
if (fifo->available_fifo_sens & BMI3_FIFO_HEAD_LESS_ACC_FRM)
{
data_index = data_index + BMI3_LENGTH_FIFO_ACC;
}
rslt = check_data_index(data_index, fifo);
should change to
rslt = check_data_index(data_index, fifo);
if (fifo->available_fifo_sens & BMI3_FIFO_HEAD_LESS_ACC_FRM)
{
data_index = data_index + BMI3_LENGTH_FIFO_ACC;
}