-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Enable Keyboard library to send key scancodes. #2356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I just tried this patch out for my project. The ability to send raw scancodes removes a lot of unnecessary overhead from the Arduino. It works just as expected, thank you! |
@jclopes after 1.6.0 release, your PR does not merge any more. Can you please update it with current master? |
I implemented someone very similar on Teensy, without adding new functions to the API. I simply increased the input from uint8_t to uint16_t, and defined symbols for the raw codes with the MSB (bit 15) set. Maybe you like this approach better, but it might be work considering reusing the existing function. Conceptually, it does exactly the same thing. |
@ffissore I rebased my master into the current arduino/master. It should work now. @PaulStoffregen I prefer to have an explicit API then to use a convention for the functions input. IMHO it makes the code easier to read. |
@jclopes You are correct, separate functions for ascii & scan codes does indeed make Arduino's source code easier to read. But does it also make Arduino easier to use for novices, who have little or no understanding of ascii vs scan codes? |
FWIW, I too would like a generic function. Less code is usually better. |
@ArduinoBot build this please |
Regarding the novice user being confused - Since the old API is still there I don't see how having a wrapper function will help having less code, help
|
It won't. I was just suggesting a mediation between paul's advice and your implementation |
Implemented in the current dev branch. All keys are now possible to press. This was solved via an enum. Have a look at the KeyboardAPI files. New keys will be added soon. https://github.com/NicoHood/HID/tree/dev_2_4 We could adapt this API to the Arduino core or just leave it as it is right now. But I think @cmaglie and @facchinm tended to keep the api simple and leave such things to my library. I have no problems if this is also added to the IDE though. But if you decide on not adding it, you may close this issue then. |
Thanks @NicoHood for the explanation, indeed we'll keep Keyboard and Mouse library (now that they are outside the core) as simple as possible, while additional functionalities will be added in expanded libraries. |
This gives more flexibility to the library and allows the development of keyboard driver.