From c988f6492152824654c8967db36da2eaae933759 Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 22 Apr 2023 19:35:42 +0200 Subject: [PATCH] [FSK4] Use compact Doxygen and stop using reserved format --- src/protocols/FSK4/FSK4.cpp | 52 ++++++++++++++++++------------------- src/protocols/FSK4/FSK4.h | 33 +++++++---------------- 2 files changed, 35 insertions(+), 50 deletions(-) diff --git a/src/protocols/FSK4/FSK4.cpp b/src/protocols/FSK4/FSK4.cpp index fcd1d1d3..bb24e5be 100644 --- a/src/protocols/FSK4/FSK4.cpp +++ b/src/protocols/FSK4/FSK4.cpp @@ -3,41 +3,41 @@ #if !defined(RADIOLIB_EXCLUDE_FSK4) FSK4Client::FSK4Client(PhysicalLayer* phy) { - _phy = phy; + phyLayer = phy; #if !defined(RADIOLIB_EXCLUDE_AFSK) - _audio = nullptr; + audioClient = nullptr; #endif } #if !defined(RADIOLIB_EXCLUDE_AFSK) FSK4Client::FSK4Client(AFSKClient* audio) { - _phy = audio->_phy; - _audio = audio; + phyLayer = audio->phyLayer; + audioClient = audio; } #endif int16_t FSK4Client::begin(float base, uint32_t shift, uint16_t rate) { // save configuration - _baseHz = base; - _shiftHz = shift; + baseFreqHz = base; + shiftFreqHz = shift; // calculate duration of 1 bit - _bitDuration = (uint32_t)1000000/rate; + bitDuration = (uint32_t)1000000/rate; // calculate carrier shift - _shift = getRawShift(shift); + shiftFreq = getRawShift(shift); // Write resultant tones into arrays for quick lookup when modulating. for(uint8_t i = 0; i < 4; i++) { - _tones[i] = _shift*i; - _tonesHz[i] = _shiftHz*i; + tones[i] = shiftFreq*i; + tonesHz[i] = shiftFreqHz*i; } // calculate 24-bit frequency - _base = (base * 1000000.0) / _phy->getFreqStep(); + baseFreq = (base * 1000000.0) / phyLayer->getFreqStep(); // configure for direct mode - return(_phy->startDirect()); + return(phyLayer->startDirect()); } void FSK4Client::idle() { @@ -47,10 +47,10 @@ void FSK4Client::idle() { int16_t FSK4Client::setCorrection(int16_t offsets[], float length) { for(uint8_t i = 0; i < 4; i++) { - _tones[i] += getRawShift(offsets[i]); - _tonesHz[i] += offsets[i]; + tones[i] += getRawShift(offsets[i]); + tonesHz[i] += offsets[i]; } - _bitDuration *= length; + bitDuration *= length; return(RADIOLIB_ERR_NONE); } @@ -80,36 +80,36 @@ size_t FSK4Client::write(uint8_t b) { } void FSK4Client::tone(uint8_t i) { - Module* mod = _phy->getMod(); + Module* mod = phyLayer->getMod(); uint32_t start = mod->hal->micros(); - transmitDirect(_base + _tones[i], _baseHz + _tonesHz[i]); - mod->waitForMicroseconds(start, _bitDuration); + transmitDirect(baseFreq + tones[i], baseFreqHz + tonesHz[i]); + mod->waitForMicroseconds(start, bitDuration); } int16_t FSK4Client::transmitDirect(uint32_t freq, uint32_t freqHz) { #if !defined(RADIOLIB_EXCLUDE_AFSK) - if(_audio != nullptr) { - return(_audio->tone(freqHz)); + if(audioClient != nullptr) { + return(audioClient->tone(freqHz)); } #endif - return(_phy->transmitDirect(freq)); + return(phyLayer->transmitDirect(freq)); } int16_t FSK4Client::standby() { // ensure everything is stopped in interrupt timing mode - Module* mod = _phy->getMod(); + Module* mod = phyLayer->getMod(); mod->waitForMicroseconds(0, 0); #if !defined(RADIOLIB_EXCLUDE_AFSK) - if(_audio != nullptr) { - return(_audio->noTone()); + if(audioClient != nullptr) { + return(audioClient->noTone()); } #endif - return(_phy->standby()); + return(phyLayer->standby()); } int32_t FSK4Client::getRawShift(int32_t shift) { // calculate module carrier frequency resolution - int32_t step = round(_phy->getFreqStep()); + int32_t step = round(phyLayer->getFreqStep()); // check minimum shift value if(abs(shift) < step / 2) { diff --git a/src/protocols/FSK4/FSK4.h b/src/protocols/FSK4/FSK4.h index aecba119..d466d642 100644 --- a/src/protocols/FSK4/FSK4.h +++ b/src/protocols/FSK4/FSK4.h @@ -10,14 +10,12 @@ /*! \class FSK4Client - \brief Client for FSK-4 communication. The public interface is the same as Arduino Serial. */ class FSK4Client { public: /*! \brief Constructor for FSK-4 mode. - \param phy Pointer to the wireless module providing PhysicalLayer communication. */ explicit FSK4Client(PhysicalLayer* phy); @@ -25,7 +23,6 @@ class FSK4Client { #if !defined(RADIOLIB_EXCLUDE_AFSK) /*! \brief Constructor for AFSK mode. - \param audio Pointer to the AFSK instance providing audio. */ explicit FSK4Client(AFSKClient* audio); @@ -35,13 +32,10 @@ class FSK4Client { /*! \brief Initialization method. - - \param base Base (space) frequency to be used in MHz (in FSK-4 mode), or the space tone frequency in Hz (in AFSK mode) - + \param base Base (space) frequency to be used in MHz (in FSK-4 mode), + or the space tone frequency in Hz (in AFSK mode) \param shift Frequency shift between each tone in Hz. - \param rate Baud rate to be used during transmission. - \returns \ref status_codes */ int16_t begin(float base, uint32_t shift, uint16_t rate); @@ -53,38 +47,29 @@ class FSK4Client { /*! \brief Set correction coefficients for frequencies and tone length. - \param offsets Four positive or negative correction offsets for audio frequencies in Hz. - \param length Tone length modifier, defaults to 1.0. - \returns \ref status_codes */ int16_t setCorrection(int16_t offsets[4], float length = 1.0f); /*! \brief Transmit binary data. - \param buff Buffer to transmit. - \param len Number of bytes to transmit. - \returns Number of transmitted bytes. */ size_t write(uint8_t* buff, size_t len); /*! \brief Transmit a single byte. - \param b Byte to transmit. - \returns Number of transmitted bytes. */ size_t write(uint8_t b); /*! \brief Stop transmitting. - \returns \ref status_codes */ int16_t standby(); @@ -92,16 +77,16 @@ class FSK4Client { #if !defined(RADIOLIB_GODMODE) private: #endif - PhysicalLayer* _phy; + PhysicalLayer* phyLayer; #if !defined(RADIOLIB_EXCLUDE_AFSK) - AFSKClient* _audio; + AFSKClient* audioClient; #endif - uint32_t _base = 0, _baseHz = 0; - uint32_t _shift = 0, _shiftHz = 0; - uint32_t _bitDuration = 0; - uint32_t _tones[4]; - uint32_t _tonesHz[4]; + uint32_t baseFreq = 0, baseFreqHz = 0; + uint32_t shiftFreq = 0, shiftFreqHz = 0; + uint32_t bitDuration = 0; + uint32_t tones[4]; + uint32_t tonesHz[4]; void tone(uint8_t i);