|
FreeRTOS-Cpp
|
Class that encapsulates the functionality of a FreeRTOS stream buffer. More...
#include <FreeRTOS/StreamBuffer.hpp>


Public Member Functions | |
| StreamBuffer (const size_t size, const size_t triggerLevel=0) | |
Construct a new StreamBuffer object by calling StreamBufferHandle_t xStreamBufferCreate( size_t xBufferSizeBytes,
size_t xTriggerLevelBytes ) | |
| StreamBuffer (const StreamBuffer &)=delete | |
| StreamBuffer & | operator= (const StreamBuffer &)=delete |
| StreamBuffer (StreamBuffer &&) noexcept=default | |
| StreamBuffer & | operator= (StreamBuffer &&) noexcept=default |
Public Member Functions inherited from FreeRTOS::StreamBufferBase | |
| StreamBufferBase (const StreamBufferBase &)=delete | |
| StreamBufferBase & | operator= (const StreamBufferBase &)=delete |
| bool | isValid () const |
| Function that checks if the underlying stream buffer handle is not NULL. This should be used to ensure a stream buffer has been created correctly. | |
| size_t | send (const void *data, const size_t length, const TickType_t ticksToWait=portMAX_DELAY) const |
Function that calls size_t xStreamBufferSend(
StreamBufferHandle_t xStreamBuffer, const void *pvTxData, size_t
xDataLengthBytes, TickType_t xTicksToWait ) | |
| size_t | sendFromISR (bool &higherPriorityTaskWoken, const void *data, const size_t length) const |
Function that calls size_t xStreamBufferSendFromISR(
StreamBufferHandle_t xStreamBuffer, const void *pvTxData, size_t
xDataLengthBytes, BaseType_t *pxHigherPriorityTaskWoken ) | |
| size_t | sendFromISR (const void *data, const size_t length) const |
Function that calls size_t xStreamBufferSendFromISR(
StreamBufferHandle_t xStreamBuffer, const void *pvTxData, size_t
xDataLengthBytes, BaseType_t *pxHigherPriorityTaskWoken ) | |
| size_t | receive (void *buffer, const size_t bufferLength, const TickType_t ticksToWait=portMAX_DELAY) const |
Function that calls size_t xStreamBufferReceive(
StreamBufferHandle_t xStreamBuffer, void *pvRxData, size_t
xBufferLengthBytes, TickType_t xTicksToWait ) | |
| size_t | receiveFromISR (bool &higherPriorityTaskWoken, void *buffer, const size_t bufferLength) const |
Function that calls size_t xStreamBufferReceiveFromISR(
StreamBufferHandle_t xStreamBuffer, void *pvRxData, size_t
xBufferLengthBytes, BaseType_t *pxHigherPriorityTaskWoken ) | |
| size_t | receiveFromISR (void *buffer, const size_t bufferLength) const |
Function that calls size_t xStreamBufferReceiveFromISR(
StreamBufferHandle_t xStreamBuffer, void *pvRxData, size_t
xBufferLengthBytes, BaseType_t *pxHigherPriorityTaskWoken ) | |
| size_t | bytesAvailable () const |
Function that calls size_t xStreamBufferBytesAvailable(
StreamBufferHandle_t xStreamBuffer ) | |
| size_t | spacesAvailable () const |
Function that calls size_t xStreamBufferSpacesAvailable(
StreamBufferHandle_t xStreamBuffer ) | |
| bool | setTriggerLevel (const size_t triggerLevel=0) const |
Function that calls BaseType_t xStreamBufferSetTriggerLevel(
StreamBufferHandle_t xStreamBuffer, size_t xTriggerLevel ) | |
| bool | reset () const |
Function that calls BaseType_t xStreamBufferReset(
StreamBufferHandle_t xStreamBuffer ) | |
| bool | isEmpty () const |
Function that calls BaseType_t xStreamBufferIsEmpty(
StreamBufferHandle_t xStreamBuffer ) | |
| bool | isFull () const |
Function that calls BaseType_t xStreamBufferIsFull(
StreamBufferHandle_t xStreamBuffer ) | |
Additional Inherited Members | |
Static Public Member Functions inherited from FreeRTOS::StreamBufferBase | |
| static void * | operator new (size_t)=delete |
| static void * | operator new[] (size_t)=delete |
| static void * | operator new (size_t, void *ptr) |
| static void * | operator new[] (size_t, void *ptr) |
Class that encapsulates the functionality of a FreeRTOS stream buffer.
A stream buffer using dynamically allocated memory from the FreeRTOS heap. See FreeRTOS::StaticStreamBuffer for a version that uses statically allocated memory (memory that is allocated at compile time).
|
inlineexplicit |
Construct a new StreamBuffer object by calling StreamBufferHandle_t xStreamBufferCreate( size_t xBufferSizeBytes,
size_t xTriggerLevelBytes )
| size | The total number of bytes the stream buffer will be able to hold at any one time. |
| triggerLevel | The number of bytes that must be in the stream buffer before a task that is blocked on the stream buffer to wait for data is moved out of the blocked state. For example, if a task is blocked on a read of an empty stream buffer that has a trigger level of 1 then the task will be unblocked when a single byte is written to the buffer or the task's block time expires. As another example, if a task is blocked on a read of an empty stream buffer that has a trigger level of 10 then the task will not be unblocked until the stream buffer contains at least 10 bytes or the task's block time expires. If a reading task's block time expires before the trigger level is reached then the task will still receive however many bytes are actually available. Setting a trigger level of 0 will result in a trigger level of 1 being used. It is not valid to specify a trigger level that is greater than the buffer size. |
Example Usage