Chirp spread spectrum modulator (LoRa-like): the written bytes are collected and sent as frame when CSSConfig::max_frame bytes are available or when you call endTransmission() (or flush()). A frame consists of the preamble (up chirps), 2 down chirps, the header and the payload. Each symbol is a chirp which starts at the frequency of its value and wraps around at the end of the band. The phase is continuous.
More...
#include <CSSEncoder.h>
|
| | CSSEncoder ()=default |
| | CSSEncoder (Print &out) |
| CSSConfig | defaultConfig () |
| | Provides a default configuration: css7 (SF 7, 1000 Hz).
|
| void | setOutput (Print &out) override |
| void | setAudioInfo (audio_tools::AudioInfo info) override |
| | Defines the sample rate and number of channels of the generated audio.
|
| audio_tools::AudioInfo | audioInfo () override |
| bool | begin (CSSConfig config) |
| | Starts the processing with the indicated configuration.
|
| bool | begin () override |
| void | end () override |
| size_t | write (const uint8_t *data, size_t len) override |
| | Collects the data: a frame is sent when max_frame bytes are available.
|
| bool | endTransmission (size_t silence_samples=0) override |
| bool | isTransmitting () override |
| | true while data is waiting to be sent
|
| float | symbolRate () override |
| | Symbols per second.
|
| size_t | frameCount () |
| | Number of sent frames.
|
| CSSConfig & | config () |
| | The configuration which was provided in begin().
|
| | operator bool () override |
| void | setOutput (Print &out) override |
| void | setGenerator (audio_tools::SoundGenerator< int16_t > &generator) |
| audio_tools::SoundGenerator< int16_t > & | getGenerator () |
| | Provides the active tone generator.
|
| virtual bool | writeIdle (size_t nsamples) |
| | Sends an idle carrier: returns false if this is not supported.
|
| void | writeSilence (size_t nsamples) |
| | Writes the indicated number of samples of silence.
|
| void | writeTone (float freq, size_t nsamples) |
| | Writes a tone for the indicated number of samples.
|
| void | flush () |
| | Ends the transmission.
|
| const char * | mime () override |
|
| static double | sawIntegral (double x) |
| | Integral of frac(x): the normalized frequency of a chirp is a saw tooth.
|
|
| static constexpr float | RAMP_SEC = 0.002f |
Chirp spread spectrum modulator (LoRa-like): the written bytes are collected and sent as frame when CSSConfig::max_frame bytes are available or when you call endTransmission() (or flush()). A frame consists of the preamble (up chirps), 2 down chirps, the header and the payload. Each symbol is a chirp which starts at the frequency of its value and wraps around at the end of the band. The phase is continuous.
- Copyright
- GPLv3
◆ CSSEncoder() [1/2]
| tinymodem::CSSEncoder::CSSEncoder |
( |
| ) |
|
|
default |
◆ CSSEncoder() [2/2]
| tinymodem::CSSEncoder::CSSEncoder |
( |
Print & | out | ) |
|
|
inline |
◆ audioInfo()
| audio_tools::AudioInfo tinymodem::CSSEncoder::audioInfo |
( |
| ) |
|
|
inlineoverride |
◆ begin() [1/2]
| bool tinymodem::CSSEncoder::begin |
( |
| ) |
|
|
inlineoverride |
◆ begin() [2/2]
| bool tinymodem::CSSEncoder::begin |
( |
CSSConfig | config | ) |
|
|
inline |
Starts the processing with the indicated configuration.
◆ config()
| CSSConfig & tinymodem::CSSEncoder::config |
( |
| ) |
|
|
inline |
The configuration which was provided in begin().
◆ defaultConfig()
| CSSConfig tinymodem::CSSEncoder::defaultConfig |
( |
| ) |
|
|
inline |
Provides a default configuration: css7 (SF 7, 1000 Hz).
◆ end()
| void tinymodem::CSSEncoder::end |
( |
| ) |
|
|
inlineoverride |
◆ endTransmission()
| bool tinymodem::CSSEncoder::endTransmission |
( |
size_t | silence_samples = 0 | ) |
|
|
inlineoverridevirtual |
Sends the collected data (and adds optional silence): returns true if a frame was sent
Implements tinymodem::ModemEncoder.
◆ frameCount()
| size_t tinymodem::CSSEncoder::frameCount |
( |
| ) |
|
|
inline |
◆ isTransmitting()
| bool tinymodem::CSSEncoder::isTransmitting |
( |
| ) |
|
|
inlineoverridevirtual |
◆ operator bool()
| tinymodem::CSSEncoder::operator bool |
( |
| ) |
|
|
inlineoverride |
◆ sawIntegral()
| double tinymodem::CSSEncoder::sawIntegral |
( |
double | x | ) |
|
|
inlinestaticprotected |
Integral of frac(x): the normalized frequency of a chirp is a saw tooth.
◆ sendChirp()
| void tinymodem::CSSEncoder::sendChirp |
( |
int | value, |
|
|
bool | up ) |
|
inlineprotected |
Writes an up chirp (starting at the frequency of the value) or a down chirp. The phase is calculated exactly: the frequency jump at the end of the band happens between two samples.
◆ sendFrame()
| void tinymodem::CSSEncoder::sendFrame |
( |
| ) |
|
|
inlineprotected |
◆ setAudioInfo()
| void tinymodem::CSSEncoder::setAudioInfo |
( |
audio_tools::AudioInfo | info | ) |
|
|
inlineoverride |
Defines the sample rate and number of channels of the generated audio.
◆ setOutput()
| void tinymodem::CSSEncoder::setOutput |
( |
Print & | out | ) |
|
|
inlineoverride |
◆ symbolRate()
| float tinymodem::CSSEncoder::symbolRate |
( |
| ) |
|
|
inlineoverridevirtual |
◆ write()
| size_t tinymodem::CSSEncoder::write |
( |
const uint8_t * | data, |
|
|
size_t | len ) |
|
inlineoverride |
Collects the data: a frame is sent when max_frame bytes are available.
◆ cfg
◆ frame
◆ frame_len
| int tinymodem::CSSEncoder::frame_len = 0 |
|
protected |
◆ frames
| size_t tinymodem::CSSEncoder::frames = 0 |
|
protected |
◆ is_active
| bool tinymodem::CSSEncoder::is_active = false |
|
protected |
◆ phase
| double tinymodem::CSSEncoder::phase = 0 |
|
protected |
◆ ramp
| size_t tinymodem::CSSEncoder::ramp = 0 |
|
protected |
◆ RAMP_SEC
| float tinymodem::CSSEncoder::RAMP_SEC = 0.002f |
|
staticconstexprprotected |
◆ samples
◆ symbol_index
| uint64_t tinymodem::CSSEncoder::symbol_index = 0 |
|
protected |
◆ total
| size_t tinymodem::CSSEncoder::total = 0 |
|
protected |
◆ written
| size_t tinymodem::CSSEncoder::written = 0 |
|
protected |
The documentation for this class was generated from the following file: