diff --git a/libraries/AP_Compass/AP_Compass.h b/libraries/AP_Compass/AP_Compass.h index 6bb13e1759..27f4a42980 100644 --- a/libraries/AP_Compass/AP_Compass.h +++ b/libraries/AP_Compass/AP_Compass.h @@ -468,7 +468,9 @@ private: #if AP_COMPASS_EXTERNALAHRS_ENABLED DRIVER_EXTERNALAHRS =18, #endif +#if AP_COMPASS_MMC5XX3_ENABLED DRIVER_MMC5XX3 =19, +#endif }; bool _driver_enabled(enum DriverType driver_type); diff --git a/libraries/AP_Compass/AP_Compass_MMC5xx3.cpp b/libraries/AP_Compass/AP_Compass_MMC5xx3.cpp index 0c164ca444..afb141a430 100644 --- a/libraries/AP_Compass/AP_Compass_MMC5xx3.cpp +++ b/libraries/AP_Compass/AP_Compass_MMC5xx3.cpp @@ -15,6 +15,8 @@ #include "AP_Compass_MMC5xx3.h" +#if AP_COMPASS_MMC5XX3_ENABLED + #include #include @@ -305,3 +307,6 @@ void AP_Compass_MMC5XX3::read() { drain_accumulated_samples(compass_instance); } + +#endif // AP_COMPASS_MMC5XX3_ENABLED + diff --git a/libraries/AP_Compass/AP_Compass_MMC5xx3.h b/libraries/AP_Compass/AP_Compass_MMC5xx3.h index 543e1ae1a7..8acd6e5633 100644 --- a/libraries/AP_Compass/AP_Compass_MMC5xx3.h +++ b/libraries/AP_Compass/AP_Compass_MMC5xx3.h @@ -14,6 +14,10 @@ */ #pragma once +#include "AP_Compass_config.h" + +#if AP_COMPASS_MMC5XX3_ENABLED + #include #include #include @@ -72,3 +76,5 @@ private: enum Rotation rotation; }; + +#endif // AP_COMPASS_MMC5XX3_ENABLED diff --git a/libraries/AP_Compass/AP_Compass_config.h b/libraries/AP_Compass/AP_Compass_config.h index 91e8b6a82e..3c1c91bd76 100644 --- a/libraries/AP_Compass/AP_Compass_config.h +++ b/libraries/AP_Compass/AP_Compass_config.h @@ -91,6 +91,10 @@ #define AP_COMPASS_MMC3416_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED #endif +#ifndef AP_COMPASS_MMC5XX3_ENABLED +#define AP_COMPASS_MMC5XX3_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED +#endif + #ifndef AP_COMPASS_QMC5883L_ENABLED #define AP_COMPASS_QMC5883L_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED #endif