/* This API is used to read number of bytes filled currently in FIFO buffer. 
This API is used to read fifo_byte_counter value (i.e) current fill-level in Fifo buffer. */
static int8_t get_fifo_byte_counter(uint16_t *bytes_to_read, struct bmi160_dev const *dev)
/* This API is used to read number of bytes filled currently in FIFO buffer. 
This API is used to read fifo_byte_counter value (i.e) current fill-level in Fifo buffer. */
static int8_t get_fifo_byte_counter(uint16_t *bytes_to_read, struct bmi160_dev const *dev)
{
    int8_t rslt = 0;
    uint8_t data[2];
    uint8_t addr = BMI160_FIFO_LENGTH_ADDR;
    rslt |= bmi160_get_regs(addr, data, 2, dev);
    data[1] = data[1] & BMI160_FIFO_BYTE_COUNTER_MASK;
    *bytes_to_read = (((uint16_t)data[1] << 8) | ((uint16_t)data[0]));
    return rslt;
}