EasyManua.ls Logo

Espressif ESP32-S2 - Page 873

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
allow the state information to be omitted from the TaskStatus_t structure. To obtain state information
then set eState to eInvalid - otherwise the value passed in eState will be reported as the task state in
the TaskStatus_t structure.
void vTaskPrioritySet(TaskHandle_t xTask, UBaseType_t uxNewPriority)
INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be available. See the configuration
section for more information.
Set the priority of any task.
A context switch will occur before the function returns if the priority being set is higher than the currently
executing task.
Example usage:
void vAFunction( void )
{
TaskHandle_t xHandle;
// Create a task, storing the handle.
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle
,);
// ...
// Use the handle to raise the priority of the created task.
vTaskPrioritySet( xHandle, tskIDLE_PRIORITY + 1 );
// ...
// Use a NULL handle to raise our priority to the same value.
vTaskPrioritySet( NULL, tskIDLE_PRIORITY + 1 );
}
Parameters
xTask: Handle to the task for which the priority is being set. Passing a NULL handle results in the
priority of the calling task being set.
uxNewPriority: The priority to which the task will be set.
void vTaskSuspend(TaskHandle_t xTaskToSuspend)
INCLUDE_vTaskSuspend must be defined as 1 for this function to be available. See the configuration section
for more information.
Suspend any task. When suspended a task will never get any microcontroller processing time, no matter what
its priority.
Calls to vTaskSuspend are not accumulative - i.e. calling vTaskSuspend () twice on the same task still only
requires one call to vTaskResume () to ready the suspended task.
Example usage:
void vAFunction( void )
{
TaskHandle_t xHandle;
// Create a task, storing the handle.
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle
,);
// ...
// Use the handle to suspend the created task.
vTaskSuspend( xHandle );
(continues on next page)
Espressif Systems 862
Submit Document Feedback
Release v4.4

Table of Contents