Espressif ESP32-S2 Programming Manual page 895

Table of Contents

Advertisement

Chapter 2. API Reference
if( xQueue1
!=
{
//
Send an
//
available
if( xQueueGenericSend( xQueue1, ( void
queueSEND_TO_BACK )
{
//
Failed to post the message, even after
}
}
if( xQueue2
!=
{
//
Send a pointer to a struct AMessage
//
queue
is
pxMessage
xQueueGenericSend( xQueue2, ( void
queueSEND_TO_BACK );
}
// ...
Rest of task
}
Return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
Parameters
• xQueue: The handle to the queue on which the item is to be posted.
• pvItemToQueue: A pointer to the item that is to be placed on the queue. The size of the items
the queue will hold was defined when the queue was created, so this many bytes will be copied from
pvItemToQueue into the queue storage area.
• xTicksToWait: The maximum amount of time the task should block waiting for space to become
available on the queue, should it already be full. The call will return immediately if this is set to 0
and the queue is full. The time is defined in tick periods so the constant portTICK_PERIOD_MS
should be used to convert to real time if this is required.
• xCopyPosition: Can take the value queueSEND_TO_BACK to place the item at the back of
the queue, or queueSEND_TO_FRONT to place the item at the front of the queue (for high priority
messages).
BaseType_t
xQueuePeek(QueueHandle_t
Receive an item from a queue without removing the item from the queue. The item is received by copy so a
buffer of adequate size must be provided. The number of bytes copied into the buffer was defined when the
queue was created.
Successfully received items remain on the queue so will be returned again by the next call, or a call to
xQueueReceive().
This macro must not be used in an interrupt service routine. See xQueuePeekFromISR() for an alternative that
can be called from an interrupt service routine.
Example usage:
struct AMessage
{
char ucMessageID;
char ucData[
20
} xMessage;
QueueHandle_t xQueue;
//
Task to create a queue
void vATask( void *pvParameters )
{
Espressif Systems
0
)
uint32_t.
Wait
for
if
necessary.
!=
pdPASS )
0
)
already
full.
= &
xMessage;
code.
xQueue, void *const pvBuffer, TickType_t xTicksToWait)
];
and
post a
Submit Document Feedback
10
ticks
for
space to become
*
) &ulVar, ( TickType_t )
10
ticks.
object.
Don't block if the
*
) &pxMessage, ( TickType_t )
value.
884
(continued from previous page)
10,␣
0,␣
(continues on next page)
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF