diff --git a/right/src/usb_interfaces/usb_interface_basic_keyboard.c b/right/src/usb_interfaces/usb_interface_basic_keyboard.c index d81fdd6..26ed4ee 100644 --- a/right/src/usb_interfaces/usb_interface_basic_keyboard.c +++ b/right/src/usb_interfaces/usb_interface_basic_keyboard.c @@ -1,42 +1,29 @@ -#include "key_action.h" -#include "fsl_port.h" -#include "usb_api.h" #include "usb_composite_device.h" -#include "peripherals/test_led.h" -#include "fsl_i2c.h" -#include "i2c.h" -#include "i2c_addresses.h" - -static usb_device_endpoint_struct_t UsbBasicKeyboardEndpoints[USB_BASIC_KEYBOARD_ENDPOINT_COUNT] = {{ - USB_BASIC_KEYBOARD_ENDPOINT_INDEX | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT), - USB_ENDPOINT_INTERRUPT, - USB_BASIC_KEYBOARD_INTERRUPT_IN_PACKET_SIZE, -}}; - -static usb_device_interface_struct_t UsbBasicKeyboardInterface[] = {{ - USB_INTERFACE_ALTERNATE_SETTING_NONE, - {USB_BASIC_KEYBOARD_ENDPOINT_COUNT, UsbBasicKeyboardEndpoints}, - NULL, -}}; - -static usb_device_interfaces_struct_t UsbBasicKeyboardInterfaces[USB_BASIC_KEYBOARD_INTERFACE_COUNT] = {{ - USB_CLASS_HID, - USB_HID_SUBCLASS_BOOT, - USB_HID_PROTOCOL_KEYBOARD, - USB_BASIC_KEYBOARD_INTERFACE_INDEX, - UsbBasicKeyboardInterface, - sizeof(UsbBasicKeyboardInterface) / sizeof(usb_device_interfaces_struct_t), -}}; - -static usb_device_interface_list_t UsbBasicKeyboardInterfaceList[USB_DEVICE_CONFIGURATION_COUNT] = {{ - USB_BASIC_KEYBOARD_INTERFACE_COUNT, - UsbBasicKeyboardInterfaces, -}}; usb_device_class_struct_t UsbBasicKeyboardClass = { - UsbBasicKeyboardInterfaceList, - kUSB_DeviceClassTypeHid, - USB_DEVICE_CONFIGURATION_COUNT, + .type = kUSB_DeviceClassTypeHid, + .configurations = USB_DEVICE_CONFIGURATION_COUNT, + .interfaceList = (usb_device_interface_list_t[USB_DEVICE_CONFIGURATION_COUNT]) {{ + .count = USB_BASIC_KEYBOARD_INTERFACE_COUNT, + .interfaces = (usb_device_interfaces_struct_t[USB_BASIC_KEYBOARD_INTERFACE_COUNT]) {{ + .classCode = USB_CLASS_HID, + .subclassCode = USB_HID_SUBCLASS_BOOT, + .protocolCode = USB_HID_PROTOCOL_KEYBOARD, + .interfaceNumber = USB_BASIC_KEYBOARD_INTERFACE_INDEX, + .count = 1, + .interface = (usb_device_interface_struct_t[]) {{ + .alternateSetting = USB_INTERFACE_ALTERNATE_SETTING_NONE, + .classSpecific = NULL, + .endpointList = { + USB_BASIC_KEYBOARD_ENDPOINT_COUNT, (usb_device_endpoint_struct_t[USB_BASIC_KEYBOARD_ENDPOINT_COUNT]) {{ + .endpointAddress = USB_BASIC_KEYBOARD_ENDPOINT_INDEX | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT), + .transferType = USB_ENDPOINT_INTERRUPT, + .maxPacketSize = USB_BASIC_KEYBOARD_INTERRUPT_IN_PACKET_SIZE, + }} + } + }} + }} + }} }; static usb_basic_keyboard_report_t usbBasicKeyboardReports[2]; diff --git a/right/src/usb_interfaces/usb_interface_generic_hid.c b/right/src/usb_interfaces/usb_interface_generic_hid.c index 52b2ee6..c9978a7 100644 --- a/right/src/usb_interfaces/usb_interface_generic_hid.c +++ b/right/src/usb_interfaces/usb_interface_generic_hid.c @@ -4,7 +4,7 @@ usb_device_class_struct_t UsbGenericHidClass = { .type = kUSB_DeviceClassTypeHid, .configurations = USB_DEVICE_CONFIGURATION_COUNT, - .interfaceList = (usb_device_interface_list_t [USB_DEVICE_CONFIGURATION_COUNT]) {{ + .interfaceList = (usb_device_interface_list_t[USB_DEVICE_CONFIGURATION_COUNT]) {{ .count = USB_GENERIC_HID_INTERFACE_COUNT, .interfaces = (usb_device_interfaces_struct_t[USB_GENERIC_HID_INTERFACE_COUNT]) {{ .classCode = USB_CLASS_HID,