Add support for shifted keys in key definitions

pull/18/head
Jesse Vincent 9 years ago
parent c80666d3c7
commit f783239ccc

@ -479,6 +479,9 @@ void send_key_event(byte row, byte col)
} }
void press_key(Key mappedKey) { void press_key(Key mappedKey) {
if (mappedKey.flags & SHIFT_HELD) {
Keyboard.press(Key_LShift.rawKey);
}
Keyboard.press(mappedKey.rawKey); Keyboard.press(mappedKey.rawKey);
if (commandBufferSize >= 31) { if (commandBufferSize >= 31) {
commandBufferSize = 0; commandBufferSize = 0;
@ -495,6 +498,10 @@ void press_key(Key mappedKey) {
} }
void release_key(Key mappedKey) { void release_key(Key mappedKey) {
if (mappedKey.flags & SHIFT_HELD) {
Keyboard.release(Key_LShift.rawKey);
}
Keyboard.release(mappedKey.rawKey); Keyboard.release(mappedKey.rawKey);
} }

@ -306,6 +306,11 @@ typedef struct {
#define KEY_SLASH '/' #define KEY_SLASH '/'
#define Key_Slash (Key){ KEY_FLAGS, 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_KEYPAD_CLEAR 0xDB
#define Key_KeypadClear (Key){ KEY_FLAGS, KEY_KEYPAD_CLEAR } #define Key_KeypadClear (Key){ KEY_FLAGS, KEY_KEYPAD_CLEAR }
#define KEY_KEYPAD_SLASH 0xDC #define KEY_KEYPAD_SLASH 0xDC

Loading…
Cancel
Save