|
ESPHome 2026.3.0
|
Helper for FreeRTOS static task management. More...
#include <static_task.h>
Public Member Functions | |
| bool | is_created () const |
| Check if the task has been created and not yet destroyed. | |
| TaskHandle_t | get_handle () const |
| Get the FreeRTOS task handle. | |
| bool | create (TaskFunction_t fn, const char *name, uint32_t stack_size, void *param, UBaseType_t priority, bool use_psram) |
| Allocate stack and create task. | |
| void | destroy () |
| Delete the task but keep the stack buffer allocated for reuse by a subsequent create() call. | |
| void | deallocate () |
| Delete the task (if running) and free the stack buffer. | |
Protected Attributes | |
| TaskHandle_t | handle_ {nullptr} |
| StaticTask_t | tcb_ |
| StackType_t * | stack_buffer_ {nullptr} |
| uint32_t | stack_size_ {0} |
| bool | use_psram_ {false} |
Helper for FreeRTOS static task management.
Bundles TaskHandle_t, StaticTask_t, and the stack buffer into one object with create/destroy methods.
Definition at line 15 of file static_task.h.
| bool esphome::StaticTask::create | ( | TaskFunction_t | fn, |
| const char * | name, | ||
| uint32_t | stack_size, | ||
| void * | param, | ||
| UBaseType_t | priority, | ||
| bool | use_psram ) |
Allocate stack and create task.
| fn | Task function |
| name | Task name (for debug) |
| stack_size | Stack size in StackType_t words |
| param | Parameter passed to task function |
| priority | FreeRTOS task priority |
| use_psram | If true, allocate stack in PSRAM; otherwise internal RAM |
Definition at line 9 of file static_task.cpp.
| void esphome::StaticTask::deallocate | ( | ) |
Delete the task (if running) and free the stack buffer.
Definition at line 51 of file static_task.cpp.
| void esphome::StaticTask::destroy | ( | ) |
Delete the task but keep the stack buffer allocated for reuse by a subsequent create() call.
Definition at line 43 of file static_task.cpp.
|
inline |
Get the FreeRTOS task handle.
Definition at line 21 of file static_task.h.
|
inline |
Check if the task has been created and not yet destroyed.
Definition at line 18 of file static_task.h.
|
protected |
Definition at line 41 of file static_task.h.
|
protected |
Definition at line 43 of file static_task.h.
|
protected |
Definition at line 44 of file static_task.h.
|
protected |
Definition at line 42 of file static_task.h.
|
protected |
Definition at line 45 of file static_task.h.