AP_Compass: support 2nd address for ICM20948 compass

This commit is contained in:
Andrew Tridgell 2021-04-12 14:08:53 +10:00
parent f07ba3164b
commit b0674a2b35
2 changed files with 10 additions and 0 deletions

View File

@ -1069,12 +1069,18 @@ void Compass::_probe_external_i2c_compasses(void)
ADD_BACKEND(DRIVER_ICM20948, AP_Compass_AK09916::probe_ICM20948(GET_I2C_DEVICE(i, HAL_COMPASS_AK09916_I2C_ADDR),
GET_I2C_DEVICE(i, HAL_COMPASS_ICM20948_I2C_ADDR),
true, ROTATION_PITCH_180_YAW_90));
ADD_BACKEND(DRIVER_ICM20948, AP_Compass_AK09916::probe_ICM20948(GET_I2C_DEVICE(i, HAL_COMPASS_AK09916_I2C_ADDR),
GET_I2C_DEVICE(i, HAL_COMPASS_ICM20948_I2C_ADDR2),
true, ROTATION_PITCH_180_YAW_90));
}
FOREACH_I2C_INTERNAL(i) {
ADD_BACKEND(DRIVER_ICM20948, AP_Compass_AK09916::probe_ICM20948(GET_I2C_DEVICE(i, HAL_COMPASS_AK09916_I2C_ADDR),
GET_I2C_DEVICE(i, HAL_COMPASS_ICM20948_I2C_ADDR),
all_external, ROTATION_PITCH_180_YAW_90));
ADD_BACKEND(DRIVER_ICM20948, AP_Compass_AK09916::probe_ICM20948(GET_I2C_DEVICE(i, HAL_COMPASS_AK09916_I2C_ADDR),
GET_I2C_DEVICE(i, HAL_COMPASS_ICM20948_I2C_ADDR2),
all_external, ROTATION_PITCH_180_YAW_90));
}
#endif // HAL_BUILD_AP_PERIPH

View File

@ -31,6 +31,10 @@
# define HAL_COMPASS_ICM20948_I2C_ADDR 0x69
#endif
#ifndef HAL_COMPASS_ICM20948_I2C_ADDR2
# define HAL_COMPASS_ICM20948_I2C_ADDR2 0x68
#endif
class AuxiliaryBus;
class AuxiliaryBusSlave;
class AP_InertialSensor;