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

View differences:

main.c
14 14
	usb_puts("Oh no!!! Reset!!\n\r");
15 15

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

  
21 21
	while (1) {
22 22
		//usb_puti(time_now());
23 23
		usb_puts("main\n\r");
24
		delay_ms(200);
24
		delay_ms(20);
25 25
	}
26 26

  
27 27
	return 0;
28 28
}
29 29

  
30 30
void task0() { 
31
	sei();
32
	usb_puts("0\n\r");
33
	
34
	cli();
31
	int i = 0;
32
	while(1) { 
33
		usb_puts("Task 0-"); 
34
		usb_puti(i++);
35
		usb_puts("\n\r");
36
		delay_ms(20);
37
	}
35 38
}
36 39

  
37 40
void task1() { 
41
	cli();
42
	usb_puts("Hello from task 1\n\r");
38 43
	sei();
39
	usb_puts("1\n\r");
40
	cli();
41 44
}
42 45

  
43 46
void task2() { 
47
	cli();
48
	usb_puts("Hello from task 2\n\r");
44 49
	sei();
45
	usb_puts("2\n\r");
46
	cli();
47 50
}

Also available in: Unified diff