count button events
[pulsecounter.git] / Pulsecounter-Prog.c
1 #include "Pulsecounter.h"\r
2 #include "Hal.h"\r
3 \r
4 static void buttonHandler(void);\r
5 \r
6 void main() {\r
7     Hal_init();\r
8     Hal_buttonEnable(buttonHandler);\r
9     Pulsecounter_start();\r
10     Hal_idleLoop();\r
11 }\r
12 \r
13 static void buttonHandler(void) {\r
14     Hal_ledOn();\r
15     Hal_delay(500);\r
16     Hal_ledOff();\r
17     Pulsecounter_event3_indicate();\r
18 }\r
19 \r
20 /* -------- SCHEMA CALLBACKS -------- */\r
21 \r
22 void Pulsecounter_connectHandler(void) {\r
23     Hal_connected();\r
24 }\r
25 \r
26 void Pulsecounter_disconnectHandler(void) {\r
27     Hal_disconnected();\r
28 }\r
29 \r
30 void Pulsecounter_event3_fetch(Pulsecounter_event3_t* const output) {\r
31     *output = buttonCnt;\r
32 }\r
33 \r
34 void Pulsecounter_event4_fetch(Pulsecounter_event4_t* const output) {\r
35     *output = 4;\r
36 }\r
37 \r
38 void Pulsecounter_event5_fetch(Pulsecounter_event5_t* const output) {\r
39     *output = 5;\r
40 }\r