1 /*---------------------------------------------------------------------------* 2 Project: Revolution USB keyboard library 3 File: kbd_key_defs.h 4 5 Copyright 2007 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Log: kbd_key_defs.h,v $ 14 Revision 1.6 2007/05/30 18:33:48 carlmu 15 Added KBK_Keypad_Equals. 16 17 Revision 1.5 2007/05/11 23:19:47 carlmu 18 Changed mappings for CTRL keys. 19 Removed obsolete comments. 20 21 Revision 1.4 2007/04/25 19:16:40 carlmu 22 Control keys moved to private range. 23 24 Revision 1.3 2007/04/18 00:02:07 carlmu 25 Updated for 0.5 API. 26 27 Revision 1.2 2007/03/28 00:28:14 carlmu 28 Updated to 0.2 API. 29 30 Revision 1.1 2007/03/21 18:06:16 carlmu 31 Initial version. 32 33 $NoKeywords: $ 34 *---------------------------------------------------------------------------*/ 35 36 #ifndef __KBD_KEY_DEFS_H__ 37 #define __KBD_KEY_DEFS_H__ 38 39 // Defines used for Key names (Unicode values for keys). 40 41 // This contains the Unicodes for keyboard keys. 42 // Right now it just contains the custom Unicodes for keys that 43 // represent non-printing functions (and some that do). 44 45 // All keyboard key names have the prefix KBK_. 46 // All those which represent printing characters should use the Unicode 47 // value for that key. Some exceptions are made for keypad keys, which 48 // use the Unicode value plus a given constant. 49 50 // Official 16-bit Unicodes use the range 0x0000-0xDFFF and 0xF900-0xFFEF. 51 // The area from 0xE000-0xF8FF is available for custom usage. 52 // The code 0xFFFF is also guaranteed not to be an official Unicode. 53 54 // Our custom map is as follows (at a high level): 55 // 56 // 0xf000 - 0xf05f : modifier keys + special keys 57 // 0xf060 - 0xf07f : function keys (F-keys) 58 // 0xf080 - 0xf0ff : reserved for future HID keys 59 // 0xf100 - 0xf13f : keypad versions of main ascii keys (numlock on) 60 // 0xf140 - 0xf17f : keypad versions of editing keys (numlock off) 61 // 0xf180 - 0xf1bf : editing keys (which may be duplicated on keypad) 62 // 0xf1c0 - 0xf1ff : control keys; reserved range 63 64 //----------------------------------------------------------------------------- 65 66 // Special values 67 68 // KBK_Void is used to indicate an undefined key press. 69 // It is used in the maps to indicate a key with no translation available. 70 // We are using the value of 0, and although that's a regular ASCII/Unicode value, 71 // this is probably okay since 0 is rarely ever used as itself (Ctrl-@). 72 73 #define KBK_Void 0x0000 74 75 // KBK_Err is a special return value for the Translate function that 76 // indicates bad arguments were passed in. 77 78 #define KBK_Error 0xffff 79 80 //----------------------------------------------------------------------------- 81 82 // Modifier keys / special keys: 0xf000-0xf05f 83 84 // These codes are modifiers that affect what key is looked up from the tables 85 86 #define KBK_Mod_Shift 0xf001 87 #define KBK_Mod_AltGr 0xf005 88 #define KBK_Lang_Toggle 0xf006 89 #define KBK_Num_Lock 0xf007 90 #define KBK_Caps_Lock 0xf008 91 92 // Extra modifiers; don't affect lookup, but are passed on as ModState 93 94 #define KBK_Mod_Control 0xf000 95 #define KBK_Mod_Alt 0xf002 96 #define KBK_Mod_GUI 0xf003 97 #define KBK_Mod_Extra 0xf004 98 99 // Other odd keys: 0xf020-0xf05f 100 101 #define KBK_Print_Screen 0xf020 102 #define KBK_Scroll_Lock 0xf021 103 #define KBK_Pause 0xf022 104 #define KBK_Application 0xf02f 105 106 // Katakana_Hiragana (key 2 right of space bar) 107 // Henkan (key right of space bar) 108 // Muhenkan (key left of space bar) 109 // Kanji (key in upper left corner) 110 #define KBK_Katakana_Hiragana 0xf040 111 #define KBK_Henkan 0xf041 112 #define KBK_Muhenkan 0xf042 113 #define KBK_Kanji 0xf043 114 115 #define KBK_Katakana 0xf044 116 #define KBK_Hiragana 0xf045 117 #define KBK_Zenkaku_Hankaku 0xf046 118 119 #define KBK_Hangul_English 0xf050 120 #define KBK_Hanja 0xf051 121 122 // all F-keys: 0xf060-0xf07f 123 124 #define KBK_F1 0xf061 125 #define KBK_F2 0xf062 126 #define KBK_F3 0xf063 127 #define KBK_F4 0xf064 128 #define KBK_F5 0xf065 129 #define KBK_F6 0xf066 130 #define KBK_F7 0xf067 131 #define KBK_F8 0xf068 132 #define KBK_F9 0xf069 133 #define KBK_F10 0xf06a 134 #define KBK_F11 0xf06b 135 #define KBK_F12 0xf06c 136 137 // Space from 0xf080-0xf0ff is reserved for 138 // possible future HID keys (0x66 - 0xDF). 139 140 // Keypad codes (for NumLock = on): 0xf100-0xf13f 141 // These keys are the Ascii code of the corresponding 142 // character on the (NumLocked) key, offset by 0xf100. 143 144 // Note that KBK_Keypad_Comma is defined here and used in maps 145 // where comma is shown on the keypad, but the NumLocked version 146 // of this key still uses the Period (0x2e) as the base code. 147 148 #define KBK_Keypad_Comma 0xf12c 149 #define KBK_Keypad_Period 0xf12e 150 #define KBK_Keypad_0 0xf130 151 #define KBK_Keypad_1 0xf131 152 #define KBK_Keypad_2 0xf132 153 #define KBK_Keypad_3 0xf133 154 #define KBK_Keypad_4 0xf134 155 #define KBK_Keypad_5 0xf135 156 #define KBK_Keypad_6 0xf136 157 #define KBK_Keypad_7 0xf137 158 #define KBK_Keypad_8 0xf138 159 #define KBK_Keypad_9 0xf139 160 161 // Keypad codes (for NumLock = irrelevant): 0xf100-0xf13f 162 // These keys are the Ascii code of the corresponding 163 // character on the key, offset by 0xf100. 164 165 #define KBK_Keypad_Slash 0xf12f 166 #define KBK_Keypad_Asterisk 0xf12a 167 #define KBK_Keypad_Minus 0xf12d 168 #define KBK_Keypad_Plus 0xf12b 169 #define KBK_Keypad_Equals 0xf13d 170 #define KBK_Keypad_Enter 0xf10d 171 172 // Keypad codes (for NumLock = off): 0xf140-0xf17f 173 // These keys are the Ascii code of the corresponding 174 // character on the (NumLocked) key, offset by 0xf140. 175 176 #define KBK_Keypad_Delete 0xf16e // KP_Period 177 #define KBK_Keypad_Insert 0xf170 // KP_0 178 #define KBK_Keypad_End 0xf171 // KP_1 179 #define KBK_Keypad_Down_Arrow 0xf172 // KP_2 180 #define KBK_Keypad_Page_Down 0xf173 // KP_3 181 #define KBK_Keypad_Left_Arrow 0xf174 // KP_4 182 #define KBK_Keypad_Space 0xf175 // KP_5 183 #define KBK_Keypad_Right_Arrow 0xf176 // KP_6 184 #define KBK_Keypad_Home 0xf177 // KP_7 185 #define KBK_Keypad_Up_Arrow 0xf178 // KP_8 186 #define KBK_Keypad_Page_Up 0xf179 // KP_9 187 188 // Editing keys: 0xf180-0xf1bf 189 // These codes are based upon the keypad codes (see below). 190 // These keys are the Ascii code of the corresponding 191 // character on the (NumLocked) key, offset by 0xf180. 192 193 #define KBK_Delete 0xf1ae // KP_Period 194 #define KBK_Insert 0xf1b0 // KP_0 195 #define KBK_End 0xf1b1 // KP_1 196 #define KBK_Down_Arrow 0xf1b2 // KP_2 197 #define KBK_Page_Down 0xf1b3 // KP_3 198 #define KBK_Left_Arrow 0xf1b4 // KP_4 199 // KP_5 200 #define KBK_Right_Arrow 0xf1b6 // KP_6 201 #define KBK_Home 0xf1b7 // KP_7 202 #define KBK_Up_Arrow 0xf1b8 // KP_8 203 #define KBK_Page_Up 0xf1b9 // KP_9 204 205 // Normal ASCII Control keys: 0xf1c0-0xf1df 206 // These keys are the Ascii code of the corresponding 207 // character on the key, offset by 0xf1c0. 208 209 #define KBK_Backspace 0xf1c8 210 #define KBK_Tab 0xf1c9 211 #define KBK_Enter 0xf1cd 212 #define KBK_Escape 0xf1db 213 214 // Range from 0xf1e0-0xf1ff is reserved for future use. 215 216 // The spacebar 217 // This is just the regular ASCII code for space. 218 // It is included here for convenience. 219 #define KBK_Space 0x0020 220 221 #endif // __KBD_KEY_DEFS_H__ 222