42#if FREERTOSCPP_USE_NAMESPACE
62 QueueBase(QueueHandle_t handle_) : queueHandle(handle_) {};
68 vQueueDelete(queueHandle);
76 return uxQueueMessagesWaiting(queueHandle);
84 return uxQueueSpacesAvailable(queueHandle);
92 xQueueReset(queueHandle);
100 return 0 == uxQueueSpacesAvailable(queueHandle);
108 return uxQueueMessagesWaiting(queueHandle) == 0;
117 return xQueueIsQueueFullFromISR(queueHandle);
126 return xQueueIsQueueEmptyFromISR(queueHandle);
135 return uxQueueMessagesWaitingFromISR(queueHandle);
142#if __cplusplus < 201101L
171 bool push(T
const& item, TickType_t time = portMAX_DELAY){
172 return xQueueSendToFront(queueHandle, &item, time);
174#if FREERTOSCPP_USE_CHRONO
182 bool push(T
const& item, Time_ms time){
183 return xQueueSendToFront(queueHandle, &item, ms2ticks(time));
193 bool add(T
const& item, TickType_t time = portMAX_DELAY){
194 return xQueueSendToBack(queueHandle, &item, time);
196#if FREERTOSCPP_USE_CHRONO
204 bool add(T
const& item, Time_ms time){
205 return xQueueSendToBack(queueHandle, &item, ms2ticks(time));
215 bool pop(T& var, TickType_t time = portMAX_DELAY) {
216 return xQueueReceive(queueHandle, &var, time);
218#if FREERTOSCPP_USE_CHRONO
226 bool pop(T& var, Time_ms time) {
227 return xQueueReceive(queueHandle, &var, ms2ticks(time));
238 bool peek(T& var, TickType_t time = 0) {
239 return xQueuePeek(queueHandle, &var, time);
241#if FREERTOSCPP_USE_CHRONO
249 bool peek(T& var, Time_ms time) {
250 return xQueuePeek(queueHandle, &var, ms2ticks(time));
263 bool push_ISR(T
const& item, portBASE_TYPE& waswoken){
264 return xQueueSendToFrontFromISR(queueHandle, &item, &waswoken);
276 bool add_ISR(T
const& item, portBASE_TYPE& waswoken){
277 return xQueueSendToBackFromISR(queueHandle, &item, &waswoken);
289 bool pop_ISR(T& var, portBASE_TYPE& waswoken) {
290 return xQueueReceiveFromISR(queueHandle, &var, &waswoken);
303 return xQueuePeekFromISR(queueHandle, &var);
324template<
class T,
unsigned queueLength
325#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
338#if( configSUPPORT_STATIC_ALLOCATION == 1 )
339 xQueueCreateStatic(queueLength, sizeof(T), reinterpret_cast<uint8_t*>(&queueStore), &queueBuff)
341 xQueueCreate(queueLength, sizeof(T))
345#if configQUEUE_REGISTRY_SIZE > 0
347 vQueueAddToRegistry(this->queueHandle, name);
352#if( configSUPPORT_STATIC_ALLOCATION == 1 )
353 StaticQueue_t queueBuff;
354 T queueStore[queueLength];
358#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
368 Queue(
unsigned portBASE_TYPE length,
char const* name = 0) :
371#if configQUEUE_REGISTRY_SIZE > 0
373 vQueueAddToRegistry(this->queueHandle, name);
381#if FREERTOSCPP_USE_NAMESPACE
Base Queue Wrapper.
Definition QueueCPP.h:54
QueueBase(QueueBase const &)=delete
We are not copyable.
QueueBase(QueueHandle_t handle_)
Constructor.
Definition QueueCPP.h:62
unsigned waiting_ISR()
Get number of message waiting.
Definition QueueCPP.h:134
unsigned available() const
Return number of spaces available in Queue.
Definition QueueCPP.h:83
virtual ~QueueBase()
Destructor.
Definition QueueCPP.h:67
unsigned waiting() const
Get number of items in the Queue.
Definition QueueCPP.h:75
bool full()
Check if Queue is Full.
Definition QueueCPP.h:99
bool empty()
Check if Queue is Empty.
Definition QueueCPP.h:107
QueueHandle_t queueHandle
Definition QueueCPP.h:139
bool full_ISR()
Is Queue Full.
Definition QueueCPP.h:116
bool empty_ISR()
Is Queue Empty.
Definition QueueCPP.h:125
void reset()
Reset the Queue.
Definition QueueCPP.h:91
Queue Wrapper.
Definition QueueCPP.h:328
Queue(char const *name=0)
Constructor.
Definition QueueCPP.h:335
Typed Queue Wrapper.
Definition QueueCPP.h:159
bool peek(T &var, TickType_t time=0)
Look at the first item in the Queue.
Definition QueueCPP.h:238
QueueTypeBase(QueueHandle_t handle_)
Definition QueueCPP.h:161
bool push_ISR(T const &item, portBASE_TYPE &waswoken)
Push an item onto the Queue.
Definition QueueCPP.h:263
bool pop(T &var, TickType_t time=portMAX_DELAY)
Get an item from the Queue.
Definition QueueCPP.h:215
bool add_ISR(T const &item, portBASE_TYPE &waswoken)
add an item at end of the Queue.
Definition QueueCPP.h:276
bool add(T const &item, TickType_t time=portMAX_DELAY)
add an item at end of the Queue.
Definition QueueCPP.h:193
bool push(T const &item, TickType_t time=portMAX_DELAY)
Push an item onto the Queue.
Definition QueueCPP.h:171
bool peek_ISR(T &var, portBASE_TYPE &waswoken)
Look at the first item in the Queue.
Definition QueueCPP.h:302
bool pop_ISR(T &var, portBASE_TYPE &waswoken)
Get an item from the Queue.
Definition QueueCPP.h:289
Definition FreeRTOScpp.h:74