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