/* USB HID device configuration descriptor set */
const uint8_t USBD_HID_CfgDesc[USB_HID_CONFIG_DESC_SIZE] =
{
0x09, /* bLength: configuration descriptor size */
USB_DESCTYPE_CONFIGURATION, /* bDescriptorType: configuration descriptor type */
USB_HID_CONFIG_DESC_SIZE, /* wTotalLength: configuration descriptor set total length */
0x00,
0x02, /* bNumInterfaces: 2 interface */
0x01, /* bConfigurationValue: configuration value */
0x00, /* iConfiguration: index of string descriptor describing the configuration */
0xA0, /* bmAttributes: device attributes (bus powered and support remote wakeup) */
0x32, /* bMaxPower 100 mA: this current is used for detecting Vbus */
/*
interface 0 for mouse.
huohongpeng 2017-02-10
*/
/************** interface descriptor 0****************/
0x09, /* bLength: interface descriptor size */
USB_DESCTYPE_INTERFACE,/* bDescriptorType: interface descriptor type */
0x00, /* bInterfaceNumber: number of interface */
0x00, /* bAlternateSetting: alternate setting */
0x01, /* bNumEndpoints: just use 1 endpoint for Tx */
0x03, /* bInterfaceClass: HID class */
0x01, /* bInterfaceSubClass: 1 = BIOS boot, 0 = no boot */
0x02, /* nInterfaceProtocol: 0 = none, 1 = keyboard, 2 = mouse */
0x00, /* iInterface: index of interface string descriptor */
/******************** HID descriptor 0********************/
0x09, /* bLength: HID descriptor size */
HID_DESC_TYPE,/* bDescriptorType: HID */
0x11, /* bcdHID: HID class protocol(HID1.11) */
0x01,
0x00, /* bCountryCode: device country code */
0x01, /* bNumDescriptors: number of HID class descriptors to follow */
0x22, /* bDescriptorType: followed class descriptor type(report descriptor) */
USB_HID_REPORT_DESC0_SIZE, /* wDescriptorLength: total length of report descriptor */
0x00,
/******************** Mouse endpoint descriptor ********************/
0x07, /* bLength: Endpoint Descriptor size */
USB_DESCTYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
HID1_IN_EP, /* bEndpointAddress: endpoint address (EP1_IN) */
0x03, /* bmAttributes: endpoint attribute(interrupt endpoint) */
HID1_IN_PACKET, /* wMaxPacketSize: 4 bytes max */
0x00,
0x0A, /* bInterval: polling interval (10 ms) */
/*
interface 1 for host communication to mcu.
huohongpeng 2017-02-10
*/
/************** interface descriptor 1****************/
0x09, /* bLength: interface descriptor size */
USB_DESCTYPE_INTERFACE,/* bDescriptorType: interface descriptor type */
0x01, /* bInterfaceNumber: number of interface */
0x00, /* bAlternateSetting: alternate setting */
0x02, /* bNumEndpoints: use 2 endpoint for Tx and Rx*/
0x03, /* bInterfaceClass: HID class */
0x00, /* bInterfaceSubClass: 1 = BIOS boot, 0 = no boot */
0x00, /* nInterfaceProtocol: 0 = none, 1 = keyboard, 2 = mouse */
0x00, /* iInterface: index of interface string descriptor */
/******************** HID descriptor 1********************/
0x09, /* bLength: HID descriptor size */
HID_DESC_TYPE,/* bDescriptorType: HID */
0x11, /* bcdHID: HID class protocol(HID1.11) */
0x01,
0x00, /* bCountryCode: device country code */
0x01, /* bNumDescriptors: number of HID class descriptors to follow */
0x22, /* bDescriptorType: followed class descriptor type(report descriptor) */
USB_HID_REPORT_DESC1_SIZE, /* wDescriptorLength: total length of report descriptor */
0x00,
/****************host communication mcu Tx endpoint descriptor ***********/
0x07, /* bLength: Endpoint Descriptor size */
USB_DESCTYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
HID2_IN_EP, /* bEndpointAddress: endpoint address (EP2_IN) */
0x03, /* bmAttributes: endpoint attribute(interrupt endpoint) */
HID2_IN_PACKET, /* wMaxPacketSize: 64 bytes max */
0x00,
0x0A, /* bInterval: polling interval (10 ms) */
/************** host communication mcu Tx endpoint descriptor ************/
0x07, /* bLength: Endpoint Descriptor size */
USB_DESCTYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
HID2_OUT_EP, /* bEndpointAddress: endpoint address (EP2_OUT) */
0x03, /* bmAttributes: endpoint attribute(interrupt endpoint) */
HID2_OUT_PACKET, /* wMaxPacketSize: 64 bytes max */
0x00,
0x0A, /* bInterval: polling interval (10 ms) */
};
---------------------