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
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.
bool prologue ()
- 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.
If Ctrl-Alt-Delete was pressed, a reboot should be triggered. In addition, the execution of an epilogue should be requested.
void epilogue ()
- Here the character read during the Prolog handling is displayed on the screen with the help of the global CGA_Stream object kout.