-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.c
More file actions
44 lines (40 loc) · 988 Bytes
/
Copy pathtask.c
File metadata and controls
44 lines (40 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "task.h"
#include "main.h"
#include "timecount.h"
/*
@purpose: Add a task to the scheduler
@paramaters: Task, the Task structure
@return: void
@version: V0.1
*/
void TaskScheduler(Task Task)
{
Tasks[TaskCount] = Task;
TaskCount++;
}
/*
@purpose: run the Tasks
@paramaters: void
@return: void
@version: V0.1
*/
void TaskExecute(void)
{
char i;
/* For each Task in side the Tasks Vector */
for (i = 0; i < NUMBER_OF_TASKS; i++)
{
/* If the Last execution was done more than the Time in Interval ago */
if (TimerCount.miliseconds - Tasks[i].lastTime > Tasks[i].interval)
{
/* If the task is active */
if (Tasks[i].active == YES)
{
/* run the task */
Tasks[i].Execute();
/* update last execution time */
Tasks[i].lastTime = TimerCount.miliseconds;
}
}
}
}