mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-18 06:38:29 -04:00
AP_Compass: added autodetect of all known compasses on external bus
This commit is contained in:
parent
33bdc9196c
commit
677f2bebc3
@ -845,6 +845,10 @@ void Compass::_detect_backends(void)
|
|||||||
ADD_BACKEND(DRIVER_HMC5883, AP_Compass_HMC5843::probe(*this, hal.i2c_mgr->get_device(HAL_COMPASS_HMC5843_I2C_BUS, HAL_COMPASS_HMC5843_I2C_ADDR),
|
ADD_BACKEND(DRIVER_HMC5883, AP_Compass_HMC5843::probe(*this, hal.i2c_mgr->get_device(HAL_COMPASS_HMC5843_I2C_BUS, HAL_COMPASS_HMC5843_I2C_ADDR),
|
||||||
false, HAL_COMPASS_HMC5843_ROTATION),
|
false, HAL_COMPASS_HMC5843_ROTATION),
|
||||||
AP_Compass_HMC5843::name, false);
|
AP_Compass_HMC5843::name, false);
|
||||||
|
#if defined(HAL_COMPASS_HMC5843_I2C_EXT_BUS) && CONFIG_HAL_BOARD == HAL_BOARD_F4LIGHT
|
||||||
|
ADD_BACKEND(DRIVER_HMC5883, AP_Compass_HMC5843::probe(*this, hal.i2c_mgr->get_device(HAL_COMPASS_HMC5843_I2C_EXT_BUS, HAL_COMPASS_HMC5843_I2C_ADDR),true),
|
||||||
|
AP_Compass_HMC5843::name, true);
|
||||||
|
#endif
|
||||||
#elif HAL_COMPASS_DEFAULT == HAL_COMPASS_HMC5843_MPU6000
|
#elif HAL_COMPASS_DEFAULT == HAL_COMPASS_HMC5843_MPU6000
|
||||||
ADD_BACKEND(DRIVER_HMC5883, AP_Compass_HMC5843::probe_mpu6000(*this),
|
ADD_BACKEND(DRIVER_HMC5883, AP_Compass_HMC5843::probe_mpu6000(*this),
|
||||||
AP_Compass_HMC5843::name, false);
|
AP_Compass_HMC5843::name, false);
|
||||||
@ -893,6 +897,41 @@ void Compass::_detect_backends(void)
|
|||||||
#error Unrecognised HAL_COMPASS_TYPE setting
|
#error Unrecognised HAL_COMPASS_TYPE setting
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(BOARD_I2C_BUS_EXT) && CONFIG_HAL_BOARD == HAL_BOARD_F4LIGHT
|
||||||
|
// autodetect external i2c bus
|
||||||
|
ADD_BACKEND(DRIVER_QMC5883, AP_Compass_QMC5883L::probe(*this, hal.i2c_mgr->get_device(BOARD_I2C_BUS_EXT, HAL_COMPASS_QMC5883L_I2C_ADDR),
|
||||||
|
true,ROTATION_NONE),
|
||||||
|
AP_Compass_QMC5883L::name, true);
|
||||||
|
|
||||||
|
ADD_BACKEND(DRIVER_HMC5883, AP_Compass_HMC5843::probe(*this, hal.i2c_mgr->get_device(BOARD_I2C_BUS_EXT, HAL_COMPASS_HMC5843_I2C_ADDR)),
|
||||||
|
AP_Compass_HMC5843::name, true);
|
||||||
|
|
||||||
|
|
||||||
|
// lis3mdl
|
||||||
|
ADD_BACKEND(DRIVER_LIS3MDL, AP_Compass_LIS3MDL::probe(*this, hal.i2c_mgr->get_device(BOARD_I2C_BUS_EXT, HAL_COMPASS_LIS3MDL_I2C_ADDR),
|
||||||
|
true, ROTATION_NONE),
|
||||||
|
AP_Compass_LIS3MDL::name, true);
|
||||||
|
|
||||||
|
// AK09916
|
||||||
|
ADD_BACKEND(DRIVER_AK09916, AP_Compass_AK09916::probe(*this, hal.i2c_mgr->get_device(BOARD_I2C_BUS_EXT, HAL_COMPASS_AK09916_I2C_ADDR),
|
||||||
|
true, ROTATION_NONE),
|
||||||
|
AP_Compass_AK09916::name, true);
|
||||||
|
|
||||||
|
ADD_BACKEND(DRIVER_IST8310, AP_Compass_IST8310::probe(*this, hal.i2c_mgr->get_device(BOARD_I2C_BUS_EXT, HAL_COMPASS_IST8310_I2C_ADDR),
|
||||||
|
ROTATION_NONE),
|
||||||
|
AP_Compass_IST8310::name, true);
|
||||||
|
|
||||||
|
ADD_BACKEND(DRIVER_BMM150, AP_Compass_BMM150::probe(*this, hal.i2c_mgr->get_device(BOARD_I2C_BUS_EXT, HAL_COMPASS_BMM150_I2C_ADDR)),
|
||||||
|
AP_Compass_BMM150::name, true);
|
||||||
|
|
||||||
|
ADD_BACKEND(DRIVER_MAG3110, AP_Compass_MAG3110::probe(*this, hal.i2c_mgr->get_device(BOARD_I2C_BUS_EXT, HAL_MAG3110_I2C_ADDR), ROTATION_NONE),
|
||||||
|
AP_Compass_MAG3110::name, true);
|
||||||
|
|
||||||
|
ADD_BACKEND(DRIVER_QMC5883, AP_Compass_QMC5883L::probe(*this, hal.i2c_mgr->get_device(BOARD_I2C_BUS_EXT, HAL_COMPASS_QMC5883L_I2C_ADDR), ROTATION_NONE),
|
||||||
|
AP_Compass_QMC5883L::name, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAL_WITH_UAVCAN
|
#if HAL_WITH_UAVCAN
|
||||||
if (_driver_enabled(DRIVER_UAVCAN)) {
|
if (_driver_enabled(DRIVER_UAVCAN)) {
|
||||||
bool added;
|
bool added;
|
||||||
|
Loading…
Reference in New Issue
Block a user