Skip to content

Keycode

hasu@tmk edited this page Sep 18, 2021 · 10 revisions

Keycode Symbol Table

Keycodes are defined in source code file tmk_core/common/keycode.h.

Range of 04-A4 and E0-E7 are identical to HID Usage of Keyboard/Keypad Page(0x07). TMK specific keycodes are defined outside of the range to support special actions.

Hex Keycode Symbol      Short name      Description
--------------------------------------------------------------------------------
00  KC_NO                               No event indicated
01  KC_TRANSPARENT      KC_TRNS         Transparent; refer to lower layer
02  KC_POST_FAIL                        Reserved
03  KC_UNDEFINED                        Reserved
04  KC_A                                Keyboard a and A
05  KC_B                                Keyboard b and B
06  KC_C                                Keyboard c and C
07  KC_D                                Keyboard d and D
08  KC_E                                Keyboard e and E
09  KC_F                                Keyboard f and F
0A  KC_G                                Keyboard g and G
0B  KC_H                                Keyboard h and H
0C  KC_I                                Keyboard i and I
0D  KC_J                                Keyboard j and J
0E  KC_K                                Keyboard k and K
0F  KC_L                                Keyboard l and L
10  KC_M                                Keyboard m and M
11  KC_N                                Keyboard n and N
12  KC_O                                Keyboard o and O
13  KC_P                                Keyboard p and P
14  KC_Q                                Keyboard q and Q
15  KC_R                                Keyboard r and R
16  KC_S                                Keyboard s and S
17  KC_T                                Keyboard t and T
18  KC_U                                Keyboard u and U
19  KC_V                                Keyboard v and V
1A  KC_W                                Keyboard w and W
1B  KC_X                                Keyboard x and X
1C  KC_Y                                Keyboard y and Y
1D  KC_Z                                Keyboard z and Z
1E  KC_1                                Keyboard 1 and !
1F  KC_2                                Keyboard 2 and @
20  KC_3                                Keyboard 3 and #
21  KC_4                                Keyboard 4 and $
22  KC_5                                Keyboard 5 and %
23  KC_6                                Keyboard 6 and ^
24  KC_7                                Keyboard 7 and &
25  KC_8                                Keyboard 8 and *
26  KC_9                                Keyboard 9 and (
27  KC_0                                Keyboard 0 and )
28  KC_ENTER            KC_ENT          Keyboard Return (ENTER)
29  KC_ESCAPE           KC_ESC          Keyboard ESCAPE
2A  KC_BSPACE           KC_BSPC         Keyboard DELETE (Backspace)
2B  KC_TAB                              Keyboard Tab
2C  KC_SPACE            KC_SPC          Keyboard Spacebar
2D  KC_MINUS            KC_MINS         Keyboard - and (underscore)
2E  KC_EQUAL            KC_EQL          Keyboard = and +
2F  KC_LBRACKET         KC_LBRC         Keyboard [ and {
30  KC_RBRACKET         KC_RBRC         Keyboard ] and }
31  KC_BSLASH           KC_BSLS         Keyboard \ and |
32  KC_NONUS_HASH       KC_NUHS         Keyboard Non-US # and ~
33  KC_SCOLON           KC_SCLN         Keyboard ; and :
34  KC_QUOTE            KC_QUOT         Keyboard ‘ and “
35  KC_GRAVE            KC_GRV          Keyboard Grave Accent and Tilde
36  KC_COMMA            KC_COMM         Keyboard, and <
37  KC_DOT                              Keyboard . and >
38  KC_SLASH            KC_SLSH         Keyboard / and ?
39  KC_CAPSLOCK         KC_CAPS         Keyboard Caps Lock
3A  KC_F1                               Keyboard F1
3B  KC_F2                               Keyboard F2
3C  KC_F3                               Keyboard F3
3D  KC_F4                               Keyboard F4
3E  KC_F5                               Keyboard F5
3F  KC_F6                               Keyboard F6
40  KC_F7                               Keyboard F7
41  KC_F8                               Keyboard F8
42  KC_F9                               Keyboard F9
43  KC_F10                              Keyboard F10
44  KC_F11                              Keyboard F11
45  KC_F12                              Keyboard F12
46  KC_PSCREEN          KC_PSCR         Keyboard PrintScreen1
47  KC_SCKLOCK          KC_SLCK         Keyboard Scroll Lock11
48  KC_PAUSE            KC_PAUS         Keyboard Pause1
49  KC_INSERT           KC_INS          Keyboard Insert1
4A  KC_HOME                             Keyboard Home1
4B  KC_PGUP                             Keyboard PageUp1
4C  KC_DELETE           KC_DELETE       Keyboard Delete Forward
4D  KC_END                              Keyboard End1
4E  KC_PGDOWN           KC_PGDN         Keyboard PageDown1
4F  KC_RIGHT            KC_RGHT         Keyboard RightArrow1
50  KC_LEFT                             Keyboard LeftArrow1
51  KC_DOWN                             Keyboard DownArrow1
52  KC_UP                               Keyboard UpArrow1
53  KC_NUMLOCK          KC_NLCK         Keypad Num Lock and Clear11
54  KC_KP_SLASH         KC_PSLS         Keypad /1
55  KC_KP_ASTERISK      KC_PAST         Keypad *
56  KC_KP_MINUS         KC_PMNS         Keypad -
57  KC_KP_PLUS          KC_PPLS         Keypad +
58  KC_KP_ENTER         KC_PENT         Keypad ENTER5
59  KC_KP_1             KC_P1           Keypad 1 and End
5A  KC_KP_2             KC_P2           Keypad 2 and Down Arrow
5B  KC_KP_3             KC_P3           Keypad 3 and PageDn
5C  KC_KP_4             KC_P4           Keypad 4 and Left Arrow
5D  KC_KP_5             KC_P5           Keypad 5
5E  KC_KP_6             KC_P6           Keypad 6 and Right Arrow
5F  KC_KP_7             KC_P7           Keypad 7 and Home
60  KC_KP_8             KC_P8           Keypad 8 and Up Arrow
61  KC_KP_9             KC_P9           Keypad 9 and PageUp
62  KC_KP_0             KC_P0           Keypad 0 and Insert
63  KC_KP_DOT           KC_PDOT         Keypad . and Delete
64  KC_NONUS_BSLASH     KC_NUBS         Keyboard Non-US \ and |
65  KC_APPLICATION      KC_APP          Keyboard Application10
66  KC_POWER                            Keyboard Power9 - For Windows use KC_PWR instead
67  KC_KP_EQUAL         KC_PEQL         Keypad =
68  KC_F13                              Keyboard F13
69  KC_F14                              Keyboard F14
6A  KC_F15                              Keyboard F15
6B  KC_F16                              Keyboard F16
6C  KC_F17                              Keyboard F17
6D  KC_F18                              Keyboard F18
6E  KC_F19                              Keyboard F19
6F  KC_F20                              Keyboard F20
70  KC_F21                              Keyboard F21
71  KC_F22                              Keyboard F22
72  KC_F23                              Keyboard F23
73  KC_F24                              Keyboard F24
74  KC_EXECUTE                          Keyboard Execute
75  KC_HELP                             Keyboard Help
76  KC_MENU                             Keyboard Menu
77  KC_SELECT                           Keyboard Select
78  KC_STOP                             Keyboard Stop
79  KC_AGAIN                            Keyboard Again
7A  KC_UNDO                             Keyboard Undo
7B  KC_CUT                              Keyboard Cut
7C  KC_COPY                             Keyboard Copy
7D  KC_PASTE                            Keyboard Paste
7E  KC_FIND                             Keyboard Find
7F  KC__MUTE                            Keyboard Mute - For Windows use KC_MUTE instead
80  KC__VOLUP                           Keyboard Volume Up - For Windows use KC_VOLU instead
81  KC__VOLDOWN                         Keyboard Volume Down - For Windows use KC_VOLD instead
82  KC_LOCKING_CAPS                     Keyboard Locking Caps Lock12
83  KC_LOCKING_NUM                      Keyboard Locking Num Lock12
84  KC_LOCKING_SCROLL                   Keyboard Locking Scroll Lock12
85  KC_KP_COMMA         KC_PCMM         Keypad Comma27
86  KC_KP_EQUAL_AS400                   Keypad Equal Sign29
87  KC_INT1             KC_RO           Keyboard International115,28
88  KC_INT2             KC_KANA         Keyboard International216
89  KC_INT3             KC_JYEN         Keyboard International317
8A  KC_INT4             KC_HENK         Keyboard International418
8B  KC_INT5             KC_MHEN         Keyboard International519
8C  KC_INT6                             Keyboard International620
8D  KC_INT7                             Keyboard International721
8E  KC_INT8                             Keyboard International822
8F  KC_INT9                             Keyboard International922
90  KC_LANG1                            Keyboard LANG125
91  KC_LANG2                            Keyboard LANG226
92  KC_LANG3                            Keyboard LANG330
93  KC_LANG4                            Keyboard LANG431
94  KC_LANG5                            Keyboard LANG532
95  KC_LANG6                            Keyboard LANG68
96  KC_LANG7                            Keyboard LANG78
97  KC_LANG8                            Keyboard LANG88
98  KC_LANG9                            Keyboard LANG98
99  KC_ALT_ERASE                        Keyboard Alternate Erase7
9A  KC_SYSREQ                           Keyboard SysReq/Attention1
9B  KC_CANCEL                           Keyboard Cancel
9C  KC_CLEAR                            Keyboard Clear
9D  KC_PRIOR                            Keyboard Prior
9E  KC_RETURN                           Keyboard Return
9F  KC_SEPARATOR                        Keyboard Separator
A0  KC_OUT                              Keyboard Out
A1  KC_OPER                             Keyboard Oper
A2  KC_CLEAR_AGAIN                      Keyboard Clear/Again
A3  KC_CRSEL                            Keyboard CrSel/Props
A4  KC_EXSEL                            Keyboard ExSel

/* A5-DF are redefined as TMK specific keycodes. See below. */
B0  KC_KP_00                            Keypad 00
B1  KC_KP_000                           Keypad 000
B2  KC_THOUSANDS_SEPARATOR              Thousands Separator
B3  KC_DECIMAL_SEPARATOR                Decimal Separator
B4  KC_CURRENCY_UNIT                    Currency Unit
B5  KC_CURRENCY_SUB_UNIT                Currency Sub-unit
B6  KC_KP_LPAREN                        Keypad (
B7  KC_KP_RPAREN                        Keypad )
B8  KC_KP_LCBRACKET                     Keypad {
B9  KC_KP_RCBRACKET                     Keypad }
BA  KC_KP_TAB                           Keypad Tab
BB  KC_KP_BSPACE                        Keypad Backspace
BC  KC_KP_A                             Keypad A
BD  KC_KP_B                             Keypad B
BE  KC_KP_C                             Keypad C
BF  KC_KP_D                             Keypad D
C0  KC_KP_E                             Keypad E
C1  KC_KP_F                             Keypad F
C2  KC_KP_XOR                           Keypad XOR
C3  KC_KP_HAT                           Keypad ^
C4  KC_KP_PERC                          Keypad %
C5  KC_KP_LT                            Keypad <
C6  KC_KP_GT                            Keypad >
C7  KC_KP_AND                           Keypad &
C8  KC_KP_LAZYAND                       Keypad &&
C9  KC_KP_OR                            Keypad |
CA  KC_KP_LAZYOR                        Keypad ||
CB  KC_KP_COLON                         Keypad :
CC  KC_KP_HASH                          Keypad #
CD  KC_KP_SPACE                         Keypad Space
CE  KC_KP_ATMARK                        Keypad @
CF  KC_KP_EXCLAMATION                   Keypad !
D0  KC_KP_MEM_STORE                     Keypad Memory Store
D1  KC_KP_MEM_RECALL                    Keypad Memory Recall
D2  KC_KP_MEM_CLEAR                     Keypad Memory Clear
D3  KC_KP_MEM_ADD                       Keypad Memory Add
D4  KC_KP_MEM_SUB                       Keypad Memory Subtract
D5  KC_KP_MEM_MUL                       Keypad Memory Multiply
D6  KC_KP_MEM_DIV                       Keypad Memory Divide
D7  KC_KP_PLUS_MINUS                    Keypad +/-
D8  KC_KP_CLEAR                         Keypad Clear
D9  KC_KP_CLEAR_ENTRY                   Keypad Clear Entry
DA  KC_KP_BINARY                        Keypad Binary
DB  KC_KP_OCTAL                         Keypad Octal
DC  KC_KP_DECIMAL                       Keypad Decimal
DD  KC_KP_HEXADECIMAL                   Keypad Hexadecimal

E0  KC_LCTRL            KC_LCTL         Keyboard LeftControl
E1  KC_LSHIFT           KC_LSFT         Keyboard LeftShift
E2  KC_LALT                             Keyboard LeftAlt
E3  KC_LGUI                             Keyboard Left GUI(Windows/Apple/Meta key)
E4  KC_RCTRL            KC_RCTL         Keyboard RightControl
E5  KC_RSHIFT           KC_RSFT         Keyboard RightShift
E6  KC_RALT                             Keyboard RightAlt
E7  KC_RGUI                             Keyboard Right GUI(Windows/Apple/Meta key)
/* E8-FF can be used as TMK vertual keycode in Keymap. See below. */

    
/************************/
/* TMK specific keycode */
/************************/
/* Generic Desktop Page(0x01) - System Control */
A5  KC_SYSTEM_POWER     KC_PWR          System Power Down
A6  KC_SYSTEM_SLEEP     KC_SLEP         System Sleep
A7  KC_SYSTEM_WAKE      KC_WAKE         System Wake
/* Consumer Page(0x07) */
A8  KC_AUDIO_MUTE       KC_MUTE         Mute
A9  KC_AUDIO_VOL_UP     KC_VOLU         Volume Increment
AA  KC_AUDIO_VOL_DOWN   KC_VOLD         Volume Decrement
AB  KC_MEDIA_NEXT_TRACK KC_MNXT         Scan Next Track
AC  KC_MEDIA_PREV_TRACK KC_MPRV         Scan Previous Track
AD  KC_MEDIA_STOP       KC_MSTP         Stop
AE  KC_MEDIA_FAST_FORWARD   KC_MFFD     Fast Forward
AF  KC_MEDIA_REWIND     KC_MRWD         Rewind
B0  KC_MEDIA_PLAY_PAUSE KC_MPLY         Play/Pause
B1  KC_EJCT             KC_MEDIA_EJECT  Stop/Eject
B2  KC_MEDIA_SELECT     KC_MSEL         AL Consumer Control Configuration
B3  KC_MAIL             KC_MAIL         AL Email Reader
B4  KC_CALCULATOR       KC_CALC         AL Calculator
B5  KC_MY_COMPUTER      KC_MYCM         AL Local Machine Browser
B6  KC_WWW_SEARCH       KC_WSCH         AC Search
B7  KC_WWW_HOME         KC_WHOM         AC Home
B8  KC_WWW_BACK         KC_WBAK         AC Back
B9  KC_WWW_FORWARD      KC_WFWD         AC Forward
BA  KC_WWW_STOP         KC_WSTP         AC Stop
BB  KC_WWW_REFRESH      KC_WREF         AC Refresh
BC  KC_WWW_FAVORITES    KC_WFAV         AC Bookmarks
BD  KC_BRIGHTNESS_INC   KC_BRTI         Display Brightness Control 
BE  KC_BRIGHTNESS_DEC   KC_BRTD         Display Brightness Control 
BF  KC_BOOTLOADER       KC_BTLD         Jump to bootloader

