Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function "bmi2_write_config_file" issue #9

Open
qqhengg opened this issue Aug 1, 2021 · 0 comments
Open

function "bmi2_write_config_file" issue #9

qqhengg opened this issue Aug 1, 2021 · 0 comments

Comments

@qqhengg
Copy link

qqhengg commented Aug 1, 2021

image

bmi270_defs.h:

  /*! @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)

bmi2.c:

  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;
  }

Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant