mirror of
https://github.com/jscrane/r65emu.git
synced 2025-01-08 05:30:10 +00:00
cleanup
This commit is contained in:
parent
ea3d18c7fe
commit
91340c358b
21
ps2drv.cpp
21
ps2drv.cpp
@ -4,7 +4,6 @@
|
||||
#define BUFFER_SIZE 16
|
||||
static volatile uint8_t buffer[BUFFER_SIZE];
|
||||
static volatile uint8_t head, tail;
|
||||
static bool isbrk;
|
||||
static uint8_t DataPin;
|
||||
|
||||
// The ISR for the external interrupt
|
||||
@ -51,26 +50,6 @@ bool PS2Driver::available() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PS2Driver::isbreak() {
|
||||
bool b = isbrk;
|
||||
isbrk = false;
|
||||
return b;
|
||||
}
|
||||
|
||||
int PS2Driver::read() {
|
||||
if (head == tail)
|
||||
return -1;
|
||||
|
||||
uint8_t i = tail+1;
|
||||
if (i == BUFFER_SIZE) i = 0;
|
||||
tail = i;
|
||||
if (buffer[i] == 0xf0) {
|
||||
isbrk = true;
|
||||
return read();
|
||||
}
|
||||
return buffer[i];
|
||||
}
|
||||
|
||||
unsigned PS2Driver::read2() {
|
||||
if (head == tail)
|
||||
return 0;
|
||||
|
9
ps2drv.h
9
ps2drv.h
@ -18,17 +18,10 @@ public:
|
||||
*/
|
||||
bool available();
|
||||
|
||||
/**
|
||||
* returns true if the key has been released
|
||||
*/
|
||||
bool isbreak();
|
||||
|
||||
/**
|
||||
* Returns the scancode last received from the keyboard.
|
||||
* If there is no char available, -1 is returned.
|
||||
* If there is no char available, 0 is returned.
|
||||
*/
|
||||
int read();
|
||||
|
||||
unsigned peek();
|
||||
|
||||
unsigned read2();
|
||||
|
Loading…
Reference in New Issue
Block a user