diff --git a/right/build/kds/.project b/right/build/kds/.project
index 56b9945..4b7aef9 100644
--- a/right/build/kds/.project
+++ b/right/build/kds/.project
@@ -185,85 +185,135 @@
1
PARENT-2-PROJECT_LOC/composite.h
-
- sources/hid_generic.c
- 1
- PARENT-2-PROJECT_LOC/hid_generic.c
-
-
- sources/hid_generic.h
- 1
- PARENT-2-PROJECT_LOC/hid_generic.h
-
-
- sources/hid_keyboard.c
- 1
- PARENT-2-PROJECT_LOC/hid_keyboard.c
-
-
- sources/hid_keyboard.h
- 1
- PARENT-2-PROJECT_LOC/hid_keyboard.h
-
-
- sources/hid_mouse.c
- 1
- PARENT-2-PROJECT_LOC/hid_mouse.c
-
-
- sources/hid_mouse.h
- 1
- PARENT-2-PROJECT_LOC/hid_mouse.h
-
sources/scancodes.h
1
PARENT-2-PROJECT_LOC/scancodes.h
+
+ sources/usb_class_generic_hid.c
+ 1
+ PARENT-2-PROJECT_LOC/usb_class_generic_hid.c
+
+
+ sources/usb_class_generic_hid.h
+ 1
+ PARENT-2-PROJECT_LOC/usb_class_generic_hid.h
+
+
+ sources/usb_class_keyboard.c
+ 1
+ PARENT-2-PROJECT_LOC/usb_class_keyboard.c
+
+
+ sources/usb_class_keyboard.h
+ 1
+ PARENT-2-PROJECT_LOC/usb_class_keyboard.h
+
+
+ sources/usb_class_mouse.c
+ 1
+ PARENT-2-PROJECT_LOC/usb_class_mouse.c
+
+
+ sources/usb_class_mouse.h
+ 1
+ PARENT-2-PROJECT_LOC/usb_class_mouse.h
+
+
+ sources/usb_descriptor_configuration.c
+ 1
+ PARENT-2-PROJECT_LOC/usb_descriptor_configuration.c
+
+
+ sources/usb_descriptor_configuration.h
+ 1
+ PARENT-2-PROJECT_LOC/usb_descriptor_configuration.h
+
+
+ sources/usb_descriptor_device.c
+ 1
+ PARENT-2-PROJECT_LOC/usb_descriptor_device.c
+
+
+ sources/usb_descriptor_device.h
+ 1
+ PARENT-2-PROJECT_LOC/usb_descriptor_device.h
+
+
+ sources/usb_descriptor_generic_hid_report.c
+ 1
+ PARENT-2-PROJECT_LOC/usb_descriptor_generic_hid_report.c
+
+
+ sources/usb_descriptor_generic_hid_report.h
+ 1
+ PARENT-2-PROJECT_LOC/usb_descriptor_generic_hid_report.h
+
+
+ sources/usb_descriptor_keyboard_report.c
+ 1
+ PARENT-2-PROJECT_LOC/usb_descriptor_keyboard_report.c
+
+
+ sources/usb_descriptor_keyboard_report.h
+ 1
+ PARENT-2-PROJECT_LOC/usb_descriptor_keyboard_report.h
+
+
+ sources/usb_descriptor_mouse_report.c
+ 1
+ PARENT-2-PROJECT_LOC/usb_descriptor_mouse_report.c
+
+
+ sources/usb_descriptor_mouse_report.h
+ 1
+ PARENT-2-PROJECT_LOC/usb_descriptor_mouse_report.h
+
+
+ sources/usb_descriptor_strings.c
+ 1
+ PARENT-2-PROJECT_LOC/usb_descriptor_strings.c
+
+
+ sources/usb_descriptor_strings.h
+ 1
+ PARENT-2-PROJECT_LOC/usb_descriptor_strings.h
+
sources/usb_device_config.h
1
PARENT-2-PROJECT_LOC/usb_device_config.h
- sources/usb_device_descriptor.c
+ sources/usb_interface_generic_hid.c
1
- PARENT-2-PROJECT_LOC/usb_device_descriptor.c
+ PARENT-2-PROJECT_LOC/usb_interface_generic_hid.c
- sources/usb_device_descriptor.h
+ sources/usb_interface_generic_hid.h
1
- PARENT-2-PROJECT_LOC/usb_device_descriptor.h
+ PARENT-2-PROJECT_LOC/usb_interface_generic_hid.h
- sources/usb_generic_hid_descriptors.c
+ sources/usb_interface_keyboard.c
1
- PARENT-2-PROJECT_LOC/usb_generic_hid_descriptors.c
+ PARENT-2-PROJECT_LOC/usb_interface_keyboard.c
- sources/usb_generic_hid_descriptors.h
+ sources/usb_interface_keyboard.h
1
- PARENT-2-PROJECT_LOC/usb_generic_hid_descriptors.h
+ PARENT-2-PROJECT_LOC/usb_interface_keyboard.h
- sources/usb_keyboard_descriptors.c
+ sources/usb_interface_mouse.c
1
- PARENT-2-PROJECT_LOC/usb_keyboard_descriptors.c
+ PARENT-2-PROJECT_LOC/usb_interface_mouse.c
- sources/usb_keyboard_descriptors.h
+ sources/usb_interface_mouse.h
1
- PARENT-2-PROJECT_LOC/usb_keyboard_descriptors.h
-
-
- sources/usb_mouse_descriptors.c
- 1
- PARENT-2-PROJECT_LOC/usb_mouse_descriptors.c
-
-
- sources/usb_mouse_descriptors.h
- 1
- PARENT-2-PROJECT_LOC/usb_mouse_descriptors.h
+ PARENT-2-PROJECT_LOC/usb_interface_mouse.h
startup/startup_MK22F51212.S
diff --git a/right/composite.c b/right/composite.c
index 5842a0c..14f2456 100644
--- a/right/composite.c
+++ b/right/composite.c
@@ -4,11 +4,11 @@
#include "include/usb/usb_device_class.h"
#include "include/usb/usb_device_hid.h"
#include "include/usb/usb_device_ch9.h"
-#include "usb_device_descriptor.h"
+#include "usb_descriptor_device.h"
#include "composite.h"
-#include "hid_keyboard.h"
-#include "hid_mouse.h"
-#include "hid_generic.h"
+#include "usb_interface_keyboard.h"
+#include "usb_interface_mouse.h"
+#include "usb_interface_generic_hid.h"
#include "fsl_device_registers.h"
#include "include/board/clock_config.h"
#include "include/board/board.h"
@@ -17,9 +17,10 @@
#include
#include "fsl_common.h"
#include "include/board/pin_mux.h"
-#include "usb_keyboard_descriptors.h"
-#include "usb_mouse_descriptors.h"
-#include "usb_generic_hid_descriptors.h"
+#include "usb_class_keyboard.h"
+#include "usb_class_mouse.h"
+#include "usb_class_generic_hid.h"
+#include "usb_descriptor_strings.h"
static usb_status_t UsbDeviceCallback(usb_device_handle handle, uint32_t event, void *param);
usb_device_composite_struct_t UsbCompositeDevice;
diff --git a/right/composite.h b/right/composite.h
index 2805705..f00c46d 100644
--- a/right/composite.h
+++ b/right/composite.h
@@ -1,6 +1,10 @@
#ifndef __USB_DEVICE_COMPOSITE_H__
#define __USB_DEVICE_COMPOSITE_H__
+// Includes:
+
+ #include "usb_descriptor_configuration.h"
+
// Macros:
#define CONTROLLER_ID kUSB_ControllerKhci0
diff --git a/right/usb_generic_hid_descriptors.c b/right/usb_class_generic_hid.c
similarity index 59%
rename from right/usb_generic_hid_descriptors.c
rename to right/usb_class_generic_hid.c
index b6d3644..a77261f 100644
--- a/right/usb_generic_hid_descriptors.c
+++ b/right/usb_class_generic_hid.c
@@ -3,8 +3,8 @@
#include "usb_device.h"
#include "include/usb/usb_device_class.h"
#include "include/usb/usb_device_hid.h"
-#include "usb_device_descriptor.h"
-#include "usb_generic_hid_descriptors.h"
+#include "usb_descriptor_device.h"
+#include "usb_class_generic_hid.h"
static usb_device_endpoint_struct_t UsbGenericHidEndpoints[USB_GENERIC_HID_ENDPOINT_COUNT] =
{
@@ -21,7 +21,7 @@ static usb_device_endpoint_struct_t UsbGenericHidEndpoints[USB_GENERIC_HID_ENDPO
};
static usb_device_interface_struct_t UsbGenericHidInterface[] = {{
- USB_KEYBOARD_INTERFACE_ALTERNATE_SETTING,
+ USB_GENERIC_HID_INTERFACE_ALTERNATE_SETTING,
{USB_GENERIC_HID_ENDPOINT_COUNT, UsbGenericHidEndpoints},
NULL,
}};
@@ -45,25 +45,3 @@ usb_device_class_struct_t UsbGenericHidClass = {
kUSB_DeviceClassTypeHid,
USB_DEVICE_CONFIGURATION_COUNT,
};
-
-uint8_t UsbGenericHidReportDescriptor[USB_GENERIC_HID_REPORT_DESCRIPTOR_LENGTH] = {
- 0x05U, 0x81U, /* Usage Page (Vendor defined)*/
- 0x09U, 0x82U, /* Usage (Vendor defined) */
- 0xA1U, 0x01U, /* Collection (Application) */
- 0x09U, 0x83U, /* Usage (Vendor defined) */
-
- 0x09U, 0x84U, /* Usage (Vendor defined) */
- 0x15U, 0x80U, /* Logical Minimum (-128) */
- 0x25U, 0x7FU, /* Logical Maximum (127) */
- 0x75U, 0x08U, /* Report Size (8U) */
- 0x95U, 0x08U, /* Report Count (8U) */
- 0x81U, 0x02U, /* Input(Data, Variable, Absolute) */
-
- 0x09U, 0x84U, /* Usage (Vendor defined) */
- 0x15U, 0x80U, /* logical Minimum (-128) */
- 0x25U, 0x7FU, /* logical Maximum (127) */
- 0x75U, 0x08U, /* Report Size (8U) */
- 0x95U, 0x08U, /* Report Count (8U) */
- 0x91U, 0x02U, /* Input (Data, Variable, Absolute) */
- 0xC0U, /* End collection */
-};
diff --git a/right/usb_generic_hid_descriptors.h b/right/usb_class_generic_hid.h
similarity index 67%
rename from right/usb_generic_hid_descriptors.h
rename to right/usb_class_generic_hid.h
index ea0b1ae..da6c350 100644
--- a/right/usb_generic_hid_descriptors.h
+++ b/right/usb_class_generic_hid.h
@@ -1,5 +1,5 @@
-#ifndef __USB_GENERIC_HID_DESCRIPTORS_H__
-#define __USB_GENERIC_HID_DESCRIPTORS_H__
+#ifndef __USB_CLASS_GENERIC_HID_H__
+#define __USB_CLASS_GENERIC_HID_H__
// Macros:
@@ -20,13 +20,8 @@
#define USB_GENERIC_HID_INTERRUPT_OUT_PACKET_SIZE (64U)
#define USB_GENERIC_HID_INTERRUPT_OUT_INTERVAL (0x04U)
- #define USB_GENERIC_HID_REPORT_DESCRIPTOR_LENGTH (33U)
- #define USB_GENERIC_HID_STRING_DESCRIPTOR_LENGTH (38U)
-
// Variables:
extern usb_device_class_struct_t UsbGenericHidClass;
- extern uint8_t UsbGenericHidReportDescriptor[USB_GENERIC_HID_REPORT_DESCRIPTOR_LENGTH];
- extern uint8_t UsbGenericHidString[USB_GENERIC_HID_STRING_DESCRIPTOR_LENGTH];
#endif
diff --git a/right/usb_class_keyboard.c b/right/usb_class_keyboard.c
new file mode 100644
index 0000000..81c4978
--- /dev/null
+++ b/right/usb_class_keyboard.c
@@ -0,0 +1,39 @@
+#include "usb_device_config.h"
+#include "usb.h"
+#include "usb_device.h"
+#include "include/usb/usb_device_class.h"
+#include "include/usb/usb_device_hid.h"
+#include "usb_descriptor_device.h"
+#include "usb_class_keyboard.h"
+
+static usb_device_endpoint_struct_t UsbKeyboardEndpoints[USB_KEYBOARD_ENDPOINT_COUNT] = {{
+ USB_KEYBOARD_ENDPOINT_ID | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
+ USB_ENDPOINT_INTERRUPT,
+ USB_KEYBOARD_INTERRUPT_IN_PACKET_SIZE,
+}};
+
+static usb_device_interface_struct_t UsbKeyboardInterface[] = {{
+ USB_KEYBOARD_INTERFACE_ALTERNATE_SETTING,
+ {USB_KEYBOARD_ENDPOINT_COUNT, UsbKeyboardEndpoints},
+ NULL,
+}};
+
+static usb_device_interfaces_struct_t UsbKeyboardInterfaces[USB_KEYBOARD_INTERFACE_COUNT] = {{
+ USB_KEYBOARD_CLASS,
+ USB_KEYBOARD_SUBCLASS,
+ USB_KEYBOARD_PROTOCOL,
+ USB_KEYBOARD_INTERFACE_INDEX,
+ UsbKeyboardInterface,
+ sizeof(UsbKeyboardInterface) / sizeof(usb_device_interfaces_struct_t),
+}};
+
+static usb_device_interface_list_t UsbKeyboardInterfaceList[USB_DEVICE_CONFIGURATION_COUNT] = {{
+ USB_KEYBOARD_INTERFACE_COUNT,
+ UsbKeyboardInterfaces,
+}};
+
+usb_device_class_struct_t UsbKeyboardClass = {
+ UsbKeyboardInterfaceList,
+ kUSB_DeviceClassTypeHid,
+ USB_DEVICE_CONFIGURATION_COUNT,
+};
diff --git a/right/usb_keyboard_descriptors.h b/right/usb_class_keyboard.h
similarity index 61%
rename from right/usb_keyboard_descriptors.h
rename to right/usb_class_keyboard.h
index 2a03981..d3b78ff 100644
--- a/right/usb_keyboard_descriptors.h
+++ b/right/usb_class_keyboard.h
@@ -1,5 +1,5 @@
-#ifndef __USB_KEYBOARD_DESCRIPTORS_H__
-#define __USB_KEYBOARD_DESCRIPTORS_H__
+#ifndef __USB_CLASS_KEYBOARD_H__
+#define __USB_CLASS_KEYBOARD_H__
// Macros:
@@ -17,13 +17,8 @@
#define USB_KEYBOARD_INTERRUPT_IN_PACKET_SIZE (8U)
#define USB_KEYBOARD_INTERRUPT_IN_INTERVAL (0x04U)
- #define USB_KEYBOARD_REPORT_DESCRIPTOR_LENGTH (63U)
- #define USB_KEYBOARD_STRING_DESCRIPTOR_LENGTH (40U)
-
// Variables:
extern usb_device_class_struct_t UsbKeyboardClass;
- extern uint8_t UsbKeyboardReportDescriptor[USB_KEYBOARD_REPORT_DESCRIPTOR_LENGTH];
- extern uint8_t UsbKeyboardString[USB_KEYBOARD_STRING_DESCRIPTOR_LENGTH];
#endif
diff --git a/right/usb_class_mouse.c b/right/usb_class_mouse.c
new file mode 100644
index 0000000..e3f2e8c
--- /dev/null
+++ b/right/usb_class_mouse.c
@@ -0,0 +1,40 @@
+#include "usb_device_config.h"
+#include "usb.h"
+#include "usb_device.h"
+#include "include/usb/usb_device_class.h"
+#include "include/usb/usb_device_hid.h"
+#include "usb_descriptor_device.h"
+#include "composite.h"
+#include "usb_class_mouse.h"
+
+static usb_device_endpoint_struct_t UsbMouseEndpoints[USB_MOUSE_ENDPOINT_COUNT] = {{
+ USB_MOUSE_ENDPOINT_ID | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
+ USB_ENDPOINT_INTERRUPT,
+ USB_MOUSE_INTERRUPT_IN_PACKET_SIZE,
+}};
+
+static usb_device_interface_struct_t UsbMouseInterface[] = {{
+ USB_MOUSE_INTERFACE_ALTERNATE_SETTING,
+ {USB_MOUSE_ENDPOINT_COUNT, UsbMouseEndpoints},
+ NULL,
+}};
+
+static usb_device_interfaces_struct_t UsbMouseInterfaces[USB_MOUSE_INTERFACE_COUNT] = {{
+ USB_MOUSE_CLASS,
+ USB_MOUSE_SUBCLASS,
+ USB_MOUSE_PROTOCOL,
+ USB_MOUSE_INTERFACE_INDEX,
+ UsbMouseInterface,
+ sizeof(UsbMouseInterface) / sizeof(usb_device_interfaces_struct_t),
+}};
+
+static usb_device_interface_list_t UsbMouseInterfaceList[USB_DEVICE_CONFIGURATION_COUNT] = {{
+ USB_MOUSE_INTERFACE_COUNT,
+ UsbMouseInterfaces,
+}};
+
+usb_device_class_struct_t UsbMouseClass = {
+ UsbMouseInterfaceList,
+ kUSB_DeviceClassTypeHid,
+ USB_DEVICE_CONFIGURATION_COUNT,
+};
diff --git a/right/usb_mouse_descriptors.h b/right/usb_class_mouse.h
similarity index 61%
rename from right/usb_mouse_descriptors.h
rename to right/usb_class_mouse.h
index 9d0fa4f..0327749 100644
--- a/right/usb_mouse_descriptors.h
+++ b/right/usb_class_mouse.h
@@ -1,5 +1,5 @@
-#ifndef __USB_MOUSE_DESCRIPTORS_H__
-#define __USB_MOUSE_DESCRIPTORS_H__
+#ifndef __USB_CLASS_MOUSE_H__
+#define __USB_CLASS_MOUSE_H__
// Macros:
@@ -17,13 +17,8 @@
#define USB_MOUSE_INTERRUPT_IN_PACKET_SIZE (8U)
#define USB_MOUSE_INTERRUPT_IN_INTERVAL (0x04U)
- #define USB_MOUSE_REPORT_DESCRIPTOR_LENGTH (52U)
- #define USB_MOUSE_STRING_DESCRIPTOR_LENGTH (34U)
-
// Variables:
extern usb_device_class_struct_t UsbMouseClass;
- extern uint8_t UsbMouseReportDescriptor[USB_MOUSE_REPORT_DESCRIPTOR_LENGTH];
- extern uint8_t UsbMouseString[USB_MOUSE_STRING_DESCRIPTOR_LENGTH];
#endif
diff --git a/right/usb_device_descriptor.c b/right/usb_descriptor_configuration.c
similarity index 64%
rename from right/usb_device_descriptor.c
rename to right/usb_descriptor_configuration.c
index e93a088..34967d4 100644
--- a/right/usb_device_descriptor.c
+++ b/right/usb_descriptor_configuration.c
@@ -3,32 +3,15 @@
#include "usb_device.h"
#include "include/usb/usb_device_class.h"
#include "include/usb/usb_device_hid.h"
-#include "usb_device_descriptor.h"
+#include "usb_descriptor_device.h"
#include "composite.h"
-#include "hid_keyboard.h"
-#include "hid_mouse.h"
-#include "hid_generic.h"
-
-uint8_t UsbDeviceDescriptor[USB_DESCRIPTOR_LENGTH_DEVICE] = {
- USB_DESCRIPTOR_LENGTH_DEVICE,
- USB_DESCRIPTOR_TYPE_DEVICE,
- USB_SHORT_GET_LOW(USB_DEVICE_SPECIFICATION_VERSION),
- USB_SHORT_GET_HIGH(USB_DEVICE_SPECIFICATION_VERSION),
- USB_DEVICE_CLASS,
- USB_DEVICE_SUBCLASS,
- USB_DEVICE_PROTOCOL,
- USB_CONTROL_MAX_PACKET_SIZE,
- USB_SHORT_GET_LOW(USB_DEVICE_VENDOR_ID),
- USB_SHORT_GET_HIGH(USB_DEVICE_VENDOR_ID),
- USB_SHORT_GET_LOW(USB_DEVICE_PRODUCT_ID),
- USB_SHORT_GET_HIGH(USB_DEVICE_PRODUCT_ID),
- USB_SHORT_GET_LOW(USB_DEVICE_RELEASE_NUMBER),
- USB_SHORT_GET_HIGH(USB_DEVICE_RELEASE_NUMBER),
- USB_STRING_DESCRIPTOR_ID_MANUFACTURER,
- USB_STRING_DESCRIPTOR_ID_PRODUCT,
- USB_STRING_DESCRIPTOR_ID_SUPPORTED_LANGUAGES,
- USB_DEVICE_CONFIGURATION_COUNT,
-};
+#include "usb_class_keyboard.h"
+#include "usb_class_mouse.h"
+#include "usb_class_generic_hid.h"
+#include "usb_descriptor_keyboard_report.h"
+#include "usb_descriptor_mouse_report.h"
+#include "usb_descriptor_generic_hid_report.h"
+#include "usb_descriptor_configuration.h"
uint8_t UsbConfigurationDescriptor[USB_CONFIGURATION_DESCRIPTOR_TOTAL_LENGTH] = {
@@ -159,87 +142,6 @@ uint8_t UsbConfigurationDescriptor[USB_CONFIGURATION_DESCRIPTOR_TOTAL_LENGTH] =
USB_GENERIC_HID_INTERRUPT_IN_INTERVAL,
};
-uint8_t UsbLanguageListStringDescriptor[USB_LANGUAGE_LIST_STRING_DESCRIPTOR_LENGTH] = {
- sizeof(UsbLanguageListStringDescriptor),
- USB_DESCRIPTOR_TYPE_STRING,
- USB_SHORT_GET_LOW(USB_LANGUAGE_ID_UNITED_STATES),
- USB_SHORT_GET_HIGH(USB_LANGUAGE_ID_UNITED_STATES)
-};
-
-uint8_t UsbManufacturerString[USB_MANUFACTURER_STRING_DESCRIPTOR_LENGTH] = {
- sizeof(UsbManufacturerString),
- USB_DESCRIPTOR_TYPE_STRING,
- 'F', 0x00U,
- 'R', 0x00U,
- 'E', 0x00U,
- 'E', 0x00U,
- 'S', 0x00U,
- 'C', 0x00U,
- 'A', 0x00U,
- 'L', 0x00U,
- 'E', 0x00U,
- ' ', 0x00U,
- 'S', 0x00U,
- 'E', 0x00U,
- 'M', 0x00U,
- 'I', 0x00U,
- 'C', 0x00U,
- 'O', 0x00U,
- 'N', 0x00U,
- 'D', 0x00U,
- 'U', 0x00U,
- 'C', 0x00U,
- 'T', 0x00U,
- 'O', 0x00U,
- 'R', 0x00U,
- ' ', 0x00U,
- 'I', 0x00U,
- 'N', 0x00U,
- 'C', 0x00U,
- '.', 0x00U,
-};
-
-uint8_t UsbProductString[USB_PRODUCT_STRING_DESCRIPTOR_LENGTH] = {
- sizeof(UsbProductString),
- USB_DESCRIPTOR_TYPE_STRING,
- 'C', 0x00U,
- 'O', 0x00U,
- 'M', 0x00U,
- 'P', 0x00U,
- 'O', 0x00U,
- 'S', 0x00U,
- 'I', 0x00U,
- 'T', 0x00U,
- 'E', 0x00U,
- ' ', 0x00U,
- 'D', 0x00U,
- 'E', 0x00U,
- 'V', 0x00U,
- 'I', 0x00U,
- 'C', 0x00U,
- 'E', 0x00U,
-};
-
-uint32_t UsbStringDescriptorLengths[USB_STRING_DESCRIPTOR_COUNT] = {
- sizeof(UsbLanguageListStringDescriptor),
- sizeof(UsbManufacturerString),
- sizeof(UsbProductString),
-};
-
-uint8_t *UsbStringDescriptors[USB_STRING_DESCRIPTOR_COUNT] = {
- UsbLanguageListStringDescriptor,
- UsbManufacturerString,
- UsbProductString,
-};
-
-usb_status_t USB_DeviceGetDeviceDescriptor(
- usb_device_handle handle, usb_device_get_device_descriptor_struct_t *deviceDescriptor)
-{
- deviceDescriptor->buffer = UsbDeviceDescriptor;
- deviceDescriptor->length = USB_DESCRIPTOR_LENGTH_DEVICE;
- return kStatus_USB_Success;
-}
-
usb_status_t USB_DeviceGetConfigurationDescriptor(
usb_device_handle handle, usb_device_get_configuration_descriptor_struct_t *configurationDescriptor)
{
@@ -251,23 +153,6 @@ usb_status_t USB_DeviceGetConfigurationDescriptor(
return kStatus_USB_InvalidRequest;
}
-usb_status_t USB_DeviceGetStringDescriptor(
- usb_device_handle handle, usb_device_get_string_descriptor_struct_t *stringDescriptor)
-{
- if (stringDescriptor->stringIndex == 0U) {
- stringDescriptor->buffer = UsbLanguageListStringDescriptor;
- stringDescriptor->length = sizeof(UsbLanguageListStringDescriptor);
- } else if (stringDescriptor->languageId == USB_LANGUAGE_ID_UNITED_STATES &&
- stringDescriptor->stringIndex < USB_STRING_DESCRIPTOR_COUNT)
- {
- stringDescriptor->buffer = UsbStringDescriptors[stringDescriptor->stringIndex];
- stringDescriptor->length = UsbStringDescriptorLengths[stringDescriptor->stringIndex];
- } else {
- return kStatus_USB_InvalidRequest;
- }
- return kStatus_USB_Success;
-}
-
usb_status_t USB_DeviceGetHidDescriptor(
usb_device_handle handle, usb_device_get_hid_descriptor_struct_t *hidDescriptor)
{
diff --git a/right/usb_device_descriptor.h b/right/usb_descriptor_configuration.h
similarity index 66%
rename from right/usb_device_descriptor.h
rename to right/usb_descriptor_configuration.h
index 4bf74f8..b0d1d7d 100644
--- a/right/usb_device_descriptor.h
+++ b/right/usb_descriptor_configuration.h
@@ -1,11 +1,11 @@
-#ifndef __USB_DEVICE_DESCRIPTOR_H__
-#define __USB_DEVICE_DESCRIPTOR_H__
+#ifndef __USB_DESCRIPTOR_CONFIGURATION_H__
+#define __USB_DESCRIPTOR_CONFIGURATION_H__
// Includes:
- #include "usb_keyboard_descriptors.h"
- #include "usb_mouse_descriptors.h"
- #include "usb_generic_hid_descriptors.h"
+ #include "usb_class_keyboard.h"
+ #include "usb_class_mouse.h"
+ #include "usb_class_generic_hid.h"
// Macros:
@@ -38,29 +38,11 @@
#define USB_HID_DESCRIPTOR_LENGTH (9U)
#define USB_CONFIGURATION_DESCRIPTOR_TOTAL_LENGTH (91U)
- // String descriptors
-
- #define USB_STRING_DESCRIPTOR_COUNT (3U)
-
- #define USB_LANGUAGE_LIST_STRING_DESCRIPTOR_LENGTH (4U)
- #define USB_MANUFACTURER_STRING_DESCRIPTOR_LENGTH (58U)
- #define USB_PRODUCT_STRING_DESCRIPTOR_LENGTH (34U)
-
- #define USB_STRING_DESCRIPTOR_ID_SUPPORTED_LANGUAGES 0U
- #define USB_STRING_DESCRIPTOR_ID_MANUFACTURER 1U
- #define USB_STRING_DESCRIPTOR_ID_PRODUCT 2U
-
// Functions:
- extern usb_status_t USB_DeviceGetDeviceDescriptor(
- usb_device_handle handle, usb_device_get_device_descriptor_struct_t *deviceDescriptor);
-
extern usb_status_t USB_DeviceGetConfigurationDescriptor(
usb_device_handle handle, usb_device_get_configuration_descriptor_struct_t *configurationDescriptor);
- extern usb_status_t USB_DeviceGetStringDescriptor(
- usb_device_handle handle, usb_device_get_string_descriptor_struct_t *stringDescriptor);
-
extern usb_status_t USB_DeviceGetHidDescriptor(
usb_device_handle handle, usb_device_get_hid_descriptor_struct_t *hidDescriptor);
diff --git a/right/usb_descriptor_device.c b/right/usb_descriptor_device.c
new file mode 100644
index 0000000..e19de91
--- /dev/null
+++ b/right/usb_descriptor_device.c
@@ -0,0 +1,40 @@
+#include "usb_device_config.h"
+#include "usb.h"
+#include "usb_device.h"
+#include "include/usb/usb_device_class.h"
+#include "include/usb/usb_device_hid.h"
+#include "usb_descriptor_device.h"
+#include "composite.h"
+#include "usb_class_keyboard.h"
+#include "usb_class_mouse.h"
+#include "usb_class_generic_hid.h"
+#include "usb_descriptor_strings.h"
+
+uint8_t UsbDeviceDescriptor[USB_DESCRIPTOR_LENGTH_DEVICE] = {
+ USB_DESCRIPTOR_LENGTH_DEVICE,
+ USB_DESCRIPTOR_TYPE_DEVICE,
+ USB_SHORT_GET_LOW(USB_DEVICE_SPECIFICATION_VERSION),
+ USB_SHORT_GET_HIGH(USB_DEVICE_SPECIFICATION_VERSION),
+ USB_DEVICE_CLASS,
+ USB_DEVICE_SUBCLASS,
+ USB_DEVICE_PROTOCOL,
+ USB_CONTROL_MAX_PACKET_SIZE,
+ USB_SHORT_GET_LOW(USB_DEVICE_VENDOR_ID),
+ USB_SHORT_GET_HIGH(USB_DEVICE_VENDOR_ID),
+ USB_SHORT_GET_LOW(USB_DEVICE_PRODUCT_ID),
+ USB_SHORT_GET_HIGH(USB_DEVICE_PRODUCT_ID),
+ USB_SHORT_GET_LOW(USB_DEVICE_RELEASE_NUMBER),
+ USB_SHORT_GET_HIGH(USB_DEVICE_RELEASE_NUMBER),
+ USB_STRING_DESCRIPTOR_ID_MANUFACTURER,
+ USB_STRING_DESCRIPTOR_ID_PRODUCT,
+ USB_STRING_DESCRIPTOR_ID_SUPPORTED_LANGUAGES,
+ USB_DEVICE_CONFIGURATION_COUNT,
+};
+
+usb_status_t USB_DeviceGetDeviceDescriptor(
+ usb_device_handle handle, usb_device_get_device_descriptor_struct_t *deviceDescriptor)
+{
+ deviceDescriptor->buffer = UsbDeviceDescriptor;
+ deviceDescriptor->length = USB_DESCRIPTOR_LENGTH_DEVICE;
+ return kStatus_USB_Success;
+}
diff --git a/right/usb_descriptor_device.h b/right/usb_descriptor_device.h
new file mode 100644
index 0000000..22c8d19
--- /dev/null
+++ b/right/usb_descriptor_device.h
@@ -0,0 +1,44 @@
+#ifndef __USB_DEVICE_DESCRIPTOR_H__
+#define __USB_DEVICE_DESCRIPTOR_H__
+
+// Includes:
+
+ #include "usb_class_keyboard.h"
+ #include "usb_class_mouse.h"
+ #include "usb_class_generic_hid.h"
+
+// Macros:
+
+ #define USB_DEVICE_CLASS (0x00U)
+ #define USB_DEVICE_SUBCLASS (0x00U)
+ #define USB_DEVICE_PROTOCOL (0x00U)
+
+ #define USB_DEVICE_SPECIFICATION_VERSION (0x0200U)
+ #define USB_HID_VERSION (0x0100U)
+
+ #define USB_DEVICE_VENDOR_ID (0x15A2U)
+ #define USB_DEVICE_PRODUCT_ID (0x007EU)
+ #define USB_DEVICE_RELEASE_NUMBER (0x0101U)
+
+ #define USB_DEVICE_CONFIGURATION_COUNT (1U)
+ #define USB_REPORT_DESCRIPTOR_COUNT_PER_HID_DEVICE (1U)
+ #define USB_DEVICE_MAX_POWER (50U) // Expressed in 2mA units
+ #define USB_COMPOSITE_INTERFACE_COUNT (USB_KEYBOARD_INTERFACE_COUNT + \
+ USB_MOUSE_INTERFACE_COUNT + \
+ USB_GENERIC_HID_INTERFACE_COUNT)
+
+ #define USB_HID_COUNTRY_CODE_NOT_SUPPORTED (0x00U)
+ #define USB_INTERFACE_ALTERNATE_SETTING_NONE (0x00U)
+ #define USB_STRING_DESCRIPTOR_NONE 0U
+
+ // Descriptor lengths
+
+ #define USB_HID_DESCRIPTOR_LENGTH (9U)
+ #define USB_CONFIGURATION_DESCRIPTOR_TOTAL_LENGTH (91U)
+
+// Functions:
+
+ extern usb_status_t USB_DeviceGetDeviceDescriptor(
+ usb_device_handle handle, usb_device_get_device_descriptor_struct_t *deviceDescriptor);
+
+#endif
diff --git a/right/usb_descriptor_generic_hid_report.c b/right/usb_descriptor_generic_hid_report.c
new file mode 100644
index 0000000..eb79056
--- /dev/null
+++ b/right/usb_descriptor_generic_hid_report.c
@@ -0,0 +1,28 @@
+#include "usb_device_config.h"
+#include "usb.h"
+#include "usb_device.h"
+#include "include/usb/usb_device_class.h"
+#include "include/usb/usb_device_hid.h"
+#include "usb_descriptor_generic_hid_report.h"
+
+uint8_t UsbGenericHidReportDescriptor[USB_GENERIC_HID_REPORT_DESCRIPTOR_LENGTH] = {
+ 0x05U, 0x81U, /* Usage Page (Vendor defined)*/
+ 0x09U, 0x82U, /* Usage (Vendor defined) */
+ 0xA1U, 0x01U, /* Collection (Application) */
+ 0x09U, 0x83U, /* Usage (Vendor defined) */
+
+ 0x09U, 0x84U, /* Usage (Vendor defined) */
+ 0x15U, 0x80U, /* Logical Minimum (-128) */
+ 0x25U, 0x7FU, /* Logical Maximum (127) */
+ 0x75U, 0x08U, /* Report Size (8U) */
+ 0x95U, 0x08U, /* Report Count (8U) */
+ 0x81U, 0x02U, /* Input(Data, Variable, Absolute) */
+
+ 0x09U, 0x84U, /* Usage (Vendor defined) */
+ 0x15U, 0x80U, /* logical Minimum (-128) */
+ 0x25U, 0x7FU, /* logical Maximum (127) */
+ 0x75U, 0x08U, /* Report Size (8U) */
+ 0x95U, 0x08U, /* Report Count (8U) */
+ 0x91U, 0x02U, /* Input (Data, Variable, Absolute) */
+ 0xC0U, /* End collection */
+};
diff --git a/right/usb_descriptor_generic_hid_report.h b/right/usb_descriptor_generic_hid_report.h
new file mode 100644
index 0000000..0c96424
--- /dev/null
+++ b/right/usb_descriptor_generic_hid_report.h
@@ -0,0 +1,12 @@
+#ifndef __USB_DESCRIPTOR_GENERIC_HID_REPORT_H__
+#define __USB_DESCRIPTOR_GENERIC_HID_REPORT_H__
+
+// Macros:
+
+ #define USB_GENERIC_HID_REPORT_DESCRIPTOR_LENGTH (33U)
+
+// Variables:
+
+ extern uint8_t UsbGenericHidReportDescriptor[USB_GENERIC_HID_REPORT_DESCRIPTOR_LENGTH];
+
+#endif
diff --git a/right/usb_keyboard_descriptors.c b/right/usb_descriptor_keyboard_report.c
similarity index 59%
rename from right/usb_keyboard_descriptors.c
rename to right/usb_descriptor_keyboard_report.c
index 957c9bd..c462278 100644
--- a/right/usb_keyboard_descriptors.c
+++ b/right/usb_descriptor_keyboard_report.c
@@ -3,40 +3,7 @@
#include "usb_device.h"
#include "include/usb/usb_device_class.h"
#include "include/usb/usb_device_hid.h"
-#include "usb_device_descriptor.h"
-#include "usb_keyboard_descriptors.h"
-
-static usb_device_endpoint_struct_t UsbKeyboardEndpoints[USB_KEYBOARD_ENDPOINT_COUNT] = {{
- USB_KEYBOARD_ENDPOINT_ID | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
- USB_ENDPOINT_INTERRUPT,
- USB_KEYBOARD_INTERRUPT_IN_PACKET_SIZE,
-}};
-
-static usb_device_interface_struct_t UsbKeyboardInterface[] = {{
- USB_KEYBOARD_INTERFACE_ALTERNATE_SETTING,
- {USB_KEYBOARD_ENDPOINT_COUNT, UsbKeyboardEndpoints},
- NULL,
-}};
-
-static usb_device_interfaces_struct_t UsbKeyboardInterfaces[USB_KEYBOARD_INTERFACE_COUNT] = {{
- USB_KEYBOARD_CLASS,
- USB_KEYBOARD_SUBCLASS,
- USB_KEYBOARD_PROTOCOL,
- USB_KEYBOARD_INTERFACE_INDEX,
- UsbKeyboardInterface,
- sizeof(UsbKeyboardInterface) / sizeof(usb_device_interfaces_struct_t),
-}};
-
-static usb_device_interface_list_t UsbKeyboardInterfaceList[USB_DEVICE_CONFIGURATION_COUNT] = {{
- USB_KEYBOARD_INTERFACE_COUNT,
- UsbKeyboardInterfaces,
-}};
-
-usb_device_class_struct_t UsbKeyboardClass = {
- UsbKeyboardInterfaceList,
- kUSB_DeviceClassTypeHid,
- USB_DEVICE_CONFIGURATION_COUNT,
-};
+#include "usb_descriptor_keyboard_report.h"
uint8_t UsbKeyboardReportDescriptor[USB_KEYBOARD_REPORT_DESCRIPTOR_LENGTH] = {
0x05U, 0x01U, // Usage Page (Generic Desktop)
diff --git a/right/usb_descriptor_keyboard_report.h b/right/usb_descriptor_keyboard_report.h
new file mode 100644
index 0000000..36c3748
--- /dev/null
+++ b/right/usb_descriptor_keyboard_report.h
@@ -0,0 +1,12 @@
+#ifndef __USB_DESCRIPTOR_KEYBOARD_H__
+#define __USB_DESCRIPTOR_KEYBOARD_H__
+
+// Macros:
+
+ #define USB_KEYBOARD_REPORT_DESCRIPTOR_LENGTH (63U)
+
+// Variables:
+
+ extern uint8_t UsbKeyboardReportDescriptor[USB_KEYBOARD_REPORT_DESCRIPTOR_LENGTH];
+
+#endif
diff --git a/right/usb_mouse_descriptors.c b/right/usb_descriptor_mouse_report.c
similarity index 56%
rename from right/usb_mouse_descriptors.c
rename to right/usb_descriptor_mouse_report.c
index 0820992..227ee31 100644
--- a/right/usb_mouse_descriptors.c
+++ b/right/usb_descriptor_mouse_report.c
@@ -3,42 +3,7 @@
#include "usb_device.h"
#include "include/usb/usb_device_class.h"
#include "include/usb/usb_device_hid.h"
-#include "usb_device_descriptor.h"
-#include "composite.h"
-#include "hid_mouse.h"
-#include "hid_keyboard.h"
-
-static usb_device_endpoint_struct_t UsbMouseEndpoints[USB_MOUSE_ENDPOINT_COUNT] = {{
- USB_MOUSE_ENDPOINT_ID | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
- USB_ENDPOINT_INTERRUPT,
- USB_MOUSE_INTERRUPT_IN_PACKET_SIZE,
-}};
-
-static usb_device_interface_struct_t UsbMouseInterface[] = {{
- USB_MOUSE_INTERFACE_ALTERNATE_SETTING,
- {USB_MOUSE_ENDPOINT_COUNT, UsbMouseEndpoints},
- NULL,
-}};
-
-static usb_device_interfaces_struct_t UsbMouseInterfaces[USB_MOUSE_INTERFACE_COUNT] = {{
- USB_MOUSE_CLASS,
- USB_MOUSE_SUBCLASS,
- USB_MOUSE_PROTOCOL,
- USB_MOUSE_INTERFACE_INDEX,
- UsbMouseInterface,
- sizeof(UsbMouseInterface) / sizeof(usb_device_interfaces_struct_t),
-}};
-
-static usb_device_interface_list_t UsbMouseInterfaceList[USB_DEVICE_CONFIGURATION_COUNT] = {{
- USB_MOUSE_INTERFACE_COUNT,
- UsbMouseInterfaces,
-}};
-
-usb_device_class_struct_t UsbMouseClass = {
- UsbMouseInterfaceList,
- kUSB_DeviceClassTypeHid,
- USB_DEVICE_CONFIGURATION_COUNT,
-};
+#include "usb_descriptor_mouse_report.h"
uint8_t UsbMouseReportDescriptor[USB_MOUSE_REPORT_DESCRIPTOR_LENGTH] = {
0x05U, 0x01U, // Usage Page (Generic Desktop)
diff --git a/right/usb_descriptor_mouse_report.h b/right/usb_descriptor_mouse_report.h
new file mode 100644
index 0000000..be52e20
--- /dev/null
+++ b/right/usb_descriptor_mouse_report.h
@@ -0,0 +1,12 @@
+#ifndef __USB_DESCRIPTOR_MOUSE_REPORT_H__
+#define __USB_DESCRIPTOR_MOUSE_REPORT_H__
+
+// Macros:
+
+ #define USB_MOUSE_REPORT_DESCRIPTOR_LENGTH (52U)
+
+// Variables:
+
+ extern uint8_t UsbMouseReportDescriptor[USB_MOUSE_REPORT_DESCRIPTOR_LENGTH];
+
+#endif
diff --git a/right/usb_descriptor_strings.c b/right/usb_descriptor_strings.c
new file mode 100644
index 0000000..111de4e
--- /dev/null
+++ b/right/usb_descriptor_strings.c
@@ -0,0 +1,96 @@
+#include "usb_device_config.h"
+#include "usb.h"
+#include "usb_device.h"
+#include "include/usb/usb_device_class.h"
+#include "include/usb/usb_device_hid.h"
+#include "usb_descriptor_strings.h"
+
+uint8_t UsbLanguageListStringDescriptor[USB_LANGUAGE_LIST_STRING_DESCRIPTOR_LENGTH] = {
+ sizeof(UsbLanguageListStringDescriptor),
+ USB_DESCRIPTOR_TYPE_STRING,
+ USB_SHORT_GET_LOW(USB_LANGUAGE_ID_UNITED_STATES),
+ USB_SHORT_GET_HIGH(USB_LANGUAGE_ID_UNITED_STATES)
+};
+
+uint8_t UsbManufacturerString[USB_MANUFACTURER_STRING_DESCRIPTOR_LENGTH] = {
+ sizeof(UsbManufacturerString),
+ USB_DESCRIPTOR_TYPE_STRING,
+ 'F', 0x00U,
+ 'R', 0x00U,
+ 'E', 0x00U,
+ 'E', 0x00U,
+ 'S', 0x00U,
+ 'C', 0x00U,
+ 'A', 0x00U,
+ 'L', 0x00U,
+ 'E', 0x00U,
+ ' ', 0x00U,
+ 'S', 0x00U,
+ 'E', 0x00U,
+ 'M', 0x00U,
+ 'I', 0x00U,
+ 'C', 0x00U,
+ 'O', 0x00U,
+ 'N', 0x00U,
+ 'D', 0x00U,
+ 'U', 0x00U,
+ 'C', 0x00U,
+ 'T', 0x00U,
+ 'O', 0x00U,
+ 'R', 0x00U,
+ ' ', 0x00U,
+ 'I', 0x00U,
+ 'N', 0x00U,
+ 'C', 0x00U,
+ '.', 0x00U,
+};
+
+uint8_t UsbProductString[USB_PRODUCT_STRING_DESCRIPTOR_LENGTH] = {
+ sizeof(UsbProductString),
+ USB_DESCRIPTOR_TYPE_STRING,
+ 'C', 0x00U,
+ 'O', 0x00U,
+ 'M', 0x00U,
+ 'P', 0x00U,
+ 'O', 0x00U,
+ 'S', 0x00U,
+ 'I', 0x00U,
+ 'T', 0x00U,
+ 'E', 0x00U,
+ ' ', 0x00U,
+ 'D', 0x00U,
+ 'E', 0x00U,
+ 'V', 0x00U,
+ 'I', 0x00U,
+ 'C', 0x00U,
+ 'E', 0x00U,
+};
+
+uint32_t UsbStringDescriptorLengths[USB_STRING_DESCRIPTOR_COUNT] = {
+ sizeof(UsbLanguageListStringDescriptor),
+ sizeof(UsbManufacturerString),
+ sizeof(UsbProductString),
+};
+
+uint8_t *UsbStringDescriptors[USB_STRING_DESCRIPTOR_COUNT] = {
+ UsbLanguageListStringDescriptor,
+ UsbManufacturerString,
+ UsbProductString,
+};
+
+usb_status_t USB_DeviceGetStringDescriptor(
+ usb_device_handle handle, usb_device_get_string_descriptor_struct_t *stringDescriptor)
+{
+ if (stringDescriptor->stringIndex == 0U) {
+ stringDescriptor->buffer = UsbLanguageListStringDescriptor;
+ stringDescriptor->length = sizeof(UsbLanguageListStringDescriptor);
+ } else if (stringDescriptor->languageId == USB_LANGUAGE_ID_UNITED_STATES &&
+ stringDescriptor->stringIndex < USB_STRING_DESCRIPTOR_COUNT)
+ {
+ stringDescriptor->buffer = UsbStringDescriptors[stringDescriptor->stringIndex];
+ stringDescriptor->length = UsbStringDescriptorLengths[stringDescriptor->stringIndex];
+ } else {
+ return kStatus_USB_InvalidRequest;
+ }
+ return kStatus_USB_Success;
+}
diff --git a/right/usb_descriptor_strings.h b/right/usb_descriptor_strings.h
new file mode 100644
index 0000000..b14d40c
--- /dev/null
+++ b/right/usb_descriptor_strings.h
@@ -0,0 +1,23 @@
+#ifndef __USB_DESCRIPTOR_STRINGS_H__
+#define __USB_DESCRIPTOR_STRINGS_H__
+
+// Macros:
+
+ #define USB_LANGUAGE_ID_UNITED_STATES (0x0409U)
+
+ #define USB_STRING_DESCRIPTOR_COUNT (3U)
+
+ #define USB_LANGUAGE_LIST_STRING_DESCRIPTOR_LENGTH (4U)
+ #define USB_MANUFACTURER_STRING_DESCRIPTOR_LENGTH (58U)
+ #define USB_PRODUCT_STRING_DESCRIPTOR_LENGTH (34U)
+
+ #define USB_STRING_DESCRIPTOR_ID_SUPPORTED_LANGUAGES 0U
+ #define USB_STRING_DESCRIPTOR_ID_MANUFACTURER 1U
+ #define USB_STRING_DESCRIPTOR_ID_PRODUCT 2U
+
+// Functions:
+
+ extern usb_status_t USB_DeviceGetStringDescriptor(
+ usb_device_handle handle, usb_device_get_string_descriptor_struct_t *stringDescriptor);
+
+#endif
diff --git a/right/hid_generic.c b/right/usb_interface_generic_hid.c
similarity index 96%
rename from right/hid_generic.c
rename to right/usb_interface_generic_hid.c
index 1e1600f..b4cb907 100644
--- a/right/hid_generic.c
+++ b/right/usb_interface_generic_hid.c
@@ -6,10 +6,11 @@
#include "include/usb/usb_device_class.h"
#include "include/usb/usb_device_hid.h"
#include "include/usb/usb_device_ch9.h"
-#include "usb_device_descriptor.h"
+#include "usb_interface_generic_hid.h"
+#include "usb_class_generic_hid.h"
+#include "usb_descriptor_configuration.h"
#include "composite.h"
#include "scancodes.h"
-#include "hid_generic.h"
static usb_device_generic_hid_struct_t UsbGenericHidDevice;
diff --git a/right/hid_generic.h b/right/usb_interface_generic_hid.h
similarity index 100%
rename from right/hid_generic.h
rename to right/usb_interface_generic_hid.h
diff --git a/right/hid_keyboard.c b/right/usb_interface_keyboard.c
similarity index 94%
rename from right/hid_keyboard.c
rename to right/usb_interface_keyboard.c
index 529c165..6975bfc 100644
--- a/right/hid_keyboard.c
+++ b/right/usb_interface_keyboard.c
@@ -6,10 +6,11 @@
#include "include/usb/usb_device_class.h"
#include "include/usb/usb_device_hid.h"
#include "include/usb/usb_device_ch9.h"
-#include "usb_device_descriptor.h"
#include "composite.h"
#include "scancodes.h"
-#include "hid_keyboard.h"
+#include "usb_interface_keyboard.h"
+#include "usb_class_keyboard.h"
+#include "usb_descriptor_configuration.h"
static usb_device_hid_keyboard_struct_t UsbKeyboardDevice;
diff --git a/right/hid_keyboard.h b/right/usb_interface_keyboard.h
similarity index 100%
rename from right/hid_keyboard.h
rename to right/usb_interface_keyboard.h
diff --git a/right/hid_mouse.c b/right/usb_interface_mouse.c
similarity index 92%
rename from right/hid_mouse.c
rename to right/usb_interface_mouse.c
index 8d99611..dfe8df9 100644
--- a/right/hid_mouse.c
+++ b/right/usb_interface_mouse.c
@@ -6,9 +6,10 @@
#include "include/usb/usb_device_class.h"
#include "include/usb/usb_device_hid.h"
#include "include/usb/usb_device_ch9.h"
-#include "usb_device_descriptor.h"
#include "composite.h"
-#include "hid_mouse.h"
+#include "usb_class_mouse.h"
+#include "usb_interface_mouse.h"
+#include "usb_descriptor_configuration.h"
static usb_device_hid_mouse_struct_t UsbMouseDevice;
@@ -60,7 +61,7 @@ usb_status_t UsbMouseSetConfiguration(class_handle_t handle, uint8_t configurati
usb_status_t UsbMouseSetInterface(class_handle_t handle, uint8_t interface, uint8_t alternateSetting)
{
- if (USB_KEYBOARD_INTERFACE_INDEX == interface) {
+ if (USB_MOUSE_INTERFACE_INDEX == interface) {
return UsbMouseAction();
}
return kStatus_USB_Error;
diff --git a/right/hid_mouse.h b/right/usb_interface_mouse.h
similarity index 100%
rename from right/hid_mouse.h
rename to right/usb_interface_mouse.h