Move shared button identifiers from enum to an inline function, so formerly shared identifiers can be separately filtered and processed on a class-by-class basis.
Fixes#611.
Added definitions for Adafruit NRF52840 Feather Express based on the
existing RBL_NRF51822 variant. The PS5 controller and USB_desc examples
have been tested and seem to work fine with a knockoff Duinofun USBmini
2.0 shield (after accounting for the mislabled pins on this hardware,
and cutting the USB VDD trace to wire it to 5V).
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.
I am using HID for Oregon Scientific WMRS200, and polling reports removed any sequence of 2 or more identical characters, e.g. instead valid sequence
FF FF 0 42 0 B8 0 2C 3C 0 0 0 62 1
i get
FF 0 42 0 B8 0 2C 3C 0 62 1
There is no need to compare previous buffer with current buffer, as they can be identical and still this should not be ignored. My sequences are built from smaller sequences, where first byte is lenght of sequence to concatenate. Usually it is concatenated from sequences of 1 byte. E.g. 01 FF, 01 FF, 01 00, 01 42 etc. But current code is filtering second 01 FF and result is only one FF in sequence, instead of FF FF. Filtering is not needed, because data are obtained using inTransfer.
It's not that uncommon to have more than three HID interfaces in a
USB device - even an Arduino Leonardo (or Pro Micro) always has
two just for the CDC; if you add a Boot Keyboard HID interface and
one generic HID interface for consumer control (multimedia) keys
you already have four..
Many commercial gaming keyboards also have more then three interfaces
(I don't think they really need that many but it is what it is).
If a connected device has more than 3 (maxHidInterfaces) HID interfaces,
which is not unusual with modern keyboards, EndpointXtract() wrote
beyond the hidInterfaces[] array and corrupted bHasReportId, PID + VID.
The same could happen with the epInfo[] array.
Now this is fixed by checking bNumIface/bNMumEP before adding new
elements to those arrays.