1 /* Teensyduino Core Library
2 * http://www.pjrc.com/teensy/
3 * Copyright (c) 2013 PJRC.COM, LLC.
4 * Modified by Jacob Alexander (2013-2014)
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * 1. The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * 2. If the Software is incorporated into a build system that allows
18 * selection among a list of target devices, then similar target
19 * devices manufactured by PJRC.COM must be included in the list of
20 * target devices and selectable in the same manner.
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 // ----- Includes -----
41 #define LSB(n) ((n) & 255)
42 #define MSB(n) (((n) >> 8) & 255)
46 // ----- USB Device Descriptor -----
48 // USB Device Descriptor. The USB host reads this first, to learn
49 // what type of device is connected.
50 static uint8_t device_descriptor[] = {
54 DEVICE_CLASS, // bDeviceClass
55 DEVICE_SUBCLASS, // bDeviceSubClass
56 DEVICE_PROTOCOL, // bDeviceProtocol
57 EP0_SIZE, // bMaxPacketSize0
58 LSB(VENDOR_ID), MSB(VENDOR_ID), // idVendor
59 LSB(PRODUCT_ID), MSB(PRODUCT_ID), // idProduct
60 0x00, 0x01, // bcdDevice
64 1 // bNumConfigurations
67 // USB Device Qualifier Descriptor
68 static uint8_t device_qualifier_descriptor[] = {
69 0 // Indicate only single speed
70 /* Device qualifier example (used for specifying multiple USB speeds)
74 DEVICE_CLASS, // bDeviceClass
75 DEVICE_SUBCLASS, // bDeviceSubClass
76 DEVICE_PROTOCOL, // bDeviceProtocol
77 EP0_SIZE, // bMaxPacketSize0
78 0, // bNumOtherSpeedConfigurations
83 // USB Debug Descriptor
84 // XXX Not sure of exact use, lsusb requests it
85 static uint8_t usb_debug_descriptor[] = {
90 // These descriptors must NOT be "const", because the USB DMA
91 // has trouble accessing flash memory with enough bandwidth
92 // while the processor is executing from flash.
97 // ----- USB HID Report Descriptsors -----
99 // Each HID interface needs a special report descriptor that tells
100 // the meaning and format of the data.
102 // Keyboard Protocol 1, HID 1.11 spec, Appendix B, page 59-60
103 static uint8_t keyboard_report_desc[] = {
104 // Keyboard Collection
105 0x05, 0x01, // Usage Page (Generic Desktop),
106 0x09, 0x06, // Usage (Keyboard),
107 0xA1, 0x01, // Collection (Application) - Keyboard,
110 0x75, 0x01, // Report Size (1),
111 0x95, 0x08, // Report Count (8),
112 0x05, 0x07, // Usage Page (Key Codes),
113 0x19, 0xE0, // Usage Minimum (224),
114 0x29, 0xE7, // Usage Maximum (231),
115 0x15, 0x00, // Logical Minimum (0),
116 0x25, 0x01, // Logical Maximum (1),
117 0x81, 0x02, // Input (Data, Variable, Absolute),
120 0x75, 0x08, // Report Size (8),
121 0x95, 0x01, // Report Count (1),
122 0x81, 0x03, // Output (Constant),
125 0x75, 0x01, // Report Size (1),
126 0x95, 0x05, // Report Count (5),
127 0x05, 0x08, // Usage Page (LEDs),
128 0x19, 0x01, // Usage Minimum (1),
129 0x29, 0x05, // Usage Maximum (5),
130 0x91, 0x02, // Output (Data, Variable, Absolute),
132 // LED Report Padding
133 0x75, 0x03, // Report Size (3),
134 0x95, 0x01, // Report Count (1),
135 0x91, 0x03, // Output (Constant),
138 0x75, 0x08, // Report Size (8),
139 0x95, 0x06, // Report Count (6),
140 0x15, 0x00, // Logical Minimum (0),
141 0x25, 0x7F, // Logical Maximum(104),
142 0x05, 0x07, // Usage Page (Key Codes),
143 0x19, 0x00, // Usage Minimum (0),
144 0x29, 0x7F, // Usage Maximum (104),
145 0x81, 0x00, // Input (Data, Array),
146 0xc0, // End Collection - Keyboard
149 // Keyboard Protocol 1, HID 1.11 spec, Appendix B, page 59-60
150 static uint8_t nkro_keyboard_report_desc[] = {
151 // Keyboard Collection
152 0x05, 0x01, // Usage Page (Generic Desktop),
153 0x09, 0x06, // Usage (Keyboard),
154 0xA1, 0x01, // Collection (Application) - Keyboard,
157 0x85, 0x01, // Report ID (1),
158 0x75, 0x01, // Report Size (1),
159 0x95, 0x05, // Report Count (5),
160 0x05, 0x08, // Usage Page (LEDs),
161 0x19, 0x01, // Usage Minimum (1),
162 0x29, 0x05, // Usage Maximum (5),
163 0x91, 0x02, // Output (Data, Variable, Absolute),
165 // LED Report Padding
166 0x75, 0x03, // Report Size (3),
167 0x95, 0x01, // Report Count (1),
168 0x91, 0x03, // Output (Constant),
170 // Normal Keys - Using an NKRO Bitmap
173 // Supports all keys defined by the spec, except 1-3 which define error events
174 // and 0 which is "no keys pressed"
175 // See http://www.usb.org/developers/hidpage/Hut1_12v2.pdf Chapter 10
176 // Or Macros/PartialMap/usb_hid.h
178 // 50 (ISO \ due to \ bug) and 156 (Clear due to Delete bug) must be excluded
179 // due to a Linux bug with bitmaps (not useful anyways)
180 // 165-175 are reserved/unused as well as 222-223 and 232-65535
182 // Compatibility Notes:
183 // - Using a second endpoint for a boot mode device helps with compatibility
184 // - DO NOT use Padding in the descriptor for bitfields
185 // (Mac OSX silently fails... Windows/Linux work correctly)
186 // - DO NOT use Report IDs, Windows 8.1 will not update keyboard correctly (modifiers disappear)
187 // (all other OSs, including OSX work fine...)
188 // (you can use them *iff* you only have 1 per collection)
189 // - Mac OSX and Windows 8.1 are extremely picky about padding
191 // Packing of bitmaps are as follows:
192 // 4-49 : 6 bytes (0x04-0x31) ( 46 bits + 2 padding bits for 6 bytes total)
193 // 51-155 : 14 bytes (0x33-0x9B) (105 bits + 6 padding bits for 15 bytes total)
194 // 157-164 : 1 byte (0x9D-0xA4) ( 8 bits)
195 // 176-221 : 6 bytes (0xB0-0xDD) ( 46 bits + 2 padding bits for 6 bytes total)
196 // 224-231 : 1 byte (0xE0-0xE7) ( 8 bits)
199 0x75, 0x01, // Report Size (1),
200 0x95, 0x08, // Report Count (8),
201 0x15, 0x00, // Logical Minimum (0),
202 0x25, 0x01, // Logical Maximum (1),
203 0x05, 0x07, // Usage Page (Key Codes),
204 0x19, 0xE0, // Usage Minimum (224),
205 0x29, 0xE7, // Usage Maximum (231),
206 0x81, 0x02, // Input (Data, Variable, Absolute),
208 // 4-49 (6 bytes/46 bits) - MainKeys
209 0x75, 0x01, // Report Size (1),
210 0x95, 0x2E, // Report Count (46),
211 0x15, 0x00, // Logical Minimum (0),
212 0x25, 0x01, // Logical Maximum (1),
213 0x05, 0x07, // Usage Page (Key Codes),
214 0x19, 0x04, // Usage Minimum (4),
215 0x29, 0x31, // Usage Maximum (49),
216 0x81, 0x02, // Input (Data, Variable, Absolute, Bitfield),
219 0x75, 0x02, // Report Size (2),
220 0x95, 0x01, // Report Count (1),
221 0x81, 0x03, // Input (Constant),
223 // 51-155 (14 bytes/105 bits) - SecondaryKeys
224 0x75, 0x01, // Report Size (1),
225 0x95, 0x69, // Report Count (105),
226 0x15, 0x00, // Logical Minimum (0),
227 0x25, 0x01, // Logical Maximum (1),
228 0x05, 0x07, // Usage Page (Key Codes),
229 0x19, 0x33, // Usage Minimum (51),
230 0x29, 0x9B, // Usage Maximum (155),
231 0x81, 0x02, // Input (Data, Variable, Absolute, Bitfield),
234 0x75, 0x07, // Report Size (7),
235 0x95, 0x01, // Report Count (1),
236 0x81, 0x03, // Input (Constant),
238 // 157-164 (1 byte/8 bits) - TertiaryKeys
239 0x75, 0x01, // Report Size (1),
240 0x95, 0x08, // Report Count (8),
241 0x15, 0x00, // Logical Minimum (0),
242 0x25, 0x01, // Logical Maximum (1),
243 0x05, 0x07, // Usage Page (Key Codes),
244 0x19, 0x9D, // Usage Minimum (157),
245 0x29, 0xA4, // Usage Maximum (164),
246 0x81, 0x02, // Input (Data, Variable, Absolute, Bitfield),
248 // 176-221 (6 bytes/46 bits) - QuartiaryKeys
249 0x75, 0x01, // Report Size (1),
250 0x95, 0x2E, // Report Count (46),
251 0x15, 0x00, // Logical Minimum (0),
252 0x25, 0x01, // Logical Maximum (1),
253 0x05, 0x07, // Usage Page (Key Codes),
254 0x19, 0xB0, // Usage Minimum (176),
255 0x29, 0xDD, // Usage Maximum (221),
256 0x81, 0x02, // Input (Data, Variable, Absolute, Bitfield),
259 0x75, 0x02, // Report Size (2),
260 0x95, 0x01, // Report Count (1),
261 0x81, 0x03, // Input (Constant),
262 0xc0, // End Collection - Keyboard
264 // System Control Collection
267 // Not bothering with NKRO for this table. If there's need, I can implement it. -HaaTa
268 // Using a 1KRO scheme
269 0x05, 0x01, // Usage Page (Generic Desktop),
270 0x09, 0x80, // Usage (System Control),
271 0xA1, 0x01, // Collection (Application),
272 0x85, 0x02, // Report ID (2),
273 0x75, 0x08, // Report Size (8),
274 0x95, 0x01, // Report Count (1),
275 0x16, 0x81, 0x00, // Logical Minimum (129),
276 0x26, 0xB7, 0x00, // Logical Maximum (183),
277 0x19, 0x81, // Usage Minimum (129),
278 0x29, 0xB7, // Usage Maximum (183),
279 0x81, 0x00, // Input (Data, Array),
280 0xc0, // End Collection - System Control
282 // Consumer Control Collection - Media Keys
285 // Not bothering with NKRO for this table. If there's a need, I can implement it. -HaaTa
286 // Using a 1KRO scheme
287 0x05, 0x0c, // Usage Page (Consumer),
288 0x09, 0x01, // Usage (Consumer Control),
289 0xA1, 0x01, // Collection (Application),
290 0x85, 0x03, // Report ID (3),
291 0x75, 0x10, // Report Size (16),
292 0x95, 0x01, // Report Count (1),
293 0x16, 0x20, 0x00, // Logical Minimum (32),
294 0x26, 0x9C, 0x02, // Logical Maximum (668),
295 0x05, 0x0C, // Usage Page (Consumer),
296 0x19, 0x20, // Usage Minimum (32),
297 0x2A, 0x9C, 0x02, // Usage Maximum (668),
298 0x81, 0x00, // Input (Data, Array),
299 0xc0, // End Collection - Consumer Control
303 // Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension
304 static uint8_t mouse_report_desc[] = {
305 0x05, 0x01, // Usage Page (Generic Desktop)
306 0x09, 0x02, // Usage (Mouse)
307 0xA1, 0x01, // Collection (Application)
308 0x05, 0x09, // Usage Page (Button)
309 0x19, 0x01, // Usage Minimum (Button #1)
310 0x29, 0x03, // Usage Maximum (Button #3)
311 0x15, 0x00, // Logical Minimum (0)
312 0x25, 0x01, // Logical Maximum (1)
313 0x95, 0x03, // Report Count (3)
314 0x75, 0x01, // Report Size (1)
315 0x81, 0x02, // Input (Data, Variable, Absolute)
316 0x95, 0x01, // Report Count (1)
317 0x75, 0x05, // Report Size (5)
318 0x81, 0x03, // Input (Constant)
319 0x05, 0x01, // Usage Page (Generic Desktop)
320 0x09, 0x30, // Usage (X)
321 0x09, 0x31, // Usage (Y)
322 0x15, 0x00, // Logical Minimum (0)
323 0x26, 0xFF, 0x7F, // Logical Maximum (32767)
324 0x75, 0x10, // Report Size (16),
325 0x95, 0x02, // Report Count (2),
326 0x81, 0x02, // Input (Data, Variable, Absolute)
327 0x09, 0x38, // Usage (Wheel)
328 0x15, 0x81, // Logical Minimum (-127)
329 0x25, 0x7F, // Logical Maximum (127)
330 0x75, 0x08, // Report Size (8),
331 0x95, 0x01, // Report Count (1),
332 0x81, 0x06, // Input (Data, Variable, Relative)
333 0xC0 // End Collection
339 // ----- USB Configuration -----
341 // USB Configuration Descriptor. This huge descriptor tells all
342 // of the devices capbilities.
343 static uint8_t config_descriptor[CONFIG_DESC_SIZE] = {
344 // --- Configuration ---
346 // configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10
348 2, // bDescriptorType;
349 LSB(CONFIG_DESC_SIZE), // wTotalLength
350 MSB(CONFIG_DESC_SIZE),
351 NUM_INTERFACE, // bNumInterfaces
352 1, // bConfigurationValue
354 0xA0, // bmAttributes
357 // --- Keyboard HID --- Boot Mode Keyboard Interface
359 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
361 4, // bDescriptorType
362 KEYBOARD_INTERFACE, // bInterfaceNumber
363 0, // bAlternateSetting
365 0x03, // bInterfaceClass (0x03 = HID)
366 0x01, // bInterfaceSubClass (0x00 = Non-Boot, 0x01 = Boot)
367 0x01, // bInterfaceProtocol (0x01 = Keyboard)
370 // HID interface descriptor, HID 1.11 spec, section 6.2.1
372 0x21, // bDescriptorType
373 0x11, 0x01, // bcdHID
375 1, // bNumDescriptors
376 0x22, // bDescriptorType
377 LSB(sizeof(keyboard_report_desc)), // wDescriptorLength
378 MSB(sizeof(keyboard_report_desc)),
380 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
382 5, // bDescriptorType
383 KEYBOARD_ENDPOINT | 0x80, // bEndpointAddress
384 0x03, // bmAttributes (0x03=intr)
385 KEYBOARD_SIZE, 0, // wMaxPacketSize
386 KEYBOARD_INTERVAL, // bInterval
388 // --- NKRO Keyboard HID --- OS Mode Keyboard Interface
390 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
392 4, // bDescriptorType
393 NKRO_KEYBOARD_INTERFACE, // bInterfaceNumber
394 0, // bAlternateSetting
396 0x03, // bInterfaceClass (0x03 = HID)
397 0x00, // bInterfaceSubClass (0x00 = Non-Boot, 0x01 = Boot)
398 0x01, // bInterfaceProtocol (0x01 = Keyboard)
401 // HID interface descriptor, HID 1.11 spec, section 6.2.1
403 0x21, // bDescriptorType
404 0x11, 0x01, // bcdHID
406 1, // bNumDescriptors
407 0x22, // bDescriptorType
408 LSB(sizeof(nkro_keyboard_report_desc)), // wDescriptorLength
409 MSB(sizeof(nkro_keyboard_report_desc)),
411 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
413 5, // bDescriptorType
414 NKRO_KEYBOARD_ENDPOINT | 0x80, // bEndpointAddress
415 0x03, // bmAttributes (0x03=intr)
416 NKRO_KEYBOARD_SIZE, 0, // wMaxPacketSize
417 NKRO_KEYBOARD_INTERVAL, // bInterval
419 // --- Serial CDC --- CDC IAD Descriptor
421 // interface association descriptor, USB ECN, Table 9-Z
423 11, // bDescriptorType
424 CDC_STATUS_INTERFACE, // bFirstInterface
425 2, // bInterfaceCount
426 0x02, // bFunctionClass
427 0x02, // bFunctionSubClass
428 0x01, // bFunctionProtocol
431 // --- Serial CDC --- CDC Data Interface
433 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
435 4, // bDescriptorType
436 CDC_STATUS_INTERFACE, // bInterfaceNumber
437 0, // bAlternateSetting
439 0x02, // bInterfaceClass
440 0x02, // bInterfaceSubClass
441 0x01, // bInterfaceProtocol
444 // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
445 5, // bFunctionLength
446 0x24, // bDescriptorType
447 0x00, // bDescriptorSubtype
448 0x10, 0x01, // bcdCDC
450 // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
451 5, // bFunctionLength
452 0x24, // bDescriptorType
453 0x01, // bDescriptorSubtype
454 0x01, // bmCapabilities
455 CDC_DATA_INTERFACE, // bDataInterface
457 // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
458 4, // bFunctionLength
459 0x24, // bDescriptorType
460 0x02, // bDescriptorSubtype
461 0x06, // bmCapabilities
463 // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
464 5, // bFunctionLength
465 0x24, // bDescriptorType
466 0x06, // bDescriptorSubtype
467 CDC_STATUS_INTERFACE, // bMasterInterface
468 CDC_DATA_INTERFACE, // bSlaveInterface0
470 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
472 5, // bDescriptorType
473 CDC_ACM_ENDPOINT | 0x80, // bEndpointAddress
474 0x03, // bmAttributes (0x03=intr)
475 CDC_ACM_SIZE, 0, // wMaxPacketSize
478 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
480 4, // bDescriptorType
481 CDC_DATA_INTERFACE, // bInterfaceNumber
482 0, // bAlternateSetting
484 0x0A, // bInterfaceClass
485 0x00, // bInterfaceSubClass
486 0x00, // bInterfaceProtocol
489 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
491 5, // bDescriptorType
492 CDC_RX_ENDPOINT, // bEndpointAddress
493 0x02, // bmAttributes (0x02=bulk)
494 CDC_RX_SIZE, 0, // wMaxPacketSize
497 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
499 5, // bDescriptorType
500 CDC_TX_ENDPOINT | 0x80, // bEndpointAddress
501 0x02, // bmAttributes (0x02=bulk)
502 CDC_TX_SIZE, 0, // wMaxPacketSize
508 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
510 4, // bDescriptorType
511 MOUSE_INTERFACE, // bInterfaceNumber
512 0, // bAlternateSetting
514 0x03, // bInterfaceClass (0x03 = HID)
515 0x00, // bInterfaceSubClass (0x01 = Boot)
516 0x00, // bInterfaceProtocol (0x02 = Mouse)
519 // HID interface descriptor, HID 1.11 spec, section 6.2.1
521 0x21, // bDescriptorType
522 0x11, 0x01, // bcdHID
524 1, // bNumDescriptors
525 0x22, // bDescriptorType
526 LSB(sizeof(mouse_report_desc)), // wDescriptorLength
527 MSB(sizeof(mouse_report_desc)),
529 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
531 5, // bDescriptorType
532 MOUSE_ENDPOINT | 0x80, // bEndpointAddress
533 0x03, // bmAttributes (0x03=intr)
534 MOUSE_SIZE, 0, // wMaxPacketSize
535 MOUSE_INTERVAL, // bInterval
536 #endif // MOUSE_INTERFACE
542 // ----- String Descriptors -----
544 // The descriptors above can provide human readable strings,
545 // referenced by index numbers. These descriptors are the
546 // actual string data
548 struct usb_string_descriptor_struct {
550 uint8_t bDescriptorType;
554 extern struct usb_string_descriptor_struct usb_string_manufacturer_name
555 __attribute__ ((weak, alias("usb_string_manufacturer_name_default")));
556 extern struct usb_string_descriptor_struct usb_string_product_name
557 __attribute__ ((weak, alias("usb_string_product_name_default")));
558 extern struct usb_string_descriptor_struct usb_string_serial_number
559 __attribute__ ((weak, alias("usb_string_serial_number_default")));
561 struct usb_string_descriptor_struct string0 = {
567 struct usb_string_descriptor_struct usb_string_manufacturer_name_default = {
568 sizeof(STR_MANUFACTURER),
572 struct usb_string_descriptor_struct usb_string_product_name_default = {
577 struct usb_string_descriptor_struct usb_string_serial_number_default = {
585 // ----- Descriptors List -----
587 // This table provides access to all the descriptor data above.
589 const usb_descriptor_list_t usb_descriptor_list[] = {
590 //wValue, wIndex, address, length
591 {0x0100, 0x0000, device_descriptor, sizeof(device_descriptor)},
592 {0x0200, 0x0000, config_descriptor, sizeof(config_descriptor)},
593 {0x0600, 0x0000, device_qualifier_descriptor, sizeof(device_qualifier_descriptor)},
594 {0x0A00, 0x0000, usb_debug_descriptor, sizeof(usb_debug_descriptor)},
595 {0x2200, KEYBOARD_INTERFACE, keyboard_report_desc, sizeof(keyboard_report_desc)},
596 {0x2100, KEYBOARD_INTERFACE, config_descriptor + KEYBOARD_DESC_OFFSET, 9},
597 {0x2200, NKRO_KEYBOARD_INTERFACE, nkro_keyboard_report_desc, sizeof(nkro_keyboard_report_desc)},
598 {0x2100, NKRO_KEYBOARD_INTERFACE, config_descriptor + NKRO_KEYBOARD_DESC_OFFSET, 9},
600 {0x2200, MOUSE_INTERFACE, mouse_report_desc, sizeof(mouse_report_desc)},
601 {0x2100, MOUSE_INTERFACE, config_descriptor+MOUSE_DESC_OFFSET, 9},
603 {0x0300, 0x0000, (const uint8_t *)&string0, 0},
604 {0x0301, 0x0409, (const uint8_t *)&usb_string_manufacturer_name, 0},
605 {0x0302, 0x0409, (const uint8_t *)&usb_string_product_name, 0},
606 {0x0303, 0x0409, (const uint8_t *)&usb_string_serial_number, 0},
612 // ----- Endpoint Configuration -----
614 // See usb_desc.h for Endpoint configuration
616 // 0x19 = Recieve only
617 // 0x15 = Transmit only
618 // 0x1D = Transmit & Recieve
620 const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS] =
622 #if (defined(ENDPOINT1_CONFIG) && NUM_ENDPOINTS >= 1)
624 #elif (NUM_ENDPOINTS >= 1)
627 #if (defined(ENDPOINT2_CONFIG) && NUM_ENDPOINTS >= 2)
629 #elif (NUM_ENDPOINTS >= 2)
632 #if (defined(ENDPOINT3_CONFIG) && NUM_ENDPOINTS >= 3)
634 #elif (NUM_ENDPOINTS >= 3)
637 #if (defined(ENDPOINT4_CONFIG) && NUM_ENDPOINTS >= 4)
639 #elif (NUM_ENDPOINTS >= 4)
642 #if (defined(ENDPOINT5_CONFIG) && NUM_ENDPOINTS >= 5)
644 #elif (NUM_ENDPOINTS >= 5)
647 #if (defined(ENDPOINT6_CONFIG) && NUM_ENDPOINTS >= 6)
649 #elif (NUM_ENDPOINTS >= 6)
652 #if (defined(ENDPOINT7_CONFIG) && NUM_ENDPOINTS >= 7)
654 #elif (NUM_ENDPOINTS >= 7)
657 #if (defined(ENDPOINT8_CONFIG) && NUM_ENDPOINTS >= 8)
659 #elif (NUM_ENDPOINTS >= 8)
662 #if (defined(ENDPOINT9_CONFIG) && NUM_ENDPOINTS >= 9)
664 #elif (NUM_ENDPOINTS >= 9)
667 #if (defined(ENDPOINT10_CONFIG) && NUM_ENDPOINTS >= 10)
669 #elif (NUM_ENDPOINTS >= 10)
672 #if (defined(ENDPOINT11_CONFIG) && NUM_ENDPOINTS >= 11)
674 #elif (NUM_ENDPOINTS >= 11)
677 #if (defined(ENDPOINT12_CONFIG) && NUM_ENDPOINTS >= 12)
679 #elif (NUM_ENDPOINTS >= 12)
682 #if (defined(ENDPOINT13_CONFIG) && NUM_ENDPOINTS >= 13)
684 #elif (NUM_ENDPOINTS >= 13)
687 #if (defined(ENDPOINT14_CONFIG) && NUM_ENDPOINTS >= 14)
689 #elif (NUM_ENDPOINTS >= 14)
692 #if (defined(ENDPOINT15_CONFIG) && NUM_ENDPOINTS >= 15)
694 #elif (NUM_ENDPOINTS >= 15)