Rename keyboard_descriptors.[ch] to usb_keyboard_descriptors.[ch]
This commit is contained in:
@@ -173,8 +173,8 @@ add_executable(dev_composite_hid_mouse_hid_keyboard_bm.elf
|
||||
"${SrcDir}/hid_mouse.h"
|
||||
"${SrcDir}/hid_keyboard.c"
|
||||
"${SrcDir}/hid_keyboard.h"
|
||||
"${SrcDir}/keyboard_descriptors.c"
|
||||
"${SrcDir}/keyboard_descriptors.h"
|
||||
"${SrcDir}/usb_keyboard_descriptors.c"
|
||||
"${SrcDir}/usb_keyboard_descriptors.h"
|
||||
"${SrcDir}/usb_device_descriptor.c"
|
||||
"${SrcDir}/usb_device_descriptor.h"
|
||||
"${SrcDir}/usb_device_config.h"
|
||||
|
||||
@@ -205,16 +205,6 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/hid_mouse.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>sources/keyboard_descriptors.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/keyboard_descriptors.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>sources/keyboard_descriptors.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/keyboard_descriptors.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>sources/usb_device_config.h</name>
|
||||
<type>1</type>
|
||||
@@ -230,6 +220,16 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/usb_device_descriptor.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>sources/usb_keyboard_descriptors.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/usb_keyboard_descriptors.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>sources/usb_keyboard_descriptors.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/usb_keyboard_descriptors.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>startup/startup_MK22F51212.S</name>
|
||||
<type>1</type>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "fsl_common.h"
|
||||
#include "include/board/pin_mux.h"
|
||||
#include "keyboard_descriptors.h"
|
||||
#include "usb_keyboard_descriptors.h"
|
||||
|
||||
void BOARD_InitHardware(void);
|
||||
|
||||
|
||||
@@ -1,117 +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_device_descriptor.h"
|
||||
#include "keyboard_descriptors.h"
|
||||
|
||||
static usb_device_endpoint_struct_t UsbKeyboardEndpoints[USB_HID_KEYBOARD_ENDPOINT_COUNT] =
|
||||
{
|
||||
{
|
||||
USB_HID_KEYBOARD_ENDPOINT_IN | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
|
||||
USB_ENDPOINT_INTERRUPT, FS_HID_KEYBOARD_INTERRUPT_IN_PACKET_SIZE,
|
||||
},
|
||||
};
|
||||
|
||||
static usb_device_interface_struct_t UsbKeyboardInterface[] =
|
||||
{
|
||||
{
|
||||
USB_KEYBOARD_INTERFACE_ALTERNATE_SETTING,
|
||||
{
|
||||
USB_HID_KEYBOARD_ENDPOINT_COUNT,
|
||||
UsbKeyboardEndpoints,
|
||||
},
|
||||
NULL,
|
||||
}
|
||||
};
|
||||
|
||||
static usb_device_interfaces_struct_t UsbKeyboardInterfaces[USB_HID_KEYBOARD_INTERFACE_COUNT] =
|
||||
{
|
||||
{
|
||||
USB_HID_KEYBOARD_CLASS,
|
||||
USB_HID_KEYBOARD_SUBCLASS,
|
||||
USB_HID_KEYBOARD_PROTOCOL,
|
||||
USB_HID_KEYBOARD_INTERFACE_INDEX,
|
||||
UsbKeyboardInterface,
|
||||
sizeof(UsbKeyboardInterface) / sizeof(usb_device_interfaces_struct_t),
|
||||
},
|
||||
};
|
||||
|
||||
static usb_device_interface_list_t UsbKeyboardInterfaceList[USB_DEVICE_CONFIGURATION_COUNT] =
|
||||
{
|
||||
{
|
||||
USB_HID_KEYBOARD_INTERFACE_COUNT,
|
||||
UsbKeyboardInterfaces,
|
||||
},
|
||||
};
|
||||
|
||||
usb_device_class_struct_t UsbKeyboardClass = {
|
||||
UsbKeyboardInterfaceList,
|
||||
kUSB_DeviceClassTypeHid,
|
||||
USB_DEVICE_CONFIGURATION_COUNT,
|
||||
};
|
||||
|
||||
uint8_t UsbKeyboardReportDescriptor[USB_DESCRIPTOR_LENGTH_HID_KEYBOARD_REPORT] = {
|
||||
0x05U, 0x01U, // Usage Page (Generic Desktop)
|
||||
0x09U, 0x06U, // Usage (Keyboard)
|
||||
0xA1U, 0x01U, // Collection (Application)
|
||||
0x75U, 0x01U, // Report Size (1U)
|
||||
0x95U, 0x08U, // Report Count (8U)
|
||||
0x05U, 0x07U, // Usage Page (Key Codes)
|
||||
0x19U, 0xE0U, // Usage Minimum (224U)
|
||||
0x29U, 0xE7U, // Usage Maximum (231U)
|
||||
|
||||
0x15U, 0x00U, // Logical Minimum (0U)
|
||||
0x25U, 0x01U, // Logical Maximum (1U)
|
||||
0x81U, 0x02U, // Input(Data, Variable, Absolute) Modifier byte
|
||||
|
||||
0x95U, 0x01U, // Report count (1U)
|
||||
0x75U, 0x08U, // Report Size (8U)
|
||||
0x81U, 0x01U, // Input (Constant), Reserved byte
|
||||
0x95U, 0x05U, // Report count (5U)
|
||||
0x75U, 0x01U, // Report Size (1U)
|
||||
|
||||
0x05U, 0x01U, // Usage Page (Page# for LEDs)
|
||||
0x19U, 0x01U, // Usage Minimum (1U)
|
||||
0x29U, 0x05U, // Usage Maximum (5U)
|
||||
0x91U, 0x02U, // Output (Data, Variable, Absolute) LED report
|
||||
0x95U, 0x01U, // Report count (1U)
|
||||
0x75U, 0x03U, // Report Size (3U)
|
||||
0x91U, 0x01U, // Output (Constant), LED report padding
|
||||
|
||||
0x95U, 0x06U, // Report count (6U)
|
||||
0x75U, 0x08U, // Report Size (8U)
|
||||
0x15U, 0x00U, // Logical Minimum (0U)
|
||||
0x25U, 0xFFU, // Logical Maximum (255U)
|
||||
0x05U, 0x07U, // Usage Page (Key Codes)
|
||||
0x19U, 0x00U, // Usage Minimum (0U)
|
||||
0x29U, 0xFFU, // Usage Maximum (255U)
|
||||
|
||||
0x81U, 0x00U, // Input(Data, Array), Key arrays(6U bytes)
|
||||
0xC0U, // End collection
|
||||
};
|
||||
|
||||
uint8_t g_UsbKeyboardString[USB_KEYBOARD_STRING_DESCRIPTOR_LENGTH] = {
|
||||
sizeof(g_UsbKeyboardString),
|
||||
USB_DESCRIPTOR_TYPE_STRING,
|
||||
'H', 0x00U,
|
||||
'I', 0x00U,
|
||||
'D', 0x00U,
|
||||
' ', 0x00U,
|
||||
'K', 0x00U,
|
||||
'E', 0x00U,
|
||||
'Y', 0x00U,
|
||||
'B', 0x00U,
|
||||
'O', 0x00U,
|
||||
'A', 0x00U,
|
||||
'R', 0x00U,
|
||||
'D', 0x00U,
|
||||
' ', 0x00U,
|
||||
'D', 0x00U,
|
||||
'E', 0x00U,
|
||||
'V', 0x00U,
|
||||
'I', 0x00U,
|
||||
'C', 0x00U,
|
||||
'E', 0x00U,
|
||||
};
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef __KEYBOARD_DESCRIPTORS_H__
|
||||
#define __KEYBOARD_DESCRIPTORS_H__
|
||||
|
||||
// Macros:
|
||||
|
||||
#define USB_HID_KEYBOARD_INTERFACE_COUNT (1U)
|
||||
#define USB_DESCRIPTOR_LENGTH_HID_KEYBOARD_REPORT (63U)
|
||||
#define USB_KEYBOARD_STRING_DESCRIPTOR_LENGTH (40U)
|
||||
#define USB_KEYBOARD_INTERFACE_ALTERNATE_SETTING (0U)
|
||||
#define USB_HID_KEYBOARD_ENDPOINT_IN (2U)
|
||||
#define FS_HID_KEYBOARD_INTERRUPT_IN_PACKET_SIZE (8U)
|
||||
#define USB_HID_KEYBOARD_ENDPOINT_COUNT (1U)
|
||||
#define USB_HID_KEYBOARD_CLASS (0x03U)
|
||||
#define USB_HID_KEYBOARD_SUBCLASS (0x01U)
|
||||
#define USB_HID_KEYBOARD_PROTOCOL (0x01U)
|
||||
#define USB_HID_KEYBOARD_INTERFACE_INDEX (1U)
|
||||
#define USB_HID_KEYBOARD_IN_BUFFER_LENGTH (8U)
|
||||
#define FS_HID_KEYBOARD_INTERRUPT_IN_INTERVAL (0x04U)
|
||||
#define USB_HID_KEYBOARD_REPORT_LENGTH (0x08U)
|
||||
|
||||
// Variables:
|
||||
|
||||
extern uint8_t g_UsbKeyboardString[USB_KEYBOARD_STRING_DESCRIPTOR_LENGTH];
|
||||
extern usb_device_class_struct_t UsbKeyboardClass;
|
||||
extern uint8_t UsbKeyboardReportDescriptor[USB_DESCRIPTOR_LENGTH_HID_KEYBOARD_REPORT];
|
||||
|
||||
#endif
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "composite.h"
|
||||
#include "hid_mouse.h"
|
||||
#include "hid_keyboard.h"
|
||||
#include "keyboard_descriptors.h"
|
||||
#include "usb_keyboard_descriptors.h"
|
||||
|
||||
// HID mouse endpoint
|
||||
usb_device_endpoint_struct_t g_UsbDeviceHidMouseEndpoints[USB_HID_MOUSE_ENDPOINT_COUNT] = {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
// Includes:
|
||||
|
||||
#include "keyboard_descriptors.h"
|
||||
#include "usb_keyboard_descriptors.h"
|
||||
|
||||
// Macros:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user