Espressif ESP32-S2 Programming Manual page 910

Table of Contents

Advertisement

Chapter 2. API Reference
//
Post the
xQueueSendToBackFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );
} while( portINPUT_BYTE( BUFFER_COUNT ) );
//
Now the buffer
if( xHigherPriorityTaskWoken )
{
portYIELD_FROM_ISR ();
}
}
Return pdTRUE if the data was successfully sent to the queue, 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.
• [out] pxHigherPriorityTaskWoken: xQueueSendToBackFromISR() will set *pxHigh-
erPriorityTaskWoken to pdTRUE if sending to the queue caused a task to unblock, and the un-
blocked task has a priority higher than the currently running task. If xQueueSendToBackFromISR()
sets this value to pdTRUE then a context switch should be requested before the interrupt is exited.
xQueueOverwriteFromISR(xQueue, pvItemToQueue, pxHigherPriorityTaskWoken)
A version of xQueueOverwrite() that can be used in an interrupt service routine (ISR).
Only for use with queues that can hold a single item - 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.
Example usage:
QueueHandle_t xQueue;
void vFunction( void *pvParameters )
{
//
Create a queue to hold one uint32_t
//
recommended
//
contain more than one value,
//
if
configASSERT()
xQueue
=
xQueueCreate( 1, sizeof( uint32_t ) );
}
void vAnInterruptHandler( void )
{
//
xHigherPriorityTaskWoken must be
BaseType_t xHigherPriorityTaskWoken
uint32_t ulVarToSend, ulValReceived;
//
Write the value
ulVarToSend
=
xQueueOverwriteFromISR( xQueue, &ulVarToSend, &xHigherPriorityTaskWoken );
//
The queue
is
//
pass
because the value held
//
new
value.
ulVarToSend
=
xQueueOverwriteFromISR( xQueue, &ulVarToSend, &xHigherPriorityTaskWoken );
//
Reading
from
Espressif Systems
byte.
is
empty we can switch context
*not*
to use xQueueOverwriteFromISR() on queues that can
and
is
defined.
10
to the queue using
10;
full, but calling xQueueOverwriteFromISR() again will still
in
100;
the
queue will now
Submit Document Feedback
if
necessary.
value.
It
is
strongly
doing so will trigger an assertion
set
to pdFALSE before it
=
pdFALSE;
xQueueOverwriteFromISR().
the queue will be overwritten
return
100.
899
(continued from previous page)
is
used.
with
the
(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