mX mbed BaseBoard USB HID

Dependencies:   mbed

Committer:
ashwin_athani
Date:
Wed Dec 08 06:30:25 2010 +0000
Revision:
0:093612081f64

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashwin_athani 0:093612081f64 1 /* asciihid.h */
ashwin_athani 0:093612081f64 2 /* ASCII to HID Keyboard lookup table */
ashwin_athani 0:093612081f64 3 /* Copyright (c) Phil Wright 2008 */
ashwin_athani 0:093612081f64 4
ashwin_athani 0:093612081f64 5 #ifndef HIDTABLE_H
ashwin_athani 0:093612081f64 6 #define HIDTABLE_H
ashwin_athani 0:093612081f64 7
ashwin_athani 0:093612081f64 8 /* Default is UK keyboard layout */
ashwin_athani 0:093612081f64 9 /* #define US_KEYBOARD */
ashwin_athani 0:093612081f64 10
ashwin_athani 0:093612081f64 11 /* Modifiers */
ashwin_athani 0:093612081f64 12 #define SHIFT (1<<1)
ashwin_athani 0:093612081f64 13
ashwin_athani 0:093612081f64 14 typedef struct {
ashwin_athani 0:093612081f64 15 unsigned char usage;
ashwin_athani 0:093612081f64 16 unsigned char modifier;
ashwin_athani 0:093612081f64 17 } KEYMAP;
ashwin_athani 0:093612081f64 18
ashwin_athani 0:093612081f64 19 #ifdef US_KEYBOARD
ashwin_athani 0:093612081f64 20 /* US keyboard (as HID standard) */
ashwin_athani 0:093612081f64 21 #define KEYMAP_SIZE (128)
ashwin_athani 0:093612081f64 22 const KEYMAP keymap[KEYMAP_SIZE] = {
ashwin_athani 0:093612081f64 23 {0, 0}, /* NUL */
ashwin_athani 0:093612081f64 24 {0, 0}, /* SOH */
ashwin_athani 0:093612081f64 25 {0, 0}, /* STX */
ashwin_athani 0:093612081f64 26 {0, 0}, /* ETX */
ashwin_athani 0:093612081f64 27 {0, 0}, /* EOT */
ashwin_athani 0:093612081f64 28 {0, 0}, /* ENQ */
ashwin_athani 0:093612081f64 29 {0, 0}, /* ACK */
ashwin_athani 0:093612081f64 30 {0, 0}, /* BEL */
ashwin_athani 0:093612081f64 31 {0x2a, 0}, /* BS */ /* Keyboard Delete (Backspace) */
ashwin_athani 0:093612081f64 32 {0x2b, 0}, /* TAB */ /* Keyboard Tab */
ashwin_athani 0:093612081f64 33 {0x28, 0}, /* LF */ /* Keyboard Return (Enter) */
ashwin_athani 0:093612081f64 34 {0, 0}, /* VT */
ashwin_athani 0:093612081f64 35 {0, 0}, /* FF */
ashwin_athani 0:093612081f64 36 {0, 0}, /* CR */
ashwin_athani 0:093612081f64 37 {0, 0}, /* SO */
ashwin_athani 0:093612081f64 38 {0, 0}, /* SI */
ashwin_athani 0:093612081f64 39 {0, 0}, /* DEL */
ashwin_athani 0:093612081f64 40 {0, 0}, /* DC1 */
ashwin_athani 0:093612081f64 41 {0, 0}, /* DC2 */
ashwin_athani 0:093612081f64 42 {0, 0}, /* DC3 */
ashwin_athani 0:093612081f64 43 {0, 0}, /* DC4 */
ashwin_athani 0:093612081f64 44 {0, 0}, /* NAK */
ashwin_athani 0:093612081f64 45 {0, 0}, /* SYN */
ashwin_athani 0:093612081f64 46 {0, 0}, /* ETB */
ashwin_athani 0:093612081f64 47 {0, 0}, /* CAN */
ashwin_athani 0:093612081f64 48 {0, 0}, /* EM */
ashwin_athani 0:093612081f64 49 {0, 0}, /* SUB */
ashwin_athani 0:093612081f64 50 {0, 0}, /* ESC */
ashwin_athani 0:093612081f64 51 {0, 0}, /* FS */
ashwin_athani 0:093612081f64 52 {0, 0}, /* GS */
ashwin_athani 0:093612081f64 53 {0, 0}, /* RS */
ashwin_athani 0:093612081f64 54 {0, 0}, /* US */
ashwin_athani 0:093612081f64 55 {0x2c, 0}, /* */
ashwin_athani 0:093612081f64 56 {0x1e, SHIFT}, /* ! */
ashwin_athani 0:093612081f64 57 {0x34, SHIFT}, /* " */
ashwin_athani 0:093612081f64 58 {0x20, SHIFT}, /* # */
ashwin_athani 0:093612081f64 59 {0x21, SHIFT}, /* $ */
ashwin_athani 0:093612081f64 60 {0x22, SHIFT}, /* % */
ashwin_athani 0:093612081f64 61 {0x24, SHIFT}, /* & */
ashwin_athani 0:093612081f64 62 {0x34, 0}, /* ' */
ashwin_athani 0:093612081f64 63 {0x26, SHIFT}, /* ( */
ashwin_athani 0:093612081f64 64 {0x27, SHIFT}, /* ) */
ashwin_athani 0:093612081f64 65 {0x25, SHIFT}, /* * */
ashwin_athani 0:093612081f64 66 {0x2e, SHIFT}, /* + */
ashwin_athani 0:093612081f64 67 {0x36, 0}, /* , */
ashwin_athani 0:093612081f64 68 {0x2d, 0}, /* - */
ashwin_athani 0:093612081f64 69 {0x37, 0}, /* . */
ashwin_athani 0:093612081f64 70 {0x38, 0}, /* / */
ashwin_athani 0:093612081f64 71 {0x27, 0}, /* 0 */
ashwin_athani 0:093612081f64 72 {0x1e, 0}, /* 1 */
ashwin_athani 0:093612081f64 73 {0x1f, 0}, /* 2 */
ashwin_athani 0:093612081f64 74 {0x20, 0}, /* 3 */
ashwin_athani 0:093612081f64 75 {0x21, 0}, /* 4 */
ashwin_athani 0:093612081f64 76 {0x22, 0}, /* 5 */
ashwin_athani 0:093612081f64 77 {0x23, 0}, /* 6 */
ashwin_athani 0:093612081f64 78 {0x24, 0}, /* 7 */
ashwin_athani 0:093612081f64 79 {0x25, 0}, /* 8 */
ashwin_athani 0:093612081f64 80 {0x26, 0}, /* 9 */
ashwin_athani 0:093612081f64 81 {0x33, SHIFT}, /* : */
ashwin_athani 0:093612081f64 82 {0x33, 0}, /* ; */
ashwin_athani 0:093612081f64 83 {0x36, SHIFT}, /* < */
ashwin_athani 0:093612081f64 84 {0x2e, 0}, /* = */
ashwin_athani 0:093612081f64 85 {0x37, SHIFT}, /* > */
ashwin_athani 0:093612081f64 86 {0x38, SHIFT}, /* ? */
ashwin_athani 0:093612081f64 87 {0x1f, SHIFT}, /* @ */
ashwin_athani 0:093612081f64 88 {0x04, SHIFT}, /* A */
ashwin_athani 0:093612081f64 89 {0x05, SHIFT}, /* B */
ashwin_athani 0:093612081f64 90 {0x06, SHIFT}, /* C */
ashwin_athani 0:093612081f64 91 {0x07, SHIFT}, /* D */
ashwin_athani 0:093612081f64 92 {0x08, SHIFT}, /* E */
ashwin_athani 0:093612081f64 93 {0x09, SHIFT}, /* F */
ashwin_athani 0:093612081f64 94 {0x0a, SHIFT}, /* G */
ashwin_athani 0:093612081f64 95 {0x0b, SHIFT}, /* H */
ashwin_athani 0:093612081f64 96 {0x0c, SHIFT}, /* I */
ashwin_athani 0:093612081f64 97 {0x0d, SHIFT}, /* J */
ashwin_athani 0:093612081f64 98 {0x0e, SHIFT}, /* K */
ashwin_athani 0:093612081f64 99 {0x0f, SHIFT}, /* L */
ashwin_athani 0:093612081f64 100 {0x10, SHIFT}, /* M */
ashwin_athani 0:093612081f64 101 {0x11, SHIFT}, /* N */
ashwin_athani 0:093612081f64 102 {0x12, SHIFT}, /* O */
ashwin_athani 0:093612081f64 103 {0x13, SHIFT}, /* P */
ashwin_athani 0:093612081f64 104 {0x14, SHIFT}, /* Q */
ashwin_athani 0:093612081f64 105 {0x15, SHIFT}, /* R */
ashwin_athani 0:093612081f64 106 {0x16, SHIFT}, /* S */
ashwin_athani 0:093612081f64 107 {0x17, SHIFT}, /* T */
ashwin_athani 0:093612081f64 108 {0x18, SHIFT}, /* U */
ashwin_athani 0:093612081f64 109 {0x19, SHIFT}, /* V */
ashwin_athani 0:093612081f64 110 {0x1a, SHIFT}, /* W */
ashwin_athani 0:093612081f64 111 {0x1b, SHIFT}, /* X */
ashwin_athani 0:093612081f64 112 {0x1c, SHIFT}, /* Y */
ashwin_athani 0:093612081f64 113 {0x1d, SHIFT}, /* Z */
ashwin_athani 0:093612081f64 114 {0x2f, 0}, /* [ */
ashwin_athani 0:093612081f64 115 {0x31, 0}, /* \ */
ashwin_athani 0:093612081f64 116 {0x30, 0}, /* ] */
ashwin_athani 0:093612081f64 117 {0x23, SHIFT}, /* ^ */
ashwin_athani 0:093612081f64 118 {0x2d, SHIFT}, /* _ */
ashwin_athani 0:093612081f64 119 {0x35, 0}, /* ` */
ashwin_athani 0:093612081f64 120 {0x04, 0}, /* a */
ashwin_athani 0:093612081f64 121 {0x05, 0}, /* b */
ashwin_athani 0:093612081f64 122 {0x06, 0}, /* c */
ashwin_athani 0:093612081f64 123 {0x07, 0}, /* d */
ashwin_athani 0:093612081f64 124 {0x08, 0}, /* e */
ashwin_athani 0:093612081f64 125 {0x09, 0}, /* f */
ashwin_athani 0:093612081f64 126 {0x0a, 0}, /* g */
ashwin_athani 0:093612081f64 127 {0x0b, 0}, /* h */
ashwin_athani 0:093612081f64 128 {0x0c, 0}, /* i */
ashwin_athani 0:093612081f64 129 {0x0d, 0}, /* j */
ashwin_athani 0:093612081f64 130 {0x0e, 0}, /* k */
ashwin_athani 0:093612081f64 131 {0x0f, 0}, /* l */
ashwin_athani 0:093612081f64 132 {0x10, 0}, /* m */
ashwin_athani 0:093612081f64 133 {0x11, 0}, /* n */
ashwin_athani 0:093612081f64 134 {0x12, 0}, /* o */
ashwin_athani 0:093612081f64 135 {0x13, 0}, /* p */
ashwin_athani 0:093612081f64 136 {0x14, 0}, /* q */
ashwin_athani 0:093612081f64 137 {0x15, 0}, /* r */
ashwin_athani 0:093612081f64 138 {0x16, 0}, /* s */
ashwin_athani 0:093612081f64 139 {0x17, 0}, /* t */
ashwin_athani 0:093612081f64 140 {0x18, 0}, /* u */
ashwin_athani 0:093612081f64 141 {0x19, 0}, /* v */
ashwin_athani 0:093612081f64 142 {0x1a, 0}, /* w */
ashwin_athani 0:093612081f64 143 {0x1b, 0}, /* x */
ashwin_athani 0:093612081f64 144 {0x1c, 0}, /* y */
ashwin_athani 0:093612081f64 145 {0x1d, 0}, /* z */
ashwin_athani 0:093612081f64 146 {0x2f, SHIFT}, /* { */
ashwin_athani 0:093612081f64 147 {0x31, SHIFT}, /* | */
ashwin_athani 0:093612081f64 148 {0x30, SHIFT}, /* } */
ashwin_athani 0:093612081f64 149 {0x35, SHIFT}, /* ~ */
ashwin_athani 0:093612081f64 150 {0,0}, /* DEL */
ashwin_athani 0:093612081f64 151 };
ashwin_athani 0:093612081f64 152
ashwin_athani 0:093612081f64 153 #else
ashwin_athani 0:093612081f64 154 /* UK keyboard */
ashwin_athani 0:093612081f64 155 #define KEYMAP_SIZE (128)
ashwin_athani 0:093612081f64 156 const KEYMAP keymap[KEYMAP_SIZE] = {
ashwin_athani 0:093612081f64 157 {0, 0}, /* NUL */
ashwin_athani 0:093612081f64 158 {0, 0}, /* SOH */
ashwin_athani 0:093612081f64 159 {0, 0}, /* STX */
ashwin_athani 0:093612081f64 160 {0, 0}, /* ETX */
ashwin_athani 0:093612081f64 161 {0, 0}, /* EOT */
ashwin_athani 0:093612081f64 162 {0, 0}, /* ENQ */
ashwin_athani 0:093612081f64 163 {0, 0}, /* ACK */
ashwin_athani 0:093612081f64 164 {0, 0}, /* BEL */
ashwin_athani 0:093612081f64 165 {0x2a, 0}, /* BS */ /* Keyboard Delete (Backspace) */
ashwin_athani 0:093612081f64 166 {0x2b, 0}, /* TAB */ /* Keyboard Tab */
ashwin_athani 0:093612081f64 167 {0x28, 0}, /* LF */ /* Keyboard Return (Enter) */
ashwin_athani 0:093612081f64 168 {0, 0}, /* VT */
ashwin_athani 0:093612081f64 169 {0, 0}, /* FF */
ashwin_athani 0:093612081f64 170 {0, 0}, /* CR */
ashwin_athani 0:093612081f64 171 {0, 0}, /* SO */
ashwin_athani 0:093612081f64 172 {0, 0}, /* SI */
ashwin_athani 0:093612081f64 173 {0, 0}, /* DEL */
ashwin_athani 0:093612081f64 174 {0, 0}, /* DC1 */
ashwin_athani 0:093612081f64 175 {0, 0}, /* DC2 */
ashwin_athani 0:093612081f64 176 {0, 0}, /* DC3 */
ashwin_athani 0:093612081f64 177 {0, 0}, /* DC4 */
ashwin_athani 0:093612081f64 178 {0, 0}, /* NAK */
ashwin_athani 0:093612081f64 179 {0, 0}, /* SYN */
ashwin_athani 0:093612081f64 180 {0, 0}, /* ETB */
ashwin_athani 0:093612081f64 181 {0, 0}, /* CAN */
ashwin_athani 0:093612081f64 182 {0, 0}, /* EM */
ashwin_athani 0:093612081f64 183 {0, 0}, /* SUB */
ashwin_athani 0:093612081f64 184 {0, 0}, /* ESC */
ashwin_athani 0:093612081f64 185 {0, 0}, /* FS */
ashwin_athani 0:093612081f64 186 {0, 0}, /* GS */
ashwin_athani 0:093612081f64 187 {0, 0}, /* RS */
ashwin_athani 0:093612081f64 188 {0, 0}, /* US */
ashwin_athani 0:093612081f64 189 {0x2c, 0}, /* */
ashwin_athani 0:093612081f64 190 {0x1e, SHIFT}, /* ! */
ashwin_athani 0:093612081f64 191 {0x1f, SHIFT}, /* " */
ashwin_athani 0:093612081f64 192 {0x32, 0}, /* # */
ashwin_athani 0:093612081f64 193 {0x21, SHIFT}, /* $ */
ashwin_athani 0:093612081f64 194 {0x22, SHIFT}, /* % */
ashwin_athani 0:093612081f64 195 {0x24, SHIFT}, /* & */
ashwin_athani 0:093612081f64 196 {0x34, 0}, /* ' */
ashwin_athani 0:093612081f64 197 {0x26, SHIFT}, /* ( */
ashwin_athani 0:093612081f64 198 {0x27, SHIFT}, /* ) */
ashwin_athani 0:093612081f64 199 {0x25, SHIFT}, /* * */
ashwin_athani 0:093612081f64 200 {0x2e, SHIFT}, /* + */
ashwin_athani 0:093612081f64 201 {0x36, 0}, /* , */
ashwin_athani 0:093612081f64 202 {0x2d, 0}, /* - */
ashwin_athani 0:093612081f64 203 {0x37, 0}, /* . */
ashwin_athani 0:093612081f64 204 {0x38, 0}, /* / */
ashwin_athani 0:093612081f64 205 {0x27, 0}, /* 0 */
ashwin_athani 0:093612081f64 206 {0x1e, 0}, /* 1 */
ashwin_athani 0:093612081f64 207 {0x1f, 0}, /* 2 */
ashwin_athani 0:093612081f64 208 {0x20, 0}, /* 3 */
ashwin_athani 0:093612081f64 209 {0x21, 0}, /* 4 */
ashwin_athani 0:093612081f64 210 {0x22, 0}, /* 5 */
ashwin_athani 0:093612081f64 211 {0x23, 0}, /* 6 */
ashwin_athani 0:093612081f64 212 {0x24, 0}, /* 7 */
ashwin_athani 0:093612081f64 213 {0x25, 0}, /* 8 */
ashwin_athani 0:093612081f64 214 {0x26, 0}, /* 9 */
ashwin_athani 0:093612081f64 215 {0x33, SHIFT}, /* : */
ashwin_athani 0:093612081f64 216 {0x33, 0}, /* ; */
ashwin_athani 0:093612081f64 217 {0x36, SHIFT}, /* < */
ashwin_athani 0:093612081f64 218 {0x2e, 0}, /* = */
ashwin_athani 0:093612081f64 219 {0x37, SHIFT}, /* > */
ashwin_athani 0:093612081f64 220 {0x38, SHIFT}, /* ? */
ashwin_athani 0:093612081f64 221 {0x34, SHIFT}, /* @ */
ashwin_athani 0:093612081f64 222 {0x04, SHIFT}, /* A */
ashwin_athani 0:093612081f64 223 {0x05, SHIFT}, /* B */
ashwin_athani 0:093612081f64 224 {0x06, SHIFT}, /* C */
ashwin_athani 0:093612081f64 225 {0x07, SHIFT}, /* D */
ashwin_athani 0:093612081f64 226 {0x08, SHIFT}, /* E */
ashwin_athani 0:093612081f64 227 {0x09, SHIFT}, /* F */
ashwin_athani 0:093612081f64 228 {0x0a, SHIFT}, /* G */
ashwin_athani 0:093612081f64 229 {0x0b, SHIFT}, /* H */
ashwin_athani 0:093612081f64 230 {0x0c, SHIFT}, /* I */
ashwin_athani 0:093612081f64 231 {0x0d, SHIFT}, /* J */
ashwin_athani 0:093612081f64 232 {0x0e, SHIFT}, /* K */
ashwin_athani 0:093612081f64 233 {0x0f, SHIFT}, /* L */
ashwin_athani 0:093612081f64 234 {0x10, SHIFT}, /* M */
ashwin_athani 0:093612081f64 235 {0x11, SHIFT}, /* N */
ashwin_athani 0:093612081f64 236 {0x12, SHIFT}, /* O */
ashwin_athani 0:093612081f64 237 {0x13, SHIFT}, /* P */
ashwin_athani 0:093612081f64 238 {0x14, SHIFT}, /* Q */
ashwin_athani 0:093612081f64 239 {0x15, SHIFT}, /* R */
ashwin_athani 0:093612081f64 240 {0x16, SHIFT}, /* S */
ashwin_athani 0:093612081f64 241 {0x17, SHIFT}, /* T */
ashwin_athani 0:093612081f64 242 {0x18, SHIFT}, /* U */
ashwin_athani 0:093612081f64 243 {0x19, SHIFT}, /* V */
ashwin_athani 0:093612081f64 244 {0x1a, SHIFT}, /* W */
ashwin_athani 0:093612081f64 245 {0x1b, SHIFT}, /* X */
ashwin_athani 0:093612081f64 246 {0x1c, SHIFT}, /* Y */
ashwin_athani 0:093612081f64 247 {0x1d, SHIFT}, /* Z */
ashwin_athani 0:093612081f64 248 {0x2f, 0}, /* [ */
ashwin_athani 0:093612081f64 249 {0x64, 0}, /* \ */
ashwin_athani 0:093612081f64 250 {0x30, 0}, /* ] */
ashwin_athani 0:093612081f64 251 {0x23, SHIFT}, /* ^ */
ashwin_athani 0:093612081f64 252 {0x2d, SHIFT}, /* _ */
ashwin_athani 0:093612081f64 253 {0x35, 0}, /* ` */
ashwin_athani 0:093612081f64 254 {0x04, 0}, /* a */
ashwin_athani 0:093612081f64 255 {0x05, 0}, /* b */
ashwin_athani 0:093612081f64 256 {0x06, 0}, /* c */
ashwin_athani 0:093612081f64 257 {0x07, 0}, /* d */
ashwin_athani 0:093612081f64 258 {0x08, 0}, /* e */
ashwin_athani 0:093612081f64 259 {0x09, 0}, /* f */
ashwin_athani 0:093612081f64 260 {0x0a, 0}, /* g */
ashwin_athani 0:093612081f64 261 {0x0b, 0}, /* h */
ashwin_athani 0:093612081f64 262 {0x0c, 0}, /* i */
ashwin_athani 0:093612081f64 263 {0x0d, 0}, /* j */
ashwin_athani 0:093612081f64 264 {0x0e, 0}, /* k */
ashwin_athani 0:093612081f64 265 {0x0f, 0}, /* l */
ashwin_athani 0:093612081f64 266 {0x10, 0}, /* m */
ashwin_athani 0:093612081f64 267 {0x11, 0}, /* n */
ashwin_athani 0:093612081f64 268 {0x12, 0}, /* o */
ashwin_athani 0:093612081f64 269 {0x13, 0}, /* p */
ashwin_athani 0:093612081f64 270 {0x14, 0}, /* q */
ashwin_athani 0:093612081f64 271 {0x15, 0}, /* r */
ashwin_athani 0:093612081f64 272 {0x16, 0}, /* s */
ashwin_athani 0:093612081f64 273 {0x17, 0}, /* t */
ashwin_athani 0:093612081f64 274 {0x18, 0}, /* u */
ashwin_athani 0:093612081f64 275 {0x19, 0}, /* v */
ashwin_athani 0:093612081f64 276 {0x1a, 0}, /* w */
ashwin_athani 0:093612081f64 277 {0x1b, 0}, /* x */
ashwin_athani 0:093612081f64 278 {0x1c, 0}, /* y */
ashwin_athani 0:093612081f64 279 {0x1d, 0}, /* z */
ashwin_athani 0:093612081f64 280 {0x2f, SHIFT}, /* { */
ashwin_athani 0:093612081f64 281 {0x64, SHIFT}, /* | */
ashwin_athani 0:093612081f64 282 {0x30, SHIFT}, /* } */
ashwin_athani 0:093612081f64 283 {0x32, SHIFT}, /* ~ */
ashwin_athani 0:093612081f64 284 {0,0}, /* DEL */
ashwin_athani 0:093612081f64 285 };
ashwin_athani 0:093612081f64 286 #endif
ashwin_athani 0:093612081f64 287
ashwin_athani 0:093612081f64 288
ashwin_athani 0:093612081f64 289 #endif