1 | /* --------------------------- Device Descriptor --------------------------- */
|
2 | #if USB_CFG_DESCR_PROPS_DEVICE == 0
|
3 | #undef USB_CFG_DESCR_PROPS_DEVICE
|
4 | #define USB_CFG_DESCR_PROPS_DEVICE sizeof(usbDescriptorDevice)
|
5 | PROGMEM char usbDescriptorDevice[] = { /* USB device descriptor */
|
6 | 18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */
|
7 | USBDESCR_DEVICE, /* descriptor type */
|
8 | 0x10, 0x01, /* USB version supported */
|
9 | USB_CFG_DEVICE_CLASS,
|
10 | USB_CFG_DEVICE_SUBCLASS,
|
11 | 0, /* protocol */
|
12 | 8, /* max packet size */
|
13 | /* the following two casts affect the first byte of the constant only, but
|
14 | * that's sufficient to avoid a warning with the default values.
|
15 | */
|
16 | (char)USB_CFG_VENDOR_ID,/* 2 bytes */
|
17 | (char)USB_CFG_DEVICE_ID,/* 2 bytes */
|
18 | USB_CFG_DEVICE_VERSION, /* 2 bytes */
|
19 | USB_CFG_DESCR_PROPS_STRING_VENDOR != 0 ? 1 : 0, /* manufacturer string index */
|
20 | USB_CFG_DESCR_PROPS_STRING_PRODUCT != 0 ? 2 : 0, /* product string index */
|
21 | USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER != 0 ? 3 : 0, /* serial number string index */
|
22 | 1, /* number of configurations */
|
23 | };
|
24 | #endif
|
25 |
|
26 | /* ----------------------- Configuration Descriptor ------------------------ */
|
27 |
|
28 | #if USB_CFG_DESCR_PROPS_HID_REPORT != 0 && USB_CFG_DESCR_PROPS_HID == 0
|
29 | #undef USB_CFG_DESCR_PROPS_HID
|
30 | #define USB_CFG_DESCR_PROPS_HID 9 /* length of HID descriptor in config descriptor below */
|
31 | #endif
|
32 |
|
33 | #if USB_CFG_DESCR_PROPS_CONFIGURATION == 0
|
34 | #undef USB_CFG_DESCR_PROPS_CONFIGURATION
|
35 | #define USB_CFG_DESCR_PROPS_CONFIGURATION sizeof(usbDescriptorConfiguration)
|
36 | PROGMEM char usbDescriptorConfiguration[] = { /* USB configuration descriptor */
|
37 | 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */
|
38 | USBDESCR_CONFIG, /* descriptor type */
|
39 | 0,
|
40 | 18 + (7 * USB_CFG_HAVE_INTRIN_ENDPOINT) + (7 * USB_CFG_HAVE_INTRIN_ENDPOINT3) + (USB_CFG_DESCR_PROPS_HID & 0xff), /* total length of data returned (including inlined descriptors) */
|
41 | 1, /* number of interfaces in this configuration */
|
42 | 1, /* index of this configuration */
|
43 | 0, /* configuration name string index */
|
44 | #if USB_CFG_IS_SELF_POWERED
|
45 | USBATTR_SELFPOWER, /* attributes */
|
46 | #else
|
47 | (char)USBATTR_BUSPOWER, /* attributes */
|
48 | #endif
|
49 | USB_CFG_MAX_BUS_POWER/2, /* max USB current in 2mA units */
|
50 | /* interface descriptor follows inline: */
|
51 | 9, /* sizeof(usbDescrInterface): length of descriptor in bytes */
|
52 | USBDESCR_INTERFACE, /* descriptor type */
|
53 | 0, /* index of this interface */
|
54 | 0, /* alternate setting for this interface */
|
55 | USB_CFG_HAVE_INTRIN_ENDPOINT + USB_CFG_HAVE_INTRIN_ENDPOINT3, /* endpoints excl 0: number of endpoint descriptors to follow */
|
56 | USB_CFG_INTERFACE_CLASS,
|
57 | USB_CFG_INTERFACE_SUBCLASS,
|
58 | USB_CFG_INTERFACE_PROTOCOL,
|
59 | 0, /* string index for interface */
|
60 | #if (USB_CFG_DESCR_PROPS_HID & 0xff) /* HID descriptor */
|
61 | 9, /* sizeof(usbDescrHID): length of descriptor in bytes */
|
62 | USBDESCR_HID, /* descriptor type: HID */
|
63 | 0x01, 0x01, /* BCD representation of HID version */
|
64 | 0x00, /* target country code */
|
65 | 0x01, /* number of HID Report (or other HID class) Descriptor infos to follow */
|
66 | 0x22, /* descriptor type: report */
|
67 | USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 0, /* total length of report descriptor */
|
68 | #endif
|
69 | #if USB_CFG_HAVE_INTRIN_ENDPOINT /* endpoint descriptor for endpoint 1 */
|
70 | 7, /* sizeof(usbDescrEndpoint) */
|
71 | USBDESCR_ENDPOINT, /* descriptor type = endpoint */
|
72 | (char)0x82, /* IN endpoint number 1 */
|
73 | 0x03, /* attrib: Interrupt endpoint */
|
74 | 0, 0x20, /* maximum packet size */
|
75 | USB_CFG_INTR_POLL_INTERVAL, /* in ms */
|
76 | #endif
|
77 | #if USB_CFG_HAVE_INTRIN_ENDPOINT3 /* endpoint descriptor for endpoint 3 */
|
78 | 7, /* sizeof(usbDescrEndpoint) */
|
79 | USBDESCR_ENDPOINT, /* descriptor type = endpoint */
|
80 | (char)0x02, /* IN endpoint number 1 */
|
81 | 0x03, /* attrib: Interrupt endpoint */
|
82 | 0, 0x20, /* maximum packet size */
|
83 | USB_CFG_INTR_POLL_INTERVAL, /* in ms */
|
84 | #endif
|
85 | };
|
86 | #endif
|