]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
pc98_usb: Add RDY pulse in response receive #666
authortmk <hasu@tmk-kbd.com>
Sat, 16 Jan 2021 14:31:22 +0000 (23:31 +0900)
committertmk <hasu@tmk-kbd.com>
Sun, 17 Jan 2021 06:52:14 +0000 (15:52 +0900)
RDY high pulse(>=37us) is required to allow keyboard to send next data.
https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n157

converter/pc98_usb/matrix.c

index ce5a5b3788c40d05860e0eb0dda3ef9f181e52aa..17335aa97f0176b7b1fca93ed300f09b88c4144a 100644 (file)
@@ -63,6 +63,13 @@ static int16_t pc98_wait_response(void)
     int16_t code = -1;
     uint8_t timeout = 255;
     while (timeout-- && (code = serial_recv2()) == -1) _delay_ms(1);
+
+    // Keyboards require RDY pulse >=37us to send next data
+    // https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n157
+    PC98_RDY_PORT |=  (1<<PC98_RDY_BIT);
+    _delay_us(40);
+    PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
+
     xprintf("r%04X ", code);
     return code;
 }
@@ -176,11 +183,12 @@ uint8_t matrix_scan(void)
         }
     }
 
-    // PC-9801V keyboard requires RDY pulse.
-    // This is not optimal place though, it works.
-    PC98_RDY_PORT |=  (1<<PC98_RDY_BIT);    // RDY: high
-    _delay_us(20);
-    PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);    // RDY: low
+    // Keyboards require RDY pulse >=37us to send next data
+    // https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n157
+    PC98_RDY_PORT |=  (1<<PC98_RDY_BIT);
+    _delay_us(40);
+    PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
+
     return code;
 }