|
TinyModem
Header-only software audio modem library
|
BasicModemStream which receives in a separate task (FreeRTOS on ESP32 and RP2040, a std::thread on the desktop): the task reads the audio input and decodes it, so the decoding does not block your loop() and no audio is lost while loop() is busy. available(), read() and peek() only access the received data and can be called from any task. More...
#include <ModemStreamRTOS.h>


Classes | |
| struct | LockedQueue |
| Print which writes the decoded data into the queue with a lock. More... | |
Public Types | |
| using | Config = typename Base::ConfigType |
Public Member Functions | |
| ~BasicModemStreamRTOS () | |
| void | setTaskConfig (int stack_size, int priority=1, int core=-1) |
| bool | begin (Config cfg, int rx_buffer_size=256) |
| void | end () |
| Stops the receive task and the modem. | |
| int | available () override |
| int | read () override |
| int | peek () override |
| size_t | update () |
| Not needed: the receive task processes the input. | |
| bool | isRunning () |
| true while the receive task is running | |
Protected Types | |
| using | Queue = typename Base::ReceiveQueue |
Protected Member Functions | |
| void | receive () |
| One iteration of the receive task. | |
| size_t | readInputLocked () |
| Reads the available audio input and feeds it to the decoder. | |
Protected Attributes | |
| audio_tools::Task | task |
| audio_tools::Mutex | mutex |
| LockedQueue | locked_queue |
| int | task_stack_size = DEFAULT_STACK_SIZE |
| int | task_priority = 1 |
| int | task_core = -1 |
| bool | task_created = false |
| bool | is_task_active = false |
| std::atomic< bool > | is_running {false} |
| std::atomic< bool > | is_idle {false} |
Static Protected Attributes | |
| static constexpr int | DEFAULT_STACK_SIZE = 2 * 1024 |
BasicModemStream which receives in a separate task (FreeRTOS on ESP32 and RP2040, a std::thread on the desktop): the task reads the audio input and decodes it, so the decoding does not block your loop() and no audio is lost while loop() is busy. available(), read() and peek() only access the received data and can be called from any task.
Transmitting (write(), print(), flush()) happens in the calling task like in the BasicModemStream. The status output (setStatusOutput()) is written by the receive task.
| Base | the BasicModemStream (e.g. ModemStream or MFSKStream) |
| using tinymodem::BasicModemStreamRTOS< Base >::Config = typename Base::ConfigType |
|
protected |
|
inline |
|
inlineoverride |
|
inline |
Starts the modem and the receive task: the input is only read while less than rx_buffer_size decoded bytes are waiting to be read
|
inline |
Stops the receive task and the modem.
|
inline |
true while the receive task is running
|
inlineoverride |
|
inlineoverride |
|
inlineprotected |
Reads the available audio input and feeds it to the decoder.
|
inlineprotected |
One iteration of the receive task.
|
inline |
Defines the receive task parameters: call before begin(). The stack size is in bytes on ESP32 and in words on other FreeRTOS platforms.
|
inline |
Not needed: the receive task processes the input.
|
staticconstexprprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |