/*====================================================================================================*/
uint8_t MPU9250_Check( void )
{
  uint8_t DeviceID = ERROR;

  DeviceID = MPU9250_ReadReg(MPU6500_WHO_AM_I);
  if(DeviceID != MPU6500_Device_ID)
     return ERROR;

#ifdef _USE_MAG_AK8963
  DeviceID = MPU9250_Mag_ReadReg(AK8963_WIA);
  if(DeviceID != AK8963_Device_ID)
     return ERROR;
#endif

  return SUCCESS;
}
Beispiel #2
0
/*====================================================================================================*/
uint8_t IMU_deviceCheck( IMU_DataTypeDef *pIMU )
{
  uint8_t deviceID = ERROR;

  if(pIMU->MPU_GyrAcc_Enable == MPU_GyrAcc_ENABLE) {
    deviceID = MPU9250_ReadReg(MPU6500_WHO_AM_I);
    if(deviceID != MPU6500_Device_ID)
      return ERROR;
  }

  if(pIMU->MPU_Mag_Enable == MPU_Mag_ENABLE) {
    deviceID = MPU9250_Mag_ReadReg(AK8963_WIA);
    if(deviceID != AK8963_Device_ID)
      return ERROR;
  }

  if(pIMU->LPS_PresTemp_Enable == LPS_PresTemp_ENABLE) {
    deviceID = LPS25H_ReadReg(LPS25H_WHO_AM_I);
    if(deviceID != LPS25H_Device_ID)
      return ERROR;
  }

  return SUCCESS;
}