FreeRTOS task.
More...
#include <Task.h>
FreeRTOS task.
- Note
- Supported by all FreeRTOS platforms
- Author
- Phil Schatzmann
- Copyright
- GPLv3 *
◆ Task() [1/2]
| Task |
( |
const char * |
name, |
|
|
int |
stackSizeWords, |
|
|
int |
priority = 1, |
|
|
int |
core = -1 |
|
) |
| |
|
inline |
Defines the task parameters; the actual FreeRTOS task is only created when begin() is called (typically from setup()), so that it is safe to declare a Task as a global object.
- Parameters
-
| name | task name, used for debugging (e.g. in FreeRTOS trace tools); must stay valid for the lifetime of the task |
| stackSizeWords | stack depth in words, not bytes (stack size in bytes = stackSizeWords * sizeof(StackType_t)); too small a value can cause a stack overflow, which on some platforms (e.g. RP2040/arduino-pico) halts the whole system instead of failing gracefully |
| priority | FreeRTOS task priority; valid range and meaning are platform-specific (bounded by configMAX_PRIORITIES, which differs a lot between platforms, e.g. RP2040/arduino-pico only goes up to 7) |
| core | core to pin the task to (0 or 1), or -1 to let the scheduler decide; only relevant on multi-core targets |
◆ Task() [2/2]
◆ ~Task()
◆ begin()
| bool begin |
( |
std::function< void()> |
process | ) |
|
|
inlinevirtual |
◆ create()
| bool create |
( |
const char * |
name, |
|
|
int |
stackSizeWords, |
|
|
int |
priority = 1, |
|
|
int |
core = -1 |
|
) |
| |
|
inline |
If you used the empty constructor, you need to call create!
- Parameters
-
| stackSizeWords | stack depth in words, not bytes |
◆ end()
suspends the task
Implements ITask.
◆ getCoreID()
◆ getReference()
◆ getTaskHandle()
◆ isEnded()
true if the task was never created or has been removed
Implements ITask.
◆ isRunning()
true if the task was created and is not suspended
Implements ITask.
◆ isSuspended()
true if the task was created and is currently suspended
Implements ITask.
◆ nop()
◆ remove()
deletes the FreeRTOS task
◆ resume()
◆ setReference()
| void setReference |
( |
void * |
r | ) |
|
|
inline |
◆ suspend()
◆ task_loop()
| static void task_loop |
( |
void * |
arg | ) |
|
|
inlinestaticprotected |
◆ loop_code
| std::function<void()> loop_code = nop |
|
protected |
◆ ref
◆ task_core
◆ task_name
| const char* task_name = nullptr |
|
protected |
◆ task_priority
◆ task_stack_size
◆ task_suspended
| bool task_suspended = false |
|
protected |
◆ xHandle
The documentation for this class was generated from the following file:
- src/AudioTools/Concurrency/RTOS/Task.h