From 7396a8bd1d6574004a8b774effe21949206e5aaa Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 13 Nov 2016 09:41:25 +0100 Subject: [PATCH] Add the default key event handler in Keyboardio_::setup Having the default handler in the list by default prevents other things to hook up before it. Add it in Keyboardio_::setup instead, so that others have a chance to add themselves first. Signed-off-by: Gergely Nagy --- src/KeyboardioFirmware.cpp | 1 + src/key_events.cpp | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/KeyboardioFirmware.cpp b/src/KeyboardioFirmware.cpp index b342446f..00ac2a5c 100644 --- a/src/KeyboardioFirmware.cpp +++ b/src/KeyboardioFirmware.cpp @@ -5,6 +5,7 @@ Keyboardio_::Keyboardio_(void) { void Keyboardio_::setup(void) { + event_handler_hook_add (handle_key_event_default); wdt_disable(); delay(100); Keyboard.begin(); diff --git a/src/key_events.cpp b/src/key_events.cpp index 125c0043..a1f6541c 100644 --- a/src/key_events.cpp +++ b/src/key_events.cpp @@ -41,10 +41,7 @@ void handle_synthetic_key_event(Key mappedKey, uint8_t currentState, uint8_t pre } } -custom_handler_t eventHandlers[HOOK_MAX] = { - handle_key_event_default, - (custom_handler_t) NULL -}; +custom_handler_t eventHandlers[HOOK_MAX] = {NULL}; Key lookup_key(byte keymap, byte row, byte col) { Key mappedKey;