Project

General

Profile

Statistics
| Revision:

root / branches / encoders / code / projects / template / main.c @ 257

History | View | Annotate | Download (980 Bytes)

1 16 bcoltin
#include <dragonfly_lib.h>
2
3 257 ayeager
4 193 ayeager
void a1()
5
{
6
        usb_puts("a\n");
7
}
8
9
void a2()
10
{
11
        usb_puts("b\n");
12
}
13
14
void a3()
15
{
16
        usb_puts("c\n");
17
}
18
19
void a4()
20
{
21
        usb_puts("4\n");
22
}
23
24
void a5()
25
{
26
        usb_puts("5\n");
27
}
28
29
void a6()
30
{
31
        usb_puts("6\n");
32
}
33
34
void a7()
35
{
36
        usb_puts("7\n");
37
}
38
39
void a8()
40
{
41
        usb_puts("8\n");
42
}
43
44
void a9()
45
{
46
        usb_puts("9\n");
47
}
48
49
void a10()
50
{
51 257 ayeager
        usb_puts("A");
52 193 ayeager
}
53
54 16 bcoltin
int main(void)
55
{
56
        dragonfly_init(ALL_ON);
57 257 ayeager
        void (*functions[])(void) = {a1};
58
        void (*allF[])(void) = {a1,a2,a3,a4,a5,a6,a7,a8,a9,a10};
59
        int test[] = {20};
60 193 ayeager
61 257 ayeager
        rtc_multi_init(test, functions, 1);
62 193 ayeager
63 257 ayeager
        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
83 16 bcoltin
        return 0;
84 193 ayeager
85 16 bcoltin
}