1 #if !defined(_RADIOLIB_MORSE_H) && !RADIOLIB_EXCLUDE_MORSE
2 #define _RADIOLIB_MORSE_H
4 #include "../../TypeDef.h"
5 #include "../PhysicalLayer/PhysicalLayer.h"
6 #include "../AFSK/AFSK.h"
7 #include "../Print/Print.h"
9 #define RADIOLIB_MORSE_DOT 0b0
10 #define RADIOLIB_MORSE_DASH 0b1
11 #define RADIOLIB_MORSE_GUARDBIT 0b1
12 #define RADIOLIB_MORSE_UNSUPPORTED 0xFF
13 #define RADIOLIB_MORSE_ASCII_OFFSET 32
14 #define RADIOLIB_MORSE_INTER_SYMBOL 0x00
15 #define RADIOLIB_MORSE_CHAR_COMPLETE 0x01
16 #define RADIOLIB_MORSE_WORD_COMPLETE 0x02
22 static const uint8_t MorseTable[] RADIOLIB_NONVOLATILE = {
26 RADIOLIB_MORSE_UNSUPPORTED,
27 RADIOLIB_MORSE_UNSUPPORTED,
28 RADIOLIB_MORSE_UNSUPPORTED,
29 RADIOLIB_MORSE_UNSUPPORTED,
33 RADIOLIB_MORSE_UNSUPPORTED,
50 RADIOLIB_MORSE_UNSUPPORTED,
51 RADIOLIB_MORSE_UNSUPPORTED,
53 RADIOLIB_MORSE_UNSUPPORTED,
82 RADIOLIB_MORSE_UNSUPPORTED,
83 RADIOLIB_MORSE_UNSUPPORTED,
84 RADIOLIB_MORSE_UNSUPPORTED,
101 #if !RADIOLIB_EXCLUDE_AFSK
117 int16_t
begin(
float base, uint8_t speed = 20);
131 static char decode(uint8_t symbol, uint8_t len);
142 #if !RADIOLIB_EXCLUDE_AFSK
143 int read(uint8_t* symbol, uint8_t* len,
float low = 0.75f,
float high = 1.25f);
151 size_t write(uint8_t b)
override;
153 #if !RADIOLIB_GODMODE
157 #if !RADIOLIB_EXCLUDE_AFSK
161 uint32_t baseFreq = 0, baseFreqHz = 0;
162 float basePeriod = 0.0f;
163 uint32_t dotLength = 0;
164 uint32_t dashLength = 0;
165 uint32_t letterSpace = 0;
166 uint16_t wordSpace = 0;
169 uint32_t signalCounter = 0;
171 uint32_t pauseCounter = 0;
174 size_t printNumber(
unsigned long, uint8_t);
175 size_t printFloat(
double, uint8_t);
177 int16_t transmitDirect(uint32_t freq = 0, uint32_t freqHz = 0);
Client for audio-based transmissions. Requires Arduino tone() function, and a module capable of direc...
Definition: AFSK.h:16
Client for Morse Code communication. The public interface is the same as Arduino Serial.
Definition: Morse.h:93
size_t startSignal()
Send start signal.
Definition: Morse.cpp:41
size_t write(uint8_t b) override
Write one byte. Implementation of interface of the RadioLibPrint/Print class.
Definition: Morse.cpp:115
int16_t begin(float base, uint8_t speed=20)
Initialization method.
Definition: Morse.cpp:23
int read(uint8_t *symbol, uint8_t *len, float low=0.75f, float high=1.25f)
Read Morse tone on input pin.
Definition: Morse.cpp:63
static char decode(uint8_t symbol, uint8_t len)
Decode Morse symbol to ASCII.
Definition: Morse.cpp:45
MorseClient(PhysicalLayer *phy)
Constructor for 2-FSK mode.
Definition: Morse.cpp:7
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:54
Printing class, based on Arduino Print class with additional encodings.
Definition: Print.h:17
unsigned long RadioLibTime_t
Type used for durations in RadioLib.
Definition: TypeDef.h:611