Wirepas SDK
|
Application scheduler library. Allows scheduling of multiple application tasks concurrently.
Definition in file app_scheduler.h.
Go to the source code of this file.
Typedefs | |
typedef uint32_t(* | task_cb_f) () |
Task callback to be registered. More... | |
Functions | |
void | App_Scheduler_init (void) |
Initialize scheduler. More... | |
app_scheduler_res_e | App_Scheduler_addTask_execTime (task_cb_f cb, uint32_t delay_ms, uint32_t exec_time_us) |
Add a task. More... | |
app_scheduler_res_e | App_Scheduler_cancelTask (task_cb_f cb) |
Cancel a task. More... | |
Enumerations | |
enum | app_scheduler_res_e { APP_SCHEDULER_RES_OK = 0, APP_SCHEDULER_RES_NO_MORE_TASK = 1, APP_SCHEDULER_RES_UNKNOWN_TASK = 2, APP_SCHEDULER_RES_UNINITIALIZED = 3, APP_SCHEDULER_RES_TOO_LONG_EXECUTION_TIME = 4 } |
List of return code. More... | |
Macros | |
#define | APP_SCHEDULER_STOP_TASK ((uint32_t)(-1)) |
Value to return from task to remove it. More... | |
#define | APP_SCHEDULER_SCHEDULE_ASAP (0) |
Value to return from task or as initial time to be executed ASAP. More... | |
typedef uint32_t(* task_cb_f) () |
Task callback to be registered.
Definition at line 32 of file app_scheduler.h.
app_scheduler_res_e App_Scheduler_addTask_execTime | ( | task_cb_f | cb, |
uint32_t | delay_ms, | ||
uint32_t | exec_time_us | ||
) |
Add a task.
Example on use:
cb | Callback to be called from main periodic task. Same cb can only be added once. Calling this function with an already registered cb will update the next scheduled time. |
delay_ms | delay in ms to be scheduled (0 to be scheduled asap) |
exec_time_us | Maximum execution time required for the task to be executed |
app_scheduler_res_e App_Scheduler_cancelTask | ( | task_cb_f | cb | ) |
Cancel a task.
cb | Callback already registered from App_Scheduler_addTask. |
void App_Scheduler_init | ( | void | ) |
Initialize scheduler.
enum app_scheduler_res_e |
List of return code.
Definition at line 47 of file app_scheduler.h.
#define APP_SCHEDULER_SCHEDULE_ASAP (0) |
Value to return from task or as initial time to be executed ASAP.
Definition at line 42 of file app_scheduler.h.
#define APP_SCHEDULER_STOP_TASK ((uint32_t)(-1)) |
Value to return from task to remove it.
Definition at line 37 of file app_scheduler.h.