From f783239ccceaeba61145b5f33e8752cf38aba7fc Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 3 Oct 2015 21:22:27 -0700 Subject: [PATCH] Add support for shifted keys in key definitions --- KeyboardioFirmware.ino | 7 +++++++ key_defs.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/KeyboardioFirmware.ino b/KeyboardioFirmware.ino index 0d671884..9e794d95 100644 --- a/KeyboardioFirmware.ino +++ b/KeyboardioFirmware.ino @@ -479,6 +479,9 @@ void send_key_event(byte row, byte col) } void press_key(Key mappedKey) { + if (mappedKey.flags & SHIFT_HELD) { + Keyboard.press(Key_LShift.rawKey); + } Keyboard.press(mappedKey.rawKey); if (commandBufferSize >= 31) { commandBufferSize = 0; @@ -495,6 +498,10 @@ void press_key(Key mappedKey) { } void release_key(Key mappedKey) { + if (mappedKey.flags & SHIFT_HELD) { + Keyboard.release(Key_LShift.rawKey); + } + Keyboard.release(mappedKey.rawKey); } diff --git a/key_defs.h b/key_defs.h index fc4aa6d1..188f638d 100644 --- a/key_defs.h +++ b/key_defs.h @@ -306,6 +306,11 @@ typedef struct { #define KEY_SLASH '/' #define Key_Slash (Key){ KEY_FLAGS, KEY_SLASH } + +#define Key_LEFT_PAREN (Key) { KEY_FLAGS|SHIFT_HELD, KEY_9 } +#define Key_RIGHT_PAREN (Key){ KEY_FLAGS|SHIFT_HELD, KEY_0 } + + #define KEY_KEYPAD_CLEAR 0xDB #define Key_KeypadClear (Key){ KEY_FLAGS, KEY_KEYPAD_CLEAR } #define KEY_KEYPAD_SLASH 0xDC