Merge all the substructures of UsbDeviceCompositeConfigList across different files to a single structure.

This commit is contained in:
László Monda
2017-12-04 20:41:22 +01:00
parent e9bf3dc355
commit a5ce90779c
11 changed files with 144 additions and 165 deletions

View File

@@ -1,32 +1,5 @@
#include "usb_composite_device.h"
usb_device_class_struct_t UsbMouseClass = {
.type = kUSB_DeviceClassTypeHid,
.configurations = USB_DEVICE_CONFIGURATION_COUNT,
.interfaceList = (usb_device_interface_list_t[USB_DEVICE_CONFIGURATION_COUNT]) {{
.count = USB_MOUSE_INTERFACE_COUNT,
.interfaces = (usb_device_interfaces_struct_t[USB_MOUSE_INTERFACE_COUNT]) {{
.classCode = USB_CLASS_HID,
.subclassCode = USB_HID_SUBCLASS_BOOT,
.protocolCode = USB_HID_PROTOCOL_MOUSE,
.interfaceNumber = USB_MOUSE_INTERFACE_INDEX,
.count = 1,
.interface = (usb_device_interface_struct_t[]) {{
.alternateSetting = USB_INTERFACE_ALTERNATE_SETTING_NONE,
.classSpecific = NULL,
.endpointList = {
USB_MOUSE_ENDPOINT_COUNT,
(usb_device_endpoint_struct_t[USB_MOUSE_ENDPOINT_COUNT]) {{
.endpointAddress = USB_MOUSE_ENDPOINT_INDEX | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
.transferType = USB_ENDPOINT_INTERRUPT,
.maxPacketSize = USB_MOUSE_INTERRUPT_IN_PACKET_SIZE,
}}
}
}}
}}
}}
};
uint32_t UsbMouseActionCounter;
static usb_mouse_report_t usbMouseReports[2];
usb_mouse_report_t* ActiveUsbMouseReport = usbMouseReports;
@@ -50,8 +23,6 @@ void ResetActiveUsbMouseReport(void)
static volatile usb_status_t usbMouseAction(void)
{
usb_mouse_report_t *mouseReport = getInactiveUsbMouseReport();
SetDebugBufferUint16(61, mouseReport->x);
SetDebugBufferUint16(63, mouseReport->y);
IsUsbMouseReportSent = true;
return USB_DeviceHidSend(UsbCompositeDevice.mouseHandle, USB_MOUSE_ENDPOINT_INDEX,
(uint8_t*)mouseReport, USB_MOUSE_REPORT_LENGTH);