From: Eugene Crosser Date: Tue, 8 Dec 2015 07:46:58 +0000 (+0300) Subject: count button events X-Git-Url: http://www.average.org/gitweb/?p=pulsecounter.git;a=commitdiff_plain;h=9cc8270392d249d6db03caefd81281886901c4bd count button events --- diff --git a/Hal/Hal.c b/Hal/Hal.c index 91f635f..3417f6a 100644 --- 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(); diff --git a/Hal/Hal.h b/Hal/Hal.h index f166774..245608c 100644 --- a/Hal/Hal.h +++ b/Hal/Hal.h @@ -27,6 +27,8 @@ extern "C" { #endif +extern int32_t buttonCnt; + typedef void (*Hal_Handler)(void); /** diff --git a/Pulsecounter-Prog.c b/Pulsecounter-Prog.c index 1507b24..266edb7 100644 --- a/Pulsecounter-Prog.c +++ b/Pulsecounter-Prog.c @@ -28,7 +28,7 @@ void Pulsecounter_disconnectHandler(void) { } void Pulsecounter_event3_fetch(Pulsecounter_event3_t* const output) { - *output = 3; + *output = buttonCnt; } void Pulsecounter_event4_fetch(Pulsecounter_event4_t* const output) {