Espressif ESP32-S2 Programming Manual page 911

Table of Contents

Advertisement

Chapter 2. API Reference
// ...
if( xHigherPrioritytaskWoken
{
//
Writing to the queue caused a task to unblock
//
has a priority higher than
//
executing task (the task this interrupt
context
//
switch so this interrupt returns directly to the unblocked
portYIELD_FROM_ISR();
}
}
Return xQueueOverwriteFromISR() is a macro that calls xQueueGenericSendFromISR(), and therefore has
the same return values as xQueueSendToFrontFromISR(). However, pdPASS is the only value that can
be returned because xQueueOverwriteFromISR() will write to the queue even when the queue is already
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: xQueueOverwriteFromISR() will set *pxHigher-
PriorityTaskWoken to pdTRUE if sending to the queue caused a task to unblock, and the unblocked
task has a priority higher than the currently running task. If xQueueOverwriteFromISR() sets this
value to pdTRUE then a context switch should be requested before the interrupt is exited.
xQueueSendFromISR(xQueue, pvItemToQueue, pxHigherPriorityTaskWoken)
This is a macro that calls xQueueGenericSendFromISR(). It is included for backward compatibility with
versions of FreeRTOS.org that did not include the xQueueSendToBackFromISR() and xQueueSendToFront-
FromISR() macros.
Post an item to the back of a queue. It is safe to use this function from within an interrupt service routine.
Items are queued by copy not reference so it is preferable to only queue small items, especially when called
from an ISR. In most cases it would be preferable to store a pointer to the item being queued.
Example usage for buffered IO (where the ISR can obtain more than one value per call):
void vBufferISR( void )
{
char cIn;
BaseType_t xHigherPriorityTaskWoken;
//
We have
not
xHigherPriorityTaskWoken
//
Loop until the buffer
do
{
//
Obtain a byte
cIn
=
portINPUT_BYTE( RX_REGISTER_ADDRESS );
//
Post the
xQueueSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );
} while( portINPUT_BYTE( BUFFER_COUNT ) );
//
Now the buffer
if( xHigherPriorityTaskWoken )
{
Espressif Systems
==
pdTRUE )
or
//
or
portEND_SWITCHING_ISR() depending on the
woken a task at the start of the
=
pdFALSE;
is
empty.
from
the
buffer.
byte.
is
empty we can switch context
Submit Document Feedback
and
equal to the priority of the currently
interrupted).
ISR.
if
necessary.
900
(continued from previous page)
the unblocked task
Perform
a␣
task.
port.
(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