AP_Compass: probe for LIS3MDL on 0x1e

as well as 0x1c
This commit is contained in:
Andrew Tridgell 2017-11-15 16:05:12 +11:00
parent 031166f64d
commit 5ad64b8656
2 changed files with 11 additions and 1 deletions

View File

@ -610,6 +610,13 @@ void Compass::_detect_backends(void)
ADD_BACKEND(DRIVER_LIS3MDL, AP_Compass_LIS3MDL::probe(*this, hal.i2c_mgr->get_device(0, HAL_COMPASS_LIS3MDL_I2C_ADDR), ADD_BACKEND(DRIVER_LIS3MDL, AP_Compass_LIS3MDL::probe(*this, hal.i2c_mgr->get_device(0, HAL_COMPASS_LIS3MDL_I2C_ADDR),
both_i2c_external, both_i2c_external?ROTATION_YAW_90:ROTATION_NONE), both_i2c_external, both_i2c_external?ROTATION_YAW_90:ROTATION_NONE),
AP_Compass_LIS3MDL::name, both_i2c_external); AP_Compass_LIS3MDL::name, both_i2c_external);
ADD_BACKEND(DRIVER_LIS3MDL, AP_Compass_LIS3MDL::probe(*this, hal.i2c_mgr->get_device(1, HAL_COMPASS_LIS3MDL_I2C_ADDR2),
true, ROTATION_YAW_90),
AP_Compass_LIS3MDL::name, true);
ADD_BACKEND(DRIVER_LIS3MDL, AP_Compass_LIS3MDL::probe(*this, hal.i2c_mgr->get_device(0, HAL_COMPASS_LIS3MDL_I2C_ADDR2),
both_i2c_external, both_i2c_external?ROTATION_YAW_90:ROTATION_NONE),
AP_Compass_LIS3MDL::name, both_i2c_external);
// AK09916. This can be found twice, due to the ICM20948 i2c bus pass-thru, so we need to be careful to avoid that // AK09916. This can be found twice, due to the ICM20948 i2c bus pass-thru, so we need to be careful to avoid that
if (!_have_driver(AP_HAL::Device::BUS_TYPE_I2C, 1, HAL_COMPASS_AK09916_I2C_ADDR, AP_Compass_Backend::DEVTYPE_ICM20948)) { if (!_have_driver(AP_HAL::Device::BUS_TYPE_I2C, 1, HAL_COMPASS_AK09916_I2C_ADDR, AP_Compass_Backend::DEVTYPE_ICM20948)) {

View File

@ -23,10 +23,13 @@
#include "AP_Compass_Backend.h" #include "AP_Compass_Backend.h"
#ifndef HAL_COMPASS_LIS3MDL_I2C_ADDR #ifndef HAL_COMPASS_LIS3MDL_I2C_ADDR
// this can also be on 0x1e
# define HAL_COMPASS_LIS3MDL_I2C_ADDR 0x1c # define HAL_COMPASS_LIS3MDL_I2C_ADDR 0x1c
#endif #endif
#ifndef HAL_COMPASS_LIS3MDL_I2C_ADDR2
# define HAL_COMPASS_LIS3MDL_I2C_ADDR2 0x1e
#endif
class AP_Compass_LIS3MDL : public AP_Compass_Backend class AP_Compass_LIS3MDL : public AP_Compass_Backend
{ {
public: public: