[Hell] Use compact Doxygen and stop using reserved format

This commit is contained in:
jgromes 2023-04-22 19:35:33 +02:00
parent bb4e6cf946
commit 34e59605b5
2 changed files with 28 additions and 35 deletions

View file

@ -4,47 +4,47 @@
#if !defined(RADIOLIB_EXCLUDE_HELLSCHREIBER) #if !defined(RADIOLIB_EXCLUDE_HELLSCHREIBER)
HellClient::HellClient(PhysicalLayer* phy) { HellClient::HellClient(PhysicalLayer* phy) {
_phy = phy; phyLayer = phy;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !defined(RADIOLIB_EXCLUDE_AFSK)
_audio = nullptr; audioClient = nullptr;
#endif #endif
} }
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !defined(RADIOLIB_EXCLUDE_AFSK)
HellClient::HellClient(AFSKClient* audio) { HellClient::HellClient(AFSKClient* audio) {
_phy = audio->_phy; phyLayer = audio->phyLayer;
_audio = audio; audioClient = audio;
} }
#endif #endif
int16_t HellClient::begin(float base, float rate) { int16_t HellClient::begin(float base, float rate) {
// calculate 24-bit frequency // calculate 24-bit frequency
_baseHz = base; baseFreqHz = base;
_base = (base * 1000000.0) / _phy->getFreqStep(); baseFreq = (base * 1000000.0) / phyLayer->getFreqStep();
// calculate "pixel" duration // calculate "pixel" duration
_pixelDuration = 1000000.0/rate; pixelDuration = 1000000.0/rate;
// configure for direct mode // configure for direct mode
return(_phy->startDirect()); return(phyLayer->startDirect());
} }
size_t HellClient::printGlyph(uint8_t* buff) { size_t HellClient::printGlyph(uint8_t* buff) {
// print the character // print the character
Module* mod = _phy->getMod(); Module* mod = phyLayer->getMod();
bool transmitting = false; bool transmitting = false;
for(uint8_t mask = 0x40; mask >= 0x01; mask >>= 1) { for(uint8_t mask = 0x40; mask >= 0x01; mask >>= 1) {
for(int8_t i = RADIOLIB_HELL_FONT_HEIGHT - 1; i >= 0; i--) { for(int8_t i = RADIOLIB_HELL_FONT_HEIGHT - 1; i >= 0; i--) {
uint32_t start = mod->hal->micros(); uint32_t start = mod->hal->micros();
if((buff[i] & mask) && (!transmitting)) { if((buff[i] & mask) && (!transmitting)) {
transmitting = true; transmitting = true;
transmitDirect(_base, _baseHz); transmitDirect(baseFreq, baseFreqHz);
} else if((!(buff[i] & mask)) && (transmitting)) { } else if((!(buff[i] & mask)) && (transmitting)) {
transmitting = false; transmitting = false;
standby(); standby();
} }
mod->waitForMicroseconds(start, _pixelDuration); mod->waitForMicroseconds(start, pixelDuration);
} }
} }
@ -54,8 +54,8 @@ size_t HellClient::printGlyph(uint8_t* buff) {
return(1); return(1);
} }
void HellClient::setInversion(bool invert) { void HellClient::setInversion(bool inv) {
_inv = invert; invert = inv;
} }
size_t HellClient::write(const char* str) { size_t HellClient::write(const char* str) {
@ -298,20 +298,20 @@ size_t HellClient::printFloat(double number, uint8_t digits) {
int16_t HellClient::transmitDirect(uint32_t freq, uint32_t freqHz) { int16_t HellClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !defined(RADIOLIB_EXCLUDE_AFSK)
if(_audio != nullptr) { if(audioClient != nullptr) {
return(_audio->tone(freqHz)); return(audioClient->tone(freqHz));
} }
#endif #endif
return(_phy->transmitDirect(freq)); return(phyLayer->transmitDirect(freq));
} }
int16_t HellClient::standby() { int16_t HellClient::standby() {
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !defined(RADIOLIB_EXCLUDE_AFSK)
if(_audio != nullptr) { if(audioClient != nullptr) {
return(_audio->noTone(_inv)); return(audioClient->noTone(invert));
} }
#endif #endif
return(_phy->standby(RADIOLIB_STANDBY_WARM)); return(phyLayer->standby(RADIOLIB_STANDBY_WARM));
} }
#endif #endif

View file

@ -13,7 +13,8 @@
// font definition: characters are stored in rows, // font definition: characters are stored in rows,
// least significant byte of each character is the first row // least significant byte of each character is the first row
// Hellschreiber use 7x7 characters, but this simplified font uses only 5x5 - the extra bytes aren't stored // Hellschreiber use 7x7 characters, but this simplified font uses only 5x5
// the extra bytes aren't stored
static const uint8_t HellFont[64][RADIOLIB_HELL_FONT_WIDTH - 2] RADIOLIB_NONVOLATILE = { static const uint8_t HellFont[64][RADIOLIB_HELL_FONT_WIDTH - 2] RADIOLIB_NONVOLATILE = {
{ 0b0000000, 0b0000000, 0b0000000, 0b0000000, 0b0000000 }, // space { 0b0000000, 0b0000000, 0b0000000, 0b0000000, 0b0000000 }, // space
{ 0b0001000, 0b0001000, 0b0001000, 0b0000000, 0b0001000 }, // ! { 0b0001000, 0b0001000, 0b0001000, 0b0000000, 0b0001000 }, // !
@ -83,14 +84,12 @@ static const uint8_t HellFont[64][RADIOLIB_HELL_FONT_WIDTH - 2] RADIOLIB_NONVOLA
/*! /*!
\class HellClient \class HellClient
\brief Client for Hellschreiber transmissions. \brief Client for Hellschreiber transmissions.
*/ */
class HellClient { class HellClient {
public: public:
/*! /*!
\brief Constructor for 2-FSK mode. \brief Constructor for 2-FSK mode.
\param phy Pointer to the wireless module providing PhysicalLayer communication. \param phy Pointer to the wireless module providing PhysicalLayer communication.
*/ */
explicit HellClient(PhysicalLayer* phy); explicit HellClient(PhysicalLayer* phy);
@ -98,7 +97,6 @@ class HellClient {
#if !defined(RADIOLIB_EXCLUDE_AFSK) #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.
*/ */
explicit HellClient(AFSKClient* audio); explicit HellClient(AFSKClient* audio);
@ -108,28 +106,23 @@ class HellClient {
/*! /*!
\brief Initialization method. \brief Initialization method.
\param base Base RF frequency to be used in MHz (in 2-FSK mode), or the tone frequency in Hz (in AFSK mode). \param base Base RF frequency to be used in MHz (in 2-FSK mode), or the tone frequency in Hz (in AFSK mode).
\param rate Baud rate to be used during transmission. Defaults to 122.5 ("Feld Hell") \param rate Baud rate to be used during transmission. Defaults to 122.5 ("Feld Hell")
*/ */
int16_t begin(float base, float rate = 122.5); int16_t begin(float base, float rate = 122.5);
/*! /*!
\brief Method to "print" a buffer of pixels, this is exposed to allow users to send custom characters. \brief Method to "print" a buffer of pixels, this is exposed to allow users to send custom characters.
\param buff Buffer of pixels to send, in a 7x7 pixel array. \param buff Buffer of pixels to send, in a 7x7 pixel array.
\returns Always returns the number of printed glyphs (1). \returns Always returns the number of printed glyphs (1).
*/ */
size_t printGlyph(uint8_t* buff); size_t printGlyph(uint8_t* buff);
/*! /*!
\brief Invert text color. \brief Invert text color.
\param inv Whether to enable color inversion (white text on black background), or not (black text on white background)
\param invert Whether to enable color inversion (white text on black background), or not (black text on white background)
*/ */
void setInversion(bool invert); void setInversion(bool inv);
size_t write(const char* str); size_t write(const char* str);
size_t write(uint8_t* buff, size_t len); size_t write(uint8_t* buff, size_t len);
@ -165,14 +158,14 @@ class HellClient {
#if !defined(RADIOLIB_GODMODE) #if !defined(RADIOLIB_GODMODE)
private: private:
#endif #endif
PhysicalLayer* _phy; PhysicalLayer* phyLayer;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !defined(RADIOLIB_EXCLUDE_AFSK)
AFSKClient* _audio; AFSKClient* audioClient;
#endif #endif
uint32_t _base = 0, _baseHz = 0; uint32_t baseFreq = 0, baseFreqHz = 0;
uint32_t _pixelDuration = 0; uint32_t pixelDuration = 0;
bool _inv = false; bool invert = false;
size_t printNumber(unsigned long, uint8_t); size_t printNumber(unsigned long, uint8_t);
size_t printFloat(double, uint8_t); size_t printFloat(double, uint8_t);