]>
git.gir.st - tmk_keyboard.git/blob - common/usb_keycodes.h
2 Copyright 2011 Jun Wako <wakojun@gmail.com>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * Key codes: HID Keyboard/Keypad Page(0x07)
20 * http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
22 #ifndef USB_KEYCODES_H
23 #define USB_KEYCODES_H
26 #define IS_ERROR(code) (KB_ROLL_OVER <= (code) && (code) <= KB_UNDEFINED)
27 #define IS_ANY(code) (KB_A <= (code) && (code) <= 0xFF)
28 #define IS_KEY(code) (KB_A <= (code) && (code) <= KB_EXSEL)
29 #define IS_MOD(code) (KB_LCTRL <= (code) && (code) <= KB_RGUI)
31 #define IS_FN(code) (KB_FN0 <= (code) && (code) <= KB_FN7)
32 #define IS_MOUSEKEY(code) (KB_MS_UP <= (code) && (code) <= KB_MS_WH_RIGHT)
33 #define IS_MOUSEKEY_MOVE(code) (KB_MS_UP <= (code) && (code) <= KB_MS_RIGHT)
34 #define IS_MOUSEKEY_BUTTON(code) (KB_MS_BTN1 <= (code) && (code) <= KB_MS_BTN5)
35 #define IS_MOUSEKEY_WHEEL(code) (KB_MS_WH_UP <= (code) && (code) <= KB_MS_WH_RIGHT)
37 #define IS_SPECIAL(code) ((0xB0 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF))
38 #define IS_CONSUMER(code) (KB_MUTE <= (code) && (code) <= KB_WFAV)
39 #define IS_SYSTEM(code) (KB_POWER <= (code) && (code) <= KB_WAKE)
41 #define MOD_BIT(code) (1<<((code) & 0x07))
42 #define FN_BIT(code) (1<<((code) - KB_FN0))
43 #define FN_INDEX(code) ((code) - KB_FN0)
47 #define KB_LCTL KB_LCTRL
48 #define KB_RCTL KB_RCTRL
49 #define KB_LSFT KB_LSHIFT
50 #define KB_RSFT KB_RSHIFT
51 #define KB_ESC KB_ESCAPE
52 #define KB_BSPC KB_BSPACE
53 #define KB_ENT KB_ENTER
54 #define KB_DEL KB_DELETE
55 #define KB_INS KB_INSERT
56 #define KB_CAPS KB_CAPSLOCK
57 #define KB_RGHT KB_RIGHT
58 #define KB_PGDN KB_PGDOWN
59 #define KB_PSCR KB_PSCREEN
60 #define KB_SLCK KB_SCKLOCK
61 #define KB_PAUS KB_PAUSE
62 #define KB_BRK KB_PAUSE
63 #define KB_NLCK KB_NUMLOCK
64 #define KB_SPC KB_SPACE
65 #define KB_MINS KB_MINUS
66 #define KB_EQL KB_EQUAL
67 #define KB_GRV KB_GRAVE
68 #define KB_RBRC KB_RBRACKET
69 #define KB_LBRC KB_LBRACKET
70 #define KB_COMM KB_COMMA
71 #define KB_BSLS KB_BSLASH
72 #define KB_SLSH KB_SLASH
73 #define KB_SCLN KB_SCOLON
74 #define KB_QUOT KB_QUOTE
75 #define KB_APP KB_APPLICATION
76 #define KB_NUHS KB_NONUS_HASH
77 #define KB_NUBS KB_NONUS_BSLASH
78 #define KB_ERAS KB_ALT_ERASE,
79 #define KB_CLR KB_CLEAR
81 #define KB_ZKHK KB_GRAVE
83 #define KB_KANA KB_INT2
84 #define KB_JYEN KB_INT3
85 #define KB_HENK KB_INT4
86 #define KB_MHEN KB_INT5
98 #define KB_PDOT KB_KP_DOT
99 #define KB_PCMM KB_KP_COMMA
100 #define KB_PSLS KB_KP_SLASH
101 #define KB_PAST KB_KP_ASTERISK
102 #define KB_PMNS KB_KP_MINUS
103 #define KB_PPLS KB_KP_PLUS
104 #define KB_PEQL KB_KP_EQUAL
105 #define KB_PENT KB_KP_ENTER
107 #define KB_MS_U KB_MS_UP
108 #define KB_MS_D KB_MS_DOWN
109 #define KB_MS_L KB_MS_LEFT
110 #define KB_MS_R KB_MS_RIGHT
111 #define KB_BTN1 KB_MS_BTN1
112 #define KB_BTN2 KB_MS_BTN2
113 #define KB_BTN3 KB_MS_BTN3
114 #define KB_BTN4 KB_MS_BTN4
115 #define KB_BTN5 KB_MS_BTN5
116 #define KB_WH_U KB_MS_WH_UP
117 #define KB_WH_D KB_MS_WH_DOWN
118 #define KB_WH_L KB_MS_WH_LEFT
119 #define KB_WH_R KB_MS_WH_RIGHT
120 /* Sytem Control & Consumer usage */
121 #define KB_PWR KB_SYSTEM_POWER
122 #define KB_SLEP KB_SYSTEM_SLEEP
123 #define KB_WAKE KB_SYSTEM_WAKE
124 #define KB_MUTE KB_AUDIO_MUTE
125 #define KB_VOLU KB_AUDIO_VOL_UP
126 #define KB_VOLD KB_AUDIO_VOL_DOWN
127 #define KB_MNXT KB_MEDIA_NEXT_TRACK
128 #define KB_MPRV KB_MEDIA_PREV_TRACK
129 #define KB_MSTP KB_MEDIA_STOP
130 #define KB_MPLY KB_MEDIA_PLAY_PAUSE
131 #define KB_MSEL KB_MEDIA_SELECT
132 #define KB_MAIL KB_MAIL
133 #define KB_CALC KB_CALCULATOR
134 #define KB_MYCM KB_MY_COMPUTER
135 #define KB_WSCH KB_WWW_SEARCH
136 #define KB_WHOM KB_WWW_HOME
137 #define KB_WBAK KB_WWW_BACK
138 #define KB_WFWD KB_WWW_FORWARD
139 #define KB_WSTP KB_WWW_STOP
140 #define KB_WREF KB_WWW_REFRESH
141 #define KB_WFAV KB_WWW_FAVORITES
144 /* Special keycode */
145 /* NOTE: 0xA5-DF and 0xE8-FF can be used for internal special purpose */
146 enum special_keycodes
{
148 KB_SYSTEM_POWER
= 0xA5,
150 KB_SYSTEM_WAKE
, /* 0xA7 */
154 KB_AUDIO_MUTE
= 0xB0,
170 KB_WWW_REFRESH
, /* 0xC0 */
171 KB_WWW_FAVORITES
, /* 0xC1 */
172 /* 0xC2-DF vacant for future use */
174 /* 0xE0-E7 for Modifiers. DO NOT USE. */
176 /* Layer Switching */
200 KB_MS_WH_RIGHT
, /* 0xFC */
201 /* 0xFD-FF vacant for future use */
204 /* USB HID Keyboard/Keypad Usage(0x07) */
254 KB_RBRACKET
, /* 0x30 */
255 KB_BSLASH
, /* \ (and |) */
256 KB_NONUS_HASH
, /* Non-US # and ~ */
257 KB_SCOLON
, /* ; (and :) */
258 KB_QUOTE
, /* ' and " */
259 KB_GRAVE
, /* Grave accent and tilde */
260 KB_COMMA
, /* , and < */
261 KB_DOT
, /* . and > */
262 KB_SLASH
, /* / and ? */
306 KB_NONUS_BSLASH
, /* Non-US \ and | */
334 KB__VOLUP
, /* 0x80 */
336 KB_LOCKING_CAPS
, /* locking Caps Lock */
337 KB_LOCKING_NUM
, /* locking Num Lock */
338 KB_LOCKING_SCROLL
, /* locking Scroll Lock */
340 KB_KP_EQUAL_AS400
, /* equal sign on AS/400 */
372 /* NOTE: 0xA5-DF are used for internal special purpose */
377 KB_THOUSANDS_SEPARATOR
,
378 KB_DECIMAL_SEPARATOR
,
380 KB_CURRENCY_SUB_UNIT
,
383 KB_KP_LCBRACKET
, /* { */
384 KB_KP_RCBRACKET
, /* } */
407 KB_KP_MEM_STORE
, /* 0xD0 */
420 KB_KP_HEXADECIMAL
, /* 0xDD */
433 /* NOTE: 0xE8-FF are used for internal special purpose */
436 #endif /* USB_KEYCODES_H */