接前一篇文章:ICM20948 DMP代码详解(13)
上一回完成了对icm20948_sensor_setup函数中第2段代码的解析,本回继续往下进行解析。为了便于理解和回顾,再次贴出icm20948_sensor_setup函数代码,在EMD-App\src\ICM20948\sensor.c中,如下:
int icm20948_sensor_setup(void){
int rc;
uint8_t i, whoami = 0xff;
/*
* Just get the whoami
*/
rc = inv_icm20948_get_whoami(&icm_device, &whoami);
if (interface_is_SPI() == 0) { // If we're using I2C
if (whoami == 0xff) { // if whoami fails try the other I2C Address
switch_I2C_to_revA();
rc = inv_icm20948_get_whoami(&icm_device, &whoami);
}
}
INV_