From 9cc8270392d249d6db03caefd81281886901c4bd Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Tue, 8 Dec 2015 10:46:58 +0300 Subject: [PATCH 1/1] count button events --- Hal/Hal.c | 3 +++ Hal/Hal.h | 2 ++ Pulsecounter-Prog.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) 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) { -- 2.39.2