TinyModem
Header-only software audio modem library
Loading...
Searching...
No Matches
tinymodem::MorseConfig Struct Reference

Configuration of the Morse code modem (MorseEncoder, MorseDecoder): a tone which is switched on and off (CW). The speed is defined in words per minute (PARIS): a unit (the length of a dot) is 1.2 / wpm seconds. More...

#include <Morse.h>

Inheritance diagram for tinymodem::MorseConfig:
Collaboration diagram for tinymodem::MorseConfig:

Public Member Functions

 MorseConfig ()
bool setMode (const char *mode)
float unitTime () const
 length of a unit (dot) in seconds
bool isValid () const
 Checks the configuration: returns false (and logs the reason) if invalid.

Static Public Member Functions

static bool isMode (const char *mode)
 true if the mode is a Morse code mode

Public Attributes

MorseAlphabet alphabet = MorseAlphabet::INTERNATIONAL
 International (default) or American Morse code.
float wpm = 20.0f
 speed in words per minute
float frequency = 700.0f
 frequency of the tone in Hz
float volume = 1.0f
 transmit amplitude (0.0 - 1.0)
float ramp_ms = 5.0f
 transmitter: rise and fall time of the tone in ms (avoids clicks)
bool adaptive_speed = true
 receiver: adapt to the speed of the sender
float min_amplitude = 0.01f
 receiver: minimum amplitude of the tone (1.0 = full scale)
int rx_timeout_units = 20
bool rx_one = false
 receiver: stop after the first transmission
uint8_t channel = 0
 receiver: input channel which is used for the decoding
float rx_noise = 0.0f
 receiver: (testing only) amplitude of added uniform noise

Static Protected Member Functions

static bool parseMode (const char *mode, MorseAlphabet &alphabet, float &speed)
static bool startsWith (const char *str, const char *prefix)

Detailed Description

Configuration of the Morse code modem (MorseEncoder, MorseDecoder): a tone which is switched on and off (CW). The speed is defined in words per minute (PARIS): a unit (the length of a dot) is 1.2 / wpm seconds.

setMode() selects "morse" or "cw" (International Morse code, 20 wpm), "morse-american" (American Morse code), optionally with the speed, e.g. "morse-25", "morse-american-15" or "cw25".

Constructor & Destructor Documentation

◆ MorseConfig()

tinymodem::MorseConfig::MorseConfig ( )
inline

Member Function Documentation

◆ isMode()

bool tinymodem::MorseConfig::isMode ( const char * mode)
inlinestatic

true if the mode is a Morse code mode

◆ isValid()

bool tinymodem::MorseConfig::isValid ( ) const
inline

Checks the configuration: returns false (and logs the reason) if invalid.

◆ parseMode()

bool tinymodem::MorseConfig::parseMode ( const char * mode,
MorseAlphabet & alphabet,
float & speed )
inlinestaticprotected

◆ setMode()

bool tinymodem::MorseConfig::setMode ( const char * mode)
inline

Selects e.g. "morse", "morse-25", "morse-american" or "cw20": returns false if invalid. The other settings are kept.

◆ startsWith()

bool tinymodem::MorseConfig::startsWith ( const char * str,
const char * prefix )
inlinestaticprotected

◆ unitTime()

float tinymodem::MorseConfig::unitTime ( ) const
inline

length of a unit (dot) in seconds

Member Data Documentation

◆ adaptive_speed

bool tinymodem::MorseConfig::adaptive_speed = true

receiver: adapt to the speed of the sender

◆ alphabet

MorseAlphabet tinymodem::MorseConfig::alphabet = MorseAlphabet::INTERNATIONAL

International (default) or American Morse code.

◆ channel

uint8_t tinymodem::MorseConfig::channel = 0

receiver: input channel which is used for the decoding

◆ frequency

float tinymodem::MorseConfig::frequency = 700.0f

frequency of the tone in Hz

◆ min_amplitude

float tinymodem::MorseConfig::min_amplitude = 0.01f

receiver: minimum amplitude of the tone (1.0 = full scale)

◆ ramp_ms

float tinymodem::MorseConfig::ramp_ms = 5.0f

transmitter: rise and fall time of the tone in ms (avoids clicks)

◆ rx_noise

float tinymodem::MorseConfig::rx_noise = 0.0f

receiver: (testing only) amplitude of added uniform noise

◆ rx_one

bool tinymodem::MorseConfig::rx_one = false

receiver: stop after the first transmission

◆ rx_timeout_units

int tinymodem::MorseConfig::rx_timeout_units = 20

receiver: the end of a transmission is reported after this silence in units

◆ volume

float tinymodem::MorseConfig::volume = 1.0f

transmit amplitude (0.0 - 1.0)

◆ wpm

float tinymodem::MorseConfig::wpm = 20.0f

speed in words per minute


The documentation for this struct was generated from the following file: