-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
68 lines (57 loc) · 1.35 KB
/
main.c
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <stdio.h>
#include <msp430.h>
#include "rileyOS_config.h"
#include "scheduler.h"
#include "task.h"
#include "hal_LCD.h"
static void schedule_and_run( void );
static void Task1( void );
static void Task2( void );
static void LCDTASK( void );
static void WRITEBAR( void );
static void WRITEFOO( void );
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
PM5CTL0 &= ~LOCKLPM5; // Disable GPIO power-on
// default high-impedance mode
schedule_and_run();
return 0;
}
static void schedule_and_run( void ) {
scheduler_init();
SCHEDULER_ADD(Task1, 256);
SCHEDULER_ADD(Task2, 256);
SCHEDULER_ADD(LCDTASK, 256);
scheduler_run();
}
static void Task1( void ) {
P1DIR |= 0x01; // Set LED P1.0 as output
while(1) {
P1OUT ^= 0x01; // Flash LED P1.0
task_sleep(100);
}
}
static void Task2( void ) {
P4DIR |= 0x01; // Set LED P4.0 as output
while(1) {
P4OUT ^= 0x01; // Flash LED P4.0
task_sleep(500);
}
}
static void LCDTASK( void ) {
Init_LCD();
SCHEDULER_ADD(WRITEFOO, 256);
task_sleep(1400);
SCHEDULER_ADD(WRITEBAR, 256);
task_join();
}
static void WRITEBAR( void ) {
while(1) {
displayScrollText("BAR");
}
}
static void WRITEFOO( void ) {
while(1) {
displayScrollText("FOO");
}
}