Ps2KeyboardHost
1.0.1
Allows you to read from one or more PS2-style keyboards on an Arduino.
|
This class provides a translation from PS2 incoming scancodes to Ansi. Right now, the name "Ansi" is aspirational, as the implementation given here only works for English keyboards. More...
#include <ps2_AnsiTranslator.h>
Public Member Functions | |
AnsiTranslator () | |
AnsiTranslator (Diagnostics &diagnostics) | |
void | reset () |
char | translatePs2Keycode (ps2::KeyboardOutput ps2Scan) |
Processes the given scan code from the keyboard. It only gives you keydown events for keys that have an ansi translation (e.g. the "g" key has an effect, the "Home" key does not.) More... | |
bool | isCtrlKeyDown () const |
Gets the state of the Ctrl key. More... | |
bool | isShiftKeyDown () const |
Gets the state of the Shift key. More... | |
void | setCapsLock (bool newCapsLockValue) |
Sets the state of the caps lock mode. More... | |
bool | getCapsLock () const |
Gets the state of the caps lock mode. More... | |
void | setNumLock (bool newNumLockValue) |
Sets the state of the num lock mode. More... | |
bool | getNumLock () const |
Gets the state of the num lock mode. More... | |
This class provides a translation from PS2 incoming scancodes to Ansi. Right now, the name "Ansi" is aspirational, as the implementation given here only works for English keyboards.
This will translate shift keys, caps lock, num lock and the ctrl key. E.g. if the user types "Ctrl+G", translatePs2Keycode will return Ascii 7. If the caps lock key has been pressed before and the user types "g", it will return 'G'. If the user types shift+H under these circumstances, it will return 'h'.
Diagnostics | A sink for debugging information. |
ps2::AnsiTranslator< Diagnostics >::AnsiTranslator | ( | ) |
ps2::AnsiTranslator< Diagnostics >::AnsiTranslator | ( | Diagnostics & | diagnostics | ) |
|
inline |
Gets the state of the caps lock mode.
|
inline |
Gets the state of the num lock mode.
|
inline |
Gets the state of the Ctrl key.
|
inline |
Gets the state of the Shift key.
void ps2::AnsiTranslator< Diagnostics >::reset | ( | ) |
|
inline |
Sets the state of the caps lock mode.
Note that this has no effect on the PS2 keyboard or the PS2 keyboard LED. It just effects how keypresses are translated.
|
inline |
Sets the state of the num lock mode.
Note that this has no effect on the PS2 keyboard or the PS2 keyboard LED. It just effects how keypresses are translated.
char ps2::AnsiTranslator< Diagnostics >::translatePs2Keycode | ( | ps2::KeyboardOutput | ps2Scan | ) |
Processes the given scan code from the keyboard. It only gives you keydown events for keys that have an ansi translation (e.g. the "g" key has an effect, the "Home" key does not.)