... | ... | @@ -31,7 +31,9 @@ If you do not plan to use such tasks, you can set `CONFIG_OWNTECH_SCHEDULING_ENA |
|
|
|
|
|
## Available functions list
|
|
|
|
|
|
All functions are available on the `scheduuling` object after including `Scheduling.h`.
|
|
|
_Please refer to the_ [_API section_](#api) _below for details on how to use these functions._
|
|
|
|
|
|
All functions are available on the `scheduling` object after including `Scheduling.h`.
|
|
|
|
|
|
### Functions related to the uninterruptible synchronous task
|
|
|
|
... | ... | @@ -45,6 +47,26 @@ All functions are available on the `scheduuling` object after including `Schedul |
|
|
* `void suspendCurrentTaskMs(uint32_t duration_ms)`
|
|
|
* `void suspendCurrentTaskUs(uint32_t duration_us)`
|
|
|
|
|
|
# API
|
|
|
|
|
|
## Uninterruptible synchronous task
|
|
|
|
|
|
First call `scheduling.defineUninterruptibleSynchronousTask()`, passing as first parameter the `void(void)` function to be run periodically, and as second parameter the period in µs. _It is not recommended to set a period under 50 µs_.
|
|
|
|
|
|
Check the return value of the function, if it is `-1`, there have been an error defining the task.
|
|
|
|
|
|
If the return value is `0`, you can later call `scheduling.startUninterruptibleSynchronousTask()` to launch the task.
|
|
|
|
|
|
## Asynchronous tasks
|
|
|
|
|
|
First call `scheduling.defineAsynchronousTask()`, passing as parameter the `void(void)` function to be run in background. The return value must be saved in a variable.
|
|
|
|
|
|
Check the return value of the function, if it is `-1`, there have been an error defining the task. For example, you exceeded the allowed number of asynchronous tasks, and need to edit the `CONFIG_OWNTECH_SCHEDULING_MAX_ASYNCHRONOUS_TASKS` value in `prj.conf`.
|
|
|
|
|
|
If the return value is not `-1`, it represents the task ID. You can later call `scheduling.startUninterruptibleSynchronousTask()` with the task ID as a parameter to launch the task.
|
|
|
|
|
|
In the task main function (function passed as parameter to `defineAsynchronousTask()`), you can call `scheduling.suspendCurrentTaskMs()` or `scheduling.suspendCurrentTaskUs()` to suspend the task for a certain amount of time. This allows to reduce calls to this task when it is not mandatory for it to run permanently, as when no other task is running, asynchronous tasks are "permanently" running in background.
|
|
|
|
|
|
# Module enable and dependencies
|
|
|
|
|
|
This module is loaded by default. The user explicitly has to set `CONFIG_OWNTECH_SCHEDULING=n` in `prj.conf` to prevent the module from loading.
|
... | ... | |