Chapter 2. API Reference
• 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. xQueueReceive() will return immediately
if xTicksToWait is zero and the queue is empty. 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.
UBaseType_t uxQueueMessagesWaiting(const
Return the number of messages stored in a queue.
Return The number of messages available in the queue.
Parameters
• xQueue: A handle to the queue being queried.
UBaseType_t uxQueueSpacesAvailable(const
Return the number of free spaces available in a queue. This is equal to the number of items that can be sent to
the queue before the queue becomes full if no items are removed.
Return The number of spaces available in the queue.
Parameters
• xQueue: A handle to the queue being queried.
void
vQueueDelete(QueueHandle_t
Delete a queue - freeing all the memory allocated for storing of items placed on the queue.
Parameters
• xQueue: A handle to the queue to be deleted.
BaseType_t
xQueueGenericSendFromISR(QueueHandle_t
It is preferred that the macros xQueueSendFromISR(), xQueueSendToFrontFromISR() and xQueueSendTo-
BackFromISR() be used in place of calling this function directly. xQueueGiveFromISR() is an equivalent for
use by semaphores that don't actually copy any data.
Post an item on 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 xHigherPriorityTaskWokenByPost;
//
We have
not
xHigherPriorityTaskWokenByPost
//
Loop until the buffer
do
{
//
Obtain a byte
cIn
=
portINPUT_BYTE( RX_REGISTER_ADDRESS );
//
Post each
xQueueGenericSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWokenByPost,
queueSEND_TO_BACK );
→
} while( portINPUT_BYTE( BUFFER_COUNT ) );
//
Now the buffer
//
name of the
if( xHigherPriorityTaskWokenByPost )
{
Espressif Systems
xQueue)
Queue, BaseType_t *const pxHigherPriorityTaskWoken,
const BaseType_t xCopyPosition)
woken a task at the start of the
=
pdFALSE;
is
empty.
from
the
buffer.
byte.
is
empty we can switch context
yield
function required
Submit Document Feedback
QueueHandle_t
xQueue)
QueueHandle_t
xQueue)
xQueue, const void *const pvItemTo-
ISR.
if
necessary.
is
port
specific.
887
Note that the
(continues on next page)
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers