AP_Compass: AK8963: Add support to use a AK8963 behind of a MPU9250 over I2C

To be able to use AK8963 connected to the auxiliary I2C bus of a
MPU9250 we need first initialize it.
This commit is contained in:
José Roberto de Souza 2015-09-28 17:46:19 -03:00 committed by Andrew Tridgell
parent d1ff4286c2
commit bdc36349b4
2 changed files with 12 additions and 0 deletions

View File

@ -89,6 +89,15 @@ AP_Compass_Backend *AP_Compass_AK8963::detect_i2c(Compass &compass,
return _detect(compass, bus);
}
AP_Compass_Backend *AP_Compass_AK8963::detect_mpu9250_i2c(Compass &compass,
AP_HAL::I2CDriver *i2c,
uint8_t addr)
{
AP_InertialSensor &ins = *AP_InertialSensor::get_instance();
ins.detect_backends();
return detect_i2c(compass, i2c, addr);
}
AP_Compass_Backend *AP_Compass_AK8963::_detect(Compass &compass,
AP_AK8963_SerialBus *bus)
{

View File

@ -39,6 +39,9 @@ class AP_Compass_AK8963 : public AP_Compass_Backend
{
public:
static AP_Compass_Backend *detect_mpu9250(Compass &compass, uint8_t mpu9250_instance);
static AP_Compass_Backend *detect_mpu9250_i2c(Compass &compass,
AP_HAL::I2CDriver *i2c,
uint8_t addr);
static AP_Compass_Backend *detect_i2c(Compass &compass,
AP_HAL::I2CDriver *i2c,
uint8_t addr);