AP_ADSB: conditionally compile based on HAL_ADSB_ENABLED

This commit is contained in:
Andy Piper 2020-09-19 09:39:57 +01:00 committed by Andrew Tridgell
parent 2f985c77d8
commit 465357e715
8 changed files with 36 additions and 0 deletions

View File

@ -21,6 +21,7 @@
*/ */
#include "AP_ADSB.h" #include "AP_ADSB.h"
#if HAL_ADSB_ENABLED
#include "AP_ADSB_Sagetech.h" #include "AP_ADSB_Sagetech.h"
#include "AP_ADSB_MAVLink.h" #include "AP_ADSB_MAVLink.h"
#include <stdio.h> // for sprintf #include <stdio.h> // for sprintf
@ -833,3 +834,6 @@ AP_ADSB *AP::ADSB()
return AP_ADSB::get_singleton(); return AP_ADSB::get_singleton();
} }
#endif // HAL_ADSB_ENABLED

View File

@ -22,11 +22,18 @@
*/ */
#include <AP_HAL/AP_HAL.h> #include <AP_HAL/AP_HAL.h>
#include <AP_HAL/AP_HAL_Boards.h>
#include <AP_Common/AP_Common.h> #include <AP_Common/AP_Common.h>
#include <AP_Param/AP_Param.h> #include <AP_Param/AP_Param.h>
#include <AP_Common/Location.h> #include <AP_Common/Location.h>
#include <GCS_MAVLink/GCS_MAVLink.h> #include <GCS_MAVLink/GCS_MAVLink.h>
#ifndef HAL_ADSB_ENABLED
#define HAL_ADSB_ENABLED !HAL_MINIMIZE_FEATURES && BOARD_FLASH_SIZE > 1024
#endif
#if HAL_ADSB_ENABLED
#define ADSB_BITBASK_RF_CAPABILITIES_UAT_IN (1 << 0) #define ADSB_BITBASK_RF_CAPABILITIES_UAT_IN (1 << 0)
#define ADSB_BITBASK_RF_CAPABILITIES_1090ES_IN (1 << 1) #define ADSB_BITBASK_RF_CAPABILITIES_1090ES_IN (1 << 1)
@ -222,3 +229,6 @@ private:
namespace AP { namespace AP {
AP_ADSB *ADSB(); AP_ADSB *ADSB();
}; };
#endif // HAL_ADSB_ENABLED

View File

@ -15,6 +15,7 @@
#include "AP_ADSB_Backend.h" #include "AP_ADSB_Backend.h"
#if HAL_ADSB_ENABLED
/* /*
base class constructor. base class constructor.
This incorporates initialisation as well. This incorporates initialisation as well.
@ -24,3 +25,5 @@ AP_ADSB_Backend::AP_ADSB_Backend(AP_ADSB &_frontend) :
{ {
} }
#endif // HAL_ADSB_ENABLED

View File

@ -16,6 +16,8 @@
#include "AP_ADSB.h" #include "AP_ADSB.h"
#if HAL_ADSB_ENABLED
class AP_ADSB_Backend class AP_ADSB_Backend
{ {
public: public:
@ -41,3 +43,5 @@ protected:
private: private:
}; };
#endif // HAL_ADSB_ENABLED

View File

@ -15,6 +15,8 @@
#include "AP_ADSB_MAVLink.h" #include "AP_ADSB_MAVLink.h"
#if HAL_ADSB_ENABLED
#include <limits.h> #include <limits.h>
#include <AP_Vehicle/AP_Vehicle.h> #include <AP_Vehicle/AP_Vehicle.h>
#include <GCS_MAVLink/GCS.h> #include <GCS_MAVLink/GCS.h>
@ -274,3 +276,4 @@ uint32_t AP_ADSB_MAVLink::get_encoded_icao(void)
return encoded_icao; return encoded_icao;
} }
#endif // HAL_ADSB_ENABLED

View File

@ -17,6 +17,8 @@
#include "AP_ADSB_Backend.h" #include "AP_ADSB_Backend.h"
#if HAL_ADSB_ENABLED
class AP_ADSB_MAVLink : public AP_ADSB_Backend { class AP_ADSB_MAVLink : public AP_ADSB_Backend {
public: public:
// constructor // constructor
@ -44,3 +46,5 @@ private:
int8_t _chan = -1; int8_t _chan = -1;
}; };
#endif // HAL_ADSB_ENABLED

View File

@ -14,6 +14,9 @@
*/ */
#include "AP_ADSB_Sagetech.h" #include "AP_ADSB_Sagetech.h"
#if HAL_ADSB_ENABLED
#include <GCS_MAVLink/GCS.h> #include <GCS_MAVLink/GCS.h>
#include <AP_AHRS/AP_AHRS.h> #include <AP_AHRS/AP_AHRS.h>
#include <AP_RTC/AP_RTC.h> #include <AP_RTC/AP_RTC.h>
@ -748,4 +751,6 @@ const char* AP_ADSB_Sagetech::systemStatsBits_to_str(const SystemStateBits syste
} }
} }
#endif // HAL_ADSB_ENABLED

View File

@ -17,6 +17,8 @@
#include "AP_ADSB_Backend.h" #include "AP_ADSB_Backend.h"
#if HAL_ADSB_ENABLED
class AP_ADSB_Sagetech : public AP_ADSB_Backend { class AP_ADSB_Sagetech : public AP_ADSB_Backend {
public: public:
// constructor // constructor
@ -148,3 +150,4 @@ private:
Transponder_Type transponder_type = Transponder_Type::Unknown; Transponder_Type transponder_type = Transponder_Type::Unknown;
}; };
#endif // HAL_ADSB_ENABLED