mirror of
https://github.com/jscrane/r65emu.git
synced 2025-01-02 13:30:53 +00:00
minor kbd changes
This commit is contained in:
parent
50110b3525
commit
f8371e10df
@ -7,10 +7,10 @@ public:
|
||||
virtual void down(byte) = 0;
|
||||
virtual void reset() = 0;
|
||||
|
||||
inline bool isshift(byte scan) {
|
||||
static inline bool isshift(byte scan) {
|
||||
return scan == 0x12 || scan == 0x59;
|
||||
}
|
||||
inline bool isctrl(byte scan) {
|
||||
static inline bool isctrl(byte scan) {
|
||||
return scan == 0x14;
|
||||
}
|
||||
};
|
||||
|
25
ps2drv.cpp
25
ps2drv.cpp
@ -71,6 +71,31 @@ int PS2Driver::read() {
|
||||
return buffer[i];
|
||||
}
|
||||
|
||||
unsigned PS2Driver::read2() {
|
||||
if (head == tail)
|
||||
return 0;
|
||||
|
||||
uint8_t i = tail+1;
|
||||
if (i == BUFFER_SIZE) i = 0;
|
||||
tail = i;
|
||||
if (buffer[i] != 0xf0)
|
||||
return buffer[i];
|
||||
return 0x0100 | read2();
|
||||
}
|
||||
|
||||
unsigned PS2Driver::peek() {
|
||||
if (head == tail)
|
||||
return 0;
|
||||
|
||||
uint8_t i = tail+1;
|
||||
if (i == BUFFER_SIZE) i = 0;
|
||||
if (buffer[i] == 0xf0) {
|
||||
if (++i == BUFFER_SIZE) i = 0;
|
||||
return 0x0100 | buffer[i];
|
||||
}
|
||||
return buffer[i];
|
||||
}
|
||||
|
||||
void PS2Driver::begin(uint8_t data_pin, uint8_t irq_pin)
|
||||
{
|
||||
DataPin = data_pin;
|
||||
|
Loading…
Reference in New Issue
Block a user