OOStuBS - Technische Informatik II (TI-II)  2.4
Öffentliche Typen | Öffentliche Methoden | Private Typen | Private Methoden | Private Attribute | Statische, private Attribute | Aufstellung aller Elemente
Keyboard_Controller Klassenreferenz

(PS/2) Tastaturtreiber Mehr ...

#include <keyctrl.h>

Klassendiagramm für Keyboard_Controller:
Inheritance graph
[Legende]
Zusammengehörigkeiten von Keyboard_Controller:
Collaboration graph
[Legende]

Öffentliche Typen

enum  Leds { caps_lock = 4, num_lock = 2, scroll_lock = 1 }
 LED names. Mehr ...

Öffentliche Methoden

Key key_hit ()
 get the last pressed key
 Keyboard_Controller ()
 Default constructor, turns all LEDs off and set speed and delay maximal.
void reboot ()
 reboots the computer
void set_led (Leds led, bool on)
 switch the specified LED of the keyboard on or off.
void set_repeat_rate (unsigned char speed, unsigned char delay)
 set the speed and delay of repeats of the keyboard.

Private Typen

enum  Commands { cmd_set_led = 0xed, cmd_set_speed = 0xf3, cmd_cpu_reset = 0xfe }
 keyboard commands Mehr ...
enum  Decodes { break_bit = 0x80, prefix1 = 0xe0, prefix2 = 0xe1 }
 Decoding constants. Mehr ...
enum  Responses { ack = 0xfa }
 keyboard responses Mehr ...
enum  StatusMasks { outb = 0x01, inpb = 0x02, auxb = 0x20 }
 Bit-Maske für das Status-Register. Mehr ...

Private Methoden

void get_ascii_code ()
 convert the received scancode and modfier bits to an ascii char
bool key_decoded ()
 interpret the reveived scancode and modifier bits

Private Attribute

unsigned char code
 der zuletzt eingelesene Scan-Code
const IO_Port ctrl_port
 "Control Port" des Tastaturkontrollers
const IO_Port data_port
 "Daten Port" des Tastaturkontrollers
Key gather
 Key to save the last input.
char leds
 variable containing the current led status
unsigned char prefix
 der Vorsatz/Prefix des aktuellen Scan-Codes

Statische, private Attribute

static unsigned char alt_tab []
 Scancode translation table if alt is pressed.
static unsigned char asc_num_tab []
 Scancode translation table to ascii for numeric block.
static unsigned char normal_tab []
 Scancode translation table without modifier.
static unsigned char scan_num_tab []
 Scancode translation table to special keys for numeric block.
static unsigned char shift_tab []
 Scancode translation table if shift is pressed.

Ausführliche Beschreibung

(PS/2) Tastaturtreiber

Diese Klasse ist eine Abstraktion des Tastaturkontrollers des Computers. Historisch bedingt ist dieser nicht ausschließlich für die Tastatur und Maus zuständig. Auch ein CPU-Neustart, PC-Lautsprecher et cetera werden durch ihn gesteuert.

Früher war er ein eigener Chip, heutzutage ist er meist Teil eines AIP-Chips (Advanced Integrated Peripheral).

Definiert in Zeile 32 der Datei keyctrl.h.

Dokumentation der Aufzählungstypen

keyboard commands

Aufzählungswerte:
cmd_set_led 

set the keyboard leds

cmd_set_speed 

change repeat rate and delay

cmd_cpu_reset 

reset the cpu

Definiert in Zeile 101 der Datei keyctrl.h.

Decoding constants.

Aufzählungswerte:
break_bit 
prefix1 
prefix2 

Definiert in Zeile 113 der Datei keyctrl.h.

LED names.

Aufzählungswerte:
caps_lock 
num_lock 
scroll_lock 

Definiert in Zeile 122 der Datei keyctrl.h.

keyboard responses

Aufzählungswerte:
ack 

acknowledged command

Definiert in Zeile 108 der Datei keyctrl.h.

Bit-Maske für das Status-Register.

Aufzählungswerte:
outb 

Ausgabepuffer ist befüllt

inpb 

Eingabepuffer ist befüllt

auxb 

Wert des Ausgabepuffers kommt von der Maus

Definiert in Zeile 91 der Datei keyctrl.h.

Beschreibung der Konstruktoren und Destruktoren

Keyboard_Controller::Keyboard_Controller ( )

Default constructor, turns all LEDs off and set speed and delay maximal.

Definiert in Zeile 179 der Datei keyctrl.cc.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Dokumentation der Elementfunktionen

void Keyboard_Controller::get_ascii_code ( )
private

convert the received scancode and modfier bits to an ascii char

Determins the ASCII code of a key according to the scancode and modifier bits.

Determins the ASCII code of a key using the scancode and modifier bits.

