Encapsulate a runnable task.
More...
#include <Task.h>
|
| Task (std::string taskName="Task", uint16_t stackSize=10000, uint8_t priority=5) |
| Create an instance of the task class. More...
|
|
void | setStackSize (uint16_t stackSize) |
| Set the stack size of the task. More...
|
|
void | setPriority (uint8_t priority) |
| Set the priority of the task. More...
|
|
void | setName (std::string name) |
| Set the name of the task. More...
|
|
void | setCore (BaseType_t coreId) |
| Set the core number the task has to be executed on. If the core number is not set, tskNO_AFFINITY will be used. More...
|
|
void | start (void *taskData=nullptr) |
| Start an instance of the task. More...
|
|
void | stop () |
| Stop the task. More...
|
|
virtual void | run (void *data)=0 |
| Body of the task to execute. More...
|
|
|
static void | delay (int ms) |
| Suspend the task for the specified milliseconds. More...
|
|
Encapsulate a runnable task.
This class is designed to be subclassed with the method:
void run(
void *data) { ... }
For example:
class CurlTestTask :
public Task {
}
};
implemented.
Task::Task |
( |
std::string |
taskName = "Task" , |
|
|
uint16_t |
stackSize = 10000 , |
|
|
uint8_t |
priority = 5 |
|
) |
| |
Create an instance of the task class.
- Parameters
-
[in] | taskName | The name of the task to create. |
[in] | stackSize | The size of the stack. |
- Returns
- N/A.
void Task::delay |
( |
int |
ms | ) |
|
|
static |
Suspend the task for the specified milliseconds.
- Parameters
-
[in] | ms | The delay time in milliseconds. |
- Returns
- N/A.
virtual void Task::run |
( |
void * |
data | ) |
|
|
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.
- Parameters
-
[in] | data | The data passed in to the newly started task. |
void Task::setCore |
( |
BaseType_t |
coreId | ) |
|
Set the core number the task has to be executed on. If the core number is not set, tskNO_AFFINITY will be used.
- Parameters
-
[in] | coreId | The id of the core. |
- Returns
- N/A.
void Task::setName |
( |
std::string |
name | ) |
|
Set the name of the task.
- Parameters
-
[in] | name | The name for the task. |
- Returns
- N/A.
void Task::setPriority |
( |
uint8_t |
priority | ) |
|
Set the priority of the task.
- Parameters
-
[in] | priority | The priority for the task. |
- Returns
- N/A.
void Task::setStackSize |
( |
uint16_t |
stackSize | ) |
|
Set the stack size of the task.
- Parameters
-
[in] | stackSize | The size of the stack for the task. |
- Returns
- N/A.
void Task::start |
( |
void * |
taskData = nullptr | ) |
|
Start an instance of the task.
- Parameters
-
[in] | taskData | Data to be passed into the task. |
- Returns
- N/A.
Stop the task.
- Returns
- N/A.
The documentation for this class was generated from the following files: