I'm still quite the n00b with arduino but i made a simple keyboard encoder and unfortunately i need to press more than the standard six buttons for my desired outcome.
I tried two of the other nrko projects found on github but they don't seem to compile, even with their provided ino examples. I also tried a few of the things seen in some other threads where people claimed to modify both the keyboard.cpp and keyboard.h but each time change the max key values past 6, my code will compile but do nothing on a programmed arduino (leonardo).
Has anyone successfully modified the latest stock keyboard library to support n key rollover? Any help would be greatly appreciated.
// Add k to the key report only if it's not already present
// and if there is an empty slot.
if (_keyReport.keys[0] != k && _keyReport.keys[1] != k &&
_keyReport.keys[2] != k && _keyReport.keys[3] != k &&
_keyReport.keys[4] != k && _keyReport.keys[5] != k) {
for (i=0; i<6; i++) {
if (_keyReport.keys[i] == 0x00) {
_keyReport.keys[i] = k;
break;
}
}
if (i == 6) {
setWriteError();
return 0;
}
}
// Test the key report to see if k is present. Clear it if it exists.
// Check all positions in case the key is present more than once (which it shouldn't be)
for (i=0; i<6; i++) {
if (0 != k && _keyReport.keys[i] == k) {
_keyReport.keys[i] = 0x00;
}
}
Yes. I tried changing those values. Anything above 6 will compile using the arduino ide but when its uploaded to my leonardo, nothing happends. The leonardo is indeed being detected as a keyboard in my device control panel.
"However, the USB standard also allows you to declare that a keyboard can operate in “boot” mode, which means that the supplied report descriptor is ignored, and a standard report descriptor is assumed instead."
That is the explanation for why only 6-key rollover works. I looked at the Keyboard and HID libraries and can't figure out how to make a non-boot keyboard that, in theory, would allow more simultaneous keys.