*all* media keys

master
Stefan Dorn 2016-01-26 15:33:59 +00:00
parent 35bbc544bb
commit 068da79193
3 changed files with 195 additions and 147 deletions

View File

@ -37,136 +37,159 @@ class Key
} }
Keys = { Keys = {
"a" => "KEY_a_A", "a" => "KEY_a_A",
"b" => "KEY_b_B", "b" => "KEY_b_B",
"c" => "KEY_c_C", "c" => "KEY_c_C",
"d" => "KEY_d_D", "d" => "KEY_d_D",
"e" => "KEY_e_E", "e" => "KEY_e_E",
"f" => "KEY_f_F", "f" => "KEY_f_F",
"g" => "KEY_g_G", "g" => "KEY_g_G",
"h" => "KEY_h_H", "h" => "KEY_h_H",
"i" => "KEY_i_I", "i" => "KEY_i_I",
"j" => "KEY_j_J", "j" => "KEY_j_J",
"k" => "KEY_k_K", "k" => "KEY_k_K",
"l" => "KEY_l_L", "l" => "KEY_l_L",
"m" => "KEY_m_M", "m" => "KEY_m_M",
"n" => "KEY_n_N", "n" => "KEY_n_N",
"o" => "KEY_o_O", "o" => "KEY_o_O",
"p" => "KEY_p_P", "p" => "KEY_p_P",
"q" => "KEY_q_Q", "q" => "KEY_q_Q",
"r" => "KEY_r_R", "r" => "KEY_r_R",
"s" => "KEY_s_S", "s" => "KEY_s_S",
"t" => "KEY_t_T", "t" => "KEY_t_T",
"u" => "KEY_u_U", "u" => "KEY_u_U",
"v" => "KEY_v_V", "v" => "KEY_v_V",
"w" => "KEY_w_W", "w" => "KEY_w_W",
"x" => "KEY_x_X", "x" => "KEY_x_X",
"y" => "KEY_y_Y", "y" => "KEY_y_Y",
"z" => "KEY_z_Z", "z" => "KEY_z_Z",
# #
"0" => "KEY_0_RightParenthesis", "0" => "KEY_0_RightParenthesis",
"1" => "KEY_1_Exclamation", "1" => "KEY_1_Exclamation",
"2" => "KEY_2_At", "2" => "KEY_2_At",
"3" => "KEY_3_Pound", "3" => "KEY_3_Pound",
"4" => "KEY_4_Dollar", "4" => "KEY_4_Dollar",
"5" => "KEY_5_Percent", "5" => "KEY_5_Percent",
"6" => "KEY_6_Caret", "6" => "KEY_6_Caret",
"7" => "KEY_7_Ampersand", "7" => "KEY_7_Ampersand",
"8" => "KEY_8_Asterisk", "8" => "KEY_8_Asterisk",
"9" => "KEY_9_LeftParenthesis", "9" => "KEY_9_LeftParenthesis",
# #
"f1" => "KEY_F1", "f1" => "KEY_F1",
"f2" => "KEY_F2", "f2" => "KEY_F2",
"f3" => "KEY_F3", "f3" => "KEY_F3",
"f4" => "KEY_F4", "f4" => "KEY_F4",
"f5" => "KEY_F5", "f5" => "KEY_F5",
"f6" => "KEY_F6", "f6" => "KEY_F6",
"f7" => "KEY_F7", "f7" => "KEY_F7",
"f8" => "KEY_F8", "f8" => "KEY_F8",
"f9" => "KEY_F9", "f9" => "KEY_F9",
"f10" => "KEY_F10", "f10" => "KEY_F10",
"f11" => "KEY_F11", "f11" => "KEY_F11",
"f12" => "KEY_F12", "f12" => "KEY_F12",
"f13" => "KEY_F13", "f13" => "KEY_F13",
"f14" => "KEY_F14", "f14" => "KEY_F14",
"f15" => "KEY_F15", "f15" => "KEY_F15",
"f16" => "KEY_F16", "f16" => "KEY_F16",
"f17" => "KEY_F17", "f17" => "KEY_F17",
"f18" => "KEY_F18", "f18" => "KEY_F18",
"f19" => "KEY_F19", "f19" => "KEY_F19",
"f20" => "KEY_F20", "f20" => "KEY_F20",
"f21" => "KEY_F21", "f21" => "KEY_F21",
"f22" => "KEY_F22", "f22" => "KEY_F22",
"f23" => "KEY_F23", "f23" => "KEY_F23",
"f24" => "KEY_F24", "f24" => "KEY_F24",
# #
"\\" => "KEY_Backslash_Pipe", "\\" => "KEY_Backslash_Pipe",
"{" => "KEY_LeftBracket_LeftBrace", "{" => "KEY_LeftBracket_LeftBrace",
"}" => "KEY_RightBracket_RightBrace", "}" => "KEY_RightBracket_RightBrace",
"[" => "KEY_LeftBracket_LeftBrace", "[" => "KEY_LeftBracket_LeftBrace",
"]" => "KEY_RightBracket_RightBrace", "]" => "KEY_RightBracket_RightBrace",
"," => "KEY_Comma_LessThan", "," => "KEY_Comma_LessThan",
"-" => "KEY_Dash_Underscore", "-" => "KEY_Dash_Underscore",
"=" => "KEY_Equal_Plus", "=" => "KEY_Equal_Plus",
"`" => "KEY_GraveAccent_Tilde", "`" => "KEY_GraveAccent_Tilde",
"." => "KEY_Period_GreaterThan", "." => "KEY_Period_GreaterThan",
"\'" => "KEY_SingleQuote_DoubleQuote", "\'" => "KEY_SingleQuote_DoubleQuote",
";" => "KEY_Semicolon_Colon", ";" => "KEY_Semicolon_Colon",
"/" => "KEY_Slash_Question", "/" => "KEY_Slash_Question",
"~" => "KEY_GraveAccent_Tilde", "~" => "KEY_GraveAccent_Tilde",
"%" => "KEY_5_Percent", "%" => "KEY_5_Percent",
"*" => "KEY_8_Asterisk", "*" => "KEY_8_Asterisk",
":" => "KEY_Semicolon_Colon", ":" => "KEY_Semicolon_Colon",
"^" => "KEY_6_Caret", "^" => "KEY_6_Caret",
"<" => "KEY_Comma_LessThan", "<" => "KEY_Comma_LessThan",
">" => "KEY_Period_GreaterThan", ">" => "KEY_Period_GreaterThan",
"?" => "KEY_Slash_Question", "?" => "KEY_Slash_Question",
"!" => "KEY_1_Exclamation", "!" => "KEY_1_Exclamation",
"(" => "KEY_9_LeftParenthesis", "(" => "KEY_9_LeftParenthesis",
")" => "KEY_0_RightParenthesis", ")" => "KEY_0_RightParenthesis",
"|" => "KEY_Backslash_Pipe", "|" => "KEY_Backslash_Pipe",
"@" => "KEY_2_At", "@" => "KEY_2_At",
"\"" => "KEY_SingleQuote_DoubleQuote", "\"" => "KEY_SingleQuote_DoubleQuote",
"_" => "KEY_Dash_Underscore", "_" => "KEY_Dash_Underscore",
"+" => "KEY_Equal_Plus", "+" => "KEY_Equal_Plus",
"$" => "KEY_4_Dollar", "$" => "KEY_4_Dollar",
"&" => "KEY_7_Ampersand", "&" => "KEY_7_Ampersand",
"#" => "KEY_3_Pound", "#" => "KEY_3_Pound",
# #
"enter" => "KEY_ReturnEnter", "enter" => "KEY_ReturnEnter",
"return" => "KEY_ReturnEnter", "return" => "KEY_ReturnEnter",
"space" => "KEY_Spacebar", "space" => "KEY_Spacebar",
"tab" => "KEY_Tab", "tab" => "KEY_Tab",
"backspace" => "KEY_DeleteBackspace", "backspace" => "KEY_DeleteBackspace",
"delete" => "KEY_DeleteForward", "delete" => "KEY_DeleteForward",
"home" => "KEY_Home", "home" => "KEY_Home",
"end" => "KEY_End", "end" => "KEY_End",
"page_up" => "KEY_PageUp", "page_up" => "KEY_PageUp",
"page_down" => "KEY_PageDown", "page_down" => "KEY_PageDown",
"up" => "KEY_UpArrow", "up" => "KEY_UpArrow",
"down" => "KEY_DownArrow", "down" => "KEY_DownArrow",
"left" => "KEY_LeftArrow", "left" => "KEY_LeftArrow",
"right" => "KEY_RightArrow", "right" => "KEY_RightArrow",
"escape" => "KEY_Escape", "escape" => "KEY_Escape",
"insert" => "KEY_Insert", "insert" => "KEY_Insert",
"menu" => "KEY_Application", "menu" => "KEY_Application",
# #
"alt" => "KEY_LeftAlt", "alt" => "KEY_LeftAlt",
"alt_gr" => "KEY_RightAlt", "alt_gr" => "KEY_RightAlt",
"umlaut" => "KEY_RightAlt", "umlaut" => "KEY_RightAlt",
"control" => "KEY_LeftControl", "control" => "KEY_LeftControl",
"control_l" => "KEY_LeftControl", "control_l" => "KEY_LeftControl",
"control_r" => "KEY_RightControl", "control_r" => "KEY_RightControl",
"win" => "KEY_LeftGUI", "win" => "KEY_LeftGUI",
"shift_l" => "KEY_LeftShift", "shift_l" => "KEY_LeftShift",
"shift_r" => "KEY_RightShift", "shift_r" => "KEY_RightShift",
"scroll_lock" => "KEY_ScrollLock", "scroll_lock" => "KEY_ScrollLock",
# #
"punc" => "1", "punc" => "1",
"nav" => "2", "nav" => "2",
"func" => "3", "func" => "3",
# #
"NULL" => "NULL", "NULL" => "NULL",
#
"audio_mute" => "MEDIAKEY_AUDIO_MUTE",
"audio_vol_up" => "MEDIAKEY_AUDIO_VOL_UP",
"audio_vol_down" => "MEDIAKEY_AUDIO_VOL_DOWN",
"next_track" => "MEDIAKEY_NEXT_TRACK",
"prev_track" => "MEDIAKEY_PREV_TRACK",
"stop" => "MEDIAKEY_STOP",
"play_pause" => "MEDIAKEY_PLAY_PAUSE",
"record" => "MEDIAKEY_RECORD",
"rewind" => "MEDIAKEY_REWIND",
"eject" => "MEDIAKEY_EJECT",
"cc_config" => "MEDIAKEY_CC_CONFIG",
"email" => "MEDIAKEY_EMAIL",
"calculator" => "MEDIAKEY_CALCULATOR",
"local_browser" => "MEDIAKEY_LOCAL_BROWSER",
"browser_search" => "MEDIAKEY_BROWSER_SEARCH",
"browser_home" => "MEDIAKEY_BROWSER_HOME",
"browser_back" => "MEDIAKEY_BROWSER_BACK",
"browser_forward" => "MEDIAKEY_BROWSER_FORWARD",
"browser_stop" => "MEDIAKEY_BROWSER_STOP",
"browser_refresh" => "MEDIAKEY_BROWSER_REFRESH",
"browser_bookmarks" => "MEDIAKEY_BROWSER_BOOKMARKS",
} }
def initialize layers def initialize layers

View File

@ -21,13 +21,27 @@
* consumer key scan code in usb_keyboard.h * consumer key scan code in usb_keyboard.h
*/ */
static const uint16_t _media_code_lookup_table[] = { static const uint16_t _media_code_lookup_table[] = {
TRANSPORT_PLAY_PAUSE, /* MEDIAKEY_PLAY_PAUSE */ AUDIO_MUTE, // MEDIAKEY_AUDIO_MUTE
TRANSPORT_STOP, /* MEDIAKEY_STOP */ AUDIO_VOL_UP, // MEDIAKEY_AUDIO_VOL_UP
TRANSPORT_PREV_TRACK, /* MEDIAKEY_PREV_TRACK */ AUDIO_VOL_DOWN, // MEDIAKEY_AUDIO_VOL_DOWN
TRANSPORT_NEXT_TRACK, /* MEDIAKEY_NEXT_TRACK */ TRANSPORT_NEXT_TRACK, // MEDIAKEY_NEXT_TRACK
AUDIO_MUTE, /* MEDIAKEY_AUDIO_MUTE */ TRANSPORT_PREV_TRACK, // MEDIAKEY_PREV_TRACK
AUDIO_VOL_UP, /* MEDIAKEY_AUDIO_VOL_UP */ TRANSPORT_STOP, // MEDIAKEY_STOP
AUDIO_VOL_DOWN, /* MEDIAKEY_AUDIO_VOL_DOWN */ TRANSPORT_PLAY_PAUSE, // MEDIAKEY_PLAY_PAUSE
TRANSPORT_RECORD, // MEDIAKEY_RECORD
TRANSPORT_REWIND, // MEDIAKEY_REWIND
TRANSPORT_EJECT, // MEDIAKEY_EJECT
AL_CC_CONFIG, // MEDIAKEY_CC_CONFIG
AL_EMAIL, // MEDIAKEY_EMAIL
AL_CALCULATOR, // MEDIAKEY_CALCULATOR
AL_LOCAL_BROWSER, // MEDIAKEY_LOCAL_BROWSER
AC_SEARCH, // MEDIAKEY_BROWSER_SEARCH
AC_HOME, // MEDIAKEY_BROWSER_HOME
AC_BACK, // MEDIAKEY_BROWSER_BACK
AC_FORWARD, // MEDIAKEY_BROWSER_FORWARD
AC_STOP, // MEDIAKEY_BROWSER_STOP
AC_REFRESH, // MEDIAKEY_BROWSER_REFRESH
AC_BOOKMARKS, // MEDIAKEY_BROWSER_BOOKMARKS
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -145,4 +159,3 @@ void _kbfun_mediakey_press_release(bool press, uint8_t keycode) {
} }
} }
} }

