-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtimertask.c
More file actions
42 lines (34 loc) · 1.08 KB
/
timertask.c
File metadata and controls
42 lines (34 loc) · 1.08 KB
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
//Startup task.
#include <stdint.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <xdc/runtime/Error.h>
#include <ti/sysbios/knl/Event.h>
#include "timertask.h"
/***** Defines *****/
#define TIMER_TASK_STACK_SIZE 1024
#define TIMER_TASK_PRIORITY 1
extern Event_Handle g_event_handle;
/***** Variable declarations *****/
static Task_Params timerTaskParams;
Task_Struct timerTask; /* not static so you can see in ROV */
static uint8_t timerTaskStack[TIMER_TASK_STACK_SIZE];
/***** Function definitions *****/
void timerTask_init( void )
{
Task_Params_init(&timerTaskParams);
timerTaskParams.stackSize = TIMER_TASK_STACK_SIZE;
timerTaskParams.priority = TIMER_TASK_PRIORITY;
timerTaskParams.stack = &timerTaskStack;
Task_construct(&timerTask, timerTaskFunction, &timerTaskParams, NULL);
}
void timerTaskFunction(UArg arg0, UArg arg1)
{
// Every 500 ms, send a timer event to the dive logic task.
// Time : bit 0
for(;;)
{
Task_sleep(500);
Event_post(g_event_handle, 0x01);
}
}