Add a variable to allow easy modification of the keypress limit.#4
Add a variable to allow easy modification of the keypress limit.#4ZDBioHazard wants to merge 2 commits intoarduino-libraries:masterfrom
Conversation
Reorder some items, remove a redundant item, make spacing consistent.
If you need more than 6 keys of rollover on your USB keyboard, now there's an easily editable value you can tweak.
|
LGTM! The code cleanup is enough to justify the merge, and the "configurable" keypress number could be useful for someone. |
|
Yes it does. The problem with this implementation is, that for u2 devices the HID reports are limited to 15 bytes + reportid. This means you should not set this variable higher than 15. Other than 6 keys makes it bios incompatible, correct. But the arduino implementation is not bios compatible anyways. My HID Project covers both needs: bios compatible and nkro keyboard with >100 keypresses at the same time. The question is, if the os can handle those. I am not against new usb functions, I really like to see people working on those things. But as the #define is just for proprietary use, it makes no sense to include it. And I think we (@facchinm and @cmaglie ) aggreed that the arduino libraries should keeps basic and simple and the HID Project should extend them. If the implementation is not more reliable or smaller (you should test this!), I see no reason to add this. But if it does, feel free to open a PR at my project. And also: This PR suffers from this missing feature too. I implemented it in the old times without arduino builder, but noone ever did for arduino-builder. It would make the code a lot simpler and compacter. This would give a breakable change to the IDE, but noone seems to care for now :( You might consider to finally have a look at this: |
|
Awesome, I hadn't run across the @NicoHood HID library. It took a little work to get it to play nice with If you like, I could go back and rework this patch into a general cleanup and resubmit it. Maybe change the |
|
I think i will not break the special bios compatiblity if the nkro is even smaller and better than this. If it works good, just use it like that ;) If #5 also applies to my project, let me know. |
|
|
If you need to be able to press more than 6 keys on your virtual keyboard, and you don't mind losing BIOS compatibility, the changes in this branch enable you to simply change
#define KEYS_ROLLOVERto however many keys you need, and it will alter the USB descriptor, resize the data structures and handle the extra keys automatically!Even with the default 6-key configuration, this implementation is 34 bytes smaller. 😉 (on my Leonardo, at least)
I haven't thought of a sensible way to tweak
KEYS_ROLLOVERfrom the user side, but at least people won't have to dig into the meat of this library to modify the rollover limit for their keyboard-emulating game controllers and whatnot.