Chapter 2. API Reference
struct AMessage *pxMessage;
//
Create a queue capable of containing
//
These should be passed by pointer
xQueue
=
xQueueCreate( 10, sizeof( struct AMessage
if( xQueue
==
{
//
Failed to create the
}
// ...
//
Send a pointer to a struct AMessage
//
queue
is
already
pxMessage
= &
xQueueSend( xQueue, ( void
// ...
Rest of task
}
//
Task to peek the data
void vADifferentTask( void *pvParameters )
{
struct AMessage *pxRxedMessage;
if( xQueue
!=
{
//
Peek a message on the created
//
message
if( xQueuePeek( xQueue, &( pxRxedMessage ), ( TickType_t )
{
//
pcRxedMessage now points to the struct AMessage variable posted
//
by vATask, but the item still remains on the
}
}
// ...
Rest of task
}
Return pdTRUE if an item was successfully received from the queue, otherwise pdFALSE.
Parameters
• xQueue: The handle to the queue from which the item is to be received.
• pvBuffer: Pointer to the buffer into which the received item will be copied.
• xTicksToWait: The maximum amount of time the task should block waiting for an item to
receive should the queue be empty at the time of the call. 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.
xQueuePeek() will return immediately if xTicksToWait is 0 and the queue is empty.
BaseType_t
xQueuePeekFromISR(QueueHandle_t
A version of xQueuePeek() that can be called from an interrupt service routine (ISR).
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().
Return pdTRUE if an item was successfully received from the queue, otherwise pdFALSE.
Parameters
• xQueue: The handle to the queue from which the item is to be received.
• pvBuffer: Pointer to the buffer into which the received item will be copied.
Espressif Systems
0
)
queue.
full.
xMessage;
*
) &pxMessage, ( TickType_t )
code.
from
the
queue.
0
)
is not
immediately
code.
Submit Document Feedback
10
pointers to AMessage
as
they contain a lot of
*
) );
object.
Don't block if the
queue.
Block
for
available.
xQueue, void *const pvBuffer)
885
(continued from previous page)
structures.
data.
0
);
10
ticks
if
a
10
) )
queue.
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?