2 Copyright 2011,2012 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 * Keycodes based on HID Usage Keyboard/Keypad Page(0x07) plus special codes
20 * http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
26 #define IS_ERROR(code) (KC_ROLL_OVER <= (code) && (code) <= KC_UNDEFINED)
27 #define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF)
28 #define IS_KEY(code) (KC_A <= (code) && (code) <= KC_EXSEL)
29 #define IS_MOD(code) (KC_LCTRL <= (code) && (code) <= KC_RGUI)
32 #define IS_SPECIAL(code) ((0xA5 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF))
33 #define IS_SYSTEM(code) (KC_PWR <= (code) && (code) <= KC_WAKE)
34 #define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_WFAV)
35 #define IS_FN(code) (KC_FN0 <= (code) && (code) <= KC_FN31)
36 #define IS_MOUSEKEY(code) (KC_MS_UP <= (code) && (code) <= KC_MS_ACCEL2)
37 #define IS_MOUSEKEY_MOVE(code) (KC_MS_UP <= (code) && (code) <= KC_MS_RIGHT)
38 #define IS_MOUSEKEY_BUTTON(code) (KC_MS_BTN1 <= (code) && (code) <= KC_MS_BTN5)
39 #define IS_MOUSEKEY_WHEEL(code) (KC_MS_WH_UP <= (code) && (code) <= KC_MS_WH_RIGHT)
40 #define IS_MOUSEKEY_ACCEL(code) (KC_MS_ACCEL0 <= (code) && (code) <= KC_MS_ACCEL2)
42 #define MOD_BIT(code) (1<<MOD_INDEX(code))
43 #define MOD_INDEX(code) ((code) & 0x07)
44 #define FN_BIT(code) (1<<FN_INDEX(code))
45 #define FN_INDEX(code) ((code) - KC_FN0)
47 #define FN_MAX KC_FN31
51 * Short names for ease of definition of keymap
53 #define KC_LCTL KC_LCTRL
54 #define KC_RCTL KC_RCTRL
55 #define KC_LSFT KC_LSHIFT
56 #define KC_RSFT KC_RSHIFT
57 #define KC_ESC KC_ESCAPE
58 #define KC_BSPC KC_BSPACE
59 #define KC_ENT KC_ENTER
60 #define KC_DEL KC_DELETE
61 #define KC_INS KC_INSERT
62 #define KC_CAPS KC_CAPSLOCK
63 #define KC_CLCK KC_CAPSLOCK
64 #define KC_RGHT KC_RIGHT
65 #define KC_PGDN KC_PGDOWN
66 #define KC_PSCR KC_PSCREEN
67 #define KC_SLCK KC_SCROLLLOCK
68 #define KC_PAUS KC_PAUSE
69 #define KC_BRK KC_PAUSE
70 #define KC_NLCK KC_NUMLOCK
71 #define KC_SPC KC_SPACE
72 #define KC_MINS KC_MINUS
73 #define KC_EQL KC_EQUAL
74 #define KC_GRV KC_GRAVE
75 #define KC_RBRC KC_RBRACKET
76 #define KC_LBRC KC_LBRACKET
77 #define KC_COMM KC_COMMA
78 #define KC_BSLS KC_BSLASH
79 #define KC_SLSH KC_SLASH
80 #define KC_SCLN KC_SCOLON
81 #define KC_QUOT KC_QUOTE
82 #define KC_APP KC_APPLICATION
83 #define KC_NUHS KC_NONUS_HASH
84 #define KC_NUBS KC_NONUS_BSLASH
85 #define KC_LCAP KC_LOCKING_CAPS
86 #define KC_LNUM KC_LOCKING_NUM
87 #define KC_LSCR KC_LOCKING_SCROLL
88 #define KC_ERAS KC_ALT_ERASE,
89 #define KC_CLR KC_CLEAR
90 /* Japanese specific */
91 #define KC_ZKHK KC_GRAVE
93 #define KC_KANA KC_INT2
94 #define KC_JYEN KC_INT3
95 #define KC_HENK KC_INT4
96 #define KC_MHEN KC_INT5
100 #define KC_P3 KC_KP_3
101 #define KC_P4 KC_KP_4
102 #define KC_P5 KC_KP_5
103 #define KC_P6 KC_KP_6
104 #define KC_P7 KC_KP_7
105 #define KC_P8 KC_KP_8
106 #define KC_P9 KC_KP_9
107 #define KC_P0 KC_KP_0
108 #define KC_PDOT KC_KP_DOT
109 #define KC_PCMM KC_KP_COMMA
110 #define KC_PSLS KC_KP_SLASH
111 #define KC_PAST KC_KP_ASTERISK
112 #define KC_PMNS KC_KP_MINUS
113 #define KC_PPLS KC_KP_PLUS
114 #define KC_PEQL KC_KP_EQUAL
115 #define KC_PENT KC_KP_ENTER
117 #define KC_MS_U KC_MS_UP
118 #define KC_MS_D KC_MS_DOWN
119 #define KC_MS_L KC_MS_LEFT
120 #define KC_MS_R KC_MS_RIGHT
121 #define KC_BTN1 KC_MS_BTN1
122 #define KC_BTN2 KC_MS_BTN2
123 #define KC_BTN3 KC_MS_BTN3
124 #define KC_BTN4 KC_MS_BTN4
125 #define KC_BTN5 KC_MS_BTN5
126 #define KC_WH_U KC_MS_WH_UP
127 #define KC_WH_D KC_MS_WH_DOWN
128 #define KC_WH_L KC_MS_WH_LEFT
129 #define KC_WH_R KC_MS_WH_RIGHT
130 #define KC_ACL0 KC_MS_ACCEL0
131 #define KC_ACL1 KC_MS_ACCEL1
132 #define KC_ACL2 KC_MS_ACCEL2
134 #define KC_PWR KC_SYSTEM_POWER
135 #define KC_SLEP KC_SYSTEM_SLEEP
136 #define KC_WAKE KC_SYSTEM_WAKE
138 #define KC_MUTE KC_AUDIO_MUTE
139 #define KC_VOLU KC_AUDIO_VOL_UP
140 #define KC_VOLD KC_AUDIO_VOL_DOWN
141 #define KC_MNXT KC_MEDIA_NEXT_TRACK
142 #define KC_MPRV KC_MEDIA_PREV_TRACK
143 #define KC_MFFD KC_MEDIA_FAST_FORWARD
144 #define KC_MRWD KC_MEDIA_REWIND
145 #define KC_MSTP KC_MEDIA_STOP
146 #define KC_MPLY KC_MEDIA_PLAY_PAUSE
147 #define KC_MSEL KC_MEDIA_SELECT
148 #define KC_EJCT KC_MEDIA_EJECT
149 #define KC_MAIL KC_MAIL
150 #define KC_CALC KC_CALCULATOR
151 #define KC_MYCM KC_MY_COMPUTER
152 #define KC_WSCH KC_WWW_SEARCH
153 #define KC_WHOM KC_WWW_HOME
154 #define KC_WBAK KC_WWW_BACK
155 #define KC_WFWD KC_WWW_FORWARD
156 #define KC_WSTP KC_WWW_STOP
157 #define KC_WREF KC_WWW_REFRESH
158 #define KC_WFAV KC_WWW_FAVORITES
160 #define KC_TRANSPARENT 1
161 #define KC_TRNS KC_TRANSPARENT
165 /* USB HID Keyboard/Keypad Usage(0x07) */
166 enum hid_keyboard_keypad_usage {
215 KC_RBRACKET, /* 0x30 */
216 KC_BSLASH, /* \ (and |) */
217 KC_NONUS_HASH, /* Non-US # and ~ */
218 KC_SCOLON, /* ; (and :) */
219 KC_QUOTE, /* ' and " */
220 KC_GRAVE, /* Grave accent and tilde */
221 KC_COMMA, /* , and < */
222 KC_DOT, /* . and > */
223 KC_SLASH, /* / and ? */
267 KC_NONUS_BSLASH, /* Non-US \ and | */
295 KC__VOLUP, /* 0x80 */
297 KC_LOCKING_CAPS, /* locking Caps Lock */
298 KC_LOCKING_NUM, /* locking Num Lock */
299 KC_LOCKING_SCROLL, /* locking Scroll Lock */
301 KC_KP_EQUAL_AS400, /* equal sign on AS/400 */
333 /* NOTE: 0xA5-DF are used for internal special purpose */
336 /* NOTE: Following codes(0xB0-DD) are not used. Leave them for reference. */
339 KC_THOUSANDS_SEPARATOR,
340 KC_DECIMAL_SEPARATOR,
342 KC_CURRENCY_SUB_UNIT,
345 KC_KP_LCBRACKET, /* { */
346 KC_KP_RCBRACKET, /* } */
369 KC_KP_MEM_STORE, /* 0xD0 */
382 KC_KP_HEXADECIMAL, /* 0xDD */
395 /* NOTE: 0xE8-FF are used for internal special purpose */
398 /* Special keycodes */
399 /* NOTE: 0xA5-DF and 0xE8-FF are used for internal special purpose */
400 enum internal_special_keycodes {
402 KC_SYSTEM_POWER = 0xA5,
426 KC_MEDIA_FAST_FORWARD,
427 KC_MEDIA_REWIND, /* 0xBC */
464 /**************************************/
465 /* 0xE0-E7 for Modifiers. DO NOT USE. */
466 /**************************************/
477 KC_MS_BTN5, /* 0xF8 */
482 KC_MS_WH_RIGHT, /* 0xFC */
486 KC_MS_ACCEL2 /* 0xFF */
489 #endif /* KEYCODE_H */