They were mostly the same, I only had to keep the original
version of Poll() because while the differences are very small,
I don't think that unifying them is possible without needlessly
complicating things.
For this to work I had to make the private fields of HIDComposite
protected instead. I took the "+1" in HIDInterface::epIndex[]
from the original HIDUniversal class.
This is needed as the in and out endpoint are defined as follows:
static const uint8_t epInterruptInIndex = 1; // InterruptIN endpoint index
static const uint8_t epInterruptOutIndex = 2; // InterruptOUT endpoint index
And maxEpPerInterface is set to 2.
See: https://travis-ci.org/felis/USB_Host_Shield_2.0/jobs/569260660
The following collisions resolved:
hid.h -> usbhid.h
hid.cpp -> usbhid.cpp
HID -> USBHID
HID_BOOT_PROTOCOL -> USB_HID_BOOT_PROTOCOL
HID_PROTOCOL_NONE -> USB_HID_PROTOCOL_NONE
HID_PROTOCOL_KEYBOARD -> USB_HID_PROTOCOL_KEYBOARD
HID_PROTOCOL_MOUSE -> USB_HID_PROTOCOL_MOUSE
As a result, it's possible to use the library together with Arduino's bundled HID / Mouse / Keyboard libraries (Leonardo, Micro, or Due).
https://www.arduino.cc/en/Reference/MouseKeyboard