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

Frame format of the chirp spread spectrum modem: the bytes of the header code word (length and parity) and of the payload code word (data, CRC-16 and parity) are sent as SF bits per symbol, most significant bit first. The symbol value is the inverse Gray code of the bits, so that a detection in the neighboring FFT bin causes only 1 wrong bit. More...

#include <CSS.h>

Static Public Member Functions

static int symbols (int bytes, int sf)
 number of symbols for the indicated number of bytes
static int payloadBytes (int len, int ecc)
 bytes of the payload code word
static void header (int len, uint8_t *out)
 Header code word: length and parity.
static int decodeHeader (uint8_t *data)
 Corrects the header in place: returns the length or -1 if invalid.
static void payload (const uint8_t *data, int len, int ecc, uint8_t *out)
 Payload code word: data, CRC-16 and parity.
static int decodePayload (uint8_t *data, int len, int ecc)
static int toSymbols (const uint8_t *data, int len, int sf, uint16_t *out)
 Converts bytes into symbols.
static void fromSymbols (const uint16_t *symbols, int n, int sf, uint8_t *data, int len)
 Converts symbols into bytes.
static int inverseGray (int g)

Static Public Attributes

static constexpr int HEADER_BYTES = 1 + CSSConfig::HEADER_ECC

Detailed Description

Frame format of the chirp spread spectrum modem: the bytes of the header code word (length and parity) and of the payload code word (data, CRC-16 and parity) are sent as SF bits per symbol, most significant bit first. The symbol value is the inverse Gray code of the bits, so that a detection in the neighboring FFT bin causes only 1 wrong bit.

Member Function Documentation

◆ decodeHeader()

int tinymodem::CSSFrame::decodeHeader ( uint8_t * data)
inlinestatic

Corrects the header in place: returns the length or -1 if invalid.

◆ decodePayload()

int tinymodem::CSSFrame::decodePayload ( uint8_t * data,
int len,
int ecc )
inlinestatic

Corrects the payload in place and checks the CRC: returns the number of corrected bytes or -1 if invalid

◆ fromSymbols()

void tinymodem::CSSFrame::fromSymbols ( const uint16_t * symbols,
int n,
int sf,
uint8_t * data,
int len )
inlinestatic

Converts symbols into bytes.

◆ header()

void tinymodem::CSSFrame::header ( int len,
uint8_t * out )
inlinestatic

Header code word: length and parity.

◆ inverseGray()

int tinymodem::CSSFrame::inverseGray ( int g)
inlinestatic

◆ payload()

void tinymodem::CSSFrame::payload ( const uint8_t * data,
int len,
int ecc,
uint8_t * out )
inlinestatic

Payload code word: data, CRC-16 and parity.

◆ payloadBytes()

int tinymodem::CSSFrame::payloadBytes ( int len,
int ecc )
inlinestatic

bytes of the payload code word

◆ symbols()

int tinymodem::CSSFrame::symbols ( int bytes,
int sf )
inlinestatic

number of symbols for the indicated number of bytes

◆ toSymbols()

int tinymodem::CSSFrame::toSymbols ( const uint8_t * data,
int len,
int sf,
uint16_t * out )
inlinestatic

Converts bytes into symbols.

Member Data Documentation

◆ HEADER_BYTES

int tinymodem::CSSFrame::HEADER_BYTES = 1 + CSSConfig::HEADER_ECC
staticconstexpr

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