Skip to content

Commit 14ddc8b

Browse files
committed
Added official HID definitions
Since the HID library adds some general HID definitions and structs, it is very useful to also include this in a custom library. If you dupe the information you have problems of redeclaration. Having those defintions inside the official HID library is essential for a good working additional HID API.
1 parent 2cc3bb6 commit 14ddc8b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

hardware/arduino/avr/libraries/HID/HID.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int HID_::getInterface(uint8_t* interfaceCount)
3030
{
3131
*interfaceCount += 1; // uses 1
3232
HIDDescriptor hidInterface = {
33-
D_INTERFACE(pluggedInterface, 1, 3, 0, 0),
33+
D_INTERFACE(pluggedInterface, 1, USB_DEVICE_CLASS_HUMAN_INTERFACE, HID_SUBCLASS_NONE, HID_PROTOCOL_NONE),
3434
D_HIDREPORT(descriptorSize),
3535
D_ENDPOINT(USB_ENDPOINT_IN(pluggedEndpoint), USB_ENDPOINT_TYPE_INTERRUPT, USB_EP_SIZE, 0x01)
3636
};

hardware/arduino/avr/libraries/HID/HID.h

+14
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@
4040
#define HID_REPORT_DESCRIPTOR_TYPE 0x22
4141
#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23
4242

43+
// HID subclass HID1.11 Page 8 4.2 Subclass
44+
#define HID_SUBCLASS_NONE 0
45+
#define HID_SUBCLASS_BOOT_INTERFACE 1
46+
47+
// HID Keyboard/Mouse bios compatible protocols HID1.11 Page 9 4.3 Protocols
48+
#define HID_PROTOCOL_NONE 0
49+
#define HID_PROTOCOL_KEYBOARD 1
50+
#define HID_PROTOCOL_MOUSE 2
51+
52+
// Normal or bios protocol (Keyboard/Mouse) HID1.11 Page 54 7.2.5 Get_Protocol Request
53+
// "protocol" variable is used for this purpose.
54+
#define HID_BOOT_PROTOCOL 0
55+
#define HID_REPORT_PROTOCOL 1
56+
4357
typedef struct
4458
{
4559
uint8_t len; // 9

0 commit comments

Comments
 (0)