Class Keyboard
Placement in the overall structure
- Module
- device
- Base classes
- Gate
- Keyboard_Controller
- Derived classes
- None
- Time of creation
- Task 2
- Modified in
- Task 3
- 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.
bool prologue ()
- 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.When the user inputs Ctrl-Alt-Delete, the system should reboot. In addition, the execution of an epilogue should be requested.
void epilogue ()
- Here, the character that was read during the prologue handling is displayed on the screen with the help of the global CGA_Stream object kout.