Wirepas SDK
app_scheduler.h
Go to the documentation of this file.
1 /* Copyright 2018 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
17 #ifndef _APP_SCHEDULER_H_
18 #define _APP_SCHEDULER_H_
19 
20 #include <stdint.h>
21 #include <stdbool.h>
22 #include "api.h"
23 
32 typedef uint32_t (*task_cb_f)();
33 
37 #define APP_SCHEDULER_STOP_TASK ((uint32_t)(-1))
38 
42 #define APP_SCHEDULER_SCHEDULE_ASAP (0)
43 
47 typedef enum
48 {
60 
68 void App_Scheduler_init(void);
69 
111 app_scheduler_res_e App_Scheduler_addTask_execTime(task_cb_f cb, uint32_t delay_ms, uint32_t exec_time_us);
112 
113 #ifdef APP_SCHEDULER_MAX_EXEC_TIME_US
114 
126 static inline app_scheduler_res_e App_Scheduler_addTask(task_cb_f cb, uint32_t delay_ms)
127 {
128  return App_Scheduler_addTask_execTime(cb, delay_ms, APP_SCHEDULER_MAX_EXEC_TIME_US);
129 }
130 #endif
131 
139 
140 #endif //_APP_SCHEDULER_H_
APP_SCHEDULER_RES_UNINITIALIZED
@ APP_SCHEDULER_RES_UNINITIALIZED
Definition: app_scheduler.h:56
APP_SCHEDULER_RES_OK
@ APP_SCHEDULER_RES_OK
Definition: app_scheduler.h:50
App_Scheduler_init
void App_Scheduler_init(void)
Initialize scheduler.
APP_SCHEDULER_RES_NO_MORE_TASK
@ APP_SCHEDULER_RES_NO_MORE_TASK
Definition: app_scheduler.h:52
App_Scheduler_addTask_execTime
app_scheduler_res_e App_Scheduler_addTask_execTime(task_cb_f cb, uint32_t delay_ms, uint32_t exec_time_us)
Add a task.
APP_SCHEDULER_RES_UNKNOWN_TASK
@ APP_SCHEDULER_RES_UNKNOWN_TASK
Definition: app_scheduler.h:54
app_scheduler_res_e
app_scheduler_res_e
List of return code.
Definition: app_scheduler.h:47
App_Scheduler_cancelTask
app_scheduler_res_e App_Scheduler_cancelTask(task_cb_f cb)
Cancel a task.
task_cb_f
uint32_t(* task_cb_f)()
Task callback to be registered.
Definition: app_scheduler.h:32
APP_SCHEDULER_RES_TOO_LONG_EXECUTION_TIME
@ APP_SCHEDULER_RES_TOO_LONG_EXECUTION_TIME
Definition: app_scheduler.h:58
api.h