Project

General

Profile

Revision 257

updated timer rtc_add_function and implemented a rtc_remove_function

View differences:

main.c
1 1
#include <dragonfly_lib.h>
2 2

  
3

  
3 4
void a1()
4 5
{
5 6
	usb_puts("a\n");
......
47 48

  
48 49
void a10()
49 50
{
50
usb_puts("A");
51
for(int i = 0; i <10; i++)
52
{
53
	buzzer_chirp(1000,C4);
54
	buzzer_chirp(1000,C5);
51
	usb_puts("A");
55 52
}
56
}
57 53

  
58 54
int main(void)
59 55
{
60 56
	dragonfly_init(ALL_ON);
61
	buzzer_init();
62
	void (*functions[])(void) = {a1,a2,a3,a4,a5,a6,a7,a8,a9,a10};
63
	int test[] = {1,2,3,4,5,6,7,8,9,1000};
64
	rtc_multi_init(test, functions, 10);
57
	void (*functions[])(void) = {a1};
58
	void (*allF[])(void) = {a1,a2,a3,a4,a5,a6,a7,a8,a9,a10};
59
	int test[] = {20};
65 60
	
66
	while(1){};
61
	rtc_multi_init(test, functions, 1);
67 62
	
63
	while(1){
64
		if(button1_click() == 1)
65
		{
66
			int time = rtc_get_function_count();
67
			usb_puts("number of functions: ");
68
			usb_puti(rtc_add_function(allF[time], time*10));
69
			usb_puts("\n");
70
		}
71
		if(button2_click() == 1)
72
		{
73
			int time = rtc_get_function_count();
74
			if(time > 0)
75
			{
76
				usb_puts("number of functions: ");
77
				usb_puti(rtc_remove_function(allF[time-1]));
78
				usb_puts("\n");
79
			}
80
		}
81
	};
82
	
68 83
	return 0;
69 84
	
70 85
}

Also available in: Unified diff