-
Notifications
You must be signed in to change notification settings - Fork 6
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
Adds the ability to output control characters #5
Conversation
I'm not sure if I made the whole line endings thing worse or not. Please let me know if I screwed it up. I added the .gitattributes file in 26ebf8e that should at least make things consistent. I'm just sticking with CRLF for now because that's what Visual Studio / Visual Micro likes. |
As for 80419a1, this raises a few issues. (In the future this might be easier to manage this in a different PR)
|
If you enter a character < 0x20 without my change, most get changed to null by the Keyboard lib so nothing gets output to the computer. With my change, those characters get converted to their Ctrl key equivalent. (Ctrl-M is CR, Ctrl-H is backspace, etc.). The reason the Keyboard lib does this is because it functions like a USB HID keyboard. While it supports a few common keystrokes which map to keys on a keyboard, it doesn't pass others (like Ctrl-C for example). With my change, they all work. A more complex change would be to directly support the few keys that map to a keyboard and include a modified version of my change to handle the others. My change as it stands is simpler and works for all characters below 0x20. My change does use a standard ASCII table. Ctrl characters are simply CHAR - 64 (I have to use 96 because the Keyboard lib sees the uppercase chars as shifted). http://man7.org/linux/man-pages/man7/ascii.7.html https://github.com/arduino-libraries/Keyboard/blob/master/src/Keyboard.cpp#L88 https://www.arduino.cc/en/Reference/KeyboardModifiers https://en.wikipedia.org/wiki/Control_key#History (zeroing the left two bits of a seven-bit word is the same as subtracting 96) |
Thanks for the clear reply; I now see how this works. I think it would be worth adding a modification for Backspace, Tab, and LF, so that they still work independent of OS or environment. The other ones work fine. |
I added code to display chars below 32 on the OLED. I also implemented the HID mode and made it configurable so a user can select HID or pure ASCII handling of lower characters |
This is awesome. Everything works as expected, and I appreciate the the level of detail that you have put into the screen output. Thank you! I will be updating code comments and README to provide credit for your work. |
ASCII < 0x20
Adds
Keyboard.press(KEY_LEFT_CTRL)
, etc., tosendVal()