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

View file

@ -13,7 +13,8 @@
// font definition: characters are stored in rows,
// 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 = {
{ 0b0000000, 0b0000000, 0b0000000, 0b0000000, 0b0000000 }, // space
{ 0b0001000, 0b0001000, 0b0001000, 0b0000000, 0b0001000 }, // !
@ -83,14 +84,12 @@ static const uint8_t HellFont[64][RADIOLIB_HELL_FONT_WIDTH - 2] RADIOLIB_NONVOLA
/*!
\class HellClient
\brief Client for Hellschreiber transmissions.
*/
class HellClient {
public:
/*!
\brief Constructor for 2-FSK mode.
\param phy Pointer to the wireless module providing PhysicalLayer communication.
*/
explicit HellClient(PhysicalLayer* phy);
@ -98,7 +97,6 @@ class HellClient {
#if !defined(RADIOLIB_EXCLUDE_AFSK)
/*!
\brief Constructor for AFSK mode.
\param audio Pointer to the AFSK instance providing audio.
*/
explicit HellClient(AFSKClient* audio);
@ -108,28 +106,23 @@ class HellClient {
/*!
\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 rate Baud rate to be used during transmission. Defaults to 122.5 ("Feld Hell")
*/
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.
\param buff Buffer of pixels to send, in a 7x7 pixel array.
\returns Always returns the number of printed glyphs (1).
*/
size_t printGlyph(uint8_t* buff);
/*!
\brief Invert text color.
\param invert Whether to enable color inversion (white text on black background), or not (black text on white background)
\param inv 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(uint8_t* buff, size_t len);
@ -165,14 +158,14 @@ class HellClient {
#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 _pixelDuration = 0;
bool _inv = false;
uint32_t baseFreq = 0, baseFreqHz = 0;
uint32_t pixelDuration = 0;
bool invert = false;
size_t printNumber(unsigned long, uint8_t);
size_t printFloat(double, uint8_t);