-
Notifications
You must be signed in to change notification settings - Fork 165
Ability to use right alt aka. alt gr to reach all characters on non us/uk layouts #50
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
Ability to use right alt aka. alt gr to reach all characters on non us/uk layouts #50
Conversation
Memory usage change @ 7152246
Click for full report table
Click for full report CSV
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AltGr is already usable as
Keyboard.press(KEY_RIGHT_ALT);
How would this change make it easier? How would you use the new feature? It is not visible through the library API.
x &= 0x7F; | ||
k = (uint8_t)x; | ||
} else if(x & 0x100) { // it's a character reached with alt gr aka. right alt | ||
_keyReport.modifiers |= 0x05; // alt gr aka. right alt modifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean
_keyReport.modifiers |= 0x40;
i.e.
_keyReport.modifiers |= (1<<(KEY_RIGHT_ALT-128));
I have added the alt gr as a modifier that can be applied to the ascii map. This means that instead of having to break up print commands because of characters such as /{}$€, they are managed through the ascii map in the .cpp file. This makes the library a lot more usable for people with keyboard layouts other than english. As I said I implemented it in the Keyboard.cpp file. The asciimap as well as the memory map has been changed to 16bits to fit an extra check bit (as was done with shift modifier). The shift modifier had the eith bit set as 1. Alt gr uses ninth bit set as 1. In addition to the 8bit -> 16bit change I also had to use memcpy_P to copy the number from the ascii map. This change includes no new libraries and does not require a significant amount of resources. |
But you have not modified the ASCII map, so it would seem the change serves no purpose. Or maybe you expect the users to modify the ASCII map themselves?
Furthermore, most computers nowadays use UTF-8 encoding for files, and “€” is then encoded as a sequence of three bytes: Keyboard.write('€'); is not valid C++, and Keyboard.print("€"); would attempt to print three characters. In this case they happen to be all invalid, but printing Thus I ask again the same question: How would you use this new feature? |
My bad. I was not suppose to include '€'. For example if I want to do print("C:\Users\Randomuser\Desktop"); I would have to do When the alt gr / right alt is added into the code I can just print the line without any problems. |
What is the status on this? |
@nuuttihenriksson @edgar-bonet was this superseded by #53? |
Good points by @edgar-bonet, was just an early idea. #53 looks good. |
Thanks for your speedy response, and for your contribution @nuuttihenriksson! Regards, Per |
Simply added possibility for non us/uk keyboards to reach characters.
Uses only libraries that were already included.