diff --git a/right/build/kds/.project b/right/build/kds/.project
index 2d966a1..32f185d 100644
--- a/right/build/kds/.project
+++ b/right/build/kds/.project
@@ -190,36 +190,6 @@
1
PARENT-2-PROJECT_LOC/composite.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
diff --git a/right/composite.c b/right/composite.c
index 14f2456..b8f959b 100644
--- a/right/composite.c
+++ b/right/composite.c
@@ -17,9 +17,6 @@
#include
#include "fsl_common.h"
#include "include/board/pin_mux.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);
diff --git a/right/usb_class_generic_hid.c b/right/usb_class_generic_hid.c
deleted file mode 100644
index a77261f..0000000
--- a/right/usb_class_generic_hid.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#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_generic_hid.h"
-
-static usb_device_endpoint_struct_t UsbGenericHidEndpoints[USB_GENERIC_HID_ENDPOINT_COUNT] =
-{
- {
- USB_GENERIC_HID_ENDPOINT_IN_ID | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
- USB_ENDPOINT_INTERRUPT,
- USB_GENERIC_HID_INTERRUPT_IN_PACKET_SIZE,
- },
- {
- USB_GENERIC_HID_ENDPOINT_OUT_ID | (USB_OUT << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
- USB_ENDPOINT_INTERRUPT,
- USB_GENERIC_HID_INTERRUPT_OUT_PACKET_SIZE,
- }
-};
-
-static usb_device_interface_struct_t UsbGenericHidInterface[] = {{
- USB_GENERIC_HID_INTERFACE_ALTERNATE_SETTING,
- {USB_GENERIC_HID_ENDPOINT_COUNT, UsbGenericHidEndpoints},
- NULL,
-}};
-
-static usb_device_interfaces_struct_t UsbGenericHidInterfaces[USB_GENERIC_HID_INTERFACE_COUNT] = {{
- USB_GENERIC_HID_CLASS,
- USB_GENERIC_HID_SUBCLASS,
- USB_GENERIC_HID_PROTOCOL,
- USB_GENERIC_HID_INTERFACE_INDEX,
- UsbGenericHidInterface,
- sizeof(UsbGenericHidInterface) / sizeof(usb_device_interfaces_struct_t),
-}};
-
-static usb_device_interface_list_t UsbGenericHidInterfaceList[USB_DEVICE_CONFIGURATION_COUNT] = {{
- USB_GENERIC_HID_INTERFACE_COUNT,
- UsbGenericHidInterfaces,
-}};
-
-usb_device_class_struct_t UsbGenericHidClass = {
- UsbGenericHidInterfaceList,
- kUSB_DeviceClassTypeHid,
- USB_DEVICE_CONFIGURATION_COUNT,
-};
diff --git a/right/usb_class_generic_hid.h b/right/usb_class_generic_hid.h
deleted file mode 100644
index e64c533..0000000
--- a/right/usb_class_generic_hid.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef __USB_CLASS_GENERIC_HID_H__
-#define __USB_CLASS_GENERIC_HID_H__
-
-// Includes:
-
- #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"
-
-// Macros:
-
- #define USB_GENERIC_HID_CLASS (0x03U)
- #define USB_GENERIC_HID_SUBCLASS (0x00U)
- #define USB_GENERIC_HID_PROTOCOL (0x00U)
-
- #define USB_GENERIC_HID_INTERFACE_INDEX (2U)
- #define USB_GENERIC_HID_INTERFACE_COUNT (1U)
- #define USB_GENERIC_HID_INTERFACE_ALTERNATE_SETTING (0U)
-
- #define USB_GENERIC_HID_ENDPOINT_IN_ID (3U)
- #define USB_GENERIC_HID_ENDPOINT_OUT_ID (4U)
- #define USB_GENERIC_HID_ENDPOINT_COUNT (2U)
-
- #define USB_GENERIC_HID_INTERRUPT_IN_PACKET_SIZE (64U)
- #define USB_GENERIC_HID_INTERRUPT_IN_INTERVAL (0x04U)
- #define USB_GENERIC_HID_INTERRUPT_OUT_PACKET_SIZE (64U)
- #define USB_GENERIC_HID_INTERRUPT_OUT_INTERVAL (0x04U)
-
-// Variables:
-
- extern usb_device_class_struct_t UsbGenericHidClass;
-
-#endif
diff --git a/right/usb_class_keyboard.c b/right/usb_class_keyboard.c
deleted file mode 100644
index 81c4978..0000000
--- a/right/usb_class_keyboard.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#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_class_keyboard.h b/right/usb_class_keyboard.h
deleted file mode 100644
index d3b78ff..0000000
--- a/right/usb_class_keyboard.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef __USB_CLASS_KEYBOARD_H__
-#define __USB_CLASS_KEYBOARD_H__
-
-// Macros:
-
- #define USB_KEYBOARD_CLASS (0x03U)
- #define USB_KEYBOARD_SUBCLASS (0x01U)
- #define USB_KEYBOARD_PROTOCOL (0x01U)
-
- #define USB_KEYBOARD_INTERFACE_INDEX (1U)
- #define USB_KEYBOARD_INTERFACE_COUNT (1U)
- #define USB_KEYBOARD_INTERFACE_ALTERNATE_SETTING (0U)
-
- #define USB_KEYBOARD_ENDPOINT_ID (2U)
- #define USB_KEYBOARD_ENDPOINT_COUNT (1U)
-
- #define USB_KEYBOARD_INTERRUPT_IN_PACKET_SIZE (8U)
- #define USB_KEYBOARD_INTERRUPT_IN_INTERVAL (0x04U)
-
-// Variables:
-
- extern usb_device_class_struct_t UsbKeyboardClass;
-
-#endif
diff --git a/right/usb_class_mouse.c b/right/usb_class_mouse.c
deleted file mode 100644
index e3f2e8c..0000000
--- a/right/usb_class_mouse.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#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_class_mouse.h b/right/usb_class_mouse.h
deleted file mode 100644
index 0327749..0000000
--- a/right/usb_class_mouse.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef __USB_CLASS_MOUSE_H__
-#define __USB_CLASS_MOUSE_H__
-
-// Macros:
-
- #define USB_MOUSE_CLASS (0x03U)
- #define USB_MOUSE_SUBCLASS (0x01U)
- #define USB_MOUSE_PROTOCOL (0x02U)
-
- #define USB_MOUSE_INTERFACE_INDEX (0U)
- #define USB_MOUSE_INTERFACE_COUNT (1U)
- #define USB_MOUSE_INTERFACE_ALTERNATE_SETTING (0U)
-
- #define USB_MOUSE_ENDPOINT_ID (1U)
- #define USB_MOUSE_ENDPOINT_COUNT (1U)
-
- #define USB_MOUSE_INTERRUPT_IN_PACKET_SIZE (8U)
- #define USB_MOUSE_INTERRUPT_IN_INTERVAL (0x04U)
-
-// Variables:
-
- extern usb_device_class_struct_t UsbMouseClass;
-
-#endif
diff --git a/right/usb_descriptor_configuration.c b/right/usb_descriptor_configuration.c
index 34967d4..3744647 100644
--- a/right/usb_descriptor_configuration.c
+++ b/right/usb_descriptor_configuration.c
@@ -5,9 +5,6 @@
#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_keyboard_report.h"
#include "usb_descriptor_mouse_report.h"
#include "usb_descriptor_generic_hid_report.h"
diff --git a/right/usb_descriptor_configuration.h b/right/usb_descriptor_configuration.h
index b0d1d7d..f3c26d6 100644
--- a/right/usb_descriptor_configuration.h
+++ b/right/usb_descriptor_configuration.h
@@ -3,9 +3,9 @@
// Includes:
- #include "usb_class_keyboard.h"
- #include "usb_class_mouse.h"
- #include "usb_class_generic_hid.h"
+ #include "usb_interface_keyboard.h"
+ #include "usb_interface_mouse.h"
+ #include "usb_interface_generic_hid.h"
// Macros:
diff --git a/right/usb_descriptor_device.c b/right/usb_descriptor_device.c
index e19de91..a29fa42 100644
--- a/right/usb_descriptor_device.c
+++ b/right/usb_descriptor_device.c
@@ -5,9 +5,6 @@
#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] = {
diff --git a/right/usb_descriptor_device.h b/right/usb_descriptor_device.h
index 22c8d19..d135c12 100644
--- a/right/usb_descriptor_device.h
+++ b/right/usb_descriptor_device.h
@@ -1,12 +1,6 @@
#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)
diff --git a/right/usb_descriptor_generic_hid_report.c b/right/usb_descriptor_generic_hid_report.c
index ed7d773..dd49c81 100644
--- a/right/usb_descriptor_generic_hid_report.c
+++ b/right/usb_descriptor_generic_hid_report.c
@@ -1,6 +1,6 @@
#include
#include "usb_report_item_macros.h"
-#include "usb_class_generic_hid.h"
+#include "usb_interface_generic_hid.h"
#include "usb_descriptor_generic_hid_report.h"
uint8_t UsbGenericHidReportDescriptor[USB_GENERIC_HID_REPORT_DESCRIPTOR_LENGTH] = {
diff --git a/right/usb_interface_generic_hid.c b/right/usb_interface_generic_hid.c
index c6c38bc..4146209 100644
--- a/right/usb_interface_generic_hid.c
+++ b/right/usb_interface_generic_hid.c
@@ -7,10 +7,49 @@
#include "include/usb/usb_device_hid.h"
#include "include/usb/usb_device_ch9.h"
#include "usb_interface_generic_hid.h"
-#include "usb_class_generic_hid.h"
#include "usb_descriptor_configuration.h"
#include "composite.h"
+static usb_device_endpoint_struct_t UsbGenericHidEndpoints[USB_GENERIC_HID_ENDPOINT_COUNT] =
+{
+ {
+ USB_GENERIC_HID_ENDPOINT_IN_ID | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
+ USB_ENDPOINT_INTERRUPT,
+ USB_GENERIC_HID_INTERRUPT_IN_PACKET_SIZE,
+ },
+ {
+ USB_GENERIC_HID_ENDPOINT_OUT_ID | (USB_OUT << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
+ USB_ENDPOINT_INTERRUPT,
+ USB_GENERIC_HID_INTERRUPT_OUT_PACKET_SIZE,
+ }
+};
+
+static usb_device_interface_struct_t UsbGenericHidInterface[] = {{
+ USB_GENERIC_HID_INTERFACE_ALTERNATE_SETTING,
+ {USB_GENERIC_HID_ENDPOINT_COUNT, UsbGenericHidEndpoints},
+ NULL,
+}};
+
+static usb_device_interfaces_struct_t UsbGenericHidInterfaces[USB_GENERIC_HID_INTERFACE_COUNT] = {{
+ USB_GENERIC_HID_CLASS,
+ USB_GENERIC_HID_SUBCLASS,
+ USB_GENERIC_HID_PROTOCOL,
+ USB_GENERIC_HID_INTERFACE_INDEX,
+ UsbGenericHidInterface,
+ sizeof(UsbGenericHidInterface) / sizeof(usb_device_interfaces_struct_t),
+}};
+
+static usb_device_interface_list_t UsbGenericHidInterfaceList[USB_DEVICE_CONFIGURATION_COUNT] = {{
+ USB_GENERIC_HID_INTERFACE_COUNT,
+ UsbGenericHidInterfaces,
+}};
+
+usb_device_class_struct_t UsbGenericHidClass = {
+ UsbGenericHidInterfaceList,
+ kUSB_DeviceClassTypeHid,
+ USB_DEVICE_CONFIGURATION_COUNT,
+};
+
static uint8_t GenericHidBuffer[2][USB_GENERIC_HID_IN_BUFFER_LENGTH];
static uint8_t GenericHidBufferIndex;
diff --git a/right/usb_interface_generic_hid.h b/right/usb_interface_generic_hid.h
index 5ce5bfe..910bde4 100644
--- a/right/usb_interface_generic_hid.h
+++ b/right/usb_interface_generic_hid.h
@@ -1,11 +1,41 @@
#ifndef __HID_GENERIC_H__
#define __HID_GENERIC_H__
+// Includes:
+
+ #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"
+
// Macros:
+ #define USB_GENERIC_HID_CLASS (0x03U)
+ #define USB_GENERIC_HID_SUBCLASS (0x00U)
+ #define USB_GENERIC_HID_PROTOCOL (0x00U)
+
+ #define USB_GENERIC_HID_INTERFACE_INDEX (2U)
+ #define USB_GENERIC_HID_INTERFACE_COUNT (1U)
+ #define USB_GENERIC_HID_INTERFACE_ALTERNATE_SETTING (0U)
+
+ #define USB_GENERIC_HID_ENDPOINT_IN_ID (3U)
+ #define USB_GENERIC_HID_ENDPOINT_OUT_ID (4U)
+ #define USB_GENERIC_HID_ENDPOINT_COUNT (2U)
+
+ #define USB_GENERIC_HID_INTERRUPT_IN_PACKET_SIZE (64U)
+ #define USB_GENERIC_HID_INTERRUPT_IN_INTERVAL (0x04U)
+ #define USB_GENERIC_HID_INTERRUPT_OUT_PACKET_SIZE (64U)
+ #define USB_GENERIC_HID_INTERRUPT_OUT_INTERVAL (0x04U)
+
#define USB_GENERIC_HID_IN_BUFFER_LENGTH (64U)
#define USB_GENERIC_HID_OUT_BUFFER_LENGTH (64U)
+// Variables:
+
+ extern usb_device_class_struct_t UsbGenericHidClass;
+
// Functions:
extern usb_status_t UsbGenericHidCallback(class_handle_t handle, uint32_t event, void *param);
diff --git a/right/usb_interface_keyboard.c b/right/usb_interface_keyboard.c
index 79bfe24..1802ba0 100644
--- a/right/usb_interface_keyboard.c
+++ b/right/usb_interface_keyboard.c
@@ -9,9 +9,40 @@
#include "composite.h"
#include "include/lufa/HIDClassCommon.h"
#include "usb_interface_keyboard.h"
-#include "usb_class_keyboard.h"
#include "usb_descriptor_configuration.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,
+};
+
static usb_keyboard_report_t UsbKeyboardReport;
static usb_status_t UsbKeyboardAction(void)
diff --git a/right/usb_interface_keyboard.h b/right/usb_interface_keyboard.h
index 36ef972..4f3eaa7 100644
--- a/right/usb_interface_keyboard.h
+++ b/right/usb_interface_keyboard.h
@@ -7,6 +7,20 @@
// Macros:
+ #define USB_KEYBOARD_CLASS (0x03U)
+ #define USB_KEYBOARD_SUBCLASS (0x01U)
+ #define USB_KEYBOARD_PROTOCOL (0x01U)
+
+ #define USB_KEYBOARD_INTERFACE_INDEX (1U)
+ #define USB_KEYBOARD_INTERFACE_COUNT (1U)
+ #define USB_KEYBOARD_INTERFACE_ALTERNATE_SETTING (0U)
+
+ #define USB_KEYBOARD_ENDPOINT_ID (2U)
+ #define USB_KEYBOARD_ENDPOINT_COUNT (1U)
+
+ #define USB_KEYBOARD_INTERRUPT_IN_PACKET_SIZE (8U)
+ #define USB_KEYBOARD_INTERRUPT_IN_INTERVAL (0x04U)
+
#define USB_KEYBOARD_REPORT_LENGTH (0x08U)
// Typedefs:
@@ -17,6 +31,9 @@
uint8_t scancodes[USB_KEYBOARD_MAX_KEYS];
} __attribute__ ((packed)) usb_keyboard_report_t;
+// Variables:
+ extern usb_device_class_struct_t UsbKeyboardClass;
+
// Functions:
extern usb_status_t UsbKeyboardCallback(class_handle_t handle, uint32_t event, void *param);
diff --git a/right/usb_interface_mouse.c b/right/usb_interface_mouse.c
index b7fbbc7..b105044 100644
--- a/right/usb_interface_mouse.c
+++ b/right/usb_interface_mouse.c
@@ -7,10 +7,42 @@
#include "include/usb/usb_device_hid.h"
#include "include/usb/usb_device_ch9.h"
#include "composite.h"
-#include "usb_class_mouse.h"
#include "usb_interface_mouse.h"
#include "usb_descriptor_configuration.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,
+};
+
static usb_mouse_report_t UsbMouseReport;
static uint8_t scrollCounter = 0;
diff --git a/right/usb_interface_mouse.h b/right/usb_interface_mouse.h
index 06af15c..b7e8699 100644
--- a/right/usb_interface_mouse.h
+++ b/right/usb_interface_mouse.h
@@ -3,6 +3,20 @@
// Macros:
+ #define USB_MOUSE_CLASS (0x03U)
+ #define USB_MOUSE_SUBCLASS (0x01U)
+ #define USB_MOUSE_PROTOCOL (0x02U)
+
+ #define USB_MOUSE_INTERFACE_INDEX (0U)
+ #define USB_MOUSE_INTERFACE_COUNT (1U)
+ #define USB_MOUSE_INTERFACE_ALTERNATE_SETTING (0U)
+
+ #define USB_MOUSE_ENDPOINT_ID (1U)
+ #define USB_MOUSE_ENDPOINT_COUNT (1U)
+
+ #define USB_MOUSE_INTERRUPT_IN_PACKET_SIZE (8U)
+ #define USB_MOUSE_INTERRUPT_IN_INTERVAL (0x04U)
+
#define USB_MOUSE_REPORT_LENGTH (0x07U)
// Typedefs:
@@ -15,6 +29,10 @@
int8_t wheelY;
} __attribute__ ((packed)) usb_mouse_report_t;
+// Variables:
+
+ extern usb_device_class_struct_t UsbMouseClass;
+
// Functions:
extern usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param);