/*! @name BMI2 configuration load status */
#define BMI2_CONFIG_LOAD_SUCCESS UINT8_C(1)
/******************************************************************************/
/*! @name Macro Definitions for internal status */
/******************************************************************************/
#define BMI2_NOT_INIT UINT8_C(0x00)
#define BMI2_INIT_OK UINT8_C(0x01)
#define BMI2_INIT_ERR UINT8_C(0x02)
#define BMI2_DRV_ERR UINT8_C(0x03)
#define BMI2_SNS_STOP UINT8_C(0x04)
#define BMI2_NVM_ERROR UINT8_C(0x05)
#define BMI2_START_UP_ERROR UINT8_C(0x06)
#define BMI2_COMPAT_ERROR UINT8_C(0x07)
#define BMI2_VFM_SKIPPED UINT8_C(0x10)
#define BMI2_AXES_MAP_ERROR UINT8_C(0x20)
#define BMI2_ODR_50_HZ_ERROR UINT8_C(0x40)
#define BMI2_ODR_HIGH_ERROR UINT8_C(0x80)
int8_t bmi2_write_config_file(struct bmi2_dev *dev)
{
...
/* Write the configuration file */
rslt = write_config_file(dev);
if (rslt == BMI2_OK)
{
/* Check the configuration load status */
rslt = bmi2_get_internal_status(&load_status, dev);
/* Return error if loading not successful */
if ((rslt == BMI2_OK) && (!(load_status & BMI2_CONFIG_LOAD_SUCCESS))) //**bug here???!!!!**
{
rslt = BMI2_E_CONFIG_LOAD;
}
}
...
return rslt;
}
As we can see the description of register INTERNAL_STATUS above, it's not hard to know that the "if condition" should be:
/* Return error if loading not successful */
if ((rslt == BMI2_OK) && ((load_status & 0x0f) != BMI2_INIT_OK)) //correction!!!
{
rslt = BMI2_E_CONFIG_LOAD;
}