USBDevice
Fork of USBDevice by
USBHID/USBKeyboard.cpp@10:378e9df8157a, 2013-04-05 (annotated)
- Committer:
- DanBUK
- Date:
- Fri Apr 05 07:09:26 2013 +0000
- Revision:
- 10:378e9df8157a
- Parent:
- 1:80ab0d068708
Making this look like an Apple USB keyboard, saves identification...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux | 1:80ab0d068708 | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
samux | 1:80ab0d068708 | 2 | * |
samux | 1:80ab0d068708 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
samux | 1:80ab0d068708 | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
samux | 1:80ab0d068708 | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
samux | 1:80ab0d068708 | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
samux | 1:80ab0d068708 | 7 | * Software is furnished to do so, subject to the following conditions: |
samux | 1:80ab0d068708 | 8 | * |
samux | 1:80ab0d068708 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
samux | 1:80ab0d068708 | 10 | * substantial portions of the Software. |
samux | 1:80ab0d068708 | 11 | * |
samux | 1:80ab0d068708 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
samux | 1:80ab0d068708 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
samux | 1:80ab0d068708 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
samux | 1:80ab0d068708 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
samux | 1:80ab0d068708 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
samux | 1:80ab0d068708 | 17 | */ |
samux | 1:80ab0d068708 | 18 | |
samux | 1:80ab0d068708 | 19 | #include "stdint.h" |
samux | 1:80ab0d068708 | 20 | |
samux | 1:80ab0d068708 | 21 | #include "USBKeyboard.h" |
samux | 1:80ab0d068708 | 22 | |
samux | 1:80ab0d068708 | 23 | #define REPORT_ID_KEYBOARD 1 |
samux | 1:80ab0d068708 | 24 | #define REPORT_ID_VOLUME 3 |
samux | 1:80ab0d068708 | 25 | |
samux | 1:80ab0d068708 | 26 | |
samux | 1:80ab0d068708 | 27 | typedef struct { |
samux | 1:80ab0d068708 | 28 | unsigned char usage; |
samux | 1:80ab0d068708 | 29 | unsigned char modifier; |
samux | 1:80ab0d068708 | 30 | } KEYMAP; |
samux | 1:80ab0d068708 | 31 | |
samux | 1:80ab0d068708 | 32 | #ifdef US_KEYBOARD |
samux | 1:80ab0d068708 | 33 | /* US keyboard (as HID standard) */ |
samux | 1:80ab0d068708 | 34 | #define KEYMAP_SIZE (152) |
samux | 1:80ab0d068708 | 35 | const KEYMAP keymap[KEYMAP_SIZE] = { |
samux | 1:80ab0d068708 | 36 | {0, 0}, /* NUL */ |
samux | 1:80ab0d068708 | 37 | {0, 0}, /* SOH */ |
samux | 1:80ab0d068708 | 38 | {0, 0}, /* STX */ |
samux | 1:80ab0d068708 | 39 | {0, 0}, /* ETX */ |
samux | 1:80ab0d068708 | 40 | {0, 0}, /* EOT */ |
samux | 1:80ab0d068708 | 41 | {0, 0}, /* ENQ */ |
samux | 1:80ab0d068708 | 42 | {0, 0}, /* ACK */ |
samux | 1:80ab0d068708 | 43 | {0, 0}, /* BEL */ |
samux | 1:80ab0d068708 | 44 | {0x2a, 0}, /* BS */ /* Keyboard Delete (Backspace) */ |
samux | 1:80ab0d068708 | 45 | {0x2b, 0}, /* TAB */ /* Keyboard Tab */ |
samux | 1:80ab0d068708 | 46 | {0x28, 0}, /* LF */ /* Keyboard Return (Enter) */ |
samux | 1:80ab0d068708 | 47 | {0, 0}, /* VT */ |
samux | 1:80ab0d068708 | 48 | {0, 0}, /* FF */ |
samux | 1:80ab0d068708 | 49 | {0, 0}, /* CR */ |
samux | 1:80ab0d068708 | 50 | {0, 0}, /* SO */ |
samux | 1:80ab0d068708 | 51 | {0, 0}, /* SI */ |
samux | 1:80ab0d068708 | 52 | {0, 0}, /* DEL */ |
samux | 1:80ab0d068708 | 53 | {0, 0}, /* DC1 */ |
samux | 1:80ab0d068708 | 54 | {0, 0}, /* DC2 */ |
samux | 1:80ab0d068708 | 55 | {0, 0}, /* DC3 */ |
samux | 1:80ab0d068708 | 56 | {0, 0}, /* DC4 */ |
samux | 1:80ab0d068708 | 57 | {0, 0}, /* NAK */ |
samux | 1:80ab0d068708 | 58 | {0, 0}, /* SYN */ |
samux | 1:80ab0d068708 | 59 | {0, 0}, /* ETB */ |
samux | 1:80ab0d068708 | 60 | {0, 0}, /* CAN */ |
samux | 1:80ab0d068708 | 61 | {0, 0}, /* EM */ |
samux | 1:80ab0d068708 | 62 | {0, 0}, /* SUB */ |
samux | 1:80ab0d068708 | 63 | {0, 0}, /* ESC */ |
samux | 1:80ab0d068708 | 64 | {0, 0}, /* FS */ |
samux | 1:80ab0d068708 | 65 | {0, 0}, /* GS */ |
samux | 1:80ab0d068708 | 66 | {0, 0}, /* RS */ |
samux | 1:80ab0d068708 | 67 | {0, 0}, /* US */ |
samux | 1:80ab0d068708 | 68 | {0x2c, 0}, /* */ |
samux | 1:80ab0d068708 | 69 | {0x1e, KEY_SHIFT}, /* ! */ |
samux | 1:80ab0d068708 | 70 | {0x34, KEY_SHIFT}, /* " */ |
samux | 1:80ab0d068708 | 71 | {0x20, KEY_SHIFT}, /* # */ |
samux | 1:80ab0d068708 | 72 | {0x21, KEY_SHIFT}, /* $ */ |
samux | 1:80ab0d068708 | 73 | {0x22, KEY_SHIFT}, /* % */ |
samux | 1:80ab0d068708 | 74 | {0x24, KEY_SHIFT}, /* & */ |
samux | 1:80ab0d068708 | 75 | {0x34, 0}, /* ' */ |
samux | 1:80ab0d068708 | 76 | {0x26, KEY_SHIFT}, /* ( */ |
samux | 1:80ab0d068708 | 77 | {0x27, KEY_SHIFT}, /* ) */ |
samux | 1:80ab0d068708 | 78 | {0x25, KEY_SHIFT}, /* * */ |
samux | 1:80ab0d068708 | 79 | {0x2e, KEY_SHIFT}, /* + */ |
samux | 1:80ab0d068708 | 80 | {0x36, 0}, /* , */ |
samux | 1:80ab0d068708 | 81 | {0x2d, 0}, /* - */ |
samux | 1:80ab0d068708 | 82 | {0x37, 0}, /* . */ |
samux | 1:80ab0d068708 | 83 | {0x38, 0}, /* / */ |
samux | 1:80ab0d068708 | 84 | {0x27, 0}, /* 0 */ |
samux | 1:80ab0d068708 | 85 | {0x1e, 0}, /* 1 */ |
samux | 1:80ab0d068708 | 86 | {0x1f, 0}, /* 2 */ |
samux | 1:80ab0d068708 | 87 | {0x20, 0}, /* 3 */ |
samux | 1:80ab0d068708 | 88 | {0x21, 0}, /* 4 */ |
samux | 1:80ab0d068708 | 89 | {0x22, 0}, /* 5 */ |
samux | 1:80ab0d068708 | 90 | {0x23, 0}, /* 6 */ |
samux | 1:80ab0d068708 | 91 | {0x24, 0}, /* 7 */ |
samux | 1:80ab0d068708 | 92 | {0x25, 0}, /* 8 */ |
samux | 1:80ab0d068708 | 93 | {0x26, 0}, /* 9 */ |
samux | 1:80ab0d068708 | 94 | {0x33, KEY_SHIFT}, /* : */ |
samux | 1:80ab0d068708 | 95 | {0x33, 0}, /* ; */ |
samux | 1:80ab0d068708 | 96 | {0x36, KEY_SHIFT}, /* < */ |
samux | 1:80ab0d068708 | 97 | {0x2e, 0}, /* = */ |
samux | 1:80ab0d068708 | 98 | {0x37, KEY_SHIFT}, /* > */ |
samux | 1:80ab0d068708 | 99 | {0x38, KEY_SHIFT}, /* ? */ |
samux | 1:80ab0d068708 | 100 | {0x1f, KEY_SHIFT}, /* @ */ |
samux | 1:80ab0d068708 | 101 | {0x04, KEY_SHIFT}, /* A */ |
samux | 1:80ab0d068708 | 102 | {0x05, KEY_SHIFT}, /* B */ |
samux | 1:80ab0d068708 | 103 | {0x06, KEY_SHIFT}, /* C */ |
samux | 1:80ab0d068708 | 104 | {0x07, KEY_SHIFT}, /* D */ |
samux | 1:80ab0d068708 | 105 | {0x08, KEY_SHIFT}, /* E */ |
samux | 1:80ab0d068708 | 106 | {0x09, KEY_SHIFT}, /* F */ |
samux | 1:80ab0d068708 | 107 | {0x0a, KEY_SHIFT}, /* G */ |
samux | 1:80ab0d068708 | 108 | {0x0b, KEY_SHIFT}, /* H */ |
samux | 1:80ab0d068708 | 109 | {0x0c, KEY_SHIFT}, /* I */ |
samux | 1:80ab0d068708 | 110 | {0x0d, KEY_SHIFT}, /* J */ |
samux | 1:80ab0d068708 | 111 | {0x0e, KEY_SHIFT}, /* K */ |
samux | 1:80ab0d068708 | 112 | {0x0f, KEY_SHIFT}, /* L */ |
samux | 1:80ab0d068708 | 113 | {0x10, KEY_SHIFT}, /* M */ |
samux | 1:80ab0d068708 | 114 | {0x11, KEY_SHIFT}, /* N */ |
samux | 1:80ab0d068708 | 115 | {0x12, KEY_SHIFT}, /* O */ |
samux | 1:80ab0d068708 | 116 | {0x13, KEY_SHIFT}, /* P */ |
samux | 1:80ab0d068708 | 117 | {0x14, KEY_SHIFT}, /* Q */ |
samux | 1:80ab0d068708 | 118 | {0x15, KEY_SHIFT}, /* R */ |
samux | 1:80ab0d068708 | 119 | {0x16, KEY_SHIFT}, /* S */ |
samux | 1:80ab0d068708 | 120 | {0x17, KEY_SHIFT}, /* T */ |
samux | 1:80ab0d068708 | 121 | {0x18, KEY_SHIFT}, /* U */ |
samux | 1:80ab0d068708 | 122 | {0x19, KEY_SHIFT}, /* V */ |
samux | 1:80ab0d068708 | 123 | {0x1a, KEY_SHIFT}, /* W */ |
samux | 1:80ab0d068708 | 124 | {0x1b, KEY_SHIFT}, /* X */ |
samux | 1:80ab0d068708 | 125 | {0x1c, KEY_SHIFT}, /* Y */ |
samux | 1:80ab0d068708 | 126 | {0x1d, KEY_SHIFT}, /* Z */ |
samux | 1:80ab0d068708 | 127 | {0x2f, 0}, /* [ */ |
samux | 1:80ab0d068708 | 128 | {0x31, 0}, /* \ */ |
samux | 1:80ab0d068708 | 129 | {0x30, 0}, /* ] */ |
samux | 1:80ab0d068708 | 130 | {0x23, KEY_SHIFT}, /* ^ */ |
samux | 1:80ab0d068708 | 131 | {0x2d, KEY_SHIFT}, /* _ */ |
samux | 1:80ab0d068708 | 132 | {0x35, 0}, /* ` */ |
samux | 1:80ab0d068708 | 133 | {0x04, 0}, /* a */ |
samux | 1:80ab0d068708 | 134 | {0x05, 0}, /* b */ |
samux | 1:80ab0d068708 | 135 | {0x06, 0}, /* c */ |
samux | 1:80ab0d068708 | 136 | {0x07, 0}, /* d */ |
samux | 1:80ab0d068708 | 137 | {0x08, 0}, /* e */ |
samux | 1:80ab0d068708 | 138 | {0x09, 0}, /* f */ |
samux | 1:80ab0d068708 | 139 | {0x0a, 0}, /* g */ |
samux | 1:80ab0d068708 | 140 | {0x0b, 0}, /* h */ |
samux | 1:80ab0d068708 | 141 | {0x0c, 0}, /* i */ |
samux | 1:80ab0d068708 | 142 | {0x0d, 0}, /* j */ |
samux | 1:80ab0d068708 | 143 | {0x0e, 0}, /* k */ |
samux | 1:80ab0d068708 | 144 | {0x0f, 0}, /* l */ |
samux | 1:80ab0d068708 | 145 | {0x10, 0}, /* m */ |
samux | 1:80ab0d068708 | 146 | {0x11, 0}, /* n */ |
samux | 1:80ab0d068708 | 147 | {0x12, 0}, /* o */ |
samux | 1:80ab0d068708 | 148 | {0x13, 0}, /* p */ |
samux | 1:80ab0d068708 | 149 | {0x14, 0}, /* q */ |
samux | 1:80ab0d068708 | 150 | {0x15, 0}, /* r */ |
samux | 1:80ab0d068708 | 151 | {0x16, 0}, /* s */ |
samux | 1:80ab0d068708 | 152 | {0x17, 0}, /* t */ |
samux | 1:80ab0d068708 | 153 | {0x18, 0}, /* u */ |
samux | 1:80ab0d068708 | 154 | {0x19, 0}, /* v */ |
samux | 1:80ab0d068708 | 155 | {0x1a, 0}, /* w */ |
samux | 1:80ab0d068708 | 156 | {0x1b, 0}, /* x */ |
samux | 1:80ab0d068708 | 157 | {0x1c, 0}, /* y */ |
samux | 1:80ab0d068708 | 158 | {0x1d, 0}, /* z */ |
samux | 1:80ab0d068708 | 159 | {0x2f, KEY_SHIFT}, /* { */ |
samux | 1:80ab0d068708 | 160 | {0x31, KEY_SHIFT}, /* | */ |
samux | 1:80ab0d068708 | 161 | {0x30, KEY_SHIFT}, /* } */ |
samux | 1:80ab0d068708 | 162 | {0x35, KEY_SHIFT}, /* ~ */ |
samux | 1:80ab0d068708 | 163 | {0,0}, /* DEL */ |
samux | 1:80ab0d068708 | 164 | |
samux | 1:80ab0d068708 | 165 | {0x3a, 0}, /* F1 */ |
samux | 1:80ab0d068708 | 166 | {0x3b, 0}, /* F2 */ |
samux | 1:80ab0d068708 | 167 | {0x3c, 0}, /* F3 */ |
samux | 1:80ab0d068708 | 168 | {0x3d, 0}, /* F4 */ |
samux | 1:80ab0d068708 | 169 | {0x3e, 0}, /* F5 */ |
samux | 1:80ab0d068708 | 170 | {0x3f, 0}, /* F6 */ |
samux | 1:80ab0d068708 | 171 | {0x40, 0}, /* F7 */ |
samux | 1:80ab0d068708 | 172 | {0x41, 0}, /* F8 */ |
samux | 1:80ab0d068708 | 173 | {0x42, 0}, /* F9 */ |
samux | 1:80ab0d068708 | 174 | {0x43, 0}, /* F10 */ |
samux | 1:80ab0d068708 | 175 | {0x44, 0}, /* F11 */ |
samux | 1:80ab0d068708 | 176 | {0x45, 0}, /* F12 */ |
samux | 1:80ab0d068708 | 177 | |
samux | 1:80ab0d068708 | 178 | {0x46, 0}, /* PRINT_SCREEN */ |
samux | 1:80ab0d068708 | 179 | {0x47, 0}, /* SCROLL_LOCK */ |
samux | 1:80ab0d068708 | 180 | {0x39, 0}, /* CAPS_LOCK */ |
samux | 1:80ab0d068708 | 181 | {0x53, 0}, /* NUM_LOCK */ |
samux | 1:80ab0d068708 | 182 | {0x49, 0}, /* INSERT */ |
samux | 1:80ab0d068708 | 183 | {0x4a, 0}, /* HOME */ |
samux | 1:80ab0d068708 | 184 | {0x4b, 0}, /* PAGE_UP */ |
samux | 1:80ab0d068708 | 185 | {0x4e, 0}, /* PAGE_DOWN */ |
samux | 1:80ab0d068708 | 186 | |
samux | 1:80ab0d068708 | 187 | {0x4f, 0}, /* RIGHT_ARROW */ |
samux | 1:80ab0d068708 | 188 | {0x50, 0}, /* LEFT_ARROW */ |
samux | 1:80ab0d068708 | 189 | {0x51, 0}, /* DOWN_ARROW */ |
samux | 1:80ab0d068708 | 190 | {0x52, 0}, /* UP_ARROW */ |
samux | 1:80ab0d068708 | 191 | }; |
samux | 1:80ab0d068708 | 192 | |
samux | 1:80ab0d068708 | 193 | #else |
samux | 1:80ab0d068708 | 194 | /* UK keyboard */ |
samux | 1:80ab0d068708 | 195 | #define KEYMAP_SIZE (152) |
samux | 1:80ab0d068708 | 196 | const KEYMAP keymap[KEYMAP_SIZE] = { |
samux | 1:80ab0d068708 | 197 | {0, 0}, /* NUL */ |
samux | 1:80ab0d068708 | 198 | {0, 0}, /* SOH */ |
samux | 1:80ab0d068708 | 199 | {0, 0}, /* STX */ |
samux | 1:80ab0d068708 | 200 | {0, 0}, /* ETX */ |
samux | 1:80ab0d068708 | 201 | {0, 0}, /* EOT */ |
samux | 1:80ab0d068708 | 202 | {0, 0}, /* ENQ */ |
samux | 1:80ab0d068708 | 203 | {0, 0}, /* ACK */ |
samux | 1:80ab0d068708 | 204 | {0, 0}, /* BEL */ |
samux | 1:80ab0d068708 | 205 | {0x2a, 0}, /* BS */ /* Keyboard Delete (Backspace) */ |
samux | 1:80ab0d068708 | 206 | {0x2b, 0}, /* TAB */ /* Keyboard Tab */ |
samux | 1:80ab0d068708 | 207 | {0x28, 0}, /* LF */ /* Keyboard Return (Enter) */ |
samux | 1:80ab0d068708 | 208 | {0, 0}, /* VT */ |
samux | 1:80ab0d068708 | 209 | {0, 0}, /* FF */ |
samux | 1:80ab0d068708 | 210 | {0, 0}, /* CR */ |
samux | 1:80ab0d068708 | 211 | {0, 0}, /* SO */ |
samux | 1:80ab0d068708 | 212 | {0, 0}, /* SI */ |
samux | 1:80ab0d068708 | 213 | {0, 0}, /* DEL */ |
samux | 1:80ab0d068708 | 214 | {0, 0}, /* DC1 */ |
samux | 1:80ab0d068708 | 215 | {0, 0}, /* DC2 */ |
samux | 1:80ab0d068708 | 216 | {0, 0}, /* DC3 */ |
samux | 1:80ab0d068708 | 217 | {0, 0}, /* DC4 */ |
samux | 1:80ab0d068708 | 218 | {0, 0}, /* NAK */ |
samux | 1:80ab0d068708 | 219 | {0, 0}, /* SYN */ |
samux | 1:80ab0d068708 | 220 | {0, 0}, /* ETB */ |
samux | 1:80ab0d068708 | 221 | {0, 0}, /* CAN */ |
samux | 1:80ab0d068708 | 222 | {0, 0}, /* EM */ |
samux | 1:80ab0d068708 | 223 | {0, 0}, /* SUB */ |
samux | 1:80ab0d068708 | 224 | {0, 0}, /* ESC */ |
samux | 1:80ab0d068708 | 225 | {0, 0}, /* FS */ |
samux | 1:80ab0d068708 | 226 | {0, 0}, /* GS */ |
samux | 1:80ab0d068708 | 227 | {0, 0}, /* RS */ |
samux | 1:80ab0d068708 | 228 | {0, 0}, /* US */ |
samux | 1:80ab0d068708 | 229 | {0x2c, 0}, /* */ |
samux | 1:80ab0d068708 | 230 | {0x1e, KEY_SHIFT}, /* ! */ |
samux | 1:80ab0d068708 | 231 | {0x1f, KEY_SHIFT}, /* " */ |
samux | 1:80ab0d068708 | 232 | {0x32, 0}, /* # */ |
samux | 1:80ab0d068708 | 233 | {0x21, KEY_SHIFT}, /* $ */ |
samux | 1:80ab0d068708 | 234 | {0x22, KEY_SHIFT}, /* % */ |
samux | 1:80ab0d068708 | 235 | {0x24, KEY_SHIFT}, /* & */ |
samux | 1:80ab0d068708 | 236 | {0x34, 0}, /* ' */ |
samux | 1:80ab0d068708 | 237 | {0x26, KEY_SHIFT}, /* ( */ |
samux | 1:80ab0d068708 | 238 | {0x27, KEY_SHIFT}, /* ) */ |
samux | 1:80ab0d068708 | 239 | {0x25, KEY_SHIFT}, /* * */ |
samux | 1:80ab0d068708 | 240 | {0x2e, KEY_SHIFT}, /* + */ |
samux | 1:80ab0d068708 | 241 | {0x36, 0}, /* , */ |
samux | 1:80ab0d068708 | 242 | {0x2d, 0}, /* - */ |
samux | 1:80ab0d068708 | 243 | {0x37, 0}, /* . */ |
samux | 1:80ab0d068708 | 244 | {0x38, 0}, /* / */ |
samux | 1:80ab0d068708 | 245 | {0x27, 0}, /* 0 */ |
samux | 1:80ab0d068708 | 246 | {0x1e, 0}, /* 1 */ |
samux | 1:80ab0d068708 | 247 | {0x1f, 0}, /* 2 */ |
samux | 1:80ab0d068708 | 248 | {0x20, 0}, /* 3 */ |
samux | 1:80ab0d068708 | 249 | {0x21, 0}, /* 4 */ |
samux | 1:80ab0d068708 | 250 | {0x22, 0}, /* 5 */ |
samux | 1:80ab0d068708 | 251 | {0x23, 0}, /* 6 */ |
samux | 1:80ab0d068708 | 252 | {0x24, 0}, /* 7 */ |
samux | 1:80ab0d068708 | 253 | {0x25, 0}, /* 8 */ |
samux | 1:80ab0d068708 | 254 | {0x26, 0}, /* 9 */ |
samux | 1:80ab0d068708 | 255 | {0x33, KEY_SHIFT}, /* : */ |
samux | 1:80ab0d068708 | 256 | {0x33, 0}, /* ; */ |
samux | 1:80ab0d068708 | 257 | {0x36, KEY_SHIFT}, /* < */ |
samux | 1:80ab0d068708 | 258 | {0x2e, 0}, /* = */ |
samux | 1:80ab0d068708 | 259 | {0x37, KEY_SHIFT}, /* > */ |
samux | 1:80ab0d068708 | 260 | {0x38, KEY_SHIFT}, /* ? */ |
samux | 1:80ab0d068708 | 261 | {0x34, KEY_SHIFT}, /* @ */ |
samux | 1:80ab0d068708 | 262 | {0x04, KEY_SHIFT}, /* A */ |
samux | 1:80ab0d068708 | 263 | {0x05, KEY_SHIFT}, /* B */ |
samux | 1:80ab0d068708 | 264 | {0x06, KEY_SHIFT}, /* C */ |
samux | 1:80ab0d068708 | 265 | {0x07, KEY_SHIFT}, /* D */ |
samux | 1:80ab0d068708 | 266 | {0x08, KEY_SHIFT}, /* E */ |
samux | 1:80ab0d068708 | 267 | {0x09, KEY_SHIFT}, /* F */ |
samux | 1:80ab0d068708 | 268 | {0x0a, KEY_SHIFT}, /* G */ |
samux | 1:80ab0d068708 | 269 | {0x0b, KEY_SHIFT}, /* H */ |
samux | 1:80ab0d068708 | 270 | {0x0c, KEY_SHIFT}, /* I */ |
samux | 1:80ab0d068708 | 271 | {0x0d, KEY_SHIFT}, /* J */ |
samux | 1:80ab0d068708 | 272 | {0x0e, KEY_SHIFT}, /* K */ |
samux | 1:80ab0d068708 | 273 | {0x0f, KEY_SHIFT}, /* L */ |
samux | 1:80ab0d068708 | 274 | {0x10, KEY_SHIFT}, /* M */ |
samux | 1:80ab0d068708 | 275 | {0x11, KEY_SHIFT}, /* N */ |
samux | 1:80ab0d068708 | 276 | {0x12, KEY_SHIFT}, /* O */ |
samux | 1:80ab0d068708 | 277 | {0x13, KEY_SHIFT}, /* P */ |
samux | 1:80ab0d068708 | 278 | {0x14, KEY_SHIFT}, /* Q */ |
samux | 1:80ab0d068708 | 279 | {0x15, KEY_SHIFT}, /* R */ |
samux | 1:80ab0d068708 | 280 | {0x16, KEY_SHIFT}, /* S */ |
samux | 1:80ab0d068708 | 281 | {0x17, KEY_SHIFT}, /* T */ |
samux | 1:80ab0d068708 | 282 | {0x18, KEY_SHIFT}, /* U */ |
samux | 1:80ab0d068708 | 283 | {0x19, KEY_SHIFT}, /* V */ |
samux | 1:80ab0d068708 | 284 | {0x1a, KEY_SHIFT}, /* W */ |
samux | 1:80ab0d068708 | 285 | {0x1b, KEY_SHIFT}, /* X */ |
samux | 1:80ab0d068708 | 286 | {0x1c, KEY_SHIFT}, /* Y */ |
samux | 1:80ab0d068708 | 287 | {0x1d, KEY_SHIFT}, /* Z */ |
samux | 1:80ab0d068708 | 288 | {0x2f, 0}, /* [ */ |
samux | 1:80ab0d068708 | 289 | {0x64, 0}, /* \ */ |
samux | 1:80ab0d068708 | 290 | {0x30, 0}, /* ] */ |
samux | 1:80ab0d068708 | 291 | {0x23, KEY_SHIFT}, /* ^ */ |
samux | 1:80ab0d068708 | 292 | {0x2d, KEY_SHIFT}, /* _ */ |
samux | 1:80ab0d068708 | 293 | {0x35, 0}, /* ` */ |
samux | 1:80ab0d068708 | 294 | {0x04, 0}, /* a */ |
samux | 1:80ab0d068708 | 295 | {0x05, 0}, /* b */ |
samux | 1:80ab0d068708 | 296 | {0x06, 0}, /* c */ |
samux | 1:80ab0d068708 | 297 | {0x07, 0}, /* d */ |
samux | 1:80ab0d068708 | 298 | {0x08, 0}, /* e */ |
samux | 1:80ab0d068708 | 299 | {0x09, 0}, /* f */ |
samux | 1:80ab0d068708 | 300 | {0x0a, 0}, /* g */ |
samux | 1:80ab0d068708 | 301 | {0x0b, 0}, /* h */ |
samux | 1:80ab0d068708 | 302 | {0x0c, 0}, /* i */ |
samux | 1:80ab0d068708 | 303 | {0x0d, 0}, /* j */ |
samux | 1:80ab0d068708 | 304 | {0x0e, 0}, /* k */ |
samux | 1:80ab0d068708 | 305 | {0x0f, 0}, /* l */ |
samux | 1:80ab0d068708 | 306 | {0x10, 0}, /* m */ |
samux | 1:80ab0d068708 | 307 | {0x11, 0}, /* n */ |
samux | 1:80ab0d068708 | 308 | {0x12, 0}, /* o */ |
samux | 1:80ab0d068708 | 309 | {0x13, 0}, /* p */ |
samux | 1:80ab0d068708 | 310 | {0x14, 0}, /* q */ |
samux | 1:80ab0d068708 | 311 | {0x15, 0}, /* r */ |
samux | 1:80ab0d068708 | 312 | {0x16, 0}, /* s */ |
samux | 1:80ab0d068708 | 313 | {0x17, 0}, /* t */ |
samux | 1:80ab0d068708 | 314 | {0x18, 0}, /* u */ |
samux | 1:80ab0d068708 | 315 | {0x19, 0}, /* v */ |
samux | 1:80ab0d068708 | 316 | {0x1a, 0}, /* w */ |
samux | 1:80ab0d068708 | 317 | {0x1b, 0}, /* x */ |
samux | 1:80ab0d068708 | 318 | {0x1c, 0}, /* y */ |
samux | 1:80ab0d068708 | 319 | {0x1d, 0}, /* z */ |
samux | 1:80ab0d068708 | 320 | {0x2f, KEY_SHIFT}, /* { */ |
samux | 1:80ab0d068708 | 321 | {0x64, KEY_SHIFT}, /* | */ |
samux | 1:80ab0d068708 | 322 | {0x30, KEY_SHIFT}, /* } */ |
samux | 1:80ab0d068708 | 323 | {0x32, KEY_SHIFT}, /* ~ */ |
samux | 1:80ab0d068708 | 324 | {0,0}, /* DEL */ |
samux | 1:80ab0d068708 | 325 | |
samux | 1:80ab0d068708 | 326 | {0x3a, 0}, /* F1 */ |
samux | 1:80ab0d068708 | 327 | {0x3b, 0}, /* F2 */ |
samux | 1:80ab0d068708 | 328 | {0x3c, 0}, /* F3 */ |
samux | 1:80ab0d068708 | 329 | {0x3d, 0}, /* F4 */ |
samux | 1:80ab0d068708 | 330 | {0x3e, 0}, /* F5 */ |
samux | 1:80ab0d068708 | 331 | {0x3f, 0}, /* F6 */ |
samux | 1:80ab0d068708 | 332 | {0x40, 0}, /* F7 */ |
samux | 1:80ab0d068708 | 333 | {0x41, 0}, /* F8 */ |
samux | 1:80ab0d068708 | 334 | {0x42, 0}, /* F9 */ |
samux | 1:80ab0d068708 | 335 | {0x43, 0}, /* F10 */ |
samux | 1:80ab0d068708 | 336 | {0x44, 0}, /* F11 */ |
samux | 1:80ab0d068708 | 337 | {0x45, 0}, /* F12 */ |
samux | 1:80ab0d068708 | 338 | |
samux | 1:80ab0d068708 | 339 | {0x46, 0}, /* PRINT_SCREEN */ |
samux | 1:80ab0d068708 | 340 | {0x47, 0}, /* SCROLL_LOCK */ |
samux | 1:80ab0d068708 | 341 | {0x39, 0}, /* CAPS_LOCK */ |
samux | 1:80ab0d068708 | 342 | {0x53, 0}, /* NUM_LOCK */ |
samux | 1:80ab0d068708 | 343 | {0x49, 0}, /* INSERT */ |
samux | 1:80ab0d068708 | 344 | {0x4a, 0}, /* HOME */ |
samux | 1:80ab0d068708 | 345 | {0x4b, 0}, /* PAGE_UP */ |
samux | 1:80ab0d068708 | 346 | {0x4e, 0}, /* PAGE_DOWN */ |
samux | 1:80ab0d068708 | 347 | |
samux | 1:80ab0d068708 | 348 | {0x4f, 0}, /* RIGHT_ARROW */ |
samux | 1:80ab0d068708 | 349 | {0x50, 0}, /* LEFT_ARROW */ |
samux | 1:80ab0d068708 | 350 | {0x51, 0}, /* DOWN_ARROW */ |
samux | 1:80ab0d068708 | 351 | {0x52, 0}, /* UP_ARROW */ |
samux | 1:80ab0d068708 | 352 | }; |
samux | 1:80ab0d068708 | 353 | #endif |
samux | 1:80ab0d068708 | 354 | |
samux | 1:80ab0d068708 | 355 | uint8_t * USBKeyboard::reportDesc() { |
samux | 1:80ab0d068708 | 356 | static uint8_t reportDescriptor[] = { |
samux | 1:80ab0d068708 | 357 | USAGE_PAGE(1), 0x01, // Generic Desktop |
samux | 1:80ab0d068708 | 358 | USAGE(1), 0x06, // Keyboard |
samux | 1:80ab0d068708 | 359 | COLLECTION(1), 0x01, // Application |
samux | 1:80ab0d068708 | 360 | REPORT_ID(1), REPORT_ID_KEYBOARD, |
samux | 1:80ab0d068708 | 361 | |
samux | 1:80ab0d068708 | 362 | USAGE_PAGE(1), 0x07, // Key Codes |
samux | 1:80ab0d068708 | 363 | USAGE_MINIMUM(1), 0xE0, |
samux | 1:80ab0d068708 | 364 | USAGE_MAXIMUM(1), 0xE7, |
samux | 1:80ab0d068708 | 365 | LOGICAL_MINIMUM(1), 0x00, |
samux | 1:80ab0d068708 | 366 | LOGICAL_MAXIMUM(1), 0x01, |
samux | 1:80ab0d068708 | 367 | REPORT_SIZE(1), 0x01, |
samux | 1:80ab0d068708 | 368 | REPORT_COUNT(1), 0x08, |
samux | 1:80ab0d068708 | 369 | INPUT(1), 0x02, // Data, Variable, Absolute |
samux | 1:80ab0d068708 | 370 | REPORT_COUNT(1), 0x01, |
samux | 1:80ab0d068708 | 371 | REPORT_SIZE(1), 0x08, |
samux | 1:80ab0d068708 | 372 | INPUT(1), 0x01, // Constant |
samux | 1:80ab0d068708 | 373 | |
samux | 1:80ab0d068708 | 374 | |
samux | 1:80ab0d068708 | 375 | REPORT_COUNT(1), 0x05, |
samux | 1:80ab0d068708 | 376 | REPORT_SIZE(1), 0x01, |
samux | 1:80ab0d068708 | 377 | USAGE_PAGE(1), 0x08, // LEDs |
samux | 1:80ab0d068708 | 378 | USAGE_MINIMUM(1), 0x01, |
samux | 1:80ab0d068708 | 379 | USAGE_MAXIMUM(1), 0x05, |
samux | 1:80ab0d068708 | 380 | OUTPUT(1), 0x02, // Data, Variable, Absolute |
samux | 1:80ab0d068708 | 381 | REPORT_COUNT(1), 0x01, |
samux | 1:80ab0d068708 | 382 | REPORT_SIZE(1), 0x03, |
samux | 1:80ab0d068708 | 383 | OUTPUT(1), 0x01, // Constant |
samux | 1:80ab0d068708 | 384 | |
samux | 1:80ab0d068708 | 385 | |
samux | 1:80ab0d068708 | 386 | REPORT_COUNT(1), 0x06, |
samux | 1:80ab0d068708 | 387 | REPORT_SIZE(1), 0x08, |
samux | 1:80ab0d068708 | 388 | LOGICAL_MINIMUM(1), 0x00, |
samux | 1:80ab0d068708 | 389 | LOGICAL_MAXIMUM(1), 0x65, |
samux | 1:80ab0d068708 | 390 | USAGE_PAGE(1), 0x07, // Key Codes |
samux | 1:80ab0d068708 | 391 | USAGE_MINIMUM(1), 0x00, |
samux | 1:80ab0d068708 | 392 | USAGE_MAXIMUM(1), 0x65, |
samux | 1:80ab0d068708 | 393 | INPUT(1), 0x00, // Data, Array |
samux | 1:80ab0d068708 | 394 | END_COLLECTION(0), |
samux | 1:80ab0d068708 | 395 | |
samux | 1:80ab0d068708 | 396 | // Media Control |
samux | 1:80ab0d068708 | 397 | USAGE_PAGE(1), 0x0C, |
samux | 1:80ab0d068708 | 398 | USAGE(1), 0x01, |
samux | 1:80ab0d068708 | 399 | COLLECTION(1), 0x01, |
samux | 1:80ab0d068708 | 400 | REPORT_ID(1), REPORT_ID_VOLUME, |
samux | 1:80ab0d068708 | 401 | USAGE_PAGE(1), 0x0C, |
samux | 1:80ab0d068708 | 402 | LOGICAL_MINIMUM(1), 0x00, |
samux | 1:80ab0d068708 | 403 | LOGICAL_MAXIMUM(1), 0x01, |
samux | 1:80ab0d068708 | 404 | REPORT_SIZE(1), 0x01, |
samux | 1:80ab0d068708 | 405 | REPORT_COUNT(1), 0x07, |
samux | 1:80ab0d068708 | 406 | USAGE(1), 0xB5, // Next Track |
samux | 1:80ab0d068708 | 407 | USAGE(1), 0xB6, // Previous Track |
samux | 1:80ab0d068708 | 408 | USAGE(1), 0xB7, // Stop |
samux | 1:80ab0d068708 | 409 | USAGE(1), 0xCD, // Play / Pause |
samux | 1:80ab0d068708 | 410 | USAGE(1), 0xE2, // Mute |
samux | 1:80ab0d068708 | 411 | USAGE(1), 0xE9, // Volume Up |
samux | 1:80ab0d068708 | 412 | USAGE(1), 0xEA, // Volume Down |
samux | 1:80ab0d068708 | 413 | INPUT(1), 0x02, // Input (Data, Variable, Absolute) |
samux | 1:80ab0d068708 | 414 | REPORT_COUNT(1), 0x01, |
samux | 1:80ab0d068708 | 415 | INPUT(1), 0x01, |
samux | 1:80ab0d068708 | 416 | END_COLLECTION(0), |
samux | 1:80ab0d068708 | 417 | }; |
samux | 1:80ab0d068708 | 418 | reportLength = sizeof(reportDescriptor); |
samux | 1:80ab0d068708 | 419 | return reportDescriptor; |
samux | 1:80ab0d068708 | 420 | } |
samux | 1:80ab0d068708 | 421 | |
samux | 1:80ab0d068708 | 422 | |
samux | 1:80ab0d068708 | 423 | bool USBKeyboard::EP1_OUT_callback() { |
samux | 1:80ab0d068708 | 424 | uint32_t bytesRead = 0; |
samux | 1:80ab0d068708 | 425 | uint8_t led[65]; |
samux | 1:80ab0d068708 | 426 | USBDevice::readEP(EPINT_OUT, led, &bytesRead, MAX_HID_REPORT_SIZE); |
samux | 1:80ab0d068708 | 427 | |
samux | 1:80ab0d068708 | 428 | // we take led[1] because led[0] is the report ID |
samux | 1:80ab0d068708 | 429 | lock_status = led[1] & 0x07; |
samux | 1:80ab0d068708 | 430 | |
samux | 1:80ab0d068708 | 431 | // We activate the endpoint to be able to recceive data |
samux | 1:80ab0d068708 | 432 | if (!readStart(EPINT_OUT, MAX_HID_REPORT_SIZE)) |
samux | 1:80ab0d068708 | 433 | return false; |
samux | 1:80ab0d068708 | 434 | return true; |
samux | 1:80ab0d068708 | 435 | } |
samux | 1:80ab0d068708 | 436 | |
samux | 1:80ab0d068708 | 437 | uint8_t USBKeyboard::lockStatus() { |
samux | 1:80ab0d068708 | 438 | return lock_status; |
samux | 1:80ab0d068708 | 439 | } |
samux | 1:80ab0d068708 | 440 | |
samux | 1:80ab0d068708 | 441 | int USBKeyboard::_putc(int c) { |
samux | 1:80ab0d068708 | 442 | return keyCode(c, keymap[c].modifier); |
samux | 1:80ab0d068708 | 443 | } |
samux | 1:80ab0d068708 | 444 | |
samux | 1:80ab0d068708 | 445 | bool USBKeyboard::keyCode(uint8_t key, uint8_t modifier) { |
samux | 1:80ab0d068708 | 446 | // Send a simulated keyboard keypress. Returns true if successful. |
samux | 1:80ab0d068708 | 447 | HID_REPORT report; |
samux | 1:80ab0d068708 | 448 | |
samux | 1:80ab0d068708 | 449 | report.data[0] = REPORT_ID_KEYBOARD; |
samux | 1:80ab0d068708 | 450 | report.data[1] = modifier; |
samux | 1:80ab0d068708 | 451 | report.data[2] = 0; |
samux | 1:80ab0d068708 | 452 | report.data[3] = keymap[key].usage; |
samux | 1:80ab0d068708 | 453 | report.data[4] = 0; |
samux | 1:80ab0d068708 | 454 | report.data[5] = 0; |
samux | 1:80ab0d068708 | 455 | report.data[6] = 0; |
samux | 1:80ab0d068708 | 456 | report.data[7] = 0; |
samux | 1:80ab0d068708 | 457 | report.data[8] = 0; |
samux | 1:80ab0d068708 | 458 | |
samux | 1:80ab0d068708 | 459 | report.length = 9; |
samux | 1:80ab0d068708 | 460 | |
samux | 1:80ab0d068708 | 461 | if (!send(&report)) { |
samux | 1:80ab0d068708 | 462 | return false; |
samux | 1:80ab0d068708 | 463 | } |
samux | 1:80ab0d068708 | 464 | |
samux | 1:80ab0d068708 | 465 | report.data[1] = 0; |
samux | 1:80ab0d068708 | 466 | report.data[3] = 0; |
samux | 1:80ab0d068708 | 467 | |
samux | 1:80ab0d068708 | 468 | if (!send(&report)) { |
samux | 1:80ab0d068708 | 469 | return false; |
samux | 1:80ab0d068708 | 470 | } |
samux | 1:80ab0d068708 | 471 | |
samux | 1:80ab0d068708 | 472 | return true; |
samux | 1:80ab0d068708 | 473 | |
samux | 1:80ab0d068708 | 474 | } |
samux | 1:80ab0d068708 | 475 | |
samux | 1:80ab0d068708 | 476 | |
samux | 1:80ab0d068708 | 477 | bool USBKeyboard::mediaControl(MEDIA_KEY key) { |
samux | 1:80ab0d068708 | 478 | HID_REPORT report; |
samux | 1:80ab0d068708 | 479 | |
samux | 1:80ab0d068708 | 480 | report.data[0] = REPORT_ID_VOLUME; |
samux | 1:80ab0d068708 | 481 | report.data[1] = (1 << key) & 0x7f; |
samux | 1:80ab0d068708 | 482 | |
samux | 1:80ab0d068708 | 483 | report.length = 2; |
samux | 1:80ab0d068708 | 484 | |
samux | 1:80ab0d068708 | 485 | if (!send(&report)) { |
samux | 1:80ab0d068708 | 486 | return false; |
samux | 1:80ab0d068708 | 487 | } |
samux | 1:80ab0d068708 | 488 | |
samux | 1:80ab0d068708 | 489 | report.data[0] = REPORT_ID_VOLUME; |
samux | 1:80ab0d068708 | 490 | report.data[1] = 0; |
samux | 1:80ab0d068708 | 491 | |
samux | 1:80ab0d068708 | 492 | report.length = 2; |
samux | 1:80ab0d068708 | 493 | |
samux | 1:80ab0d068708 | 494 | return send(&report); |
samux | 1:80ab0d068708 | 495 | } |
samux | 1:80ab0d068708 | 496 | |
samux | 1:80ab0d068708 | 497 | |
samux | 1:80ab0d068708 | 498 | #define DEFAULT_CONFIGURATION (1) |
samux | 1:80ab0d068708 | 499 | #define TOTAL_DESCRIPTOR_LENGTH ((1 * CONFIGURATION_DESCRIPTOR_LENGTH) \ |
samux | 1:80ab0d068708 | 500 | + (1 * INTERFACE_DESCRIPTOR_LENGTH) \ |
samux | 1:80ab0d068708 | 501 | + (1 * HID_DESCRIPTOR_LENGTH) \ |
samux | 1:80ab0d068708 | 502 | + (2 * ENDPOINT_DESCRIPTOR_LENGTH)) |
samux | 1:80ab0d068708 | 503 | |
samux | 1:80ab0d068708 | 504 | uint8_t * USBKeyboard::configurationDesc() { |
samux | 1:80ab0d068708 | 505 | static uint8_t configurationDescriptor[] = { |
samux | 1:80ab0d068708 | 506 | CONFIGURATION_DESCRIPTOR_LENGTH,// bLength |
samux | 1:80ab0d068708 | 507 | CONFIGURATION_DESCRIPTOR, // bDescriptorType |
samux | 1:80ab0d068708 | 508 | LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB) |
samux | 1:80ab0d068708 | 509 | MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB) |
samux | 1:80ab0d068708 | 510 | 0x01, // bNumInterfaces |
samux | 1:80ab0d068708 | 511 | DEFAULT_CONFIGURATION, // bConfigurationValue |
samux | 1:80ab0d068708 | 512 | 0x00, // iConfiguration |
samux | 1:80ab0d068708 | 513 | C_RESERVED | C_SELF_POWERED, // bmAttributes |
samux | 1:80ab0d068708 | 514 | C_POWER(0), // bMaxPowerHello World from Mbed |
samux | 1:80ab0d068708 | 515 | |
samux | 1:80ab0d068708 | 516 | INTERFACE_DESCRIPTOR_LENGTH, // bLength |
samux | 1:80ab0d068708 | 517 | INTERFACE_DESCRIPTOR, // bDescriptorType |
samux | 1:80ab0d068708 | 518 | 0x00, // bInterfaceNumber |
samux | 1:80ab0d068708 | 519 | 0x00, // bAlternateSetting |
samux | 1:80ab0d068708 | 520 | 0x02, // bNumEndpoints |
samux | 1:80ab0d068708 | 521 | HID_CLASS, // bInterfaceClass |
samux | 1:80ab0d068708 | 522 | 1, // bInterfaceSubClass |
samux | 1:80ab0d068708 | 523 | 1, // bInterfaceProtocol (keyboard) |
samux | 1:80ab0d068708 | 524 | 0x00, // iInterface |
samux | 1:80ab0d068708 | 525 | |
samux | 1:80ab0d068708 | 526 | HID_DESCRIPTOR_LENGTH, // bLength |
samux | 1:80ab0d068708 | 527 | HID_DESCRIPTOR, // bDescriptorType |
samux | 1:80ab0d068708 | 528 | LSB(HID_VERSION_1_11), // bcdHID (LSB) |
samux | 1:80ab0d068708 | 529 | MSB(HID_VERSION_1_11), // bcdHID (MSB) |
samux | 1:80ab0d068708 | 530 | 0x00, // bCountryCode |
samux | 1:80ab0d068708 | 531 | 0x01, // bNumDescriptors |
samux | 1:80ab0d068708 | 532 | REPORT_DESCRIPTOR, // bDescriptorType |
samux | 1:80ab0d068708 | 533 | LSB(reportDescLength()), // wDescriptorLength (LSB) |
samux | 1:80ab0d068708 | 534 | MSB(reportDescLength()), // wDescriptorLength (MSB) |
samux | 1:80ab0d068708 | 535 | |
samux | 1:80ab0d068708 | 536 | ENDPOINT_DESCRIPTOR_LENGTH, // bLength |
samux | 1:80ab0d068708 | 537 | ENDPOINT_DESCRIPTOR, // bDescriptorType |
samux | 1:80ab0d068708 | 538 | PHY_TO_DESC(EPINT_IN), // bEndpointAddress |
samux | 1:80ab0d068708 | 539 | E_INTERRUPT, // bmAttributes |
samux | 1:80ab0d068708 | 540 | LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB) |
samux | 1:80ab0d068708 | 541 | MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB) |
samux | 1:80ab0d068708 | 542 | 1, // bInterval (milliseconds) |
samux | 1:80ab0d068708 | 543 | |
samux | 1:80ab0d068708 | 544 | ENDPOINT_DESCRIPTOR_LENGTH, // bLength |
samux | 1:80ab0d068708 | 545 | ENDPOINT_DESCRIPTOR, // bDescriptorType |
samux | 1:80ab0d068708 | 546 | PHY_TO_DESC(EPINT_OUT), // bEndpointAddress |
samux | 1:80ab0d068708 | 547 | E_INTERRUPT, // bmAttributes |
samux | 1:80ab0d068708 | 548 | LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB) |
samux | 1:80ab0d068708 | 549 | MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB) |
samux | 1:80ab0d068708 | 550 | 1, // bInterval (milliseconds) |
samux | 1:80ab0d068708 | 551 | }; |
samux | 1:80ab0d068708 | 552 | return configurationDescriptor; |
samux | 1:80ab0d068708 | 553 | } |