Merge usb_class_*.[ch] into usb_interface_*.[ch] respectively.
This commit is contained in:
@@ -190,36 +190,6 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/composite.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>sources/usb_class_generic_hid.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/usb_class_generic_hid.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>sources/usb_class_generic_hid.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/usb_class_generic_hid.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>sources/usb_class_keyboard.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/usb_class_keyboard.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>sources/usb_class_keyboard.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/usb_class_keyboard.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>sources/usb_class_mouse.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/usb_class_mouse.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>sources/usb_class_mouse.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/usb_class_mouse.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>sources/usb_descriptor_configuration.c</name>
|
||||
<type>1</type>
|
||||
|
||||
@@ -17,9 +17,6 @@
|
||||
#include <stdlib.h>
|
||||
#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);
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
@@ -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
|
||||
@@ -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,
|
||||
};
|
||||
@@ -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
|
||||
@@ -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,
|
||||
};
|
||||
@@ -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
|
||||
@@ -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"
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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] = {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#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] = {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user