Crate pc_keyboard
source ·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§
- Implements the various keyboard layouts.
Structs§
- Converts KeyEvents into Unicode, according to the current Keyboard Layout
- A event describing something happen to a key on your keyboard.
- Encapsulates decode/sampling logic, and handles state transitions and key events.
- The set of modifier keys you have on a keyboard.
- Handles decoding of IBM PS/2 Keyboard (and IBM PC/AT Keyboard) bit-streams.
- Contains the implementation of Scancode Set 1.
- Contains the implementation of Scancode Set 2.
Enums§
- Contains either a Unicode character, or a raw key code.
- Indicates different error conditions.
- Options for how we can handle what happens when the Ctrl key is held down and a letter is pressed.
- Keycodes that can be generated by a keyboard.
- The new state for a key, as part of a key event.
Traits§
- Describes a Keyboard Layout.
- A mechanism to convert bytes from a Keyboard into
KeyCode
values.