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
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 interrupts from the keyboard.
Since several interrupts are triggered with each keystroke,
a usable ASCII code cannot be expected in every case.
Only if the method
key_hit
of 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. When the user inputs Ctrl-Alt-Delete, the system should reboot.