[Morse] Reworked macro configuration system
This commit is contained in:
parent
670e70bd9f
commit
8f5cff0cd4
2 changed files with 11 additions and 11 deletions
|
@ -2,17 +2,17 @@
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#if !defined(RADIOLIB_EXCLUDE_MORSE)
|
#if !RADIOLIB_EXCLUDE_MORSE
|
||||||
|
|
||||||
MorseClient::MorseClient(PhysicalLayer* phy) {
|
MorseClient::MorseClient(PhysicalLayer* phy) {
|
||||||
phyLayer = phy;
|
phyLayer = phy;
|
||||||
lineFeed = "^";
|
lineFeed = "^";
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !RADIOLIB_EXCLUDE_AFSK
|
||||||
audioClient = nullptr;
|
audioClient = nullptr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !RADIOLIB_EXCLUDE_AFSK
|
||||||
MorseClient::MorseClient(AFSKClient* audio) {
|
MorseClient::MorseClient(AFSKClient* audio) {
|
||||||
phyLayer = audio->phyLayer;
|
phyLayer = audio->phyLayer;
|
||||||
lineFeed = "^";
|
lineFeed = "^";
|
||||||
|
@ -59,7 +59,7 @@ char MorseClient::decode(uint8_t symbol, uint8_t len) {
|
||||||
return(RADIOLIB_MORSE_UNSUPPORTED);
|
return(RADIOLIB_MORSE_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !RADIOLIB_EXCLUDE_AFSK
|
||||||
int MorseClient::read(uint8_t* symbol, uint8_t* len, float low, float high) {
|
int MorseClient::read(uint8_t* symbol, uint8_t* len, float low, float high) {
|
||||||
Module* mod = phyLayer->getMod();
|
Module* mod = phyLayer->getMod();
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ size_t MorseClient::write(uint8_t b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t MorseClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
|
int16_t MorseClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !RADIOLIB_EXCLUDE_AFSK
|
||||||
if(audioClient != nullptr) {
|
if(audioClient != nullptr) {
|
||||||
return(audioClient->tone(freqHz));
|
return(audioClient->tone(freqHz));
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ int16_t MorseClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t MorseClient::standby() {
|
int16_t MorseClient::standby() {
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !RADIOLIB_EXCLUDE_AFSK
|
||||||
if(audioClient != nullptr) {
|
if(audioClient != nullptr) {
|
||||||
return(audioClient->noTone(true));
|
return(audioClient->noTone(true));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if !defined(_RADIOLIB_RADIOLIB_MORSE_H) && !defined(RADIOLIB_EXCLUDE_MORSE)
|
#if !defined(_RADIOLIB_RADIOLIB_MORSE_H) && !RADIOLIB_EXCLUDE_MORSE
|
||||||
#define _RADIOLIB_RADIOLIB_MORSE_H
|
#define _RADIOLIB_RADIOLIB_MORSE_H
|
||||||
|
|
||||||
#include "../../TypeDef.h"
|
#include "../../TypeDef.h"
|
||||||
|
@ -98,7 +98,7 @@ class MorseClient: public RadioLibPrint {
|
||||||
*/
|
*/
|
||||||
explicit MorseClient(PhysicalLayer* phy);
|
explicit MorseClient(PhysicalLayer* phy);
|
||||||
|
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !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.
|
||||||
|
@ -139,7 +139,7 @@ class MorseClient: public RadioLibPrint {
|
||||||
\returns 0 if not enough symbols were decoded, 1 if inter-character space was detected,
|
\returns 0 if not enough symbols were decoded, 1 if inter-character space was detected,
|
||||||
2 if inter-word space was detected.
|
2 if inter-word space was detected.
|
||||||
*/
|
*/
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !RADIOLIB_EXCLUDE_AFSK
|
||||||
int read(uint8_t* symbol, uint8_t* len, float low = 0.75f, float high = 1.25f);
|
int read(uint8_t* symbol, uint8_t* len, float low = 0.75f, float high = 1.25f);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -150,11 +150,11 @@ class MorseClient: public RadioLibPrint {
|
||||||
*/
|
*/
|
||||||
size_t write(uint8_t b);
|
size_t write(uint8_t b);
|
||||||
|
|
||||||
#if !defined(RADIOLIB_GODMODE)
|
#if !RADIOLIB_GODMODE
|
||||||
private:
|
private:
|
||||||
#endif
|
#endif
|
||||||
PhysicalLayer* phyLayer;
|
PhysicalLayer* phyLayer;
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !RADIOLIB_EXCLUDE_AFSK
|
||||||
AFSKClient* audioClient;
|
AFSKClient* audioClient;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue