Task scheduler library  1.0
Arduino library for simply executing tasks in parallel
Tasks.h
Go to the documentation of this file.
1 
32 #ifndef TASKS_H
33 #define TASKS_H
34 
35 
36 #include <Arduino.h>
37 
38 
39 #pragma GCC optimize ("O2")
40 
41 
42 #define MAX_TASK_CNT 8
43 
44 typedef void (*Task)(void);
45 
46 
47 
55 void Tasks_Init(void);
56 
57 
58 
78 bool Tasks_Add(Task func, int16_t period, int16_t delay = 0);
79 
80 
81 
92 bool Tasks_Remove(Task func);
93 
94 
95 
113 bool Tasks_Delay(Task func, int16_t delay);
114 
115 
116 
131 bool Tasks_SetState(Task func, bool state);
132 
133 
134 
146 inline bool Tasks_Start_Task(Task func)
147  {
148  return Tasks_SetState(func, true);
149  }
150 
151 
152 
164 inline bool Tasks_Pause_Task(Task func)
165  {
166  return Tasks_SetState(func, false);
167  }
168 
169 
170 
178 void Tasks_Start(void);
179 
180 
181 
189 void Tasks_Pause(void);
190 
191 
192 #endif //TASKS_H
void(* Task)(void)
Example prototype for a function than can be executed as a task.
Definition: Tasks.h:44
void Tasks_Init(void)
Initialize and reset the tasks library.
Definition: Tasks.cpp:140
bool Tasks_SetState(Task func, bool state)
Enable or disable the execution of a task.
Definition: Tasks.cpp:370
bool Tasks_Add(Task func, int16_t period, int16_t delay=0)
Add a task to the task scheduler.
Definition: Tasks.cpp:169
bool Tasks_Start_Task(Task func)
Activate a task in the scheduler.
Definition: Tasks.h:146
bool Tasks_Delay(Task func, int16_t delay)
Delay execution of a task.
Definition: Tasks.cpp:316
bool Tasks_Remove(Task func)
Remove a task from the task scheduler.
Definition: Tasks.cpp:257
void Tasks_Pause(void)
Pause the task scheduler.
Definition: Tasks.cpp:438
bool Tasks_Pause_Task(Task func)
Deactivate a task in the scheduler.
Definition: Tasks.h:164
void Tasks_Start(void)
Start the task scheduler.
Definition: Tasks.cpp:412