View File

@ -270,16 +270,28 @@
// Media key codes are not real scan codes, they must be translated to a 16 // Media key codes are not real scan codes, they must be translated to a 16
// bit number by the consumer key key function // bit number by the consumer key key function
#define MEDIAKEY_PLAY_PAUSE 0x00 #define MEDIAKEY_AUDIO_MUTE 0
#define MEDIAKEY_STOP 0x01 #define MEDIAKEY_AUDIO_VOL_UP 1
#define MEDIAKEY_PREV_TRACK 0x02 #define MEDIAKEY_AUDIO_VOL_DOWN 2
#define MEDIAKEY_NEXT_TRACK 0x03 #define MEDIAKEY_NEXT_TRACK 3
#define MEDIAKEY_AUDIO_MUTE 0x04 #define MEDIAKEY_PREV_TRACK 4
#define MEDIAKEY_AUDIO_VOL_UP 0x05 #define MEDIAKEY_STOP 5
#define MEDIAKEY_AUDIO_VOL_DOWN 0x06 #define MEDIAKEY_PLAY_PAUSE 6
#define MEDIAKEY_RECORD 7
#define MEDIAKEY_REWIND 8
#define MEDIAKEY_EJECT 9
#define MEDIAKEY_CC_CONFIG 10
#define MEDIAKEY_EMAIL 11
#define MEDIAKEY_CALCULATOR 12
#define MEDIAKEY_LOCAL_BROWSER 13
#define MEDIAKEY_BROWSER_SEARCH 14
#define MEDIAKEY_BROWSER_HOME 15
#define MEDIAKEY_BROWSER_BACK 16
#define MEDIAKEY_BROWSER_FORWARD 17
#define MEDIAKEY_BROWSER_STOP 18
#define MEDIAKEY_BROWSER_REFRESH 19
#define MEDIAKEY_BROWSER_BOOKMARKS 20
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#endif #endif