|
arduino-audio-tools
|
Buffer implementation which is using a FreeRTOS StreamBuffer. The default allocator uses psram is available. More...
#include <BufferRTOS.h>
Public Member Functions | |
| BufferRTOS (size_t streamBufferSize, size_t xTriggerLevel=1, TickType_t writeMaxWait=portMAX_DELAY, TickType_t readMaxWait=portMAX_DELAY, Allocator &allocator=DefaultAllocator) | |
| T * | address () override |
| returns the address of the start of the physical read buffer | |
| int | available () override |
| provides the number of entries that are available to read | |
| int | availableForWrite () override |
| provides the number of entries that are available to write | |
| void | clear () |
| same as reset | |
| virtual int | clearArray (int len) |
| Removes the next len entries. | |
| bool | isEmpty () |
| bool | isFull () override |
| checks if the buffer is full | |
| virtual float | levelPercent () |
| Returns the level of the buffer in %. | |
| operator bool () | |
| bool | peek (T &result) override |
| peeks the actual entry from the buffer | |
| bool | read (T &result) override |
| reads a single value | |
| int | readArray (T data[], int len) |
| reads multiple values | |
| void | reset () override |
| clears the buffer | |
| virtual bool | resize (int bytes) |
| Resizes the buffer if supported: returns false if not supported. | |
| bool | resize (size_t size) |
| Re-Allocats the memory and the queue. | |
| void | setReadFromISR (bool active) |
| void | setReadMaxWait (TickType_t ticks) |
| void | setWriteFromISR (bool active) |
| void | setWriteMaxWait (TickType_t ticks) |
| size_t | size () |
| bool | write (T data) override |
| write add an entry to the buffer | |
| int | writeArray (const T data[], int len) |
| Fills the buffer data. | |
| virtual int | writeArrayOverwrite (const T data[], int len) |
| Fills the buffer data and overwrites the oldest data if the buffer is full. | |
Protected Member Functions | |
| void | end () |
| Release resurces: call resize to restart again. | |
| bool | setup () |
Protected Attributes | |
| size_t | current_size_bytes = 0 |
| Allocator * | p_allocator = nullptr |
| uint8_t * | p_data = nullptr |
| bool | read_from_isr = false |
| int | readWait = portMAX_DELAY |
| StaticStreamBuffer_t | static_stream_buffer |
| size_t | trigger_level = 0 |
| bool | write_from_isr = false |
| int | writeWait = portMAX_DELAY |
| BaseType_t | xHigherPriorityTaskWoken = pdFALSE |
| StreamBufferHandle_t | xStreamBuffer = nullptr |
Buffer implementation which is using a FreeRTOS StreamBuffer. The default allocator uses psram is available.
| T |
|
inlineoverridevirtual |
returns the address of the start of the physical read buffer
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
provides the number of entries that are available to read
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
provides the number of entries that are available to write
Implements BaseBuffer< T >.
|
inlinevirtualinherited |
Removes the next len entries.
Reimplemented in SingleBuffer< T >.
|
inlineoverridevirtual |
checks if the buffer is full
Reimplemented from BaseBuffer< T >.
|
inlineoverridevirtual |
peeks the actual entry from the buffer
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
reads a single value
Implements BaseBuffer< T >.
|
inlinevirtual |
reads multiple values
Reimplemented from BaseBuffer< T >.
|
inlineoverridevirtual |
clears the buffer
Implements BaseBuffer< T >.
|
inlinevirtualinherited |
Resizes the buffer if supported: returns false if not supported.
Reimplemented in NBuffer< T >, RingBuffer< T >, DynamicMultiBuffer< T, BufferType >, SingleBuffer< T >, RingBufferFile< File, T >, and RedisBuffer< T >.
|
inlineprotected |
The allocation has been postponed to be done here, so that we can e.g. use psram
|
inlinevirtual |
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
write add an entry to the buffer
Implements BaseBuffer< T >.
|
inlinevirtual |
Fills the buffer data.
Reimplemented from BaseBuffer< T >.