AP_Compass: add and use AP_COMPASS_MMC5XX3_ENABLED

This commit is contained in:
Peter Barker 2023-02-20 12:05:18 +11:00 committed by Andrew Tridgell
parent 47c48775ed
commit 1889d3dea5
4 changed files with 17 additions and 0 deletions

View File

@ -468,7 +468,9 @@ private:
#if AP_COMPASS_EXTERNALAHRS_ENABLED #if AP_COMPASS_EXTERNALAHRS_ENABLED
DRIVER_EXTERNALAHRS =18, DRIVER_EXTERNALAHRS =18,
#endif #endif
#if AP_COMPASS_MMC5XX3_ENABLED
DRIVER_MMC5XX3 =19, DRIVER_MMC5XX3 =19,
#endif
}; };
bool _driver_enabled(enum DriverType driver_type); bool _driver_enabled(enum DriverType driver_type);

View File

@ -15,6 +15,8 @@
#include "AP_Compass_MMC5xx3.h" #include "AP_Compass_MMC5xx3.h"
#if AP_COMPASS_MMC5XX3_ENABLED
#include <AP_HAL/AP_HAL.h> #include <AP_HAL/AP_HAL.h>
#include <stdio.h> #include <stdio.h>
@ -305,3 +307,6 @@ void AP_Compass_MMC5XX3::read()
{ {
drain_accumulated_samples(compass_instance); drain_accumulated_samples(compass_instance);
} }
#endif // AP_COMPASS_MMC5XX3_ENABLED

View File

@ -14,6 +14,10 @@
*/ */
#pragma once #pragma once
#include "AP_Compass_config.h"
#if AP_COMPASS_MMC5XX3_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/I2CDevice.h> #include <AP_HAL/I2CDevice.h>
@ -72,3 +76,5 @@ private:
enum Rotation rotation; enum Rotation rotation;
}; };
#endif // AP_COMPASS_MMC5XX3_ENABLED

View File

@ -91,6 +91,10 @@
#define AP_COMPASS_MMC3416_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED #define AP_COMPASS_MMC3416_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
#endif #endif
#ifndef AP_COMPASS_MMC5XX3_ENABLED
#define AP_COMPASS_MMC5XX3_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
#endif
#ifndef AP_COMPASS_QMC5883L_ENABLED #ifndef AP_COMPASS_QMC5883L_ENABLED
#define AP_COMPASS_QMC5883L_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED #define AP_COMPASS_QMC5883L_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
#endif #endif