Definiert in Zeile 150 der Datei keyctrl.cc.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

bool Keyboard_Controller::key_decoded ( )
private

interpret the reveived scancode and modifier bits

Interpretes the make and break code of the keyboard an returns an valid ASCII code, scancode and information about modifier keys like SHIFT and CTRL.

Rückgabe
TRUE if character is komplete otherwise FALSE.

Definiert in Zeile 53 der Datei keyctrl.cc.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

Key Keyboard_Controller::key_hit ( )

get the last pressed key

Is used to get the information of the pressed key after is has been pressed. If a scancode and ASCII code could not be determined an invalid key is returned.

Rückgabe
an invalid key if data transfer has not ended otherwise a valid key with every information is returned. Can be checked withd Key::valid().

Definiert in Zeile 212 der Datei keyctrl.cc.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

void Keyboard_Controller::reboot ( )

reboots the computer

This uses a keyboard controller command.

Definiert in Zeile 199 der Datei keyctrl.cc.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

void Keyboard_Controller::set_led ( Leds  led,
bool  on 
)

switch the specified LED of the keyboard on or off.

Parameter
ledspecifies the LED turned on or off
onif TRUE LED is turned on otherwise off

Definiert in Zeile 250 der Datei keyctrl.cc.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

void Keyboard_Controller::set_repeat_rate ( unsigned char  speed,
unsigned char  delay 
)

set the speed and delay of repeats of the keyboard.

Parameter
speeddefines speed of a repeat (0 fast - 31 slow)
delaydefines delay of a repeat (0 minimal - 7 maximal)

Definiert in Zeile 230 der Datei keyctrl.cc.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

Dokumentation der Datenelemente

unsigned char Keyboard_Controller::alt_tab
staticprivate
Initialisierung:
{
0, 0, 0, 253, 0, 0, 0, 0, '{', '[', ']', '}', '\\', 0, 0,
0, '@', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '~', 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 230, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '|', 0, 0
}

Scancode translation table if alt is pressed.

Definiert in Zeile 136 der Datei keyctrl.h.

unsigned char Keyboard_Controller::asc_num_tab
staticprivate
Initialisierung:
{
'7', '8', '9', '-', '4', '5', '6', '+', '1', '2', '3', '0', ','
}

Scancode translation table to ascii for numeric block.

Definiert in Zeile 139 der Datei keyctrl.h.

unsigned char Keyboard_Controller::code
private

der zuletzt eingelesene Scan-Code

Definiert in Zeile 39 der Datei keyctrl.h.

const IO_Port Keyboard_Controller::ctrl_port
private

"Control Port" des Tastaturkontrollers

Dieser Port gibt beim Lesen den Zustand des Tastaturkontrollers aus und beim Schreiben werden Befehle übergeben.

Definiert in Zeile 71 der Datei keyctrl.h.

const IO_Port Keyboard_Controller::data_port
private

"Daten Port" des Tastaturkontrollers

Hiermit können Daten vom Tastaturpuffer gelesen oder in diesem geschrieben werden.

Definiert in Zeile 84 der Datei keyctrl.h.

Key Keyboard_Controller::gather
private

Key to save the last input.

Definiert in Zeile 51 der Datei keyctrl.h.

char Keyboard_Controller::leds
private

variable containing the current led status

Definiert in Zeile 57 der Datei keyctrl.h.

unsigned char Keyboard_Controller::normal_tab
staticprivate
Initialisierung:
{
0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 225, 39, '\b',
0, 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 129, '+', '\n',
0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 148, 132, '^', 0, '#',
'y', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0,
'*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-',
0, 0, 0, '+', 0, 0, 0, 0, 0, 0, 0, '<', 0, 0
}

Scancode translation table without modifier.

Definiert in Zeile 130 der Datei keyctrl.h.

unsigned char Keyboard_Controller::prefix
private

der Vorsatz/Prefix des aktuellen Scan-Codes

Definiert in Zeile 45 der Datei keyctrl.h.

unsigned char Keyboard_Controller::scan_num_tab
staticprivate
Initialisierung:
{
8, 9, 10, 53, 5, 6, 7, 27, 2, 3, 4, 11, 51
}

Scancode translation table to special keys for numeric block.

Definiert in Zeile 142 der Datei keyctrl.h.

unsigned char Keyboard_Controller::shift_tab
staticprivate
Initialisierung:
{
0, 0, '!', '"', 21, '$', '%', '&', '/', '(', ')', '=', '?', 96, 0,
0, 'Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 154, '*', 0,
0, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 153, 142, 248, 0, 39,
'Y', 'X', 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0,
0, 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '>', 0, 0
}

Scancode translation table if shift is pressed.

Definiert in Zeile 133 der Datei keyctrl.h.


Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Dateien: