consumer control support!

pull/18/head
Jesse Vincent 11 years ago
parent 400eb2c8c0
commit 5046de2747

@ -24,7 +24,6 @@ typedef struct {
#include "key_defs.h"
boolean key_was_pressed (byte keyState)
{
if ( byte((keyState >> 4)) ^ B00001111 ) {

@ -23,7 +23,6 @@
extern int usbMaxPower;
//#define DEBUG_SERIAL false

@ -99,6 +99,12 @@
#define Key_wwwForward (Key) {KEY_FLAGS | SYNTHETIC_KEY|IS_CONSUMER, CONSUMER_CONTROL_WWW_FORWARD}
#define Key_wwwBack (Key) {KEY_FLAGS | SYNTHETIC_KEY|IS_CONSUMER, CONSUMER_CONTROL_WWW_BACK}
//#define Key_Cut (Key) {KEY_FLAGS | SYNTHETIC_KEY|IS_CONSUMER, CONSUMER_CONTROL_AC_CUT }
//#define Key_Copy (Key) {KEY_FLAGS | SYNTHETIC_KEY|IS_CONSUMER, CONSUMER_CONTROL_AC_COPY}
//#define Key_Paste (Key) {KEY_FLAGS | SYNTHETIC_KEY|IS_CONSUMER, CONSUMER_CONTROL_AC_PASTE}
//#define Key_Undo (Key) {KEY_FLAGS | SYNTHETIC_KEY|IS_CONSUMER, CONSUMER_CONTROL_AC_UNDO }
#define Key_LCtrl (Key){ KEY_FLAGS, KEY_LEFT_CTRL }
#define KEY_LEFT_CTRL 0x80
#define Key_LCtrl (Key){ KEY_FLAGS, KEY_LEFT_CTRL }
@ -347,6 +353,9 @@
#define KEY_LEFT_FN2 0xff
#define Key_LFN2 (Key){ KEY_FLAGS, KEY_LEFT_FN2 }
#define KEY_UNDO 0x7a
#define Key_Undo (Key){ KEY_FLAGS, KEY_UNDO }
/*
These keycodes don't seem to map to unique keypresses. we can use them for meta-keys

@ -4,23 +4,17 @@
{Key_PageDn, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Esc, Key_Keymap0, Key_K, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus},\
{Key_LGUI, Key_Backspace, Key_LShift, Key_LCtrl, Key_KeymapNext_Momentary, Key_skip, Key_skip, Key_skip, Key_skip, Key_KeymapNext_Momentary, Key_RCtrl, Key_RShift, Key_Space, Key_RAlt},\
},
#define KEYMAP_COLEMAK_FN2 { /* Generated keymap for COLEMAK_FN2 */ {Key_skip, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_skip, Key_skip, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_skip},\
{Key_Backtick, Key_macroKey1, Key_mouseBtnL, Key_mouseBtnM, Key_mouseBtnR, Key_NoKey, Key_NoKey, Key_NoKey, Key_LCurlyBracket, Key_RCurlyBracket, Key_LSquareBracket, Key_RSquareBracket, Key_NoKey, Key_Equals},\
{Key_PageUp, Key_mouseL, Key_mouseUp, Key_mouseDn, Key_mouseR, Key_NoKey, Key_Tab, Key_Return, Key_LArrow, Key_DnArrow, Key_UpArrow, Key_RArrow, Key_Semicolon, Key_Quote},\
{Key_PageDn, Key_Keymap0, Key_mouseBtnL, Key_mouseBtnM, Key_mouseBtnR, Key_NoKey, Key_Esc, Key_Enter, Key_Pipe, Key_NoKey, Key_Comma, Key_Period, Key_Backslash, Key_Minus},\
{Key_LGUI, Key_Backspace, Key_LShift, Key_LCtrl, Key_NoKey, Key_skip, Key_skip, Key_skip, Key_skip, Key_NoKey, Key_RCtrl, Key_RShift, Key_Space, Key_RAlt},\
},
#define KEYMAP_DVORAK { /* Generated keymap for DVORAK */ {Key_skip, Key_1, Key_2, Key_3, Key_4, Key_5, Key_skip, Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip},\
{Key_Backtick, Key_Quote, Key_Comma, Key_Period, Key_P, Key_Y, Key_skip, Key_skip, Key_F, Key_G, Key_C, Key_R, Key_L, Key_Equals},\
{Key_PageUp, Key_A, Key_O, Key_E, Key_U, Key_I, Key_Tab, Key_Return, Key_D, Key_H, Key_T, Key_N, Key_S, Key_Minus},\
{Key_PageDn, Key_Slash, Key_Semicolon, Key_Q, Key_J, Key_K, Key_Esc, Key_Keymap2, Key_X, Key_B, Key_M, Key_W, Key_V, Key_Z},\
{Key_LGUI, Key_Backspace, Key_LShift, Key_LCtrl, Key_KeymapNext_Momentary, Key_skip, Key_skip, Key_skip, Key_skip, Key_KeymapNext_Momentary, Key_RCtrl, Key_RShift, Key_Space, Key_RAlt},\
},
#define KEYMAP_DVORAK_FN2 { /* Generated keymap for DVORAK_FN2 */ {Key_skip, Key_1, Key_2, Key_3, Key_4, Key_5, Key_skip, Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip},\
{Key_Backtick, Key_macroKey1, Key_mouseBtnL, Key_mouseBtnM, Key_mouseBtnR, Key_T, Key_NoKey, Key_NoKey, Key_LCurlyBracket, Key_RCurlyBracket, Key_LSquareBracket, Key_RSquareBracket, Key_P, Key_Equals},\
{Key_PageUp, Key_mouseL, Key_mouseUp, Key_mouseDn, Key_mouseR, Key_G, Key_Tab, Key_Return, Key_LArrow, Key_DnArrow, Key_UpArrow, Key_RArrow, Key_Semicolon, Key_Quote},\
{Key_PageDn, Key_Backslash, Key_mouseBtnL, Key_mouseBtnM, Key_mouseBtnR, Key_B, Key_Esc, Key_Enter, Key_Pipe, Key_M, Key_Comma, Key_Period, Key_Backslash, Key_Minus},\
{Key_LGUI, Key_Backspace, Key_LShift, Key_LCtrl, Key_NoKey, Key_skip, Key_skip, Key_skip, Key_skip, Key_NoKey, Key_RCtrl, Key_RShift, Key_Space, Key_RAlt},\
#define KEYMAP_GENERIC_FN2 { /* Generated keymap for GENERIC_FN2 */ {Key_skip, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_skip, Key_skip, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_skip},\
{Key_Tab, Key_macroKey1, Key_mouseBtnL, Key_mouseBtnM, Key_mouseBtnR, Key_volumeUp, Key_NoKey, Key_NoKey, Key_prevTrack, Key_playPause, Key_nextTrack, Key_wwwSearch, Key_BacklightUp, Key_sleep},\
{Key_Home, Key_mouseL, Key_mouseUp, Key_mouseDn, Key_mouseR, Key_volumeDown, Key_Tab, Key_Return, Key_LArrow, Key_DnArrow, Key_UpArrow, Key_RArrow, Key_BacklightDn, Key_skip},\
{Key_End, Key_Z, Key_X, Key_C, Key_V, Key_volumeMute, Key_Esc, Key_Enter, Key_Pipe, Key_M, Key_Comma, Key_Period, Key_Backslash, Key_Minus},\
{Key_LGUI, Key_Delete, Key_LShift, Key_LCtrl, Key_NoKey, Key_skip, Key_skip, Key_skip, Key_skip, Key_NoKey, Key_RCtrl, Key_RShift, Key_Space, Key_RAlt},\
},
#define KEYMAP_MALTRON { /* Generated keymap for MALTRON */ {Key_skip, Key_1, Key_2, Key_3, Key_4, Key_5, Key_skip, Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip},\
{Key_Backtick, Key_Q, Key_P, Key_Y, Key_C, Key_B, Key_skip, Key_skip, Key_V, Key_M, Key_U, Key_Z, Key_L, Key_Equals},\
@ -28,46 +22,29 @@
{Key_PageDn, Key_Comma, Key_Period, Key_J, Key_G, Key_Slash, Key_Esc, Key_Keymap2, Key_Semicolon, Key_W, Key_K, Key_Minus, Key_X, Key_LSquareBracket},\
{Key_LGUI, Key_E, Key_LShift, Key_Backspace, Key_KeymapNext_Momentary, Key_skip, Key_skip, Key_skip, Key_skip, Key_KeymapNext_Momentary, Key_RCtrl, Key_RShift, Key_Space, Key_RAlt},\
},
#define KEYMAP_MALTRON_FN2 { /* Generated keymap for MALTRON_FN2 */ {Key_skip, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_skip, Key_skip, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_skip},\
{Key_Backtick, Key_macroKey1, Key_mouseBtnL, Key_mouseBtnM, Key_mouseBtnR, Key_T, Key_NoKey, Key_NoKey, Key_LCurlyBracket, Key_RCurlyBracket, Key_LSquareBracket, Key_RSquareBracket, Key_P, Key_Equals},\
{Key_PageUp, Key_mouseL, Key_mouseUp, Key_mouseDn, Key_mouseR, Key_G, Key_Tab, Key_Return, Key_LArrow, Key_DnArrow, Key_UpArrow, Key_RArrow, Key_Semicolon, Key_Quote},\
{Key_PageDn, Key_Keymap2, Key_mouseBtnL, Key_mouseBtnM, Key_mouseBtnR, Key_Backslash, Key_Esc, Key_Enter, Key_Pipe, Key_M, Key_Comma, Key_Period, Key_Backslash, Key_RSquareBracket},\
{Key_LGUI, Key_Backspace, Key_LShift, Key_LCtrl, Key_NoKey, Key_skip, Key_skip, Key_skip, Key_skip, Key_NoKey, Key_RCtrl, Key_RShift, Key_Space, Key_RAlt},\
},
#define KEYMAP_QWERTY { /* Generated keymap for QWERTY */ {Key_skip, Key_1, Key_2, Key_3, Key_4, Key_5, Key_skip, Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip},\
{Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_skip, Key_skip, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals},\
{Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G, Key_Tab, Key_Return, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote},\
{Key_PageDn, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Esc, Key_Keymap2, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus},\
{Key_LGUI, Key_Backspace, Key_LShift, Key_LCtrl, Key_KeymapNext_Momentary, Key_skip, Key_skip, Key_skip, Key_skip, Key_KeymapNext_Momentary, Key_RCtrl, Key_RShift, Key_Space, Key_RAlt},\
},
#define KEYMAP_QWERTY_FN2 { /* Generated keymap for QWERTY_FN2 */ {Key_skip, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_skip, Key_skip, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_skip},\
{Key_Tab, Key_macroKey1, Key_mouseBtnL, Key_mouseBtnM, Key_mouseBtnR, Key_T, Key_NoKey, Key_NoKey, Key_LCurlyBracket, Key_RCurlyBracket, Key_LSquareBracket, Key_RSquareBracket, Key_P, Key_Equals},\
{Key_PageUp, Key_mouseL, Key_mouseUp, Key_mouseDn, Key_mouseR, Key_G, Key_Tab, Key_Return, Key_LArrow, Key_DnArrow, Key_UpArrow, Key_RArrow, Key_sleep, Key_volumeUp},\
{Key_PageDn, Key_Keymap2, Key_mouseBtnL, Key_mouseBtnM, Key_mouseBtnR, Key_B, Key_Esc, Key_Enter, Key_Pipe, Key_M, Key_Comma, Key_Period, Key_Backslash, Key_Minus},\
{Key_LGUI, Key_Backspace, Key_LShift, Key_LCtrl, Key_NoKey, Key_skip, Key_skip, Key_skip, Key_skip, Key_NoKey, Key_RCtrl, Key_RShift, Key_Space, Key_RAlt},\
},
#define KEYMAP_WORKMAN { /* Generated keymap for WORKMAN */ {Key_skip, Key_1, Key_2, Key_3, Key_4, Key_5, Key_skip, Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip},\
{Key_Backtick, Key_Q, Key_D, Key_R, Key_W, Key_B, Key_skip, Key_skip, Key_J, Key_F, Key_U, Key_P, Key_Semicolon, Key_Equals},\
{Key_PageUp, Key_A, Key_S, Key_H, Key_T, Key_G, Key_Tab, Key_Return, Key_Y, Key_N, Key_E, Key_O, Key_I, Key_Quote},\
{Key_PageDn, Key_Z, Key_X, Key_M, Key_C, Key_V, Key_Esc, Key_Keymap0, Key_K, Key_L, Key_Comma, Key_Period, Key_Slash, Key_Minus},\
{Key_LGUI, Key_Backspace, Key_LShift, Key_LCtrl, Key_KeymapNext_Momentary, Key_skip, Key_skip, Key_skip, Key_skip, Key_KeymapNext_Momentary, Key_RCtrl, Key_RShift, Key_Space, Key_RAlt},\
},
#define KEYMAP_WORKMAN_FN2 { /* Generated keymap for WORKMAN_FN2 */ {Key_skip, Key_1, Key_2, Key_3, Key_4, Key_5, Key_skip, Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip},\
{Key_Backtick, Key_macroKey1, Key_mouseBtnL, Key_mouseBtnM, Key_mouseBtnR, Key_NoKey, Key_NoKey, Key_NoKey, Key_LCurlyBracket, Key_RCurlyBracket, Key_LSquareBracket, Key_RSquareBracket, Key_NoKey, Key_Equals},\
{Key_PageUp, Key_mouseL, Key_mouseUp, Key_mouseDn, Key_mouseR, Key_NoKey, Key_Tab, Key_Return, Key_LArrow, Key_DnArrow, Key_UpArrow, Key_RArrow, Key_Semicolon, Key_Quote},\
{Key_PageDn, Key_Keymap0, Key_mouseBtnL, Key_mouseBtnM, Key_mouseBtnR, Key_NoKey, Key_Esc, Key_Enter, Key_Pipe, Key_NoKey, Key_Comma, Key_Period, Key_Backslash, Key_Minus},\
{Key_LGUI, Key_Backspace, Key_LShift, Key_LCtrl, Key_NoKey, Key_skip, Key_skip, Key_skip, Key_skip, Key_NoKey, Key_RCtrl, Key_RShift, Key_Space, Key_RAlt},\
},
#define LAYERS 8
// This is a total waste. we should only ever include any given keymap once
static const Key keymaps[LAYERS][ROWS][COLS] = {
KEYMAP_QWERTY
KEYMAP_QWERTY_FN2
KEYMAP_GENERIC_FN2
KEYMAP_COLEMAK
KEYMAP_COLEMAK_FN2
KEYMAP_GENERIC_FN2
KEYMAP_DVORAK
KEYMAP_DVORAK_FN2
KEYMAP_GENERIC_FN2
KEYMAP_WORKMAN
KEYMAP_WORKMAN_FN2
KEYMAP_GENERIC_FN2

@ -1,13 +1,14 @@
#define LAYERS 8
// This is a total waste. we should only ever include any given keymap once
static const Key keymaps[LAYERS][ROWS][COLS] = {
KEYMAP_QWERTY
KEYMAP_QWERTY_FN2
KEYMAP_GENERIC_FN2
KEYMAP_COLEMAK
KEYMAP_COLEMAK_FN2
KEYMAP_GENERIC_FN2
KEYMAP_DVORAK
KEYMAP_DVORAK_FN2
KEYMAP_GENERIC_FN2
KEYMAP_WORKMAN
KEYMAP_WORKMAN_FN2
KEYMAP_GENERIC_FN2

@ -1,6 +0,0 @@
#NAME: COLEMAK_FN2
skip F1 F2 F3 F4 F5 skip skip F6 F7 F8 F9 F10 skip
` macroKey1 mouseBtnL mouseBtnM mouseBtnR NoKey NoKey NoKey { } [ ] NoKey =
PageUp mouseL mouseUp mouseDn mouseR NoKey Tab Return LArrow DnArrow UpArrow RArrow ; '
PageDn Keymap0 mouseBtnL mouseBtnM mouseBtnR NoKey Esc Enter | NoKey , . \ -
LGUI Backspace LShift LCtrl NoKey skip skip skip skip NoKey RCtrl RShift Space RAlt

@ -1,6 +0,0 @@
#NAME: DVORAK_FN2
skip 1 2 3 4 5 skip skip 6 7 8 9 0 skip
` macroKey1 mouseBtnL mouseBtnM mouseBtnR T NoKey NoKey { } [ ] P =
PageUp mouseL mouseUp mouseDn mouseR G Tab Return LArrow DnArrow UpArrow RArrow ; '
PageDn \ mouseBtnL mouseBtnM mouseBtnR B Esc Enter | M , . \ -
LGUI Backspace LShift LCtrl NoKey skip skip skip skip NoKey RCtrl RShift Space RAlt

@ -1,6 +1,6 @@
#NAME: QWERTY_FN2
#NAME: GENERIC_FN2
skip F1 F2 F3 F4 F5 skip skip F6 F7 F8 F9 F10 skip
Tab macroKey1 mouseBtnL mouseBtnM mouseBtnR volumeUp NoKey NoKey prevTrack playPause nextTrack wwwSearch BacklightUp sleep
Home mouseL mouseUp mouseDn mouseR volumeDown Tab Return LArrow DnArrow UpArrow RArrow BacklightDn
End Undo Cut Copy Paste volumeMute Esc Enter | M , . \ -
Home mouseL mouseUp mouseDn mouseR volumeDown Tab Return LArrow DnArrow UpArrow RArrow BacklightDn skip
End Z X C V volumeMute Esc Enter | M , . \ -
LGUI Delete LShift LCtrl NoKey skip skip skip skip NoKey RCtrl RShift Space RAlt

@ -1,6 +0,0 @@
#NAME: MALTRON_FN2
skip F1 F2 F3 F4 F5 skip skip F6 F7 F8 F9 F10 skip
` macroKey1 mouseBtnL mouseBtnM mouseBtnR T NoKey NoKey { } [ ] P =
PageUp mouseL mouseUp mouseDn mouseR G Tab Return LArrow DnArrow UpArrow RArrow ; '
PageDn Keymap2 mouseBtnL mouseBtnM mouseBtnR \ Esc Enter | M , . \ ]
LGUI Backspace LShift LCtrl NoKey skip skip skip skip NoKey RCtrl RShift Space RAlt

@ -1,6 +0,0 @@
#NAME: WORKMAN_FN2
skip 1 2 3 4 5 skip skip 6 7 8 9 0 skip
` macroKey1 mouseBtnL mouseBtnM mouseBtnR NoKey NoKey NoKey { } [ ] NoKey =
PageUp mouseL mouseUp mouseDn mouseR NoKey Tab Return LArrow DnArrow UpArrow RArrow ; '
PageDn Keymap0 mouseBtnL mouseBtnM mouseBtnR NoKey Esc Enter | NoKey , . \ -
LGUI Backspace LShift LCtrl NoKey skip skip skip skip NoKey RCtrl RShift Space RAlt
Loading…
Cancel
Save