update vorgabe04
This commit is contained in:
@ -73,16 +73,18 @@ bool Keyboard::key_decoded() {
|
|||||||
gather.shift(false);
|
gather.shift(false);
|
||||||
break;
|
break;
|
||||||
case 56:
|
case 56:
|
||||||
if (prefix == prefix1)
|
if (prefix == prefix1) {
|
||||||
gather.alt_right(false);
|
gather.alt_right(false);
|
||||||
else
|
} else {
|
||||||
gather.alt_left(false);
|
gather.alt_left(false);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 29:
|
case 29:
|
||||||
if (prefix == prefix1)
|
if (prefix == prefix1) {
|
||||||
gather.ctrl_right(false);
|
gather.ctrl_right(false);
|
||||||
else
|
} else {
|
||||||
gather.ctrl_left(false);
|
gather.ctrl_left(false);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,16 +110,18 @@ bool Keyboard::key_decoded() {
|
|||||||
gather.shift(true);
|
gather.shift(true);
|
||||||
break;
|
break;
|
||||||
case 56:
|
case 56:
|
||||||
if (prefix == prefix1)
|
if (prefix == prefix1) {
|
||||||
gather.alt_right(true);
|
gather.alt_right(true);
|
||||||
else
|
} else {
|
||||||
gather.alt_left(true);
|
gather.alt_left(true);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 29:
|
case 29:
|
||||||
if (prefix == prefix1)
|
if (prefix == prefix1) {
|
||||||
gather.ctrl_right(true);
|
gather.ctrl_right(true);
|
||||||
else
|
} else {
|
||||||
gather.ctrl_left(true);
|
gather.ctrl_left(true);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 58:
|
case 58:
|
||||||
gather.caps_lock(!gather.caps_lock());
|
gather.caps_lock(!gather.caps_lock());
|
||||||
@ -153,10 +157,7 @@ bool Keyboard::key_decoded() {
|
|||||||
// Also ist es jetzt abgehandelt.
|
// Also ist es jetzt abgehandelt.
|
||||||
prefix = 0;
|
prefix = 0;
|
||||||
|
|
||||||
if (done)
|
return done;
|
||||||
return true; // Tastaturabfrage abgeschlossen
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -333,9 +334,8 @@ void Keyboard::plugin() {
|
|||||||
void scroll_mode(Key key);
|
void scroll_mode(Key key);
|
||||||
|
|
||||||
void Keyboard::trigger() {
|
void Keyboard::trigger() {
|
||||||
// TODO: Get data from PS/2 Mouse if necessary
|
|
||||||
|
|
||||||
Key key = this->key_hit();
|
Key key = this->key_hit();
|
||||||
|
this->lastkey = key.ascii();
|
||||||
|
|
||||||
// NOTE: My keyboard has no delete key...
|
// NOTE: My keyboard has no delete key...
|
||||||
if (key.ctrl_left() && key.alt_left() && (char)key == 'r') {
|
if (key.ctrl_left() && key.alt_left() && (char)key == 'r') {
|
||||||
@ -343,8 +343,6 @@ void Keyboard::trigger() {
|
|||||||
} else if ((char)key == 'k' || (char)key == 'j') {
|
} else if ((char)key == 'k' || (char)key == 'j') {
|
||||||
scroll_mode(key);
|
scroll_mode(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Keyboard insert mode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Where to place this?
|
// TODO: Where to place this?
|
||||||
|
|||||||
@ -6,21 +6,19 @@
|
|||||||
* Beschreibung: Treiber für den Tastaturcontroller des PCs. *
|
* Beschreibung: Treiber für den Tastaturcontroller des PCs. *
|
||||||
* *
|
* *
|
||||||
* Autor: Olaf Spinczyk, TU Dortmund *
|
* Autor: Olaf Spinczyk, TU Dortmund *
|
||||||
* Modifikationen, Michael Schoettner, 17.8.2016 *
|
* Modifikationen, Michael Schoettner, 2.6.2022 *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifndef __Keyboard_include__
|
#ifndef __Keyboard_include__
|
||||||
#define __Keyboard_include__
|
#define __Keyboard_include__
|
||||||
|
|
||||||
#include "devices/Key.h"
|
#include "devices/Key.h"
|
||||||
#include "kernel/interrupts/IntDispatcher.h"
|
|
||||||
#include "kernel/interrupts/ISR.h"
|
#include "kernel/interrupts/ISR.h"
|
||||||
#include "kernel/interrupts/PIC.h"
|
|
||||||
#include "kernel/IOport.h"
|
#include "kernel/IOport.h"
|
||||||
|
|
||||||
class Keyboard : public ISR {
|
class Keyboard : public ISR {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Keyboard(const Keyboard& copy); // Verhindere Kopieren
|
Keyboard(const Keyboard& copy) = delete; // Verhindere Kopieren
|
||||||
|
|
||||||
unsigned char code; // Byte von Tastatur
|
unsigned char code; // Byte von Tastatur
|
||||||
unsigned char prefix; // Prefix von Tastatur
|
unsigned char prefix; // Prefix von Tastatur
|
||||||
@ -73,13 +71,15 @@ private:
|
|||||||
// Ermittelt anhand von Tabellen den ASCII-Code.
|
// Ermittelt anhand von Tabellen den ASCII-Code.
|
||||||
void get_ascii_code();
|
void get_ascii_code();
|
||||||
|
|
||||||
public:
|
|
||||||
// Initialisierung der Tastatur.
|
|
||||||
Keyboard();
|
|
||||||
|
|
||||||
// Tastaturabfrage (vorerst Polling)
|
// Tastaturabfrage (vorerst Polling)
|
||||||
Key key_hit();
|
Key key_hit();
|
||||||
|
|
||||||
|
public:
|
||||||
|
unsigned int lastkey; // speichert den ASCII-Code der zuletzt gedrückten Taste
|
||||||
|
|
||||||
|
// Initialisierung der Tastatur.
|
||||||
|
Keyboard();
|
||||||
|
|
||||||
// Fuehrt einen Neustart des Rechners durch.
|
// Fuehrt einen Neustart des Rechners durch.
|
||||||
void reboot();
|
void reboot();
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ public:
|
|||||||
IntDispatcher();
|
IntDispatcher();
|
||||||
|
|
||||||
// Registrierung einer ISR. (Rueckgabewert: 0 = Erfolg, -1 = Fehler)
|
// Registrierung einer ISR. (Rueckgabewert: 0 = Erfolg, -1 = Fehler)
|
||||||
int assign(unsigned int vector, ISR& gate);
|
int assign(unsigned int vector, ISR& isr);
|
||||||
|
|
||||||
// ISR fuer 'vector' ausfuehren
|
// ISR fuer 'vector' ausfuehren
|
||||||
int report(unsigned int vector);
|
int report(unsigned int vector);
|
||||||
|
|||||||
24
c_os/lib/Input.cc
Normal file
24
c_os/lib/Input.cc
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* *
|
||||||
|
* I N P U T *
|
||||||
|
* *
|
||||||
|
*---------------------------------------------------------------------------*
|
||||||
|
* Beschreibung: Hilfsfunktion zum Warten bis auf der Tastatur die Ein- *
|
||||||
|
* -gabetaste gedrückt wird. *
|
||||||
|
* *
|
||||||
|
* Autor: Michael Schoettner, HHU, 2.05.2022 *
|
||||||
|
*****************************************************************************/
|
||||||
|
#include "devices/Keyboard.h"
|
||||||
|
#include "kernel/Globals.h"
|
||||||
|
|
||||||
|
void waitForReturn() {
|
||||||
|
// Warten bis <ENTER> gedrueckt wird
|
||||||
|
kb.lastkey = '\0'; // lastKey loeschen
|
||||||
|
while (kb.lastkey != 10) {};
|
||||||
|
}
|
||||||
|
|
||||||
|
char getch() {
|
||||||
|
kb.lastkey = '\0'; // lastKey loeschen
|
||||||
|
while (kb.lastkey == '\0') {};
|
||||||
|
return kb.lastkey;
|
||||||
|
}
|
||||||
17
c_os/lib/Input.h
Normal file
17
c_os/lib/Input.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* *
|
||||||
|
* I N P U T *
|
||||||
|
* *
|
||||||
|
*---------------------------------------------------------------------------*
|
||||||
|
* Beschreibung: Hilfsfunktion zum Warten bis auf der Tastatur die Ein- *
|
||||||
|
* -gabetaste gedrückt wird. *
|
||||||
|
* *
|
||||||
|
* Autor: Michael Schoettner, HHU, 2.05.2022 *
|
||||||
|
*****************************************************************************/
|
||||||
|
#ifndef __Input_include__
|
||||||
|
#define __Input_include__
|
||||||
|
|
||||||
|
char getch();
|
||||||
|
void waitForReturn();
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user