|
enum | Status {
HAS_OUTPUT = 1 << 0
,
INPUT_PENDING = 1 << 1
,
SYSTEM_FLAG = 1 << 2
,
IS_COMMAND = 1 << 3
,
IS_MOUSE = 1 << 5
,
TIMEOUT_ERROR = 1 << 6
,
PARITY_ERROR = 1 << 7
} |
| Flags in the PS/2 controller status register. More...
|
|
enum | KeyboardCommand : uint8_t {
KEYBOARD_SET_LED = 0xed
,
KEYBOARD_SEND_ECHO = 0xee
,
KEYBOARD_SET_SPEED = 0xf3
,
KEYBOARD_ENABLE = 0xf4
,
KEYBOARD_DISABLE = 0xf5
,
KEYBOARD_SET_DEFAULT = 0xf6
} |
| Commands to be send to the Keyboard. More...
|
|
enum | Reply {
ACK = 0xfa
,
RESEND = 0xfe
,
ECHO = 0xee
} |
| Replies. More...
|
|
enum | ControllerCommand {
CONTROLLER_GET_COMMAND_BYTE = 0x20
,
CONTROLLER_SET_COMMAND_BYTE = 0x60
,
CONTROLLER_MOUSE_DISABLE = 0xa7
,
CONTROLLER_MOUSE_ENABLE = 0xa8
,
CONTROLLER_KEYBOARD_DISABLE = 0xad
,
CONTROLLER_KEYBOARD_ENABLE = 0xae
,
CONTROLLER_SEND_TO_MOUSE = 0xd4
} |
| Commands for the PS/2 Controller. More...
|
|
enum | MouseCommand {
MOUSE_RESET = 0xff
,
MOUSE_DEFAULTS = 0xf6
,
MOUSE_STREAMING_DISABLE = 0xf5
,
MOUSE_STREAMING_ENABLE = 0xf4
,
MOUSE_SAMPLE_RATE = 0xf3
,
MOUSE_ID = 0xf2
,
MOUSE_REQUEST_PACKET = 0xeb
,
MOUSE_REQUEST_STATUS = 0xe9
,
MOUSE_RESOLUTION = 0xe8
,
MOUSE_SCALING_2_1 = 0xe7
,
MOUSE_SCALING_1_1 = 0xe6
} |
| Commands to be send to the mouse. More...
|
|
enum | Delay {
DELAY_250MS = 0
,
DELAY_500MS = 1
,
DELAY_750MS = 2
,
DELAY_1000MS = 3
} |
| Delay before the keyboard starts repeating sending a pressed key. More...
|
|
enum | Speed {
SPEED_30_0CPS = 0x00
,
SPEED_26_7CPS = 0x01
,
SPEED_24_0CPS = 0x02
,
SPEED_21_8CPS = 0x03
,
SPEED_20_7CPS = 0x04
,
SPEED_18_5CPS = 0x05
,
SPEED_17_1CPS = 0x06
,
SPEED_16_0CPS = 0x07
,
SPEED_15_0CPS = 0x08
,
SPEED_13_3CPS = 0x09
,
SPEED_12_0CPS = 0x0a
,
SPEED_10_9CPS = 0x0b
,
SPEED_10_0CPS = 0x0c
,
SPEED_09_2CPS = 0x0d
,
SPEED_08_6CPS = 0x0e
,
SPEED_08_0CPS = 0x0f
,
SPEED_07_5CPS = 0x10
,
SPEED_06_7CPS = 0x11
,
SPEED_06_0CPS = 0x12
,
SPEED_05_5CPS = 0x13
,
SPEED_05_0CPS = 0x14
,
SPEED_04_6CPS = 0x15
,
SPEED_04_3CPS = 0x16
,
SPEED_04_0CPS = 0x17
,
SPEED_03_7CPS = 0x18
,
SPEED_03_3CPS = 0x19
,
SPEED_03_0CPS = 0x1a
,
SPEED_02_7CPS = 0x1b
,
SPEED_02_5CPS = 0x1c
,
SPEED_02_3CPS = 0x1d
,
SPEED_02_1CPS = 0x1e
,
SPEED_02_0CPS = 0x1f
} |
| Repeat Rate of Characters. More...
|
|
enum | LED {
LED_SCROLL_LOCK = 1 << 0
,
LED_NUM_LOCK = 1 << 1
,
LED_CAPS_LOCK = 1 << 2
} |
| Keyboard LEDs. More...
|
|
PS/2 Controller.
Initializes the PS/2 devices (Keyboard and optional Mouse), and determines both the scan code and ASCII character of a pressed key from the transmitted make and break codes using the KeyDecoder.
- Note
- This controller is also known as Intel 8042 (nowadays integrated in the mainboard) or Keyboard Controller. But to avoid confusion with the actual Keyboard and since we use the PS/2-compatible mode to support the Mouse as well, the name PS/2 Controller was chosen for the sake of simplicity.
-
Since modern PCs sometimes don't have an PS/2 connector, USB keyboards and mice are emulated as PS/2 device with USB Legacy Support.
bool PS2Controller::fetch |
( |
Key & |
pressed | ) |
|
Retrieve the keyboard event.
Retrieves make and brake events from the keyboard. If a valid (non special) key was pressed, the scan code is determined using KeyDecoder::decode into a Key object. Events on special keys like Shift, Alt, CapsLock etc. are stored (in KeyDecoder) and applied on subsequent keystrokes, while no valid key is retrieved.
Mouse events are ignored.
- Parameters
-
pressed | Reference to an object which will contain the pressed Key on success |
- Returns
true
if a valid key was decoded