Components/Libraries/XF/FreeRTOS/Queue
Queue
The class Queue is a C++ interface that manage a FreeRTOS queue.
Member Attibuts
Queue()
Description
The constructor of the queue. It will create an uninitialized FreeRTOS queue. It mean that the queue is created but could not be used. Call initQueue to initialize it.
Parameters
oSizeofObject : the size of the element that must be contained by the Queue
Queue(baseUInt oSizeofObject)
Description
The constructor of the queue. It will create a free RTOS queue and initialize it for the given object size.
Parameters
oSizeofObject : the size of the element that must be contained by the Queue
~Queue()
Description
The destructor of the Queue. It will delete the free RTOS queue.
Not that if the queue contains pointer, the objects must be deleted manually
bool initQueue(baseUInt oSizeofObject)
Description
Initialize the queue for the given size of object
Parameters
oSizeofObject : the size of the element that must be contained by the queue
Return
Return true if the Queue has been initialized correctly, else false
bool push(void* opEl, timeSize oTimeToWait)
Description
Add an element to the queue.
This will just push a pointer to the element and not a copy. see pushCopy if you want to add a copy of the element
Parameters
opEl : a pointer to the element to add oTimeToWait : maximal amount of time (in ms) that thread should wait if queue is full
Return
Return true if the element has been pushed successfully, else false.
bool pushCopy(void* opEl, TickType_t oTimeToWait)
Description
Add a copy of the element to the queue.
IMPORTANT do not use this function if elements to add are pointers.
Parameters
opEl : a pointer to the element to add oTimeToWait : maximal amount of time (in ms) that thread should wait if queue is full
Return
Return true if a copy of the element has been pushed successfully in the Queue
bool pushFromISR(void* opEl)
Description
Add a pointer to the element in the queue from an ISR.
Parameters
opEl : a pointer to the element to add
Return
Return true if the element has been pushed successfully
bool pushCopyFromISR(void* opEl)
Description
Add a copy of the element to the queue from an ISR.
Parameters
opEl : a pointer to the element to add
Return
Return true if a copy of the element has beem sent successfully
void* pop(timeSize oTimeToWait)
Description
Return the first element of the queue and removes it from the queue.
Parameters
opEl : a point to the element where put the item oTimeToWait : maximal amount of time (in ms) that thread should wait if queue is empty (Normally set as INFINIT_TIME)
void* popFromISR()
Description
Return the first event of the queue and removes it from the queue from an ISR.
Parameters
opEl : a point to the element where put the item
void* peek(timeSize oTimeToWait)
Description
Return the first element of the queue (but does not delete it).
Parameters
opEl : a pointer to the element where put the item oTimeToWait : maximal amount of time (in ticks) that thread should wait if queue is empty
void* peekFromISR()
Description
Return the first event of the queue from an ISR (but does not delete it).
Parameters
opEl : a point to the element where put the item
bool isEmpty()
Description
Test if the event queue is empty. If yes it returns true else false