RadioLib
Universal wireless communication library for Arduino
MorseClient Class Reference

Client for Morse Code communication. The public interface is the same as Arduino Serial. More...

#include <Morse.h>

Inheritance diagram for MorseClient:
RadioLibPrint

Public Member Functions

 MorseClient (PhysicalLayer *phy)
 Constructor for 2-FSK mode. More...
 
 MorseClient (AFSKClient *audio)
 Constructor for AFSK mode. More...
 
int16_t begin (float base, uint8_t speed=20)
 Initialization method. More...
 
size_t startSignal ()
 Send start signal. More...
 
int read (uint8_t *symbol, uint8_t *len, float low=0.75f, float high=1.25f)
 Read Morse tone on input pin. More...
 
size_t write (uint8_t b) override
 Write one byte. Implementation of interface of the RadioLibPrint/Print class. More...
 
- Public Member Functions inherited from RadioLibPrint
size_t write (const char *str)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
size_t write (const char *buffer, size_t size)
 
size_t print (ITA2String &ita2)
 
size_t println (ITA2String &ita2)
 
size_t print (const char[])
 
size_t print (char)
 
size_t print (unsigned char, int=DEC)
 
size_t print (int, int=DEC)
 
size_t print (unsigned int, int=DEC)
 
size_t print (long, int=DEC)
 
size_t print (unsigned long, int=DEC)
 
size_t print (double, int=2)
 
size_t println (const char[])
 
size_t println (char)
 
size_t println (unsigned char, int=DEC)
 
size_t println (int, int=DEC)
 
size_t println (unsigned int, int=DEC)
 
size_t println (long, int=DEC)
 
size_t println (unsigned long, int=DEC)
 
size_t println (double, int=2)
 
size_t println (void)
 

Static Public Member Functions

static char decode (uint8_t symbol, uint8_t len)
 Decode Morse symbol to ASCII. More...
 

Detailed Description

Client for Morse Code communication. The public interface is the same as Arduino Serial.

Constructor & Destructor Documentation

◆ MorseClient() [1/2]

MorseClient::MorseClient ( PhysicalLayer phy)
explicit

Constructor for 2-FSK mode.

Parameters
phyPointer to the wireless module providing PhysicalLayer communication.

◆ MorseClient() [2/2]

MorseClient::MorseClient ( AFSKClient audio)
explicit

Constructor for AFSK mode.

Parameters
audioPointer to the AFSK instance providing audio.

Member Function Documentation

◆ begin()

int16_t MorseClient::begin ( float  base,
uint8_t  speed = 20 
)

Initialization method.

Parameters
baseBase RF frequency to be used in MHz (in 2-FSK mode), or the tone frequency in Hz (in AFSK mode)
speedCoding speed in words per minute.
Returns
Status Codes

◆ decode()

char MorseClient::decode ( uint8_t  symbol,
uint8_t  len 
)
static

Decode Morse symbol to ASCII.

Parameters
symbolMorse code symbol, represented as outlined in MorseTable.
lenSymbol length (number of dots and dashes).
Returns
ASCII character matching the symbol, or 0xFF if no match is found.

◆ read()

int MorseClient::read ( uint8_t *  symbol,
uint8_t *  len,
float  low = 0.75f,
float  high = 1.25f 
)

Read Morse tone on input pin.

Parameters
symbolPointer to the symbol buffer.
lenPointer to the length counter.
lowLow threshold for decision limit (dot length, pause length etc.), defaults to 0.75.
highHigh threshold for decision limit (dot length, pause length etc.), defaults to 1.25.
Returns
0 if not enough symbols were decoded, 1 if inter-character space was detected, 2 if inter-word space was detected.

◆ startSignal()

size_t MorseClient::startSignal ( )

Send start signal.

Returns
Number of bytes sent (always 0).

◆ write()

size_t MorseClient::write ( uint8_t  b)
overridevirtual

Write one byte. Implementation of interface of the RadioLibPrint/Print class.

Parameters
bByte to write.
Returns
1 if the byte was written, 0 otherwise.

Implements RadioLibPrint.


The documentation for this class was generated from the following files: