AP_Compass: add and use AP_COMPASS_MAG3110_ENABLED

This commit is contained in:
Peter Barker 2023-02-20 12:05:15 +11:00 committed by Andrew Tridgell
parent 3173c92417
commit aac6228f58
4 changed files with 18 additions and 2 deletions

View File

@ -453,7 +453,9 @@ private:
#if AP_COMPASS_SITL_ENABLED #if AP_COMPASS_SITL_ENABLED
DRIVER_SITL =13, DRIVER_SITL =13,
#endif #endif
#if AP_COMPASS_MAG3110_ENABLED
DRIVER_MAG3110 =14, DRIVER_MAG3110 =14,
#endif
#if AP_COMPASS_IST8308_ENABLED #if AP_COMPASS_IST8308_ENABLED
DRIVER_IST8308 =15, DRIVER_IST8308 =15,
#endif #endif

View File

@ -12,14 +12,16 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "AP_Compass_MAG3110.h"
#if AP_COMPASS_MAG3110_ENABLED
#include <utility> #include <utility>
#include <AP_HAL/AP_HAL.h> #include <AP_HAL/AP_HAL.h>
#include <AP_Math/AP_Math.h> #include <AP_Math/AP_Math.h>
#include <stdio.h> #include <stdio.h>
#include "AP_Compass_MAG3110.h"
extern const AP_HAL::HAL &hal; extern const AP_HAL::HAL &hal;
@ -219,3 +221,5 @@ void AP_Compass_MAG3110::read()
drain_accumulated_samples(_compass_instance); drain_accumulated_samples(_compass_instance);
} }
#endif // AP_COMPASS_MAG3110_ENABLED

View File

@ -1,5 +1,9 @@
#pragma once #pragma once
#include "AP_Compass_config.h"
#if AP_COMPASS_MAG3110_ENABLED
#include <AP_Common/AP_Common.h> #include <AP_Common/AP_Common.h>
#include <AP_HAL/AP_HAL.h> #include <AP_HAL/AP_HAL.h>
#include <AP_HAL/Device.h> #include <AP_HAL/Device.h>
@ -44,3 +48,5 @@ private:
uint8_t _compass_instance; uint8_t _compass_instance;
bool _initialised; bool _initialised;
}; };
#endif // AP_COMPASS_MAG3110_ENABLED

View File

@ -83,6 +83,10 @@
#define AP_COMPASS_LSM9DS1_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED #define AP_COMPASS_LSM9DS1_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
#endif #endif
#ifndef AP_COMPASS_MAG3110_ENABLED
#define AP_COMPASS_MAG3110_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
#endif
#ifndef AP_COMPASS_MMC3416_ENABLED #ifndef AP_COMPASS_MMC3416_ENABLED
#define AP_COMPASS_MMC3416_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED #define AP_COMPASS_MMC3416_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
#endif #endif