EasyManuals Logo

Espressif ESP32-S2 User Manual

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
Page #864 background imageLoading...
Page #864 background image
Chapter 2. API Reference
(continued from previous page)
// Create the task, storing the handle. Note that the passed parameter
,ucParameterToPass
// must exist for the lifetime of the task, so in this case is declared
,static. If it was just an
// an automatic stack variable it might no longer exist, or at least have
,been corrupted, by the time
// the new task attempts to access it.
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, &ucParameterToPass, tskIDLE_
,PRIORITY, &xHandle );
configASSERT( xHandle );
// Use the handle to delete the task.
if( xHandle != NULL )
{
vTaskDelete( xHandle );
}
}
Return pdPASS if the task was successfully created and added to a ready list, otherwise an error code defined
in the file projdefs.h
Note If program uses thread local variables (ones specified with__threadkeyword) then storage for them
will be allocated on the tasks stack.
Parameters
pvTaskCode: Pointer to the task entry function. Tasks must be implemented to never return (i.e.
continuous loop), or should be terminated using vTaskDelete function.
pcName: A descriptive name for the task. This is mainly used to facilitate debugging. Max length
defined by configMAX_TASK_NAME_LEN - default is 16.
usStackDepth: The size of the task stack specified as the number of bytes. Note that this differs
from vanilla FreeRTOS.
pvParameters: Pointer that will be used as the parameter for the task being created.
uxPriority: The priority at which the task should run. Systems that include MPU support can
optionally create tasks in a privileged (system) mode by setting bit portPRIVILEGE_BIT of the
priority parameter. For example, to create a privileged task at priority 2 the uxPriority parameter
should be set to ( 2 | portPRIVILEGE_BIT ).
pvCreatedTask: Used to pass back a handle by which the created task can be referenced.
TaskHandle_t xTaskCreateStaticPinnedToCore(TaskFunction_t pvTaskCode, const char
*const pcName, const uint32_t ulStack-
Depth, void *const pvParameters, UBase-
Type_t uxPriority, StackType_t *const pxS-
tackBuer, StaticTask_t *const pxTaskBuer,
const BaseType_t xCoreID)
Create a new task with a specified affinity.
This function is similar to xTaskCreateStatic, but allows specifying task affinity in an SMP system.
Return If neither pxStackBuffer or pxTaskBuffer are NULL, then the task will be created and pdPASS is
returned. If either pxStackBuffer or pxTaskBuffer are NULL then the task will not be created and er-
rCOULD_NOT_ALLOCATE_REQUIRED_MEMORY is returned.
Parameters
pvTaskCode: Pointer to the task entry function. Tasks must be implemented to never return (i.e.
continuous loop), or should be terminated using vTaskDelete function.
pcName: A descriptive name for the task. This is mainly used to facilitate debugging. The maxi-
mum length of the string is defined by configMAX_TASK_NAME_LEN in FreeRTOSConfig.h.
ulStackDepth: The size of the task stack specified as the number of bytes. Note that this differs
from vanilla FreeRTOS.
pvParameters: Pointer that will be used as the parameter for the task being created.
uxPriority: The priority at which the task will run.
pxStackBuffer: Must point to a StackType_t array that has at least ulStackDepth indexes -
Espressif Systems 853
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish