back up of work during May 2019
Dependencies: microbit
keymap.h
00001 /** 00002 https://gist.github.com/MightyPork/6da26e382a7ad91b5496ee55fdc73db2 00003 **/ 00004 00005 /** 00006 * USB HID Keyboard scan codes as per USB spec 1.11 00007 * plus some additional codes 00008 * 00009 * Created by MightyPork, 2016 00010 * Public domain 00011 * 00012 * Adapted from: 00013 * https://source.android.com/devices/input/keyboard-devices.html 00014 */ 00015 00016 #ifndef USB_HID_KEYS 00017 #define USB_HID_KEYS 00018 00019 /** 00020 * Modifier masks - used for the first byte in the HID report. 00021 * NOTE: The second byte in the report is reserved, 0x00 00022 */ 00023 #define KEY_MOD_LCTRL 0x01 00024 #define KEY_MOD_LSHIFT 0x02 00025 #define KEY_MOD_LALT 0x04 00026 #define KEY_MOD_LMETA 0x08 00027 #define KEY_MOD_RCTRL 0x10 00028 #define KEY_MOD_RSHIFT 0x20 00029 #define KEY_MOD_RALT 0x40 00030 #define KEY_MOD_RMETA 0x80 00031 00032 /** 00033 * Scan codes - last N slots in the HID report (usually 6). 00034 * 0x00 if no key pressed. 00035 * 00036 * If more than N keys are pressed, the HID reports 00037 * KEY_ERR_OVF in all slots to indicate this condition. 00038 */ 00039 00040 #define KEY_NONE 0x00 // No key pressed 00041 #define KEY_ERR_OVF 0x01 // Keyboard Error Roll Over - used for all slots if too many keys are pressed ("Phantom key") 00042 // 0x02 // Keyboard POST Fail 00043 // 0x03 // Keyboard Error Undefined 00044 #define KEY_A 0x04 // Keyboard a and A 00045 #define KEY_B 0x05 // Keyboard b and B 00046 #define KEY_C 0x06 // Keyboard c and C 00047 #define KEY_D 0x07 // Keyboard d and D 00048 #define KEY_E 0x08 // Keyboard e and E 00049 #define KEY_F 0x09 // Keyboard f and F 00050 #define KEY_G 0x0a // Keyboard g and G 00051 #define KEY_H 0x0b // Keyboard h and H 00052 #define KEY_I 0x0c // Keyboard i and I 00053 #define KEY_J 0x0d // Keyboard j and J 00054 #define KEY_K 0x0e // Keyboard k and K 00055 #define KEY_L 0x0f // Keyboard l and L 00056 #define KEY_M 0x10 // Keyboard m and M 00057 #define KEY_N 0x11 // Keyboard n and N 00058 #define KEY_O 0x12 // Keyboard o and O 00059 #define KEY_P 0x13 // Keyboard p and P 00060 #define KEY_Q 0x14 // Keyboard q and Q 00061 #define KEY_R 0x15 // Keyboard r and R 00062 #define KEY_S 0x16 // Keyboard s and S 00063 #define KEY_T 0x17 // Keyboard t and T 00064 #define KEY_U 0x18 // Keyboard u and U 00065 #define KEY_V 0x19 // Keyboard v and V 00066 #define KEY_W 0x1a // Keyboard w and W 00067 #define KEY_X 0x1b // Keyboard x and X 00068 #define KEY_Y 0x1c // Keyboard y and Y 00069 #define KEY_Z 0x1d // Keyboard z and Z 00070 00071 #define KEY_1 0x1e // Keyboard 1 and ! 00072 #define KEY_2 0x1f // Keyboard 2 and @ 00073 #define KEY_3 0x20 // Keyboard 3 and # 00074 #define KEY_4 0x21 // Keyboard 4 and $ 00075 #define KEY_5 0x22 // Keyboard 5 and % 00076 #define KEY_6 0x23 // Keyboard 6 and ^ 00077 #define KEY_7 0x24 // Keyboard 7 and & 00078 #define KEY_8 0x25 // Keyboard 8 and * 00079 #define KEY_9 0x26 // Keyboard 9 and ( 00080 #define KEY_0 0x27 // Keyboard 0 and ) 00081 00082 #define KEY_ENTER 0x28 // Keyboard Return (ENTER) 00083 #define KEY_ESC 0x29 // Keyboard ESCAPE 00084 #define KEY_BACKSPACE 0x2a // Keyboard DELETE (Backspace) 00085 #define KEY_TAB 0x2b // Keyboard Tab 00086 #define KEY_SPACE 0x2c // Keyboard Spacebar 00087 #define KEY_MINUS 0x2d // Keyboard - and _ 00088 #define KEY_EQUAL 0x2e // Keyboard = and + 00089 #define KEY_LEFTBRACE 0x2f // Keyboard [ and { 00090 #define KEY_RIGHTBRACE 0x30 // Keyboard ] and } 00091 #define KEY_BACKSLASH 0x31 // Keyboard \ and | 00092 #define KEY_HASHTILDE 0x32 // Keyboard Non-US # and ~ 00093 #define KEY_SEMICOLON 0x33 // Keyboard ; and : 00094 #define KEY_APOSTROPHE 0x34 // Keyboard ' and " 00095 #define KEY_GRAVE 0x35 // Keyboard ` and ~ 00096 #define KEY_COMMA 0x36 // Keyboard , and < 00097 #define KEY_DOT 0x37 // Keyboard . and > 00098 #define KEY_SLASH 0x38 // Keyboard / and ? 00099 #define KEY_CAPSLOCK 0x39 // Keyboard Caps Lock 00100 00101 #define KEY_F1 0x3a // Keyboard F1 00102 #define KEY_F2 0x3b // Keyboard F2 00103 #define KEY_F3 0x3c // Keyboard F3 00104 #define KEY_F4 0x3d // Keyboard F4 00105 #define KEY_F5 0x3e // Keyboard F5 00106 #define KEY_F6 0x3f // Keyboard F6 00107 #define KEY_F7 0x40 // Keyboard F7 00108 #define KEY_F8 0x41 // Keyboard F8 00109 #define KEY_F9 0x42 // Keyboard F9 00110 #define KEY_F10 0x43 // Keyboard F10 00111 #define KEY_F11 0x44 // Keyboard F11 00112 #define KEY_F12 0x45 // Keyboard F12 00113 00114 #define KEY_SYSRQ 0x46 // Keyboard Print Screen 00115 #define KEY_SCROLLLOCK 0x47 // Keyboard Scroll Lock 00116 #define KEY_PAUSE 0x48 // Keyboard Pause 00117 #define KEY_INSERT 0x49 // Keyboard Insert 00118 #define KEY_HOME 0x4a // Keyboard Home 00119 #define KEY_PAGEUP 0x4b // Keyboard Page Up 00120 #define KEY_DELETE 0x4c // Keyboard Delete Forward 00121 #define KEY_END 0x4d // Keyboard End 00122 #define KEY_PAGEDOWN 0x4e // Keyboard Page Down 00123 #define KEY_RIGHT 0x4f // Keyboard Right Arrow 00124 #define KEY_LEFT 0x50 // Keyboard Left Arrow 00125 #define KEY_DOWN 0x51 // Keyboard Down Arrow 00126 #define KEY_UP 0x52 // Keyboard Up Arrow 00127 00128 #define KEY_NUMLOCK 0x53 // Keyboard Num Lock and Clear 00129 #define KEY_KPSLASH 0x54 // Keypad / 00130 #define KEY_KPASTERISK 0x55 // Keypad * 00131 #define KEY_KPMINUS 0x56 // Keypad - 00132 #define KEY_KPPLUS 0x57 // Keypad + 00133 #define KEY_KPENTER 0x58 // Keypad ENTER 00134 #define KEY_KP1 0x59 // Keypad 1 and End 00135 #define KEY_KP2 0x5a // Keypad 2 and Down Arrow 00136 #define KEY_KP3 0x5b // Keypad 3 and PageDn 00137 #define KEY_KP4 0x5c // Keypad 4 and Left Arrow 00138 #define KEY_KP5 0x5d // Keypad 5 00139 #define KEY_KP6 0x5e // Keypad 6 and Right Arrow 00140 #define KEY_KP7 0x5f // Keypad 7 and Home 00141 #define KEY_KP8 0x60 // Keypad 8 and Up Arrow 00142 #define KEY_KP9 0x61 // Keypad 9 and Page Up 00143 #define KEY_KP0 0x62 // Keypad 0 and Insert 00144 #define KEY_KPDOT 0x63 // Keypad . and Delete 00145 00146 #define KEY_102ND 0x64 // Keyboard Non-US \ and | 00147 #define KEY_COMPOSE 0x65 // Keyboard Application 00148 #define KEY_POWER 0x66 // Keyboard Power 00149 #define KEY_KPEQUAL 0x67 // Keypad = 00150 00151 #define KEY_F13 0x68 // Keyboard F13 00152 #define KEY_F14 0x69 // Keyboard F14 00153 #define KEY_F15 0x6a // Keyboard F15 00154 #define KEY_F16 0x6b // Keyboard F16 00155 #define KEY_F17 0x6c // Keyboard F17 00156 #define KEY_F18 0x6d // Keyboard F18 00157 #define KEY_F19 0x6e // Keyboard F19 00158 #define KEY_F20 0x6f // Keyboard F20 00159 #define KEY_F21 0x70 // Keyboard F21 00160 #define KEY_F22 0x71 // Keyboard F22 00161 #define KEY_F23 0x72 // Keyboard F23 00162 #define KEY_F24 0x73 // Keyboard F24 00163 00164 #define KEY_OPEN 0x74 // Keyboard Execute 00165 #define KEY_HELP 0x75 // Keyboard Help 00166 #define KEY_PROPS 0x76 // Keyboard Menu 00167 #define KEY_FRONT 0x77 // Keyboard Select 00168 #define KEY_STOP 0x78 // Keyboard Stop 00169 #define KEY_AGAIN 0x79 // Keyboard Again 00170 #define KEY_UNDO 0x7a // Keyboard Undo 00171 #define KEY_CUT 0x7b // Keyboard Cut 00172 #define KEY_COPY 0x7c // Keyboard Copy 00173 #define KEY_PASTE 0x7d // Keyboard Paste 00174 #define KEY_FIND 0x7e // Keyboard Find 00175 #define KEY_MUTE 0x7f // Keyboard Mute 00176 #define KEY_VOLUMEUP 0x80 // Keyboard Volume Up 00177 #define KEY_VOLUMEDOWN 0x81 // Keyboard Volume Down 00178 // 0x82 Keyboard Locking Caps Lock 00179 // 0x83 Keyboard Locking Num Lock 00180 // 0x84 Keyboard Locking Scroll Lock 00181 #define KEY_KPCOMMA 0x85 // Keypad Comma 00182 // 0x86 Keypad Equal Sign 00183 #define KEY_RO 0x87 // Keyboard International1 00184 #define KEY_KATAKANAHIRAGANA 0x88 // Keyboard International2 00185 #define KEY_YEN 0x89 // Keyboard International3 00186 #define KEY_HENKAN 0x8a // Keyboard International4 00187 #define KEY_MUHENKAN 0x8b // Keyboard International5 00188 #define KEY_KPJPCOMMA 0x8c // Keyboard International6 00189 // 0x8d Keyboard International7 00190 // 0x8e Keyboard International8 00191 // 0x8f Keyboard International9 00192 #define KEY_HANGEUL 0x90 // Keyboard LANG1 00193 #define KEY_HANJA 0x91 // Keyboard LANG2 00194 #define KEY_KATAKANA 0x92 // Keyboard LANG3 00195 #define KEY_HIRAGANA 0x93 // Keyboard LANG4 00196 #define KEY_ZENKAKUHANKAKU 0x94 // Keyboard LANG5 00197 // 0x95 Keyboard LANG6 00198 // 0x96 Keyboard LANG7 00199 // 0x97 Keyboard LANG8 00200 // 0x98 Keyboard LANG9 00201 // 0x99 Keyboard Alternate Erase 00202 // 0x9a Keyboard SysReq/Attention 00203 // 0x9b Keyboard Cancel 00204 // 0x9c Keyboard Clear 00205 // 0x9d Keyboard Prior 00206 // 0x9e Keyboard Return 00207 // 0x9f Keyboard Separator 00208 // 0xa0 Keyboard Out 00209 // 0xa1 Keyboard Oper 00210 // 0xa2 Keyboard Clear/Again 00211 // 0xa3 Keyboard CrSel/Props 00212 // 0xa4 Keyboard ExSel 00213 00214 // 0xb0 Keypad 00 00215 // 0xb1 Keypad 000 00216 // 0xb2 Thousands Separator 00217 // 0xb3 Decimal Separator 00218 // 0xb4 Currency Unit 00219 // 0xb5 Currency Sub-unit 00220 #define KEY_KPLEFTPAREN 0xb6 // Keypad ( 00221 #define KEY_KPRIGHTPAREN 0xb7 // Keypad ) 00222 // 0xb8 Keypad { 00223 // 0xb9 Keypad } 00224 // 0xba Keypad Tab 00225 // 0xbb Keypad Backspace 00226 // 0xbc Keypad A 00227 // 0xbd Keypad B 00228 // 0xbe Keypad C 00229 // 0xbf Keypad D 00230 // 0xc0 Keypad E 00231 // 0xc1 Keypad F 00232 // 0xc2 Keypad XOR 00233 // 0xc3 Keypad ^ 00234 // 0xc4 Keypad % 00235 // 0xc5 Keypad < 00236 // 0xc6 Keypad > 00237 // 0xc7 Keypad & 00238 // 0xc8 Keypad && 00239 // 0xc9 Keypad | 00240 // 0xca Keypad || 00241 // 0xcb Keypad : 00242 // 0xcc Keypad # 00243 // 0xcd Keypad Space 00244 // 0xce Keypad @ 00245 // 0xcf Keypad ! 00246 // 0xd0 Keypad Memory Store 00247 // 0xd1 Keypad Memory Recall 00248 // 0xd2 Keypad Memory Clear 00249 // 0xd3 Keypad Memory Add 00250 // 0xd4 Keypad Memory Subtract 00251 // 0xd5 Keypad Memory Multiply 00252 // 0xd6 Keypad Memory Divide 00253 // 0xd7 Keypad +/- 00254 // 0xd8 Keypad Clear 00255 // 0xd9 Keypad Clear Entry 00256 // 0xda Keypad Binary 00257 // 0xdb Keypad Octal 00258 // 0xdc Keypad Decimal 00259 // 0xdd Keypad Hexadecimal 00260 00261 #define KEY_LEFTCTRL 0xe0 // Keyboard Left Control 00262 #define KEY_LEFTSHIFT 0xe1 // Keyboard Left Shift 00263 #define KEY_LEFTALT 0xe2 // Keyboard Left Alt 00264 #define KEY_LEFTMETA 0xe3 // Keyboard Left GUI 00265 #define KEY_RIGHTCTRL 0xe4 // Keyboard Right Control 00266 #define KEY_RIGHTSHIFT 0xe5 // Keyboard Right Shift 00267 #define KEY_RIGHTALT 0xe6 // Keyboard Right Alt 00268 #define KEY_RIGHTMETA 0xe7 // Keyboard Right GUI 00269 00270 #define KEY_MEDIA_PLAYPAUSE 0xe8 00271 #define KEY_MEDIA_STOPCD 0xe9 00272 #define KEY_MEDIA_PREVIOUSSONG 0xea 00273 #define KEY_MEDIA_NEXTSONG 0xeb 00274 #define KEY_MEDIA_EJECTCD 0xec 00275 #define KEY_MEDIA_VOLUMEUP 0xed 00276 #define KEY_MEDIA_VOLUMEDOWN 0xee 00277 #define KEY_MEDIA_MUTE 0xef 00278 #define KEY_MEDIA_WWW 0xf0 00279 #define KEY_MEDIA_BACK 0xf1 00280 #define KEY_MEDIA_FORWARD 0xf2 00281 #define KEY_MEDIA_STOP 0xf3 00282 #define KEY_MEDIA_FIND 0xf4 00283 #define KEY_MEDIA_SCROLLUP 0xf5 00284 #define KEY_MEDIA_SCROLLDOWN 0xf6 00285 #define KEY_MEDIA_EDIT 0xf7 00286 #define KEY_MEDIA_SLEEP 0xf8 00287 #define KEY_MEDIA_COFFEE 0xf9 00288 #define KEY_MEDIA_REFRESH 0xfa 00289 #define KEY_MEDIA_CALC 0xfb 00290 00291 #endif // USB_HID_KEYS
Generated on Mon Jul 18 2022 14:25:12 by 1.7.2