Class Keyboard
Placement in the overall structure
- Module
- device
- Base classes
- Gate
- Keyboard_Controller
- Derived classes
- None
- Time of creation
- Task 2
- Files
keyboard.h keyboard.cc
Description
The class Keyboard represents the abstraction of the keyboard. It takes care of the correct initialization and especially the interrupt handling. Later, Keyboard will also allow the application to retrieve the keyboard input.
Public methods
void plugin ()
- "Plugs in" the keyboard (driver). From now on, keypresses are handled. To do this, the keyboard object must register at the Plugbox object plugbox and tell the PIC object pic that interrupts of the keyboard should from now on be reported to the processor.
void trigger ()
- This method responds to the interrupts from the keyboard.
Since several interrupts are triggered with each keystroke,
an usable ASCII code cannot be expected in every case.
Only if the method key_hit of the base class Keyboard_Controller
returns a valid Key,
a complete scan code could be determined.
For "normal" keys then a non-zero ASCII code exists.
In the context of task 2, the ASCII code of the pressed key is not yet to be polled by the application, but should be displayed immediately on the screen. If Ctrl-Alt-Delete was pressed, spoa reboot should be triggered.