Driver for a PS/2 PC keyboard.
Supports PS/2 Scan Code Set 1 and 2, on a variety of keyboard layouts. See the OSDev Wiki.
There are three basic steps to handling keyboard input. Your application may bypass some of these.
Ps2Decoder- converts 11-bit PS/2 words into bytes, removing the start/stop bits and checking the parity bits. Only needed if you talk to the PS/2 keyboard over GPIO pins and not required if you talk to the i8042 PC keyboard controller.
ScancodeSet- converts from Scancode Set 1 (i8042 PC keyboard controller) or Scancode Set 2 (raw PS/2 keyboard output) into a symbolic
KeyCodeand an up/down
EventDecoder- converts symbolic
KeyStateinto a Unicode characters (where possible) according to the currently selected
There is also
Keyboard which combines the above three functions into a single object.