Add descriptor class, subclass and protocol constants to the class drivers, modify all demos to use them where possible.
Move out private/internal host class driver constants to the common class driver headers, so that they can be used in the Low Level host mode demos. Ensure all demos, projects and bootloaders use the class driver constants where possible to minimise code repetition.
This commit is contained in:
parent
b37d77eab3
commit
55538dcef3
96 changed files with 650 additions and 631 deletions
|
@ -52,7 +52,7 @@ uint8_t ProcessConfigurationDescriptor(void)
|
|||
uint16_t CurrConfigBytesRem;
|
||||
|
||||
USB_Descriptor_Interface_t* HIDInterface = NULL;
|
||||
USB_Descriptor_HID_t* HIDDescriptor = NULL;
|
||||
USB_HID_Descriptor_HID_t* HIDDescriptor = NULL;
|
||||
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
|
||||
|
||||
/* Retrieve the entire configuration descriptor into the allocated buffer */
|
||||
|
@ -95,7 +95,7 @@ uint8_t ProcessConfigurationDescriptor(void)
|
|||
}
|
||||
|
||||
/* Save the HID descriptor for later use */
|
||||
HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
|
||||
HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_HID_Descriptor_HID_t);
|
||||
|
||||
/* Skip the remainder of the loop as we have not found an endpoint yet */
|
||||
continue;
|
||||
|
@ -133,9 +133,8 @@ uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor)
|
|||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
{
|
||||
/* Check the HID descriptor class and protocol, break out if correct class/protocol interface found */
|
||||
if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == KEYBOARD_CLASS) &&
|
||||
(DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == KEYBOARD_PROTOCOL))
|
||||
/* Check the HID descriptor class, break out if correct class interface found */
|
||||
if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == HID_CSCP_HIDClass)
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
|
|
|
@ -42,12 +42,6 @@
|
|||
#include "HIDReport.h"
|
||||
|
||||
/* Macros: */
|
||||
/** Interface Class value for the Human Interface Device class. */
|
||||
#define KEYBOARD_CLASS 0x03
|
||||
|
||||
/** Interface Protocol value for a Boot Protocol Keyboard compliant device. */
|
||||
#define KEYBOARD_PROTOCOL 0x01
|
||||
|
||||
/** Pipe number for the keyboard report data pipe. */
|
||||
#define KEYBOARD_DATA_IN_PIPE 1
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ uint8_t GetHIDReportData(void)
|
|||
{
|
||||
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
|
||||
.bRequest = REQ_GetDescriptor,
|
||||
.wValue = (DTYPE_Report << 8),
|
||||
.wValue = (HID_DTYPE_Report << 8),
|
||||
.wIndex = 0,
|
||||
.wLength = HIDReportSize,
|
||||
};
|
||||
|
|
|
@ -41,6 +41,10 @@
|
|||
|
||||
#include "KeyboardHostWithParser.h"
|
||||
|
||||
/* Macros: */
|
||||
/** HID Report Descriptor Usage Page value for a desktop keyboard. */
|
||||
#define USAGE_PAGE_KEYBOARD 0x07
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the possible return codes of the \ref GetHIDReportData() function. */
|
||||
enum KeyboardHostWithParser_GetHIDReportDataCodes_t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue