Revision 1573 trunk/code/projects/scheduler/main.c

View differences:

main.c
1
#include <dragonfly_lib.h>
1
#include <serial.h>
2
#include <avr/interrupt.h>
2 3
#include "scheduler.h"
3 4

  
5
void task0(void);
6
void task1(void);
7
void task2(void);
8

  
4 9
int main(void)
5 10
{
11
	//Granularity is currently seconds, 
12
	usb_init();
6 13

  
7
	/* initialize components, set wireless channel */
8
	dragonfly_init(ALL_ON);
9
	
10
	int val;
14
	usb_puts("Oh no!!! Reset!!\n\r");
11 15

  
16
	scheduler_init();
17
	register_task(task0, 22);
18
	//register_task(task1, 2);
19
	//register_task(task2, 3);
20

  
12 21
	while (1) {
13

  
14
		usb_puts("Val: ");
15
		bom_refresh(BOM_ALL);
16
		usb_puti(bom_get_max());
17

  
18
		usb_putc('\n');
19

  
22
		//usb_puti(time_now());
23
		usb_puts("main\n\r");
20 24
		delay_ms(200);
21

  
22 25
	}
23 26

  
24 27
	return 0;
25 28
}
26 29

  
30
void task0() { 
31
	sei();
32
	usb_puts("0\n\r");
33
	
34
	cli();
35
}
36

  
37
void task1() { 
38
	sei();
39
	usb_puts("1\n\r");
40
	cli();
41
}
42

  
43
void task2() { 
44
	sei();
45
	usb_puts("2\n\r");
46
	cli();
47
}

Also available in: Unified diff