2 * Key codes from HID Keyboard/Keypad Page
3 * http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
5 * Based on Keyboard Upgrade v0.3.0 http://github.com/rhomann/kbupgrade
8 * Keyboard Upgrade -- Firmware for homebrew computer keyboard controllers.
9 * Copyright (C) 2009 Robert Homann
11 * Based on RUMP (http://mg8.org/rump/), Copyright (C) 2008 Chris Lee
13 * Based on c64key (http://symlink.dk/projects/c64key/),
14 * Copyright (C) 2006-2007 Mikkel Holm Olsen
16 * Based on HID-Test by Christian Starkjohann, Objective Development
18 * This file is part of the Keyboard Upgrade package.
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
25 * This program is distributed in the hope that it will be useful, but
26 * WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with the Keyboard Upgrade package; if not, write to the
32 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
35 #ifndef USB_KEYCODES_H
36 #define USB_KEYCODES_H
39 #define IS_ERROR(code) (KB_ROLL_OVER <= (code) && (code) <= KB_UNDEFINED)
40 #define IS_KEY(code) (KB_A <= (code) && (code) <= KB_KP_HEXADECIMAL)
41 #define IS_MOD(code) (KB_LCTRL <= (code) && (code) <= KB_RGUI)
42 #define IS_FN(code) (KB_FN0 <= (code) && (code) <= KB_FN7)
43 #define IS_MOUSEKEY(code) (KB_MS_UP <= (code) && (code) <= KB_MS_WH_RIGHT)
44 #define IS_MOUSEKEY_MOVE(code) (KB_MS_UP <= (code) && (code) <= KB_MS_RIGHT)
45 #define IS_MOUSEKEY_BUTTON(code) (KB_MS_BTN1 <= (code) && (code) <= KB_MS_BTN5)
46 #define IS_MOUSEKEY_WHEEL(code) (KB_MS_WH_UP <= (code) && (code) <= KB_MS_WH_RIGHT)
48 #define MOD_BIT(code) (1<<((code) & 0x07))
49 #define FN_BIT(code) (1<<((code) - KB_FN0))
55 #define KB_LCTL KB_LCTRL
56 #define KB_RCTL KB_RCTRL
57 #define KB_LSFT KB_LSHIFT
58 #define KB_RSFT KB_RSHIFT
59 #define KB_ESC KB_ESCAPE
60 #define KB_BSPC KB_BSPACE
61 #define KB_ENT KB_ENTER
62 #define KB_DEL KB_DELETE
63 #define KB_INS KB_INSERT
64 #define KB_CAPS KB_CAPSLOCK
65 #define KB_RGHT KB_RIGHT
66 #define KB_PGDN KB_PGDOWN
67 #define KB_PSCR KB_PSCREEN
68 #define KB_SLCK KB_SCKLOCK
69 #define KB_BRK KB_BREAK
70 #define KB_NLCK KB_NUMLOCK
71 #define KB_SPC KB_SPACE
72 #define KB_MINS KB_MINUS
73 #define KB_EQL KB_EQUAL
74 #define KB_GRV KB_GRAVE
75 #define KB_RBRC KB_RBRACKET
76 #define KB_LBRC KB_LBRACKET
77 #define KB_COMM KB_COMMA
78 #define KB_BSLS KB_BSLASH
79 #define KB_SLSH KB_SLASH
80 #define KB_SCLN KB_SCOLON
81 #define KB_QUOT KB_QUOTE
82 #define KB_PWR KB_POWER
83 #define KB_VOLU KB_VOLUP
84 #define KB_VOLD KB_VOLDOWN
96 #define KB_PDOT KB_KP_DOT
97 #define KB_PSLS KB_KP_SLASH
98 #define KB_PAST KB_KP_ASTERISK
99 #define KB_PMNS KB_KP_MINUS
100 #define KB_PPLS KB_KP_PLUS
101 #define KB_PEQL KB_KP_EQUAL
102 #define KB_PENT KB_KP_ENTER
104 #define KB_MS_U KB_MS_UP
105 #define KB_MS_D KB_MS_DOWN
106 #define KB_MS_L KB_MS_LEFT
107 #define KB_MS_R KB_MS_RIGHT
108 #define KB_BTN1 KB_MS_BTN1
109 #define KB_BTN2 KB_MS_BTN2
110 #define KB_BTN3 KB_MS_BTN3
111 #define KB_BTN4 KB_MS_BTN4
112 #define KB_BTN5 KB_MS_BTN5
113 #define KB_WH_U KB_MS_WH_UP
114 #define KB_WH_D KB_MS_WH_DOWN
115 #define KB_WH_L KB_MS_WH_LEFT
116 #define KB_WH_R KB_MS_WH_RIGHT
169 KB_BSLASH, /* \ (and |) */
170 KB_NONUS_HASH, /* Non-US # and ~ */
171 KB_SCOLON, /* ; (and :) */
172 KB_QUOTE, /* ' and " */
173 KB_GRAVE, /* Grave accent and tilde */
174 KB_COMMA, /* , and < */
175 KB_DOT, /* . and > */
176 KB_SLASH, /* / and ? */
220 KB_NONUS_BSLASH, /* Non-US \ and | */
250 KB_LOCKING_CAPS, /* locking Caps Lock */
251 KB_LOCKING_NUM, /* locking Num Lock */
252 KB_LOCKING_SCROLL, /* locking Scroll Lock */
254 KB_KP_EQUAL_AS400, /* equal sign on AS/400 */
288 KB_THOUSANDS_SEPARATOR,
289 KB_DECIMAL_SEPARATOR,
291 KB_CURRENCY_SUB_UNIT,
294 KB_KP_LCBRACKET, /* { */
295 KB_KP_RCBRACKET, /* } */
334 KB_LCTRL = 0xE0, /* 0x01 */
335 KB_LSHIFT, /* 0x02 */
339 KB_RSHIFT, /* 0x20 */
343 /* extensions for internal use */
370 #endif /* USB_KEYCODES_H */