From a6e9baa8f6af21a9d21a6bbd30d90a474d3c13fa Mon Sep 17 00:00:00 2001 From: Mark Whitehorn Date: Wed, 26 Jul 2017 16:38:30 -0600 Subject: [PATCH] AP_Compass: probe for LIS3MDL in mRo Neo-M8N GPS module --- libraries/AP_Compass/AP_Compass.cpp | 11 +++++++++++ libraries/AP_Compass/AP_Compass_LIS3MDL.h | 1 + 2 files changed, 12 insertions(+) diff --git a/libraries/AP_Compass/AP_Compass.cpp b/libraries/AP_Compass/AP_Compass.cpp index ccdc128f5e..941406b6fc 100644 --- a/libraries/AP_Compass/AP_Compass.cpp +++ b/libraries/AP_Compass/AP_Compass.cpp @@ -597,9 +597,20 @@ void Compass::_detect_backends(void) ADD_BACKEND(DRIVER_LIS3MDL, AP_Compass_LIS3MDL::probe(*this, hal.i2c_mgr->get_device(1, HAL_COMPASS_LIS3MDL_I2C_ADDR), 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_ADDR), both_i2c_external, both_i2c_external?ROTATION_YAW_90:ROTATION_NONE), AP_Compass_LIS3MDL::name, both_i2c_external); + + // external lis3mdl in mRo Neo-M8N GPS module + ADD_BACKEND(DRIVER_LIS3MDL, AP_Compass_LIS3MDL::probe(*this, hal.i2c_mgr->get_device(1, HAL_COMPASS_LIS3MDL_I2C_ADDR), + true, ROTATION_YAW_90), + AP_Compass_LIS3MDL::name, true); + + // external lis3mdl in mRo Neo-M8N GPS module (alternate I2C address) + 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); // AK09916 ADD_BACKEND(DRIVER_AK09916, AP_Compass_AK09916::probe(*this, hal.i2c_mgr->get_device(1, HAL_COMPASS_AK09916_I2C_ADDR), diff --git a/libraries/AP_Compass/AP_Compass_LIS3MDL.h b/libraries/AP_Compass/AP_Compass_LIS3MDL.h index 327ef95904..d208a025bf 100644 --- a/libraries/AP_Compass/AP_Compass_LIS3MDL.h +++ b/libraries/AP_Compass/AP_Compass_LIS3MDL.h @@ -25,6 +25,7 @@ #ifndef HAL_COMPASS_LIS3MDL_I2C_ADDR // this can also be on 0x1e # define HAL_COMPASS_LIS3MDL_I2C_ADDR 0x1c +# define HAL_COMPASS_LIS3MDL_I2C_ADDR2 0x1e #endif class AP_Compass_LIS3MDL : public AP_Compass_Backend