[RTTY] Update to 5.0.0
This commit is contained in:
parent
008187b0b1
commit
7f3ef0bff5
4 changed files with 67 additions and 65 deletions
|
@ -49,7 +49,7 @@ void setup() {
|
||||||
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
|
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
|
||||||
// int state = radio.begin();
|
// int state = radio.begin();
|
||||||
|
|
||||||
if(state == ERR_NONE) {
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
} else {
|
} else {
|
||||||
Serial.print(F("failed, code "));
|
Serial.print(F("failed, code "));
|
||||||
|
@ -75,7 +75,7 @@ void setup() {
|
||||||
// encoding: ASCII (7-bit)
|
// encoding: ASCII (7-bit)
|
||||||
// stop bits: 1
|
// stop bits: 1
|
||||||
state = rtty.begin(434.0, 183, 45);
|
state = rtty.begin(434.0, 183, 45);
|
||||||
if(state == ERR_NONE) {
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
} else {
|
} else {
|
||||||
Serial.print(F("failed, code "));
|
Serial.print(F("failed, code "));
|
||||||
|
|
|
@ -50,7 +50,7 @@ void setup() {
|
||||||
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
|
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
|
||||||
// int state = radio.begin();
|
// int state = radio.begin();
|
||||||
|
|
||||||
if(state == ERR_NONE) {
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
} else {
|
} else {
|
||||||
Serial.print(F("failed, code "));
|
Serial.print(F("failed, code "));
|
||||||
|
@ -68,7 +68,7 @@ void setup() {
|
||||||
// encoding: ASCII (7-bit)
|
// encoding: ASCII (7-bit)
|
||||||
// stop bits: 1
|
// stop bits: 1
|
||||||
state = rtty.begin(400, 170, 45);
|
state = rtty.begin(400, 170, 45);
|
||||||
if(state == ERR_NONE) {
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
} else {
|
} else {
|
||||||
Serial.print(F("failed, code "));
|
Serial.print(F("failed, code "));
|
||||||
|
|
|
@ -16,7 +16,7 @@ ITA2String::ITA2String(const char* str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ITA2String::~ITA2String() {
|
ITA2String::~ITA2String() {
|
||||||
#ifndef RADIOLIB_STATIC_ONLY
|
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||||
delete[] _str;
|
delete[] _str;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ size_t ITA2String::length() {
|
||||||
|
|
||||||
uint8_t* ITA2String::byteArr() {
|
uint8_t* ITA2String::byteArr() {
|
||||||
// create temporary array 2x the string length (figures may be 3 bytes)
|
// create temporary array 2x the string length (figures may be 3 bytes)
|
||||||
#ifdef RADIOLIB_STATIC_ONLY
|
#if defined(RADIOLIB_STATIC_ONLY)
|
||||||
uint8_t temp[RADIOLIB_STATIC_ARRAY_SIZE*2 + 1];
|
uint8_t temp[RADIOLIB_STATIC_ARRAY_SIZE*2 + 1];
|
||||||
#else
|
#else
|
||||||
uint8_t* temp = new uint8_t[_len*2 + 1];
|
uint8_t* temp = new uint8_t[_len*2 + 1];
|
||||||
|
@ -48,11 +48,11 @@ uint8_t* ITA2String::byteArr() {
|
||||||
uint8_t shift = (code >> 5) & 0b11111;
|
uint8_t shift = (code >> 5) & 0b11111;
|
||||||
uint8_t character = code & 0b11111;
|
uint8_t character = code & 0b11111;
|
||||||
// check if the code is letter or figure
|
// check if the code is letter or figure
|
||||||
if(shift == ITA2_FIGS) {
|
if(shift == RADIOLIB_ITA2_FIGS) {
|
||||||
// check if this is the first figure in sequence
|
// check if this is the first figure in sequence
|
||||||
if(!flagFigure) {
|
if(!flagFigure) {
|
||||||
flagFigure = true;
|
flagFigure = true;
|
||||||
temp[arrayLen++] = ITA2_FIGS;
|
temp[arrayLen++] = RADIOLIB_ITA2_FIGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the character code
|
// add the character code
|
||||||
|
@ -62,14 +62,14 @@ uint8_t* ITA2String::byteArr() {
|
||||||
if(i < (_len - 1)) {
|
if(i < (_len - 1)) {
|
||||||
uint16_t nextCode = getBits(_str[i+1]);
|
uint16_t nextCode = getBits(_str[i+1]);
|
||||||
uint8_t nextShift = (nextCode >> 5) & 0b11111;
|
uint8_t nextShift = (nextCode >> 5) & 0b11111;
|
||||||
if(nextShift == ITA2_LTRS) {
|
if(nextShift == RADIOLIB_ITA2_LTRS) {
|
||||||
// next character is a letter, terminate figure shift
|
// next character is a letter, terminate figure shift
|
||||||
temp[arrayLen++] = ITA2_LTRS;
|
temp[arrayLen++] = RADIOLIB_ITA2_LTRS;
|
||||||
flagFigure = false;
|
flagFigure = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// reached the end of the message, terminate figure shift
|
// reached the end of the message, terminate figure shift
|
||||||
temp[arrayLen++] = ITA2_LTRS;
|
temp[arrayLen++] = RADIOLIB_ITA2_LTRS;
|
||||||
flagFigure = false;
|
flagFigure = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -82,7 +82,7 @@ uint8_t* ITA2String::byteArr() {
|
||||||
|
|
||||||
uint8_t* arr = new uint8_t[arrayLen];
|
uint8_t* arr = new uint8_t[arrayLen];
|
||||||
memcpy(arr, temp, arrayLen);
|
memcpy(arr, temp, arrayLen);
|
||||||
#ifndef RADIOLIB_STATIC_ONLY
|
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||||
delete[] temp;
|
delete[] temp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -92,14 +92,14 @@ uint8_t* ITA2String::byteArr() {
|
||||||
uint16_t ITA2String::getBits(char c) {
|
uint16_t ITA2String::getBits(char c) {
|
||||||
// search ITA2 table
|
// search ITA2 table
|
||||||
uint16_t code = 0x0000;
|
uint16_t code = 0x0000;
|
||||||
for(uint8_t i = 0; i < ITA2_LENGTH; i++) {
|
for(uint8_t i = 0; i < RADIOLIB_ITA2_LENGTH; i++) {
|
||||||
if(RADIOLIB_PROGMEM_READ_BYTE(&ITA2Table[i][0]) == c) {
|
if(RADIOLIB_NONVOLATILE_READ_BYTE(&ITA2Table[i][0]) == c) {
|
||||||
// character is in letter shift
|
// character is in letter shift
|
||||||
code = (ITA2_LTRS << 5) | i;
|
code = (RADIOLIB_ITA2_LTRS << 5) | i;
|
||||||
break;
|
break;
|
||||||
} else if(RADIOLIB_PROGMEM_READ_BYTE(&ITA2Table[i][1]) == c) {
|
} else if(RADIOLIB_NONVOLATILE_READ_BYTE(&ITA2Table[i][1]) == c) {
|
||||||
// character is in figures shift
|
// character is in figures shift
|
||||||
code = (ITA2_FIGS << 5) | i;
|
code = (RADIOLIB_ITA2_FIGS << 5) | i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,17 +129,17 @@ int16_t RTTYClient::begin(float base, uint32_t shift, uint16_t rate, uint8_t enc
|
||||||
_shiftHz = shift;
|
_shiftHz = shift;
|
||||||
|
|
||||||
switch(encoding) {
|
switch(encoding) {
|
||||||
case ASCII:
|
case RADIOLIB_ASCII:
|
||||||
_dataBits = 7;
|
_dataBits = 7;
|
||||||
break;
|
break;
|
||||||
case ASCII_EXTENDED:
|
case RADIOLIB_ASCII_EXTENDED:
|
||||||
_dataBits = 8;
|
_dataBits = 8;
|
||||||
break;
|
break;
|
||||||
case ITA2:
|
case RADIOLIB_ITA2:
|
||||||
_dataBits = 5;
|
_dataBits = 5;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return(ERR_UNSUPPORTED_ENCODING);
|
return(RADIOLIB_ERR_UNSUPPORTED_ENCODING);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate duration of 1 bit
|
// calculate duration of 1 bit
|
||||||
|
@ -150,7 +150,7 @@ int16_t RTTYClient::begin(float base, uint32_t shift, uint16_t rate, uint8_t enc
|
||||||
|
|
||||||
// check minimum shift value
|
// check minimum shift value
|
||||||
if(shift < step / 2) {
|
if(shift < step / 2) {
|
||||||
return(ERR_INVALID_RTTY_SHIFT);
|
return(RADIOLIB_ERR_INVALID_RTTY_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// round shift to multiples of frequency step size
|
// round shift to multiples of frequency step size
|
||||||
|
@ -210,7 +210,7 @@ size_t RTTYClient::print(__FlashStringHelper* fstr) {
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
PGM_P p = reinterpret_cast<PGM_P>(fstr);
|
PGM_P p = reinterpret_cast<PGM_P>(fstr);
|
||||||
while(true) {
|
while(true) {
|
||||||
char c = RADIOLIB_PROGMEM_READ_BYTE(p++);
|
char c = RADIOLIB_NONVOLATILE_READ_BYTE(p++);
|
||||||
len++;
|
len++;
|
||||||
if(c == '\0') {
|
if(c == '\0') {
|
||||||
break;
|
break;
|
||||||
|
@ -218,7 +218,7 @@ size_t RTTYClient::print(__FlashStringHelper* fstr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// dynamically allocate memory
|
// dynamically allocate memory
|
||||||
#ifdef RADIOLIB_STATIC_ONLY
|
#if defined(RADIOLIB_STATIC_ONLY)
|
||||||
char str[RADIOLIB_STATIC_ARRAY_SIZE];
|
char str[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||||
#else
|
#else
|
||||||
char* str = new char[len];
|
char* str = new char[len];
|
||||||
|
@ -227,17 +227,17 @@ size_t RTTYClient::print(__FlashStringHelper* fstr) {
|
||||||
// copy string from flash
|
// copy string from flash
|
||||||
p = reinterpret_cast<PGM_P>(fstr);
|
p = reinterpret_cast<PGM_P>(fstr);
|
||||||
for(size_t i = 0; i < len; i++) {
|
for(size_t i = 0; i < len; i++) {
|
||||||
str[i] = RADIOLIB_PROGMEM_READ_BYTE(p + i);
|
str[i] = RADIOLIB_NONVOLATILE_READ_BYTE(p + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
if(_encoding == ITA2) {
|
if(_encoding == RADIOLIB_ITA2) {
|
||||||
ITA2String ita2 = ITA2String(str);
|
ITA2String ita2 = ITA2String(str);
|
||||||
n = RTTYClient::print(ita2);
|
n = RTTYClient::print(ita2);
|
||||||
} else if((_encoding == ASCII) || (_encoding == ASCII_EXTENDED)) {
|
} else if((_encoding == RADIOLIB_ASCII) || (_encoding == RADIOLIB_ASCII_EXTENDED)) {
|
||||||
n = RTTYClient::write((uint8_t*)str, len);
|
n = RTTYClient::write((uint8_t*)str, len);
|
||||||
}
|
}
|
||||||
#ifndef RADIOLIB_STATIC_ONLY
|
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||||
delete[] str;
|
delete[] str;
|
||||||
#endif
|
#endif
|
||||||
return(n);
|
return(n);
|
||||||
|
@ -252,10 +252,10 @@ size_t RTTYClient::print(ITA2String& ita2) {
|
||||||
|
|
||||||
size_t RTTYClient::print(const String& str) {
|
size_t RTTYClient::print(const String& str) {
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
if(_encoding == ITA2) {
|
if(_encoding == RADIOLIB_ITA2) {
|
||||||
ITA2String ita2 = ITA2String(str.c_str());
|
ITA2String ita2 = ITA2String(str.c_str());
|
||||||
n = RTTYClient::print(ita2);
|
n = RTTYClient::print(ita2);
|
||||||
} else if((_encoding == ASCII) || (_encoding == ASCII_EXTENDED)) {
|
} else if((_encoding == RADIOLIB_ASCII) || (_encoding == RADIOLIB_ASCII_EXTENDED)) {
|
||||||
n = RTTYClient::write((uint8_t*)str.c_str(), str.length());
|
n = RTTYClient::write((uint8_t*)str.c_str(), str.length());
|
||||||
}
|
}
|
||||||
return(n);
|
return(n);
|
||||||
|
@ -263,10 +263,10 @@ size_t RTTYClient::print(const String& str) {
|
||||||
|
|
||||||
size_t RTTYClient::print(const char str[]) {
|
size_t RTTYClient::print(const char str[]) {
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
if(_encoding == ITA2) {
|
if(_encoding == RADIOLIB_ITA2) {
|
||||||
ITA2String ita2 = ITA2String(str);
|
ITA2String ita2 = ITA2String(str);
|
||||||
n = RTTYClient::print(ita2);
|
n = RTTYClient::print(ita2);
|
||||||
} else if((_encoding == ASCII) || (_encoding == ASCII_EXTENDED)) {
|
} else if((_encoding == RADIOLIB_ASCII) || (_encoding == RADIOLIB_ASCII_EXTENDED)) {
|
||||||
n = RTTYClient::write((uint8_t*)str, strlen(str));
|
n = RTTYClient::write((uint8_t*)str, strlen(str));
|
||||||
}
|
}
|
||||||
return(n);
|
return(n);
|
||||||
|
@ -274,10 +274,10 @@ size_t RTTYClient::print(const char str[]) {
|
||||||
|
|
||||||
size_t RTTYClient::print(char c) {
|
size_t RTTYClient::print(char c) {
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
if(_encoding == ITA2) {
|
if(_encoding == RADIOLIB_ITA2) {
|
||||||
ITA2String ita2 = ITA2String(c);
|
ITA2String ita2 = ITA2String(c);
|
||||||
n = RTTYClient::print(ita2);
|
n = RTTYClient::print(ita2);
|
||||||
} else if((_encoding == ASCII) || (_encoding == ASCII_EXTENDED)) {
|
} else if((_encoding == RADIOLIB_ASCII) || (_encoding == RADIOLIB_ASCII_EXTENDED)) {
|
||||||
n = RTTYClient::write(c);
|
n = RTTYClient::write(c);
|
||||||
}
|
}
|
||||||
return(n);
|
return(n);
|
||||||
|
@ -324,10 +324,10 @@ size_t RTTYClient::print(double n, int digits) {
|
||||||
|
|
||||||
size_t RTTYClient::println(void) {
|
size_t RTTYClient::println(void) {
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
if(_encoding == ITA2) {
|
if(_encoding == RADIOLIB_ITA2) {
|
||||||
ITA2String lf = ITA2String("\r\n");
|
ITA2String lf = ITA2String("\r\n");
|
||||||
n = RTTYClient::print(lf);
|
n = RTTYClient::print(lf);
|
||||||
} else if((_encoding == ASCII) || (_encoding == ASCII_EXTENDED)) {
|
} else if((_encoding == RADIOLIB_ASCII) || (_encoding == RADIOLIB_ASCII_EXTENDED)) {
|
||||||
n = RTTYClient::write("\r\n");
|
n = RTTYClient::write("\r\n");
|
||||||
}
|
}
|
||||||
return(n);
|
return(n);
|
||||||
|
@ -400,18 +400,20 @@ size_t RTTYClient::println(double d, int digits) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTTYClient::mark() {
|
void RTTYClient::mark() {
|
||||||
uint32_t start = Module::micros();
|
Module* mod = _phy->getMod();
|
||||||
|
uint32_t start = mod->micros();
|
||||||
transmitDirect(_base + _shift, _baseHz + _shiftHz);
|
transmitDirect(_base + _shift, _baseHz + _shiftHz);
|
||||||
while(Module::micros() - start < _bitDuration) {
|
while(mod->micros() - start < _bitDuration) {
|
||||||
Module::yield();
|
mod->yield();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTTYClient::space() {
|
void RTTYClient::space() {
|
||||||
uint32_t start = Module::micros();
|
Module* mod = _phy->getMod();
|
||||||
|
uint32_t start = mod->micros();
|
||||||
transmitDirect(_base, _baseHz);
|
transmitDirect(_base, _baseHz);
|
||||||
while(Module::micros() - start < _bitDuration) {
|
while(mod->micros() - start < _bitDuration) {
|
||||||
Module::yield();
|
mod->yield();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,12 +435,12 @@ size_t RTTYClient::printNumber(unsigned long n, uint8_t base) {
|
||||||
} while(n);
|
} while(n);
|
||||||
|
|
||||||
size_t l = 0;
|
size_t l = 0;
|
||||||
if(_encoding == ITA2) {
|
if(_encoding == RADIOLIB_ITA2) {
|
||||||
ITA2String ita2 = ITA2String(str);
|
ITA2String ita2 = ITA2String(str);
|
||||||
uint8_t* arr = ita2.byteArr();
|
uint8_t* arr = ita2.byteArr();
|
||||||
l = RTTYClient::write(arr, ita2.length());
|
l = RTTYClient::write(arr, ita2.length());
|
||||||
delete[] arr;
|
delete[] arr;
|
||||||
} else if((_encoding == ASCII) || (_encoding == ASCII_EXTENDED)) {
|
} else if((_encoding == RADIOLIB_ASCII) || (_encoding == RADIOLIB_ASCII_EXTENDED)) {
|
||||||
l = RTTYClient::write(str);
|
l = RTTYClient::write(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,25 +458,25 @@ size_t RTTYClient::printFloat(double number, uint8_t digits) {
|
||||||
if (number <-4294967040.0) strcpy(code, "ovf"); // constant determined empirically
|
if (number <-4294967040.0) strcpy(code, "ovf"); // constant determined empirically
|
||||||
|
|
||||||
if(code[0] != 0x00) {
|
if(code[0] != 0x00) {
|
||||||
if(_encoding == ITA2) {
|
if(_encoding == RADIOLIB_ITA2) {
|
||||||
ITA2String ita2 = ITA2String(code);
|
ITA2String ita2 = ITA2String(code);
|
||||||
uint8_t* arr = ita2.byteArr();
|
uint8_t* arr = ita2.byteArr();
|
||||||
n = RTTYClient::write(arr, ita2.length());
|
n = RTTYClient::write(arr, ita2.length());
|
||||||
delete[] arr;
|
delete[] arr;
|
||||||
return(n);
|
return(n);
|
||||||
} else if((_encoding == ASCII) || (_encoding == ASCII_EXTENDED)) {
|
} else if((_encoding == RADIOLIB_ASCII) || (_encoding == RADIOLIB_ASCII_EXTENDED)) {
|
||||||
return(RTTYClient::write(code));
|
return(RTTYClient::write(code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle negative numbers
|
// Handle negative numbers
|
||||||
if (number < 0.0) {
|
if (number < 0.0) {
|
||||||
if(_encoding == ITA2) {
|
if(_encoding == RADIOLIB_ITA2) {
|
||||||
ITA2String ita2 = ITA2String("-");
|
ITA2String ita2 = ITA2String("-");
|
||||||
uint8_t* arr = ita2.byteArr();
|
uint8_t* arr = ita2.byteArr();
|
||||||
n += RTTYClient::write(arr, ita2.length());
|
n += RTTYClient::write(arr, ita2.length());
|
||||||
delete[] arr;
|
delete[] arr;
|
||||||
} else if((_encoding == ASCII) || (_encoding == ASCII_EXTENDED)) {
|
} else if((_encoding == RADIOLIB_ASCII) || (_encoding == RADIOLIB_ASCII_EXTENDED)) {
|
||||||
n += RTTYClient::print('-');
|
n += RTTYClient::print('-');
|
||||||
}
|
}
|
||||||
number = -number;
|
number = -number;
|
||||||
|
@ -494,12 +496,12 @@ size_t RTTYClient::printFloat(double number, uint8_t digits) {
|
||||||
|
|
||||||
// Print the decimal point, but only if there are digits beyond
|
// Print the decimal point, but only if there are digits beyond
|
||||||
if(digits > 0) {
|
if(digits > 0) {
|
||||||
if(_encoding == ITA2) {
|
if(_encoding == RADIOLIB_ITA2) {
|
||||||
ITA2String ita2 = ITA2String(".");
|
ITA2String ita2 = ITA2String(".");
|
||||||
uint8_t* arr = ita2.byteArr();
|
uint8_t* arr = ita2.byteArr();
|
||||||
n += RTTYClient::write(arr, ita2.length());
|
n += RTTYClient::write(arr, ita2.length());
|
||||||
delete[] arr;
|
delete[] arr;
|
||||||
} else if((_encoding == ASCII) || (_encoding == ASCII_EXTENDED)) {
|
} else if((_encoding == RADIOLIB_ASCII) || (_encoding == RADIOLIB_ASCII_EXTENDED)) {
|
||||||
n += RTTYClient::print('.');
|
n += RTTYClient::print('.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,17 +8,17 @@
|
||||||
#include "../PhysicalLayer/PhysicalLayer.h"
|
#include "../PhysicalLayer/PhysicalLayer.h"
|
||||||
#include "../AFSK/AFSK.h"
|
#include "../AFSK/AFSK.h"
|
||||||
|
|
||||||
#define ITA2_FIGS 0x1B
|
#define RADIOLIB_ITA2_FIGS 0x1B
|
||||||
#define ITA2_LTRS 0x1F
|
#define RADIOLIB_ITA2_LTRS 0x1F
|
||||||
#define ITA2_LENGTH 32
|
#define RADIOLIB_ITA2_LENGTH 32
|
||||||
|
|
||||||
// ITA2 character table: - position in array corresponds to 5-bit ITA2 code
|
// 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 to the left are in letters shift, characters to the right in figures shift
|
||||||
// - characters marked 0x7F do not have ASCII equivalent
|
// - characters marked 0x7F do not have ASCII equivalent
|
||||||
static const char ITA2Table[ITA2_LENGTH][2] RADIOLIB_PROGMEM = {{'\0', '\0'}, {'E', '3'}, {'\n', '\n'}, {'A', '-'}, {' ', ' '}, {'S', '\''}, {'I', '8'}, {'U', '7'},
|
static const char ITA2Table[RADIOLIB_ITA2_LENGTH][2] RADIOLIB_NONVOLATILE = {{'\0', '\0'}, {'E', '3'}, {'\n', '\n'}, {'A', '-'}, {' ', ' '}, {'S', '\''}, {'I', '8'}, {'U', '7'},
|
||||||
{'\r', '\r'}, {'D', 0x05}, {'R', '4'}, {'J', '\a'}, {'N', ','}, {'F', '!'}, {'C', ':'}, {'K', '('},
|
{'\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'},
|
{'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}};
|
{'O', '9'}, {'B', '?'}, {'G', '&'}, {0x7F, 0x7F}, {'M', '.'}, {'X', '/'}, {'V', ';'}, {0x7F, 0x7F}};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class ITA2String
|
\class ITA2String
|
||||||
|
@ -61,10 +61,10 @@ class ITA2String {
|
||||||
*/
|
*/
|
||||||
uint8_t* byteArr();
|
uint8_t* byteArr();
|
||||||
|
|
||||||
#ifndef RADIOLIB_GODMODE
|
#if !defined(RADIOLIB_GODMODE)
|
||||||
private:
|
private:
|
||||||
#endif
|
#endif
|
||||||
#ifdef RADIOLIB_STATIC_ONLY
|
#if defined(RADIOLIB_STATIC_ONLY)
|
||||||
char _str[RADIOLIB_STATIC_ARRAY_SIZE];
|
char _str[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||||
#else
|
#else
|
||||||
char* _str;
|
char* _str;
|
||||||
|
@ -76,9 +76,9 @@ class ITA2String {
|
||||||
};
|
};
|
||||||
|
|
||||||
// supported encoding schemes
|
// supported encoding schemes
|
||||||
#define ASCII 0
|
#define RADIOLIB_ASCII 0
|
||||||
#define ASCII_EXTENDED 1
|
#define RADIOLIB_ASCII_EXTENDED 1
|
||||||
#define ITA2 2
|
#define RADIOLIB_ITA2 2
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class RTTYClient
|
\class RTTYClient
|
||||||
|
@ -120,7 +120,7 @@ class RTTYClient {
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t begin(float base, uint32_t shift, uint16_t rate, uint8_t encoding = ASCII, uint8_t stopBits = 1);
|
int16_t begin(float base, uint32_t shift, uint16_t rate, uint8_t encoding = RADIOLIB_ASCII, uint8_t stopBits = 1);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Send out idle condition (RF tone at mark frequency).
|
\brief Send out idle condition (RF tone at mark frequency).
|
||||||
|
@ -163,7 +163,7 @@ class RTTYClient {
|
||||||
size_t println(unsigned long, int = DEC);
|
size_t println(unsigned long, int = DEC);
|
||||||
size_t println(double, int = 2);
|
size_t println(double, int = 2);
|
||||||
|
|
||||||
#ifndef RADIOLIB_GODMODE
|
#if !defined(RADIOLIB_GODMODE)
|
||||||
private:
|
private:
|
||||||
#endif
|
#endif
|
||||||
PhysicalLayer* _phy;
|
PhysicalLayer* _phy;
|
||||||
|
@ -171,7 +171,7 @@ class RTTYClient {
|
||||||
AFSKClient* _audio;
|
AFSKClient* _audio;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t _encoding = ASCII;
|
uint8_t _encoding = RADIOLIB_ASCII;
|
||||||
uint32_t _base = 0, _baseHz = 0;
|
uint32_t _base = 0, _baseHz = 0;
|
||||||
uint32_t _shift = 0, _shiftHz = 0;
|
uint32_t _shift = 0, _shiftHz = 0;
|
||||||
uint32_t _bitDuration = 0;
|
uint32_t _bitDuration = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue