/* This API checks the presence of non-valid frames in the read fifo data.  */
static void check_frame_validity(uint16_t *data_index, const struct bmi160_dev *dev)
/* This API checks the presence of non-valid frames in the read fifo data.  */
static void check_frame_validity(uint16_t *data_index, const struct bmi160_dev *dev)
{
    if ((*data_index + 2) < dev->fifo->length)
    {
        if ((dev->fifo->data[*data_index] == FIFO_CONFIG_MSB_CHECK) &&
            (dev->fifo->data[*data_index + 1] == FIFO_CONFIG_LSB_CHECK))
        {
            *data_index = dev->fifo->length;
        }
    }
}