|
arduino-audio-tools
|
Buffer implementation using Zephyr semaphores + mutex as a bounded ring buffer. More...
#include <BufferZephyr.h>
Public Member Functions | |
| BufferZephyr (size_t streamBufferSize, size_t xTriggerLevel=1, TickType_t writeMaxWait=portMAX_DELAY, TickType_t readMaxWait=portMAX_DELAY, Allocator &allocator=DefaultAllocator) | |
| ~BufferZephyr () | |
| 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 | |
| virtual int | bufferCountEmpty () |
| Provides the number of entries that are available to write: -1 does not apply. | |
| virtual int | bufferCountFilled () |
| Provides the number of entries that are available to read: -1 does not apply. | |
| void | clear () |
| same as reset | |
| virtual int | clearArray (int len) |
| Removes the next len entries. | |
| virtual void | flush () |
| 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) override |
| reads multiple values | |
| void | reset () override |
| clears the buffer | |
| bool | resize (size_t size) |
| Re-Allocates the memory and queue. | |
| void | setReadFromISR (bool active) |
| void | setReadMaxWait (TickType_t ticks) |
| void | setWriteFromISR (bool active) |
| void | setWriteMaxWait (TickType_t ticks) |
| size_t | size () override |
| bool | write (T data) override |
| write add an entry to the buffer | |
| int | writeArray (const T data[], int len) override |
| 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 resources: call resize to restart again. | |
| bool | readOne (T &value) |
| bool | setup () |
| bool | writeOne (const T &value) |
Protected Attributes | |
| struct k_mutex | buffer_mutex |
| size_t | buffer_size_public = 0 |
| size_t | current_size_entries = 0 |
| size_t | head = 0 |
| struct k_sem | items_sem |
| Allocator * | p_allocator = nullptr |
| T * | p_data = nullptr |
| bool | read_from_isr = false |
| TickType_t | readWait = portMAX_DELAY |
| struct k_sem | spaces_sem |
| size_t | tail = 0 |
| bool | write_from_isr = false |
| TickType_t | writeWait = portMAX_DELAY |
Buffer implementation using Zephyr semaphores + mutex as a bounded ring buffer.
|
inline |
|
inline |
returns the address of the start of the physical read buffer
Implements BaseBuffer< T >.
provides the number of entries that are available to read
Implements BaseBuffer< T >.
provides the number of entries that are available to write
Implements BaseBuffer< T >.
Provides the number of entries that are available to write: -1 does not apply.
Reimplemented in SynchronizedNBufferRTOST< T >, SynchronizedNBufferZephyrT< T >, and NBuffer< T >.
Provides the number of entries that are available to read: -1 does not apply.
Reimplemented in SynchronizedNBufferRTOST< T >, SynchronizedNBufferZephyrT< T >, and NBuffer< T >.
|
inlineinherited |
same as reset
Removes the next len entries.
Reimplemented in SingleBuffer< T >.
Submit any partially-filled write buffer so the reader can access it. Only meaningful for NBuffer-style block pools; no-op for ring buffers.
Reimplemented in NBuffer< T >.
checks if the buffer is full
Reimplemented from BaseBuffer< T >.
peeks the actual entry from the buffer
Implements BaseBuffer< T >.
reads a single value
Implements BaseBuffer< T >.
reads multiple values
Reimplemented from BaseBuffer< T >.
clears the buffer
Implements BaseBuffer< T >.
Re-Allocates the memory and queue.
Reimplemented from BaseBuffer< T >.
|
inline |
Allocation has been postponed to be done here so that e.g. psram can be used.
|
inline |
Implements BaseBuffer< T >.
write add an entry to the buffer
Implements BaseBuffer< T >.
Fills the buffer data.
Reimplemented from BaseBuffer< T >.
Fills the buffer data and overwrites the oldest data if the buffer is full.
|
protected |
|
protected |