Expand description
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 symbolicKeyCode
and an up/downKeyState
.EventDecoder
- converts symbolicKeyCode
andKeyState
into a Unicode characters (where possible) according to the currently selectedKeyboardLayout
.
There is also Keyboard
which combines the above three functions into a single object.
Modules§
- layouts
- Implements the various keyboard layouts.
Structs§
- Event
Decoder - Converts KeyEvents into Unicode, according to the current Keyboard Layout
- KeyEvent
- A event describing something happen to a key on your keyboard.
- Keyboard
- Encapsulates decode/sampling logic, and handles state transitions and key events.
- Modifiers
- The set of modifier keys you have on a keyboard.
- Ps2Decoder
- Handles decoding of IBM PS/2 Keyboard (and IBM PC/AT Keyboard) bit-streams.
- Scancode
Set1 - Contains the implementation of Scancode Set 1.
- Scancode
Set2 - Contains the implementation of Scancode Set 2.
Enums§
- Decoded
Key - Contains either a Unicode character, or a raw key code.
- Error
- Indicates different error conditions.
- Handle
Control - Options for how we can handle what happens when the Ctrl key is held down and a letter is pressed.
- KeyCode
- Keycodes that can be generated by a keyboard.
- KeyState
- The new state for a key, as part of a key event.
Traits§
- Keyboard
Layout - Describes a Keyboard Layout.
- Scancode
Set - A mechanism to convert bytes from a Keyboard into
KeyCode
values.