This commit is contained in:
hathach 2018-08-01 08:20:20 +07:00
parent 1e524f1b98
commit 6ddd8583da
2 changed files with 56 additions and 50 deletions

View File

@ -37,15 +37,23 @@
#define USB_PID 0x802A #define USB_PID 0x802A
/*------------- Interface Numbering -------------*/ /*------------- Interface Numbering -------------*/
#define ITF_NUM_CDC 0 enum {
#define ITF_NUM_MSC 2 ITF_NUM_CDC = 0 ,
#define ITF_NUM_HID_GEN 3 ITF_NUM_CDC_DATA ,
#define ITF_TOTAL 4 ITF_NUM_MSC ,
ITF_NUM_HID_GEN ,
ITF_NUM_TOTAL
};
enum {
#define ITF_STR_CDC 4 ITF_STR_LANGUAGE = 0 ,
#define ITF_STR_MSC 5 ITF_STR_MANUFACTURER ,
#define ITF_STR_HID 6 ITF_STR_PRODUCT ,
ITF_STR_SERIAL ,
ITF_STR_CDC ,
ITF_STR_MSC ,
ITF_STR_HID
};
/*------------- Endpoint Numbering & Size -------------*/ /*------------- Endpoint Numbering & Size -------------*/
#define _EP_IN(x) (0x80 | (x)) #define _EP_IN(x) (0x80 | (x))
@ -169,10 +177,8 @@ usb_desc_cfg_t const usb_desc_cfg =
{ {
.bLength = sizeof(tusb_desc_configuration_t), .bLength = sizeof(tusb_desc_configuration_t),
.bDescriptorType = TUSB_DESC_CONFIGURATION, .bDescriptorType = TUSB_DESC_CONFIGURATION,
.wTotalLength = sizeof(usb_desc_cfg_t), .wTotalLength = sizeof(usb_desc_cfg_t),
.bNumInterfaces = ITF_TOTAL, .bNumInterfaces = ITF_NUM_TOTAL,
.bConfigurationValue = 1, .bConfigurationValue = 1,
.iConfiguration = 0x00, .iConfiguration = 0x00,
.bmAttributes = TUSB_DESC_CONFIG_ATT_BUS_POWER, .bmAttributes = TUSB_DESC_CONFIG_ATT_BUS_POWER,
@ -371,8 +377,8 @@ usb_desc_cfg_t const usb_desc_cfg =
// tud_desc_set is required by tinyusb stack // tud_desc_set is required by tinyusb stack
tud_desc_set_t tud_desc_set = tud_desc_set_t tud_desc_set =
{ {
.device = (uint8_t const*) &usb_desc_dev, .device = &usb_desc_dev,
.config = (uint8_t const*) &usb_desc_cfg, .config = &usb_desc_cfg,
.string_arr = (uint8_t const **) string_desc_arr, .string_arr = (uint8_t const **) string_desc_arr,
.string_count = sizeof(string_desc_arr)/sizeof(string_desc_arr[0]), .string_count = sizeof(string_desc_arr)/sizeof(string_desc_arr[0]),