Chapter 2. API Reference
//
Actual macro used here
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: xQueueSendFromISR() will set *pxHigherPriori-
tyTaskWoken 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 xQueueSendFromISR() sets this value to
pdTRUE then a context switch should be requested before the interrupt is exited.
xQueueReset(xQueue)
Reset a queue back to its original empty state. The return value is now obsolete and is always set to pdPASS.
Type Definitions
typedef struct QueueDefinition *QueueHandle_t
typedef struct QueueDefinition *QueueSetHandle_t
Type by which queue sets are referenced. For example, a call to xQueueCreateSet() returns an xQueueSet
variable that can then be used as a parameter to xQueueSelectFromSet(), xQueueAddToSet(), etc.
typedef struct QueueDefinition *QueueSetMemberHandle_t
Queue sets can contain both queues and semaphores, so the QueueSetMemberHandle_t is defined as a type to
be used where a parameter or return value can be either an QueueHandle_t or an SemaphoreHandle_t.
Semaphore API
Header File
•
components/freertos/include/freertos/semphr.h
Macros
semBINARY_SEMAPHORE_QUEUE_LENGTH
semSEMAPHORE_QUEUE_ITEM_LENGTH
semGIVE_BLOCK_TIME
vSemaphoreCreateBinary(xSemaphore)
xSemaphoreCreateBinary()
Creates a new binary semaphore instance, and returns a handle by which the new semaphore can be referenced.
In many usage scenarios it is faster and more memory efficient to use a direct to task notification in place of a
binary semaphore!
https://www.FreeRTOS.org/RTOS-task-notifications.html
Internally, within the FreeRTOS implementation, binary semaphores use a block of memory, in which the
semaphore structure is stored. If a binary semaphore is created using xSemaphoreCreateBinary() then the
required memory is automatically dynamically allocated inside the xSemaphoreCreateBinary() function. (see
https://www.FreeRTOS.org/a00111.html). If a binary semaphore is created using xSemaphoreCreateBina-
ryStatic() then the application writer must provide the memory. xSemaphoreCreateBinaryStatic() therefore
allows a binary semaphore to be created without using any dynamic memory allocation.
The old vSemaphoreCreateBinary() macro is now deprecated in favour of this xSemaphoreCreateBinary()
function. Note that binary semaphores created using the vSemaphoreCreateBinary() macro are created in a
state such that the first call to 'take'the semaphore would pass, whereas binary semaphores created using
Espressif Systems
is
port
specific.
901
Submit Document Feedback
(continued from previous 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