FreeRTOS-Cpp
Public Member Functions | Private Attributes | List of all members
FreeRTOS::StaticQueue< T, N > Class Template Reference

Class that encapsulates the functionality of a FreeRTOS queue. More...

#include <FreeRTOS/Queue.hpp>

Inheritance diagram for FreeRTOS::StaticQueue< T, N >:
Inheritance graph
[legend]
Collaboration diagram for FreeRTOS::StaticQueue< T, N >:
Collaboration graph
[legend]

Public Member Functions

 StaticQueue ()
 Construct a new StaticQueue object by calling QueueHandle_t xQueueCreateStatic( UBaseType_t uxQueueLength, UBaseType_t uxItemSize, uint8_t *pucQueueStorageBuffer, StaticQueue_t *pxQueueBuffer ) More...
 
 StaticQueue (const StaticQueue &)=delete
 
StaticQueueoperator= (const StaticQueue &)=delete
 
 StaticQueue (StaticQueue &&) noexcept=default
 
StaticQueueoperator= (StaticQueue &&) noexcept=default
 
- Public Member Functions inherited from FreeRTOS::QueueBase< T >
 QueueBase (const QueueBase &)=delete
 
QueueBaseoperator= (const QueueBase &)=delete
 
bool isValid () const
 Function that checks if the underlying queue handle is not NULL. This should be used to ensure a queue has been created correctly. More...
 
bool sendToBack (const T &item, const TickType_t ticksToWait=portMAX_DELAY) const
 Function that calls xQueueSendToBack( xQueue, pvItemToQueue, xTicksToWait ) More...
 
bool sendToBackFromISR (bool &higherPriorityTaskWoken, const T &item) const
 Function that calls xQueueSendToBackFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) More...
 
bool sendToBackFromISR (const T &item) const
 Function that calls xQueueSendToBackFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) More...
 
bool sendToFront (const T &item, const TickType_t ticksToWait=portMAX_DELAY) const
 Function that calls xQueueSendToFront( xQueue, pvItemToQueue, xTicksToWait ) More...
 
bool sendToFrontFromISR (bool &higherPriorityTaskWoken, const T &item) const
 Function that calls xQueueSendToFrontFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) More...
 
bool sendToFrontFromISR (const T &item) const
 Function that calls xQueueSendToFrontFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) More...
 
std::optional< T > receive (const TickType_t ticksToWait=portMAX_DELAY) const
 Function that calls BaseType_t xQueueReceive( QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait ) More...
 
std::optional< T > receiveFromISR (bool &higherPriorityTaskWoken) const
 Function that calls BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue, void *pvBuffer, BaseType_t *pxHigherPriorityTaskWoken ) More...
 
std::optional< T > receiveFromISR () const
 Function that calls BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue, void *pvBuffer, BaseType_t *pxHigherPriorityTaskWoken ) More...
 
UBaseType_t messagesWaiting () const
 Function that calls UBaseType_t uxQueueMessagesWaiting( QueueHandle_t xQueue ) More...
 
UBaseType_t messagesWaitingFromISR () const
 Function that calls UBaseType_t uxQueueMessagesWaitingFromISR( QueueHandle_t xQueue ) More...
 
UBaseType_t spacesAvailable () const
 Function that calls UBaseType_t uxQueueSpacesAvailable( QueueHandle_t xQueue ) More...
 
void reset () const
 Function that calls BaseType_t xQueueReset( QueueHandle_t xQueue ) More...
 
void overwrite (const T &item) const
 Function that calls BaseType_t xQueueOverwrite( QueueHandle_t xQueue, const void * pvItemToQueue ) More...
 
void overwriteFromISR (bool &higherPriorityTaskWoken, const T &item) const
 Function that calls BaseType_t xQueueOverwriteFromISR( QueueHandle_t xQueue, const void * pvItemToQueue, BaseType_t *pxHigherPriorityTaskWoken ) More...
 
void overwriteFromISR (const T &item) const
 Function that calls BaseType_t xQueueOverwriteFromISR( QueueHandle_t xQueue, const void * pvItemToQueue, BaseType_t *pxHigherPriorityTaskWoken ) More...
 
std::optional< T > peek (const TickType_t ticksToWait=portMAX_DELAY) const
 Function that calls BaseType_t xQueuePeek( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait ) More...
 
std::optional< T > peekFromISR () const
 Function that calls BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, void *pvBuffer ) More...
 
void addToRegistry (const char *name) const
 Function that calls void vQueueAddToRegistry( QueueHandle_t xQueue, char *pcQueueName ) More...
 
void unregister () const
 Function that calls void vQueueUnregisterQueue( QueueHandle_t xQueue ) More...
 
const char * getName () const
 Function that calls const char *pcQueueGetName( QueueHandle_t xQueue ) More...
 
bool isFullFromISR () const
 Function that calls BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) More...
 
bool isEmptyFromISR () const
 Function that calls BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) More...
 

Private Attributes

StaticQueue_t staticQueue
 
uint8_t storage [N *sizeof(T)]
 

Additional Inherited Members

- Static Public Member Functions inherited from FreeRTOS::QueueBase< T >
static void * operator new (size_t, void *ptr)
 
static void * operator new[] (size_t, void *ptr)
 
static void * operator new (size_t)=delete
 
static void * operator new[] (size_t)=delete
 

Detailed Description

template<class T, UBaseType_t N>
class FreeRTOS::StaticQueue< T, N >

Class that encapsulates the functionality of a FreeRTOS queue.

If a queue is created using this class then the RAM is provided by the application writer as part of the object instance and allows the RAM to be statically allocated at compile time.

Template Parameters
TType to be stored in the queue.
NThe maximum number of items the queue can hold at any one time.

Constructor & Destructor Documentation

◆ StaticQueue()

template<class T , UBaseType_t N>
FreeRTOS::StaticQueue< T, N >::StaticQueue ( )
inline

Construct a new StaticQueue object by calling QueueHandle_t xQueueCreateStatic( UBaseType_t uxQueueLength, UBaseType_t uxItemSize, uint8_t *pucQueueStorageBuffer, StaticQueue_t *pxQueueBuffer )

Queue.hpp

See also
https://www.freertos.org/xQueueCreateStatic.html
Warning
This class contains the storage buffer for the queue, so the user should create this object as a global object or with the static storage specifier so that the object instance is not on the stack.

Example Usage

#include <FreeRTOS/Queue.hpp>
#include <FreeRTOS/Task.hpp>
class MyTask : public FreeRTOS::Task {
public:
void taskFunction() final;
};
void MyTask::taskFunction() {
// The queue is to be created to hold a maximum of 10 uint64_t variables.
// Queue should be valid
configASSERT(queue.isValid());
}
bool isValid() const
Function that checks if the underlying queue handle is not NULL. This should be used to ensure a queu...
Definition: Queue.hpp:75
Class that encapsulates the functionality of a FreeRTOS queue.
Definition: Queue.hpp:698
Class that encapsulates the functionality of a FreeRTOS task.
Definition: Task.hpp:1323

The documentation for this class was generated from the following file: