ME507 Utility Library
0.2.1
Mechatronics Course Support Software for ARM/Arduino/FreeRTOS
|
Go to the documentation of this file.
142 Queue (BaseType_t queue_size,
const char* p_name = NULL,
143 TickType_t = portMAX_DELAY);
146 bool put (
const dataType item);
151 bool ISR_put (
const dataType item);
184 return (uxQueueMessagesWaiting (
handle) == 0);
195 return (uxQueueMessagesWaitingFromISR (
handle) == 0);
208 void get (dataType& recv_item)
226 dataType return_this;
240 portBASE_TYPE task_awakened;
244 xQueueReceiveFromISR (
handle, &recv_item, &task_awakened);
257 portBASE_TYPE task_awakened;
259 dataType return_this;
260 xQueueReceiveFromISR (
handle, &return_this, &task_awakened);
275 void peek (dataType& recv_item)
312 portBASE_TYPE task_awakened;
316 xQueuePeekFromISR (
handle, &recv_item, &task_awakened);
330 portBASE_TYPE task_awakened;
332 xQueuePeekFromISR (
handle, &recv_item, &task_awakened);
344 return (uxQueueMessagesWaiting (
handle) != 0);
358 if (CHECK_IF_IN_ISR ())
382 if (CHECK_IF_IN_ISR ())
384 portBASE_TYPE task_awakened;
387 xQueueReceiveFromISR (
handle, &put_here, &task_awakened);
404 return (uxQueueMessagesWaitingFromISR (
handle) != 0);
416 return (uxQueueMessagesWaiting (
handle));
427 return (uxQueueMessagesWaitingFromISR (
handle));
475 template <
class dataType>
477 TickType_t wait_time)
481 handle = xQueueCreate (queue_size,
sizeof (dataType));
503 template <
class dataType>
506 bool return_value = (bool)(xQueueSendToBack (handle, &item,
510 uint16_t fillage = uxQueueMessagesWaiting (handle);
511 if (fillage > max_full)
516 return (return_value);
527 template <
class dataType>
531 signed portBASE_TYPE shouldSwitch = pdFALSE;
536 return_value = (bool)(xQueueSendToBackFromISR (handle, &item,
541 uint16_t fillage = uxQueueMessagesWaitingFromISR (handle);
542 if (fillage > max_full)
548 return (return_value);
559 template <
class dataType>
563 signed portBASE_TYPE shouldSwitch = pdFALSE;
568 return_value = (bool)(xQueueSendToFrontFromISR (handle, &item,
572 return (return_value);
582 template <
class dataType>
586 print_dev.printf (
"%-16squeue\t", name);
592 print_dev << max_full <<
'/' << buf_size << endl;
596 print_dev <<
"UNUSABLE" << endl;
602 p_next->print_in_list (print_dev);
606 #endif // _TASKQUEUE_H_
TickType_t ticks_to_wait
RTOS ticks to wait for empty.
Definition: taskqueue.h:134
bool ISR_any(void)
Return true if the queue has items in it, from within an ISR.
Definition: taskqueue.h:402
bool ISR_is_empty(void)
Return true if the queue is empty, from within an ISR.
Definition: taskqueue.h:193
uint16_t max_full
Maximum number of bytes in queue.
Definition: taskqueue.h:136
bool ISR_put(const dataType item)
Put an item into the queue from within an ISR.
Definition: taskqueue.h:528
void peek(dataType &recv_item)
Get the item at the queue head without removing it.
Definition: taskqueue.h:275
unsigned portBASE_TYPE ISR_available(void)
Return the number of items in the queue, to an ISR.
Definition: taskqueue.h:425
bool is_empty(void)
Return true if the queue is empty.
Definition: taskqueue.h:182
dataType get(void)
Retrieve, remove, and return the item at the head of the queue.
Definition: taskqueue.h:224
bool any(void)
Return true if the queue has contents which can be read.
Definition: taskqueue.h:342
bool usable(void)
Indicates whether this queue is usable.
Definition: taskqueue.h:444
dataType ISR_peek(void)
Return a copy of the item at the front of the queue without deleting it, from within an ISR.
Definition: taskqueue.h:328
QueueHandle_t get_handle(void)
Return a handle to the FreeRTOS structure which runs this queue.
Definition: taskqueue.h:458
unsigned portBASE_TYPE available(void)
Return the number of items in the queue.
Definition: taskqueue.h:414
void operator<<(dataType new_data)
Operator which inserts data into the queue.
Definition: taskqueue.h:356
void get(dataType &recv_item)
Retrieve and remove the item at the head of the queue.
Definition: taskqueue.h:208
void print_in_list(Print &print_dev)
Print the queue's status to a serial device.
Definition: taskqueue.h:583
dataType peek(void)
Return a copy of the item at the queue head without removing it.
Definition: taskqueue.h:293
bool butt_in(const dataType item)
Put an item into the front of the queue to be retrieved first.
Definition: taskqueue.h:167
dataType ISR_get(void)
Retrieve, remove, and return the item at the head of the queue when called by ISR code.
Definition: taskqueue.h:255
QueueHandle_t handle
Hhandle for the FreeTOS queue.
Definition: taskqueue.h:133
Headers for a base class for type-safe, thread-safe task data exchange classes.
Queue(BaseType_t queue_size, const char *p_name=NULL, TickType_t=portMAX_DELAY)
Construct a queue object, allocating memory for the buffer.
Definition: taskqueue.h:476
Implements a queue to transmit data from one RTOS task to another.
Definition: taskqueue.h:128
uint16_t buf_size
Size of queue buffer in bytes.
Definition: taskqueue.h:135
void operator>>(dataType &put_here)
Read data from the queue.
Definition: taskqueue.h:380
bool ISR_butt_in(const dataType item)
Put an item into the front of the queue from within an ISR.
Definition: taskqueue.h:560
void ISR_get(dataType &recv_item)
Remove the item at the head of the queue from within an ISR.
Definition: taskqueue.h:238
bool put(const dataType item)
Put an item into the queue behind other items.
Definition: taskqueue.h:504
void ISR_peek(dataType &recv_item)
Get the item at the front of the queue without deleting it, from within an ISR.
Definition: taskqueue.h:310
Base class for classes that share data in a thread-safe manner between tasks.
Definition: baseshare.h:54