From f15cc19577a16b1016a7c4e5e5b553c891d4acdb Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 1 Aug 2020 16:36:25 +0200 Subject: [PATCH] [RTTY] Added Module overrides for all Arduino core functions --- src/protocols/RTTY/RTTY.cpp | 20 ++++++++++---------- src/protocols/RTTY/RTTY.h | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/protocols/RTTY/RTTY.cpp b/src/protocols/RTTY/RTTY.cpp index 686c3494..640a79a8 100644 --- a/src/protocols/RTTY/RTTY.cpp +++ b/src/protocols/RTTY/RTTY.cpp @@ -91,11 +91,11 @@ uint16_t ITA2String::getBits(char c) { // search ITA2 table uint16_t code = 0x0000; for(uint8_t i = 0; i < ITA2_LENGTH; i++) { - if(pgm_read_byte(&ITA2Table[i][0]) == c) { + if(RADIOLIB_PROGMEM_READ_BYTE(&ITA2Table[i][0]) == c) { // character is in letter shift code = (ITA2_LTRS << 5) | i; break; - } else if(pgm_read_byte(&ITA2Table[i][1]) == c) { + } else if(RADIOLIB_PROGMEM_READ_BYTE(&ITA2Table[i][1]) == c) { // character is in figures shift code = (ITA2_FIGS << 5) | i; break; @@ -217,7 +217,7 @@ size_t RTTYClient::print(__FlashStringHelper* fstr) { size_t len = 0; PGM_P p = reinterpret_cast(fstr); while(true) { - char c = pgm_read_byte(p++); + char c = RADIOLIB_PROGMEM_READ_BYTE(p++); len++; if(c == '\0') { break; @@ -234,7 +234,7 @@ size_t RTTYClient::print(__FlashStringHelper* fstr) { // copy string from flash p = reinterpret_cast(fstr); for(size_t i = 0; i < len; i++) { - str[i] = pgm_read_byte(p + i); + str[i] = RADIOLIB_PROGMEM_READ_BYTE(p + i); } size_t n = 0; @@ -407,18 +407,18 @@ size_t RTTYClient::println(double d, int digits) { } void RTTYClient::mark() { - uint32_t start = micros(); + uint32_t start = Module::micros(); transmitDirect(_base + _shift, _baseHz + _shiftHz); - while(micros() - start < _bitDuration) { - yield(); + while(Module::micros() - start < _bitDuration) { + Module::yield(); } } void RTTYClient::space() { - uint32_t start = micros(); + uint32_t start = Module::micros(); transmitDirect(_base, _baseHz); - while(micros() - start < _bitDuration) { - yield(); + while(Module::micros() - start < _bitDuration) { + Module::yield(); } } diff --git a/src/protocols/RTTY/RTTY.h b/src/protocols/RTTY/RTTY.h index baf89fe1..6eab5fec 100644 --- a/src/protocols/RTTY/RTTY.h +++ b/src/protocols/RTTY/RTTY.h @@ -15,10 +15,10 @@ // ITA2 character table: - position in array corresponds to 5-bit ITA2 code // - characters to the left are in letters shift, characters to the right in figures shift // - characters marked 0x7F do not have ASCII equivalent -static const char ITA2Table[ITA2_LENGTH][2] PROGMEM = {{'\0', '\0'}, {'E', '3'}, {'\n', '\n'}, {'A', '-'}, {' ', ' '}, {'S', '\''}, {'I', '8'}, {'U', '7'}, - {'\r', '\r'}, {'D', 0x05}, {'R', '4'}, {'J', '\a'}, {'N', ','}, {'F', '!'}, {'C', ':'}, {'K', '('}, - {'T', '5'}, {'Z', '+'}, {'L', ')'}, {'W', '2'}, {'H', 0x7F}, {'Y', '6'}, {'P', '0'}, {'Q', '1'}, - {'O', '9'}, {'B', '?'}, {'G', '&'}, {0x7F, 0x7F}, {'M', '.'}, {'X', '/'}, {'V', ';'}, {0x7F, 0x7F}}; +static const char ITA2Table[ITA2_LENGTH][2] RADIOLIB_PROGMEM = {{'\0', '\0'}, {'E', '3'}, {'\n', '\n'}, {'A', '-'}, {' ', ' '}, {'S', '\''}, {'I', '8'}, {'U', '7'}, + {'\r', '\r'}, {'D', 0x05}, {'R', '4'}, {'J', '\a'}, {'N', ','}, {'F', '!'}, {'C', ':'}, {'K', '('}, + {'T', '5'}, {'Z', '+'}, {'L', ')'}, {'W', '2'}, {'H', 0x7F}, {'Y', '6'}, {'P', '0'}, {'Q', '1'}, + {'O', '9'}, {'B', '?'}, {'G', '&'}, {0x7F, 0x7F}, {'M', '.'}, {'X', '/'}, {'V', ';'}, {0x7F, 0x7F}}; /*! \class ITA2String