Hi Aloe,
In the official BMI270 sensor API(https://github.com/boschsensortec/BMI270_SensorAPI), function bmi2_get_internal_status() will first delay for a period of time, waiting for the sensor to initialize before reading the status register. If using the official Sensor API, it has already implemented this operation.
/*! * @brief This API gets Error bits and message indicating internal status. */ int8_t bmi2_get_internal_status(uint8_t *int_stat, struct bmi2_dev *dev) { /* Variable to define error */ int8_t rslt;
/* Null-pointer check */ rslt = null_ptr_check(dev); if ((rslt == BMI2_OK) && (int_stat != NULL)) { /* Wait till ASIC is initialized */ dev->delay_us(BMI2_INTERNAL_STATUS_READ_DELAY_MS, dev->intf_ptr);
/* Get the error bits and message */ rslt = bmi2_get_regs(BMI2_INTERNAL_STATUS_ADDR, int_stat, 1, dev); } else { rslt = BMI2_E_NULL_PTR; }
return rslt; }
... View more