/* This API reads the FIFO data of Accel and/or Mag sensor.  */
uint16_t bma4_read_fifo_data(struct bma4_dev *dev)
/* This API reads the FIFO data of Accel and/or Mag sensor.  */
uint16_t bma4_read_fifo_data(struct bma4_dev *dev)
{
    uint16_t rslt = 0;
    uint8_t data = 0;
    uint8_t addr = BMA4_FIFO_DATA_ADDR;
    if (dev == NULL || dev->fifo == NULL || dev->fifo->data == NULL) {
        rslt |= BMA4_E_NULL_PTR;
    } else {
        reset_fifo_data_structure(dev);
        if (dev->interface == BMA4_SPI_INTERFACE)
            addr = addr | BMA4_SPI_RD_MASK;
        rslt |= dev->bus_read(dev->dev_addr, addr, dev->fifo->data, dev->fifo->length);
        rslt |= bma4_read_regs(BMA4_FIFO_CONFIG_1_ADDR, &data, 1, dev);
        dev->fifo->fifo_header_enable = data & BMA4_FIFO_HEADER;
        dev->fifo->fifo_data_enable = data & BMA4_FIFO_M_A_ENABLE;
    }
    return rslt;
}