8 #ifndef COMPONENTS_CPP_UTILS_TASK_H_
9 #define COMPONENTS_CPP_UTILS_TASK_H_
10 #include <freertos/FreeRTOS.h>
11 #include <freertos/task.h>
36 Task(std::string taskName=
"Task", uint16_t stackSize=2048, UBaseType_t priority = 5);
37 Task(BaseType_t coreId, std::string taskName=
"Task", uint16_t stackSize=2048, UBaseType_t priority = 5);
39 void setStackSize(uint16_t stackSize);
40 void setPriority(UBaseType_t priority);
41 void setTaskName(std::string &taskN);
42 void start(
void *taskData=
nullptr);
53 virtual void runAsync(
void *data) = 0;
59 static void runTask(
void *data);
62 UBaseType_t priority = 5;
64 BaseType_t coreId = -1;
virtual void runAsync(void *data)=0
Body of the task to execute.
void delay(int ms)
Suspend the task for the specified milliseconds.
Definition: Task.cpp:49
Task(std::string taskName="Task", uint16_t stackSize=2048, UBaseType_t priority=5)
Definition: Task.cpp:27
void start(void *taskData=nullptr)
Start an instance of the task.
Definition: Task.cpp:70
static void runTask(void *data)
Definition: Task.cpp:58
Encapsulate a runnable task.
Definition: Task.h:34