[Morse] Added Module overrides for all Arduino core functions

This commit is contained in:
jgromes 2020-08-01 16:36:11 +02:00
parent e965072092
commit 182a9688cb
2 changed files with 8 additions and 8 deletions

View file

@ -64,12 +64,12 @@ size_t MorseClient::write(uint8_t b) {
if(b == ' ') { if(b == ' ') {
RADIOLIB_DEBUG_PRINTLN(F("space")); RADIOLIB_DEBUG_PRINTLN(F("space"));
standby(); standby();
delay(4 * _dotLength); Module::delay(4 * _dotLength);
return(1); return(1);
} }
// get morse code from lookup table // get morse code from lookup table
uint8_t code = pgm_read_byte(&MorseTable[(uint8_t)(toupper(b) - 32)]); uint8_t code = RADIOLIB_PROGMEM_READ_BYTE(&MorseTable[(uint8_t)(toupper(b) - 32)]);
// check unsupported characters // check unsupported characters
if(code == MORSE_UNSUPORTED) { if(code == MORSE_UNSUPORTED) {
@ -83,16 +83,16 @@ size_t MorseClient::write(uint8_t b) {
if (code & MORSE_DASH) { if (code & MORSE_DASH) {
RADIOLIB_DEBUG_PRINT('-'); RADIOLIB_DEBUG_PRINT('-');
transmitDirect(_base, _baseHz); transmitDirect(_base, _baseHz);
delay(3 * _dotLength); Module::delay(3 * _dotLength);
} else { } else {
RADIOLIB_DEBUG_PRINT('.'); RADIOLIB_DEBUG_PRINT('.');
transmitDirect(_base, _baseHz); transmitDirect(_base, _baseHz);
delay(_dotLength); Module::delay(_dotLength);
} }
// symbol space // symbol space
standby(); standby();
delay(_dotLength); Module::delay(_dotLength);
// move onto the next bit // move onto the next bit
code >>= 1; code >>= 1;
@ -100,7 +100,7 @@ size_t MorseClient::write(uint8_t b) {
// letter space // letter space
standby(); standby();
delay(2 * _dotLength); Module::delay(2 * _dotLength);
RADIOLIB_DEBUG_PRINTLN(); RADIOLIB_DEBUG_PRINTLN();
return(1); return(1);
@ -110,7 +110,7 @@ size_t MorseClient::print(__FlashStringHelper* fstr) {
PGM_P p = reinterpret_cast<PGM_P>(fstr); PGM_P p = reinterpret_cast<PGM_P>(fstr);
size_t n = 0; size_t n = 0;
while(true) { while(true) {
char c = pgm_read_byte(p++); char c = RADIOLIB_PROGMEM_READ_BYTE(p++);
if(c == '\0') { if(c == '\0') {
break; break;
} }

View file

@ -14,7 +14,7 @@
// - Morse code representation is saved LSb first, using additional bit as guard // - Morse code representation is saved LSb first, using additional bit as guard
// - position in array corresponds ASCII code minus MORSE_ASCII_OFFSET // - position in array corresponds ASCII code minus MORSE_ASCII_OFFSET
// - ASCII characters marked MORSE_UNSUPORTED do not have ITU-R M.1677-1 equivalent // - ASCII characters marked MORSE_UNSUPORTED do not have ITU-R M.1677-1 equivalent
static const uint8_t MorseTable[] PROGMEM = { static const uint8_t MorseTable[] RADIOLIB_PROGMEM = {
0b00, // space 0b00, // space
0b110101, // ! (unsupported) 0b110101, // ! (unsupported)
0b1010010, // " 0b1010010, // "