[AX25] Reworked driver exclusion

This commit is contained in:
jgromes 2020-06-30 10:45:00 +02:00
parent 6f6ff7d637
commit 55ebbc3488
2 changed files with 12 additions and 1 deletions

View file

@ -1,4 +1,5 @@
#include "AX25.h" #include "AX25.h"
#if !defined(RADIOLIB_EXCLUDE_AX25)
AX25Frame::AX25Frame(const char* destCallsign, uint8_t destSSID, const char* srcCallsign, uint8_t srcSSID, uint8_t control) AX25Frame::AX25Frame(const char* destCallsign, uint8_t destSSID, const char* srcCallsign, uint8_t srcSSID, uint8_t control)
: AX25Frame(destCallsign, destSSID, srcCallsign, srcSSID, control, 0, NULL, 0) { : AX25Frame(destCallsign, destSSID, srcCallsign, srcSSID, control, 0, NULL, 0) {
@ -115,10 +116,12 @@ AX25Client::AX25Client(PhysicalLayer* phy) {
_audio = nullptr; _audio = nullptr;
} }
#if !defined(RADIOLIB_EXCLUDE_AFSK)
AX25Client::AX25Client(AFSKClient* audio) { AX25Client::AX25Client(AFSKClient* audio) {
_phy = audio->_phy; _phy = audio->_phy;
_audio = audio; _audio = audio;
} }
#endif
int16_t AX25Client::begin(const char* srcCallsign, uint8_t srcSSID, uint8_t preambleLen) { int16_t AX25Client::begin(const char* srcCallsign, uint8_t srcSSID, uint8_t preambleLen) {
// set source SSID // set source SSID
@ -414,3 +417,5 @@ uint16_t AX25Client::flipBits16(uint16_t i) {
i = (i & 0xAAAA) >> 1 | (i & 0x5555) << 1; i = (i & 0xAAAA) >> 1 | (i & 0x5555) << 1;
return i; return i;
} }
#endif

View file

@ -1,4 +1,4 @@
#ifndef _RADIOLIB_AX25_H #if !defined(_RADIOLIB_AX25_H) && !defined(RADIOLIB_EXCLUDE_AX25)
#define _RADIOLIB_AX25_H #define _RADIOLIB_AX25_H
#include "../../TypeDef.h" #include "../../TypeDef.h"
@ -268,12 +268,14 @@ class AX25Client {
*/ */
AX25Client(PhysicalLayer* phy); AX25Client(PhysicalLayer* phy);
#if !defined(RADIOLIB_EXCLUDE_AFSK)
/*! /*!
\brief Constructor for AFSK mode. \brief Constructor for AFSK mode.
\param audio Pointer to the AFSK instance providing audio. \param audio Pointer to the AFSK instance providing audio.
*/ */
AX25Client(AFSKClient* audio); AX25Client(AFSKClient* audio);
#endif
// basic methods // basic methods
@ -316,7 +318,11 @@ class AX25Client {
private: private:
#endif #endif
PhysicalLayer* _phy; PhysicalLayer* _phy;
#if !defined(RADIOLIB_EXCLUDE_AFSK)
AFSKClient* _audio; AFSKClient* _audio;
#else
void* _audio;
#endif
char _srcCallsign[AX25_MAX_CALLSIGN_LEN + 1]; char _srcCallsign[AX25_MAX_CALLSIGN_LEN + 1];
uint8_t _srcSSID; uint8_t _srcSSID;