|
ESPectro32 Library
Library for using ESPectro32 board
|
Encapsulate a runnable task. More...
#include <Task.h>
Public Member Functions | |
| Task (std::string taskName="Task", uint16_t stackSize=2048, UBaseType_t priority=5) | |
| Task (BaseType_t coreId, std::string taskName="Task", uint16_t stackSize=2048, UBaseType_t priority=5) | |
| void | setStackSize (uint16_t stackSize) |
| void | setPriority (UBaseType_t priority) |
| void | setTaskName (std::string &taskN) |
| void | start (void *taskData=nullptr) |
| Start an instance of the task. More... | |
| void | stop () |
| virtual void | runAsync (void *data)=0 |
| Body of the task to execute. More... | |
| void | delay (int ms) |
| Suspend the task for the specified milliseconds. More... | |
Static Private Member Functions | |
| static void | runTask (void *data) |
Private Attributes | |
| xTaskHandle | handle |
| void * | taskData |
| std::string | taskName |
| uint16_t | stackSize |
| UBaseType_t | priority = 5 |
| BaseType_t | coreId = -1 |
Encapsulate a runnable task.
This class is designed to be subclassed with the method:
For example:
implemented.
| Task::Task | ( | std::string | taskName = "Task", |
| uint16_t | stackSize = 2048, |
||
| UBaseType_t | priority = 5 |
||
| ) |
Create an instance of the task class.
| taskName | |
| stackSize | |
| taskData |
| void Task::delay | ( | int | ms | ) |
Suspend the task for the specified milliseconds.
| [in] | ms | The delay time in milliseconds. |
|
pure virtual |
Body of the task to execute.
This function must be implemented in the subclass that represents the actual task to run. When a task is started by calling start(), this is the code that is executed in the newly created task.
| [in] | data | The data passed in to the newly started task. |
Implemented in WiFiManager, ESPectro32_Button, ESPectro32_LED_Animator, and Animator.
|
staticprivate |
Static class member that actually runs the target task.
The code here will run on the task thread.
| void Task::start | ( | void * | taskData = nullptr | ) |
Start an instance of the task.
| [in] | Data | to be passed into the task. |
1.8.6