mirror of
https://github.com/tebl/RC6502-Apple-1-Replica.git
synced 2024-11-25 17:44:22 +00:00
Use KBD interrupt to detect when computer has read character sent (Arduino doesn't support flow control in other direction)
This commit is contained in:
parent
972f4c3b06
commit
7e9fb543ca
@ -1,7 +1,9 @@
|
|||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <MCP23S17.h>
|
#include <MCP23S17.h>
|
||||||
|
|
||||||
#define debug 0
|
#define DEBUG 0
|
||||||
|
#define KBD_INTERRUPT_ENABLE true
|
||||||
|
#define KBD_SEND_TIMEOUT 23
|
||||||
|
|
||||||
#define IO_SS 10
|
#define IO_SS 10
|
||||||
|
|
||||||
@ -62,7 +64,7 @@ void debug_value(String description, byte value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void debug_value(String description, byte value, int level) {
|
void debug_value(String description, byte value, int level) {
|
||||||
if (debug < level) return;
|
if (DEBUG < level) return;
|
||||||
Serial.print(description);
|
Serial.print(description);
|
||||||
Serial.print(": ");
|
Serial.print(": ");
|
||||||
print_hex(value);
|
print_hex(value);
|
||||||
@ -99,21 +101,31 @@ void pia_send(int c) {
|
|||||||
/* Output the actual keys as long as it's supported */
|
/* Output the actual keys as long as it's supported */
|
||||||
if (c < 96) {
|
if (c < 96) {
|
||||||
bridge.writePort(IO_KBD, c | 128);
|
bridge.writePort(IO_KBD, c | 128);
|
||||||
|
|
||||||
digitalWrite(KBD_STROBE, HIGH);
|
digitalWrite(KBD_STROBE, HIGH);
|
||||||
/*
|
if (KBD_INTERRUPT_ENABLE) {
|
||||||
while(digitalRead(KBD_READY) != LOW) {
|
byte timeout;
|
||||||
Serial.print("-");
|
|
||||||
|
/* Wait for KBD_READY (CA2) to go HIGH */
|
||||||
|
timeout = KBD_SEND_TIMEOUT;
|
||||||
|
while(digitalRead(KBD_READY) != HIGH) {
|
||||||
delay(1);
|
delay(1);
|
||||||
|
if (timeout == 0) break;
|
||||||
|
else timeout--;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
delay(23);
|
|
||||||
digitalWrite(KBD_STROBE, LOW);
|
digitalWrite(KBD_STROBE, LOW);
|
||||||
/*
|
|
||||||
while(digitalRead(KBD_READY) == HIGH) {
|
/* Wait for KBD_READY (CA2) to go LOW */
|
||||||
Serial.print(".");
|
timeout = KBD_SEND_TIMEOUT;
|
||||||
|
while(digitalRead(KBD_READY) != LOW) {
|
||||||
delay(1);
|
delay(1);
|
||||||
|
if (timeout == 0) break;
|
||||||
|
else timeout--;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
delay(KBD_SEND_TIMEOUT);
|
||||||
|
digitalWrite(KBD_STROBE, LOW);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user