X-Git-Url: http://www.average.org/gitweb/?p=pulsecounter.git;a=blobdiff_plain;f=Hal%2FHal.c;h=f7b801c4aed7174759f08fc616f26a4ade4f54d9;hp=ef498ba6f3d0b36a463b8b23e6666815b925b979;hb=62d25e937392e215935ad07e554ef9b18dba18fe;hpb=13db6cae32995a2f76fb4b4f1c5f40cea2470a55 diff --git a/Hal/Hal.c b/Hal/Hal.c index ef498ba..f7b801c 100644 --- a/Hal/Hal.c +++ b/Hal/Hal.c @@ -86,13 +86,15 @@ #define WAKEUP() (__bic_SR_register_on_exit(LPM3_bits)) #endif -#define NUM_HANDLERS 3 +#define NUM_HANDLERS 5 #define BUTTON_HANDLER_ID 0 -#define TICK_HANDLER_ID 1 -#define DISPATCH_HANDLER_ID 2 +#define EVENT4_HANDLER_ID 1 +#define EVENT5_HANDLER_ID 2 +#define TICK_HANDLER_ID 3 +#define DISPATCH_HANDLER_ID 4 -static void buttonHandler(void); +static void buttonHandler(uint8_t id); static void postEvent(uint8_t handlerId); static Hal_Handler appButtonHandler; @@ -226,7 +228,7 @@ void Hal_idleLoop(void) { uint8_t id; for (id = 0, mask = 0x1; id < NUM_HANDLERS; id++, mask <<= 1) { if ((events & mask) && handlerTab[id]) { - handlerTab[id](); + handlerTab[id](id); } } } @@ -326,10 +328,10 @@ void Em_Hal_watchOn(void) { /* -------- INTERNAL FUNCTIONS -------- */ -static void buttonHandler(void) { +static void buttonHandler(uint8_t id) { Hal_delay(BUTTON_DEBOUNCE_MSECS); if (BUTTON_PRESSED() && appButtonHandler) { - appButtonHandler(); + appButtonHandler(id); } BUTTON_ENABLE(); }