| ... | ... | @@ -8,9 +8,10 @@ One of the best advantages to use such component is that all the functions given |
|
|
|
## Adding Tasks
|
|
|
|
The interface for adding a new task is pretty simple:
|
|
|
|
```cpp
|
|
|
|
void add(std::function<void()> func, uint32_t intervalMs, uint8_t id, int64_t start = miosix::getTick());
|
|
|
|
void add(function_t func, uint32_t intervalMs, uint8_t id, int64_t start = miosix::getTick());
|
|
|
|
```
|
|
|
|
Where the parameters are: the function to be periodically executed, the task period in milliseconds, an identifier for the task and the start time (by default set to the current system time).
|
|
|
|
Where `function_t` is an `std::function<void()>`.
|
|
|
|
The parameters are: the function to be periodically executed, the task period in milliseconds, an identifier for the task and the start time (by default set to the current system time).
|
|
|
|
|
|
|
|
> :warning: **Tasks in the tasks scheduler are meant to be added at inizialization. This means that all the tasks have to be added to the scheduler before the _start()_ method is called (which will start the thread execution).**
|
|
|
|
|
| ... | ... | |