/* Fn key to define custom action in 8-bit keymap */
C0  KC_FN0
C1  KC_FN1
C2  KC_FN2
C3  KC_FN3
C4  KC_FN4
C5  KC_FN5
C6  KC_FN6
C7  KC_FN7
C8  KC_FN8
C9  KC_FN9
CA  KC_FN10
CB  KC_FN11
CC  KC_FN12
CD  KC_FN13
CE  KC_FN14
CF  KC_FN15
D0  KC_FN16
D1  KC_FN17
D2  KC_FN18
D3  KC_FN19
D4  KC_FN20
D5  KC_FN21
D6  KC_FN22
D7  KC_FN23
D8  KC_FN24
D9  KC_FN25
DA  KC_FN26
DB  KC_FN27
DC  KC_FN28
DD  KC_FN29
DE  KC_FN30
DF  KC_FN31

/* Mousekey */
F0  KC_MS_UP            KC_MS_U         Mouse Cursor Up
F1  KC_MS_DOWN          KC_MS_D         Mouse Cursor Down
F2  KC_MS_LEFT          KC_MS_L         Mouse Cursor Left
F3  KC_MS_RIGHT         KC_MS_R         Mouse Cursor Right
F4  KC_MS_BTN1          KC_BTN1         Mouse Button 1
F5  KC_MS_BTN2          KC_BTN2         Mouse Button 2
F6  KC_MS_BTN3          KC_BTN3         Mouse Button 3
F7  KC_MS_BTN4          KC_BTN4         Mouse Button 4
F8  KC_MS_BTN5          KC_BTN5         Mouse Button 5
F9  KC_MS_WH_UP         KC_WH_U         Mouse Wheel Up
FA  KC_MS_WH_DOWN       KC_WH_D         Mouse Wheel Down
FB  KC_MS_WH_LEFT       KC_WH_L         Mouse Wheel Left
FC  KC_MS_WH_RIGHT      KC_WH_R         Mouse Wheel Right
FD  KC_MS_ACCEL0        KC_ACL0         Mouse Acceleration 0
FE  KC_MS_ACCEL1        KC_ACL1         Mouse Acceleration 1
FF  KC_MS_ACCEL2        KC_ACL2         Mouse Acceleration 2

System Media Control

Check this for OS specific info.

https://github.com/tmk/tmk_keyboard/issues/332

Keycode range: 0x0B-DD

It seems Keycodes(USB HID usages) in range 0xB0-DD are virtually unuseful on most of computers with default configuration if not completely.

This firmware doesn't support to send them currently, the range is used for TMK specific actions instead.

https://github.com/tmk/tmk_keyboard/issues/684

Clone this wiki locally