Espressif ESP32-S2 Programming Manual page 907

Table of Contents

Advertisement

Chapter 2. API Reference
struct AMessage
{
char ucMessageID;
char ucData[
20
} xMessage;
uint32_t ulVar
void vATask( void *pvParameters )
{
QueueHandle_t xQueue1, xQueue2;
struct AMessage *pxMessage;
//
Create a queue capable of containing
xQueue1
=
xQueueCreate( 10, sizeof( uint32_t ) );
//
Create a queue capable of containing
//
These should be passed by pointer
xQueue2
=
xQueueCreate( 10, sizeof( struct AMessage
// ...
if( xQueue1
!=
{
//
Send an
//
available
if( xQueueSend( xQueue1, ( void
)
{
//
Failed to post the message, even after
}
}
if( xQueue2
!=
{
//
Send a pointer to a struct AMessage
//
queue
is
pxMessage
xQueueSend( xQueue2, ( void
}
// ...
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.
xQueueOverwrite(xQueue, pvItemToQueue)
Only for use with queues that have a length of one - so the queue is either empty or full.
Post an item on a queue. If the queue is already full then overwrite the value held in the queue. The item is
queued by copy, not by reference.
This function must not be called from an interrupt service routine. See xQueueOverwriteFromISR () for an
alternative which may be used in an ISR.
Espressif Systems
];
=
10UL;
0
)
uint32_t.
Wait
for
if
necessary.
0
)
already
full.
= &
xMessage;
*
code.
Submit Document Feedback
10
uint32_t
values.
10
pointers to AMessage
as
they contain a lot of
*
10
ticks
for
space to become
*
) &ulVar, ( TickType_t )
10
ticks.
object.
Don't block if the
) &pxMessage, ( TickType_t )
896
structures.
data.
) );
10
)
!=
pdPASS␣
0
);
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?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents

Save PDF