clean up
This commit is contained in:
parent
1e524f1b98
commit
6ddd8583da
@ -66,67 +66,67 @@ static uint8_t digitizer_report_buffer[USB_HID_REPORT_LENGTH_DIGITIZER];
|
||||
usb_hid_device_obj_t usb_hid_devices[] = {
|
||||
#if USB_HID_DEVICE_KEYBOARD
|
||||
{
|
||||
.base = { .type = &usb_hid_device_type },
|
||||
.report_buffer = keyboard_report_buffer,
|
||||
.report_id = USB_HID_REPORT_ID_KEYBOARD,
|
||||
.report_length = USB_HID_REPORT_LENGTH_KEYBOARD,
|
||||
.usage_page = HID_USAGE_PAGE_DESKTOP,
|
||||
.usage = HID_USAGE_DESKTOP_KEYBOARD,
|
||||
.base = { .type = &usb_hid_device_type } ,
|
||||
.report_buffer = keyboard_report_buffer ,
|
||||
.report_id = USB_HID_REPORT_ID_KEYBOARD ,
|
||||
.report_length = USB_HID_REPORT_LENGTH_KEYBOARD ,
|
||||
.usage_page = HID_USAGE_PAGE_DESKTOP ,
|
||||
.usage = HID_USAGE_DESKTOP_KEYBOARD ,
|
||||
},
|
||||
#endif
|
||||
|
||||
#if USB_HID_DEVICE_MOUSE
|
||||
{
|
||||
.base = { .type = &usb_hid_device_type },
|
||||
.report_buffer = mouse_report_buffer,
|
||||
.report_id = USB_HID_REPORT_ID_MOUSE,
|
||||
.report_length = USB_HID_REPORT_LENGTH_MOUSE,
|
||||
.usage_page = HID_USAGE_PAGE_DESKTOP,
|
||||
.usage = HID_USAGE_DESKTOP_MOUSE,
|
||||
.base = { .type = &usb_hid_device_type } ,
|
||||
.report_buffer = mouse_report_buffer ,
|
||||
.report_id = USB_HID_REPORT_ID_MOUSE ,
|
||||
.report_length = USB_HID_REPORT_LENGTH_MOUSE ,
|
||||
.usage_page = HID_USAGE_PAGE_DESKTOP ,
|
||||
.usage = HID_USAGE_DESKTOP_MOUSE ,
|
||||
},
|
||||
#endif
|
||||
|
||||
#if USB_HID_DEVICE_CONSUMER
|
||||
{
|
||||
.base = { .type = &usb_hid_device_type },
|
||||
.report_buffer = consumer_report_buffer,
|
||||
.report_id = USB_HID_REPORT_ID_CONSUMER,
|
||||
.report_length = USB_HID_REPORT_LENGTH_CONSUMER,
|
||||
.usage_page = HID_USAGE_PAGE_CONSUMER,
|
||||
.usage = HID_USAGE_CONSUMER_CONTROL,
|
||||
.base = { .type = &usb_hid_device_type } ,
|
||||
.report_buffer = consumer_report_buffer ,
|
||||
.report_id = USB_HID_REPORT_ID_CONSUMER ,
|
||||
.report_length = USB_HID_REPORT_LENGTH_CONSUMER ,
|
||||
.usage_page = HID_USAGE_PAGE_CONSUMER ,
|
||||
.usage = HID_USAGE_CONSUMER_CONTROL ,
|
||||
},
|
||||
#endif
|
||||
|
||||
#if USB_HID_DEVICE_SYS_CONTROL
|
||||
{
|
||||
.base = { .type = &usb_hid_device_type },
|
||||
.report_buffer = sys_control_report_buffer,
|
||||
.report_id = USB_HID_REPORT_ID_SYS_CONTROL,
|
||||
.report_length = USB_HID_REPORT_LENGTH_SYS_CONTROL,
|
||||
.usage_page = HID_USAGE_PAGE_DESKTOP,
|
||||
.usage = HID_USAGE_DESKTOP_SYSTEM_CONTROL,
|
||||
.base = { .type = &usb_hid_device_type } ,
|
||||
.report_buffer = sys_control_report_buffer ,
|
||||
.report_id = USB_HID_REPORT_ID_SYS_CONTROL ,
|
||||
.report_length = USB_HID_REPORT_LENGTH_SYS_CONTROL ,
|
||||
.usage_page = HID_USAGE_PAGE_DESKTOP ,
|
||||
.usage = HID_USAGE_DESKTOP_SYSTEM_CONTROL ,
|
||||
},
|
||||
#endif
|
||||
|
||||
#if USB_HID_DEVICE_GAMEPAD
|
||||
{
|
||||
.base = { .type = &usb_hid_device_type },
|
||||
.report_buffer = gamepad_report_buffer,
|
||||
.report_id = USB_HID_REPORT_ID_GAMEPAD,
|
||||
.report_length = USB_HID_REPORT_LENGTH_GAMEPAD,
|
||||
.usage_page = HID_USAGE_PAGE_DESKTOP,
|
||||
.usage = HID_USAGE_DESKTOP_GAMEPAD,
|
||||
.base = { .type = &usb_hid_device_type } ,
|
||||
.report_buffer = gamepad_report_buffer ,
|
||||
.report_id = USB_HID_REPORT_ID_GAMEPAD ,
|
||||
.report_length = USB_HID_REPORT_LENGTH_GAMEPAD ,
|
||||
.usage_page = HID_USAGE_PAGE_DESKTOP ,
|
||||
.usage = HID_USAGE_DESKTOP_GAMEPAD ,
|
||||
},
|
||||
#endif
|
||||
|
||||
#if USB_HID_DEVICE_DIGITIZER
|
||||
{
|
||||
.base = { .type = &usb_hid_device_type },
|
||||
.report_buffer = digitizer_report_buffer,
|
||||
.report_id = USB_HID_REPORT_ID_DIGITIZER,
|
||||
.report_length = USB_HID_REPORT_LENGTH_DIGITIZER,
|
||||
.usage_page = 0x0D,
|
||||
.usage = 0x02,
|
||||
.base = { .type = &usb_hid_device_type } ,
|
||||
.report_buffer = digitizer_report_buffer ,
|
||||
.report_id = USB_HID_REPORT_ID_DIGITIZER ,
|
||||
.report_length = USB_HID_REPORT_LENGTH_DIGITIZER ,
|
||||
.usage_page = 0x0D ,
|
||||
.usage = 0x02 ,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
@ -37,15 +37,23 @@
|
||||
#define USB_PID 0x802A
|
||||
|
||||
/*------------- Interface Numbering -------------*/
|
||||
#define ITF_NUM_CDC 0
|
||||
#define ITF_NUM_MSC 2
|
||||
#define ITF_NUM_HID_GEN 3
|
||||
#define ITF_TOTAL 4
|
||||
enum {
|
||||
ITF_NUM_CDC = 0 ,
|
||||
ITF_NUM_CDC_DATA ,
|
||||
ITF_NUM_MSC ,
|
||||
ITF_NUM_HID_GEN ,
|
||||
ITF_NUM_TOTAL
|
||||
};
|
||||
|
||||
|
||||
#define ITF_STR_CDC 4
|
||||
#define ITF_STR_MSC 5
|
||||
#define ITF_STR_HID 6
|
||||
enum {
|
||||
ITF_STR_LANGUAGE = 0 ,
|
||||
ITF_STR_MANUFACTURER ,
|
||||
ITF_STR_PRODUCT ,
|
||||
ITF_STR_SERIAL ,
|
||||
ITF_STR_CDC ,
|
||||
ITF_STR_MSC ,
|
||||
ITF_STR_HID
|
||||
};
|
||||
|
||||
/*------------- Endpoint Numbering & Size -------------*/
|
||||
#define _EP_IN(x) (0x80 | (x))
|
||||
@ -169,10 +177,8 @@ usb_desc_cfg_t const usb_desc_cfg =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_configuration_t),
|
||||
.bDescriptorType = TUSB_DESC_CONFIGURATION,
|
||||
|
||||
.wTotalLength = sizeof(usb_desc_cfg_t),
|
||||
.bNumInterfaces = ITF_TOTAL,
|
||||
|
||||
.bNumInterfaces = ITF_NUM_TOTAL,
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = 0x00,
|
||||
.bmAttributes = TUSB_DESC_CONFIG_ATT_BUS_POWER,
|
||||
@ -371,9 +377,9 @@ usb_desc_cfg_t const usb_desc_cfg =
|
||||
// tud_desc_set is required by tinyusb stack
|
||||
tud_desc_set_t tud_desc_set =
|
||||
{
|
||||
.device = (uint8_t const*) &usb_desc_dev,
|
||||
.config = (uint8_t const*) &usb_desc_cfg,
|
||||
.string_arr = (uint8_t const **) string_desc_arr,
|
||||
.device = &usb_desc_dev,
|
||||
.config = &usb_desc_cfg,
|
||||
.string_arr = (uint8_t const **) string_desc_arr,
|
||||
.string_count = sizeof(string_desc_arr)/sizeof(string_desc_arr[0]),
|
||||
|
||||
.hid_report =
|
||||
|
Loading…
Reference in New Issue
Block a user