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

Configuration of the chirp spread spectrum modem (CSSEncoder, CSSDecoder), which works like LoRa in the audio band: each symbol is a linear chirp over the bandwidth, which starts at one of N = 2^SF frequencies and carries SF bits (SF = spreading factor). The signal can be received far below the noise level and is robust against frequency offsets, different clocks and echoes. It is not compatible with LoRa radios. More...

#include <CSS.h>

Inheritance diagram for tinymodem::CSSConfig:
Collaboration diagram for tinymodem::CSSConfig:

Public Member Functions

 CSSConfig ()
bool setMode (const char *mode)
int chips () const
 chips (FFT bins) per symbol
float symbolTime () const
 duration of a symbol in seconds
float symbolRate () const
 symbols per second
float lowFreq () const
 lowest frequency of the chirps in Hz
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 chirp spread spectrum mode

Public Attributes

int spreading_factor = 7
float bandwidth = 1000.0f
 bandwidth of the chirps in Hz
float center_freq = 1500.0f
 center frequency in Hz
float volume = 1.0f
 transmit amplitude (0.0 - 1.0)
int preamble_symbols = 8
 transmitter: number of up chirps before the sync symbols
int max_frame = 64
 transmitter: max number of bytes per frame (1 - 200)
int ecc_bytes = 8
float detect_threshold = 8.0f
bool rx_one = false
 receiver: stop after the first frame
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 Public Attributes

static constexpr int MAX_FRAME = 200
 max payload of a frame
static constexpr int HEADER_ECC = 4
 header: length byte and Reed-Solomon parity

Static Protected Member Functions

static bool parseMode (const char *mode, int &sf, float &bw)

Detailed Description

Configuration of the chirp spread spectrum modem (CSSEncoder, CSSDecoder), which works like LoRa in the audio band: each symbol is a linear chirp over the bandwidth, which starts at one of N = 2^SF frequencies and carries SF bits (SF = spreading factor). The signal can be received far below the noise level and is robust against frequency offsets, different clocks and echoes. It is not compatible with LoRa radios.

A frame starts with preamble_symbols up chirps and 2 down chirps, followed by the header (length, Reed-Solomon protected) and the payload (CRC-16 and ecc_bytes Reed-Solomon parity bytes).

setMode() selects "css5" to "css10" (SF, 1000 Hz bandwidth) or e.g. "css7-500" or "css9-2000" (SF and bandwidth). "css" is "css7".

Constructor & Destructor Documentation

◆ CSSConfig()

tinymodem::CSSConfig::CSSConfig ( )
inline

Member Function Documentation

◆ chips()

int tinymodem::CSSConfig::chips ( ) const
inline

chips (FFT bins) per symbol

◆ isMode()

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

true if the mode is a chirp spread spectrum mode

◆ isValid()

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

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

◆ lowFreq()

float tinymodem::CSSConfig::lowFreq ( ) const
inline

lowest frequency of the chirps in Hz

◆ parseMode()

bool tinymodem::CSSConfig::parseMode ( const char * mode,
int & sf,
float & bw )
inlinestaticprotected

◆ setMode()

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

Selects e.g. "css7" or "css9-500": returns false if invalid. The other settings are kept.

◆ symbolRate()

float tinymodem::CSSConfig::symbolRate ( ) const
inline

symbols per second

◆ symbolTime()

float tinymodem::CSSConfig::symbolTime ( ) const
inline

duration of a symbol in seconds

Member Data Documentation

◆ bandwidth

float tinymodem::CSSConfig::bandwidth = 1000.0f

bandwidth of the chirps in Hz

◆ center_freq

float tinymodem::CSSConfig::center_freq = 1500.0f

center frequency in Hz

◆ channel

uint8_t tinymodem::CSSConfig::channel = 0

receiver: input channel which is used for the decoding

◆ detect_threshold

float tinymodem::CSSConfig::detect_threshold = 8.0f

receiver: min ratio of the peak power to the mean power of the other bins to detect the preamble

◆ ecc_bytes

int tinymodem::CSSConfig::ecc_bytes = 8

Reed-Solomon parity bytes of the payload (2 - 64): corrects ecc_bytes / 2 wrong bytes

◆ HEADER_ECC

int tinymodem::CSSConfig::HEADER_ECC = 4
staticconstexpr

header: length byte and Reed-Solomon parity

◆ MAX_FRAME

int tinymodem::CSSConfig::MAX_FRAME = 200
staticconstexpr

max payload of a frame

◆ max_frame

int tinymodem::CSSConfig::max_frame = 64

transmitter: max number of bytes per frame (1 - 200)

◆ preamble_symbols

int tinymodem::CSSConfig::preamble_symbols = 8

transmitter: number of up chirps before the sync symbols

◆ rx_noise

float tinymodem::CSSConfig::rx_noise = 0.0f

receiver: (testing only) amplitude of added uniform noise

◆ rx_one

bool tinymodem::CSSConfig::rx_one = false

receiver: stop after the first frame

◆ spreading_factor

int tinymodem::CSSConfig::spreading_factor = 7

bits per symbol (5 - 10): each step doubles the symbol duration and improves the sensitivity by about 2.5 dB

◆ volume

float tinymodem::CSSConfig::volume = 1.0f

transmit amplitude (0.0 - 1.0)


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