Espressif ESP32-S2 Programming Manual page 866

Table of Contents

Advertisement

Chapter 2. API Reference
structure.
//
puxStackBuffer
//
been created,
//
to suspend the
vTaskSuspend( xHandle );
}
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.
Note If program uses thread local variables (ones specified with "__thread"keyword) then storage for them
will be allocated on the task's 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. 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 -
the array will then be used as the task's stack, removing the need for the stack to be allocated
dynamically.
• pxTaskBuffer: Must point to a variable of type StaticTask_t, which will then be used to hold
the task's data structures, removing the need for the memory to be allocated dynamically.
void
vTaskAllocateMPURegions(TaskHandle_t
Only available when configSUPPORT_DYNAMIC_ALLOCATION is set to 1.
xTaskCreateRestricted() should only be used in systems that include an MPU implementation.
Create a new task and add it to the list of tasks that are ready to run. The function parameters define the
memory regions and associated access permissions allocated to the task.
See xTaskCreateRestrictedStatic() for a version that does not use any dynamic memory allocation.
return pdPASS if the task was successfully created and added to a ready list, otherwise an error code defined
in the file projdefs.h
Parameters
• pxTaskDefinition: Pointer to a structure that contains a member for each of the normal
xTaskCreate() parameters (see the xTaskCreate() API documentation) plus an optional stack buffer
and the memory region definitions.
• pxCreatedTask: Used to pass back a handle by which the created task can be referenced.
Example usage:
//
Create an TaskParameters_t structure that defines the task to be
static const TaskParameters_t xCheckTaskParameters
{
vATask,
//
"ATask",
//
100,
//
NULL,
//
parameters.
Espressif Systems
tskIDLE_PRIORITY,//
xStack,
&xTaskBuffer );
and
pxTaskBuffer were
and
xHandle will be the
task.
gions)
pvTaskCode
-
the function that implements the
pcName
-
just a text name
usStackDepth
-
the stack size DEFINED IN
pvParameters
-
passed into the task function
Submit Document Feedback
Priority at which the task
//
Array to use
as
//
Variable to hold the
not
NULL, so the task will have
task's handle.
xTask, const MemoryRegion_t *const pxRe-
=
for
the task to assist
855
(continued from previous page)
is
created.
the
task's stack.
task's
data␣
Use the handle
created.
task.
debugging.
WORDS.
as
the
function␣
(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