]> www.average.org Git - pulsecounter.git/commitdiff
count button events
authorEugene Crosser <crosser@average.org>
Tue, 8 Dec 2015 07:46:58 +0000 (10:46 +0300)
committerEugene Crosser <crosser@average.org>
Tue, 8 Dec 2015 07:46:58 +0000 (10:46 +0300)
Hal/Hal.c
Hal/Hal.h
Pulsecounter-Prog.c

index 91f635fc6610a7b808b61528e7f41d570a8b8187..3417f6a534d440037b49603032313fcf00058ae0 100644 (file)
--- a/Hal/Hal.c
+++ b/Hal/Hal.c
@@ -88,6 +88,8 @@
 #define TICK_HANDLER_ID        1
 #define DISPATCH_HANDLER_ID    2
 
+int32_t buttonCnt = 0;
+
 static void buttonHandler(void);
 static void postEvent(uint8_t handlerId);
 
@@ -325,6 +327,7 @@ static void postEvent(uint8_t handlerId) {
     #pragma vector=PORT1_VECTOR
 #endif
 INTERRUPT void buttonIsr(void) {
+    buttonCnt++;
     postEvent(BUTTON_HANDLER_ID);
     BUTTON_ENABLE();
     WAKEUP();
index f166774501274df29b6c8b7d1626b9afda905aae..245608cc98c2c19df3b9ea851e31c17de6f4c633 100644 (file)
--- a/Hal/Hal.h
+++ b/Hal/Hal.h
@@ -27,6 +27,8 @@
 extern "C" {
 #endif
 
+extern int32_t buttonCnt;
+
 typedef void (*Hal_Handler)(void);
 
 /**
index 1507b24fea482d97b2a56ddee915e754b90a8f79..266edb73fd12e66c81504035a7d1e9b5ebc0a5a0 100644 (file)
@@ -28,7 +28,7 @@ void Pulsecounter_disconnectHandler(void) {
 }\r
 \r
 void Pulsecounter_event3_fetch(Pulsecounter_event3_t* const output) {\r
-    *output = 3;\r
+    *output = buttonCnt;\r
 }\r
 \r
 void Pulsecounter_event4_fetch(Pulsecounter_event4_t* const output) {\r