Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

jclopes
Copy link

@jclopes jclopes commented Oct 11, 2014

This gives more flexibility to the library and allows the development of keyboard driver.

@RasmusB
Copy link

RasmusB commented Feb 15, 2015

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!

@ffissore
Copy link
Contributor

@jclopes after 1.6.0 release, your PR does not merge any more. Can you please update it with current master?

@PaulStoffregen
Copy link
Contributor

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.

@jclopes
Copy link
Author

jclopes commented Feb 17, 2015

@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.

@PaulStoffregen
Copy link
Contributor

@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?

@ffissore
Copy link
Contributor

FWIW, I too would like a generic function. Less code is usually better.
I'll make the bot build this PR.
@jclopes what about having public press dispatch to press_sc or (a new) press_key, both private or protected? Code would still be easy to read and the api won't change much

@ffissore
Copy link
Contributor

@ArduinoBot build this please

@jclopes
Copy link
Author

jclopes commented Feb 20, 2015

Regarding the novice user being confused - Since the old API is still there
and there are plenty of example code, I don't think that is a real problem.
I think is more confusing to have only one function that requires you to
pass some odd argument when you just want to send a char.

I don't see how having a wrapper function will help having less code, help
the experienced or the novice user.
But that could be done in a separate commit if there is demand for it.
On Feb 18, 2015 10:47 AM, "ArduinoBot" [email protected] wrote:

Build successful. Please test this code using one of the following:

http://arduino.cc/download.php?f=/javaide/pull_requests/arduino-PR-2356-BUILD-169-linux32.tar.xz

http://arduino.cc/download.php?f=/javaide/pull_requests/arduino-PR-2356-BUILD-169-linux64.tar.xz

http://arduino.cc/download.php?f=/javaide/pull_requests/arduino-PR-2356-BUILD-169-windows.zip

http://arduino.cc/download.php?f=/javaide/pull_requests/arduino-PR-2356-BUILD-169-macosx.zip

http://arduino.cc/download.php?f=/javaide/pull_requests/arduino-PR-2356-BUILD-169-macosx-java-latest.zip


Reply to this email directly or view it on GitHub
#2356 (comment).

@ffissore
Copy link
Contributor

It won't. I was just suggesting a mediation between paul's advice and your implementation

@cmaglie cmaglie added feature request A request to make an enhancement (not a bug fix) Component: USB Device Opposed to USB Host. Related to the USB subsystem (SerialUSB, HID, ...) Architecture: AVR Applies only to the AVR microcontrollers (Uno, etc.) labels Apr 15, 2015
@NicoHood
Copy link
Contributor

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.

@facchinm
Copy link
Member

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.

@facchinm facchinm closed this Oct 29, 2015
@ffissore ffissore modified the milestone: Release 1.6.6 Oct 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture: AVR Applies only to the AVR microcontrollers (Uno, etc.) Component: USB Device Opposed to USB Host. Related to the USB subsystem (SerialUSB, HID, ...) feature request A request to make an enhancement (not a bug fix)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants