4 * Created on: Jun 18, 2015
9 #include "app_usbd_cfg.h"
10 #include "DAP_config.h"
12 ALIGNED(4) const uint8_t HID_ReportDescriptor[] = {
13 HID_UsagePageVendor(0x00),
15 HID_Collection(HID_Application),
16 HID_LogicalMin(0), /* value range: 0 - 0xFF */
17 HID_LogicalMaxS(0xFF),
18 HID_ReportSize(8), /* 8 bits */
19 HID_ReportCount(DAP_PACKET_SIZE),
21 HID_Input(HID_Data | HID_Variable | HID_Absolute),
22 HID_ReportCount(DAP_PACKET_SIZE),
24 HID_Output(HID_Data | HID_Variable | HID_Absolute),
27 HID_Feature(HID_Data | HID_Variable | HID_Absolute),
31 const uint8_t hid_report_size = sizeof (HID_ReportDescriptor);
35 * USB Standard Device Descriptor
37 ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = {
38 USB_DEVICE_DESC_SIZE, /* bLength */
39 USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
40 WBVAL(0x0200), /* bcdUSB 2.0 */
41 0x00, /* bDeviceClass */
42 0x00, /* bDeviceSubClass */
43 0x00, /* bDeviceProtocol */
44 USB_MAX_PACKET0, /* bMaxPacketSize0 */
45 WBVAL(0x1FC9), /* idVendor */
46 WBVAL(0x0081), /* idProduct */
47 WBVAL(0x0100), /* bcdDevice */
48 0x01, /* iManufacturer */
50 0x03, /* iSerialNumber */
51 0x01 /* bNumConfigurations */
55 * USB FSConfiguration Descriptor
56 * All Descriptors (Configuration, Interface, Endpoint, Class, Vendor)
58 ALIGNED(4) uint8_t USB_FsConfigDescriptor[] = {
60 USB_CONFIGURATION_DESC_SIZE, /* bLength */
61 USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
62 WBVAL( /* wTotalLength */
63 USB_CONFIGURATION_DESC_SIZE +
64 USB_INTERFACE_DESC_SIZE +
66 USB_ENDPOINT_DESC_SIZE +
67 USB_ENDPOINT_DESC_SIZE
69 0x01, /* bNumInterfaces */
70 0x01, /* bConfigurationValue */
71 0x00, /* iConfiguration */
72 USB_CONFIG_SELF_POWERED, /* bmAttributes */
73 USB_CONFIG_POWER_MA(100), /* bMaxPower */
75 /* Interface 0, Alternate Setting 0, HID Class */
76 USB_INTERFACE_DESC_SIZE, /* bLength */
77 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
78 0x00, /* bInterfaceNumber */
79 0x00, /* bAlternateSetting */
80 0x02, /* bNumEndpoints */
81 USB_DEVICE_CLASS_HUMAN_INTERFACE, /* bInterfaceClass */
82 HID_SUBCLASS_NONE, /* bInterfaceSubClass */
83 HID_PROTOCOL_NONE, /* bInterfaceProtocol */
84 0x04, /* iInterface */
85 /* HID Class Descriptor */
86 /* HID_DESC_OFFSET = 0x0012 */
87 HID_DESC_SIZE, /* bLength */
88 HID_HID_DESCRIPTOR_TYPE, /* bDescriptorType */
89 WBVAL(0x0111), /* bcdHID : 1.11*/
90 0x00, /* bCountryCode */
91 0x01, /* bNumDescriptors */
92 HID_REPORT_DESCRIPTOR_TYPE, /* bDescriptorType */
93 WBVAL(sizeof(HID_ReportDescriptor)), /* wDescriptorLength */
94 /* Endpoint, HID Interrupt In */
95 USB_ENDPOINT_DESC_SIZE, /* bLength */
96 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
97 HID_EP_IN, /* bEndpointAddress */
98 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
99 WBVAL(64), /* wMaxPacketSize */
100 0x01, /* 1ms */ /* bInterval */
101 /* Endpoint, HID Interrupt Out */
102 USB_ENDPOINT_DESC_SIZE, /* bLength */
103 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
104 HID_EP_OUT, /* bEndpointAddress */
105 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
106 WBVAL(64), /* wMaxPacketSize */
107 0x01, /* bInterval: 1ms */
113 * USB String Descriptor (optional)
115 const uint8_t USB_StringDescriptor[] = {
116 /* Index 0x00: LANGID Codes */
118 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
119 WBVAL(0x0409), /* wLANGID : US English*/
120 /* Index 0x01: Manufacturer */
121 (8 * 2 + 2), /* bLength (8 Char + Type + lenght) */
122 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
131 /* Index 0x02: Product */
132 (24 * 2 + 2), /* bLength (24 Char + Type + lenght) */
133 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
158 /* Index 0x03: Serial Number */
159 (11 * 2 + 2), /* bLength (13 Char + Type + lenght) */
160 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
172 /* Index 0x04: Interface 0, Alternate Setting 0 */
173 (3 * 2 + 2), /* bLength (3 Char + Type + lenght) */
174 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */