diff --git a/src/KeyboardioFirmware.cpp b/src/KeyboardioFirmware.cpp index 87c8bf9b..68ef8bf9 100644 --- a/src/KeyboardioFirmware.cpp +++ b/src/KeyboardioFirmware.cpp @@ -15,8 +15,6 @@ Keyboardio_::setup(const byte keymap_count) { LEDControl.setup(); temporary_keymap = primary_keymap = Storage.load_primary_keymap(keymap_count); - - event_handler_hook_add (handle_key_event_default); } custom_loop_t loopHooks[HOOK_MAX]; diff --git a/src/key_events.cpp b/src/key_events.cpp index dd0e3272..5a5b6671 100644 --- a/src/key_events.cpp +++ b/src/key_events.cpp @@ -60,18 +60,7 @@ Key lookup_key(byte keymap, byte row, byte col) { return mappedKey; } -void handle_key_event(Key mappedKey, byte row, byte col, uint8_t keyState) { - if (!(keyState & INJECTED)) { - mappedKey = lookup_key(temporary_keymap, row, col); - } - for (byte i = 0; eventHandlers[i] != NULL && i < HOOK_MAX; i++) { - custom_handler_t handler = eventHandlers[i]; - if ((*handler)(mappedKey, row, col, keyState)) - return; - } -} - -bool handle_key_event_default(Key mappedKey, byte row, byte col, uint8_t keyState) { +static bool handle_key_event_default(Key mappedKey, byte row, byte col, uint8_t keyState) { //for every newly pressed button, figure out what logical key it is and send a key down event // for every newly released button, figure out what logical key it is and send a key up event @@ -131,3 +120,15 @@ void release_key(Key mappedKey) { } Keyboard.release(mappedKey.rawKey); } + +void handle_key_event(Key mappedKey, byte row, byte col, uint8_t keyState) { + if (!(keyState & INJECTED)) { + mappedKey = lookup_key(temporary_keymap, row, col); + } + for (byte i = 0; eventHandlers[i] != NULL && i < HOOK_MAX; i++) { + custom_handler_t handler = eventHandlers[i]; + if ((*handler)(mappedKey, row, col, keyState)) + return; + } + handle_key_event_default(mappedKey, row, col, keyState); +} diff --git a/src/key_events.h b/src/key_events.h index cfa1faab..6050ffba 100644 --- a/src/key_events.h +++ b/src/key_events.h @@ -48,6 +48,5 @@ void handle_key_event(Key mappedKey, byte row, byte col, uint8_t keyState); // Internal use void press_key(Key mappedKey); void release_key(Key mappedKey); -bool handle_key_event_default(Key mappedKey, byte row, byte col, uint8_t keyState); Key lookup_key(byte keymap, byte row, byte col);