From 307ba23046ff4c0795009c1426708facb37bdf82 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 18 Apr 2019 22:31:35 +0700 Subject: wrap up hid device refactor --- src/device/usbd.h | 7 +++++++ src/device/usbd_auto_desc.c | 41 ----------------------------------------- 2 files changed, 7 insertions(+), 41 deletions(-) (limited to 'src/device') diff --git a/src/device/usbd.h b/src/device/usbd.h index f90c40aab..b3b66768c 100644 --- a/src/device/usbd.h +++ b/src/device/usbd.h @@ -91,6 +91,13 @@ ATTR_WEAK void tud_suspend_cb(bool remote_wakeup_en); // Invoked when usb bus is resumed ATTR_WEAK void tud_resume_cb(void); +//--------------------------------------------------------------------+ +// Interface Descriptor Template +//--------------------------------------------------------------------+ + +#define TUD_CONFIG_DESCRIPTOR(_itfcount, _stridx, _total_len, _attribute, _power_ma) \ + 9, TUSB_DESC_CONFIGURATION, U16_TO_U8S_LE(_total_len), _itfcount, 1, _stridx, TU_BIT(7) | _attribute, (_power_ma)/2 + #ifdef __cplusplus } #endif diff --git a/src/device/usbd_auto_desc.c b/src/device/usbd_auto_desc.c index ad90f7d70..b5a0ce4b2 100644 --- a/src/device/usbd_auto_desc.c +++ b/src/device/usbd_auto_desc.c @@ -473,47 +473,6 @@ desc_auto_cfg_t const _desc_auto_config_struct = }, #endif // boot keyboard - //------------- HID Mouse -------------// -#if CFG_TUD_HID_MOUSE && CFG_TUD_HID_MOUSE_BOOT - .hid_mse_boot = - { - .itf = - { - .bLength = sizeof(tusb_desc_interface_t), - .bDescriptorType = TUSB_DESC_INTERFACE, - .bInterfaceNumber = ITF_NUM_HID_BOOT_MSE, - .bAlternateSetting = 0x00, - .bNumEndpoints = 1, - .bInterfaceClass = TUSB_CLASS_HID, - .bInterfaceSubClass = HID_SUBCLASS_BOOT, - .bInterfaceProtocol = HID_PROTOCOL_MOUSE, - .iInterface = 0 // 4 + CFG_TUD_CDC + CFG_TUD_MSC + CFG_TUD_HID_KEYBOARD - }, - - .hid_desc = - { - .bLength = sizeof(tusb_hid_descriptor_hid_t), - .bDescriptorType = HID_DESC_TYPE_HID, - .bcdHID = 0x0111, - .bCountryCode = HID_Local_NotSupported, - .bNumDescriptors = 1, - .bReportType = HID_DESC_TYPE_REPORT, - .wReportLength = sizeof(_desc_auto_hid_boot_mse_report) - }, - - .ep_in = - { - .bLength = sizeof(tusb_desc_endpoint_t), - .bDescriptorType = TUSB_DESC_ENDPOINT, - .bEndpointAddress = EP_HID_MSE_BOOT, - .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT }, - .wMaxPacketSize = { .size = EP_HID_MSE_BOOT_SZ }, - .bInterval = 0x0A - }, - }, - -#endif // boot mouse - #if AUTO_DESC_HID_GENERIC //------------- HID Generic Multiple report -------------// .hid_generic = -- cgit v1.3.1