/* This API is the entry point. Call this API before using all other APIs. This API reads the chip-id of the sensor which is the first step to verify the sensor and also it configures the read mechanism of SPI and I2C interface.  */
uint16_t bma4_init(struct bma4_dev *dev)
/* This API is the entry point. Call this API before using all other APIs. This API reads the chip-id of the sensor which is the first step to verify the sensor and also it configures the read mechanism of SPI and I2C interface.  */
uint16_t bma4_init(struct bma4_dev *dev)
{
    uint16_t rslt = 0;
    uint8_t data = 0;
    if ((dev == NULL) || (dev->bus_read == NULL) || (dev->bus_write == NULL)) {
        rslt |= BMA4_E_NULL_PTR;
    } else {
        if (dev->interface == BMA4_SPI_INTERFACE)
            dev->dummy_byte = 1;
        else
            dev->dummy_byte = 0;
        rslt |= bma4_read_regs(BMA4_CHIP_ID_ADDR, &data, 1, dev);
        if (rslt == BMA4_OK) {
            dev->chip_id = data;
        }
    }
    return rslt;
}