Chapter 2. API Reference
char ucData[
20
};
#define QUEUE_LENGTH 10
#define ITEM_SIZE sizeof( uint32_t )
//
xQueueBuffer will hold the queue
StaticQueue_t xQueueBuffer;
//
ucQueueStorage will hold the items posted to the
//
[(queue length)
uint8_t ucQueueStorage[ QUEUE_LENGTH
void vATask( void *pvParameters )
{
QueueHandle_t xQueue1;
//
Create a queue capable of containing
xQueue1
=
xQueueCreate( QUEUE_LENGTH,
hold.
→
hold the items
→
queue
structure.
→
//
The queue
is
//
allocation
// ...
Rest of task
}
Return If the queue is created then a handle to the created queue is returned. If pxQueueBuffer is NULL
then NULL is returned.
Parameters
• uxQueueLength: The maximum number of items that the queue can contain.
• uxItemSize: The number of bytes each item in the queue will require. Items are queued by copy,
not by reference, so this is the number of bytes that will be copied for each posted item. Each item
on the queue must be the same size.
• pucQueueStorage: If uxItemSize is not zero then pucQueueStorageBuffer must point to a
uint8_t array that is at least large enough to hold the maximum number of items that can be in
the queue at any one time - which is ( uxQueueLength * uxItemsSize ) bytes. If uxItemSize is zero
then pucQueueStorageBuffer can be NULL.
• pxQueueBuffer: Must point to a variable of type StaticQueue_t, which will be used to hold the
queue's data structure.
xQueueSendToFront(xQueue, pvItemToQueue, xTicksToWait)
Post an item to the front of a queue. The item is queued by copy, not by reference. This function must not be
called from an interrupt service routine. See xQueueSendFromISR () for an alternative which may be used in
an ISR.
Example usage:
struct AMessage
{
char ucMessageID;
char ucData[
20
} xMessage;
uint32_t ulVar
Espressif Systems
];
*
( queue item size)]
ITEM_SIZE
&( ucQueueStorage[
in
the
queue.
&xQueueBuffer );
guaranteed to be created successfully
is
used.
Therefore xQueue1
code.
];
=
10UL;
Submit Document Feedback
structure.
queue.
bytes
long.
*
ITEM_SIZE ];
10
uint32_t
values.
//
The number of items the queue
//
The size of each item
0
] ),
//
The buffer that
//
The buffer that will hold
is
now a handle to a valid
893
(continued from previous page)
Must be at least
can␣
in
the queue
will␣
the␣
as
no dynamic memory
queue.
(continues on next page)
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers