From 343c32afc6d1dea955d14c17c8c1981c42418d8d Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 8 May 2020 21:32:41 +0900 Subject: [PATCH] ibmpc: Fix 'Ack' check of sending data --- tmk_core/protocol/ibmpc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tmk_core/protocol/ibmpc.c b/tmk_core/protocol/ibmpc.c index c2400dc5..a071db19 100644 --- a/tmk_core/protocol/ibmpc.c +++ b/tmk_core/protocol/ibmpc.c @@ -105,13 +105,13 @@ int16_t ibmpc_host_send(uint8_t data) /* terminate a transmission if we have */ inhibit(); - wait_us(100); // 100us [4]p.13, [5]p.50 + wait_us(100); // [5]p.54 /* 'Request to Send' and Start bit */ data_lo(); wait_us(100); - clock_hi(); - WAIT(clock_lo, 10000, 1); // 10ms [5]p.50 + clock_hi(); // [5]p.54 [clock low]>100us [5]p.50 + WAIT(clock_lo, 10000, 1); // [5]p.53, -10ms [5]p.50 /* Data bit[2-9] */ for (uint8_t i = 0; i < 8; i++) { @@ -135,14 +135,15 @@ int16_t ibmpc_host_send(uint8_t data) /* Stop bit */ wait_us(15); data_hi(); + WAIT(clock_hi, 50, 6); + WAIT(clock_lo, 50, 7); /* Ack */ - WAIT(data_lo, 50, 6); - WAIT(clock_lo, 50, 7); + WAIT(data_lo, 50, 8); /* wait for idle state */ - WAIT(clock_hi, 50, 8); - WAIT(data_hi, 50, 9); + WAIT(clock_hi, 50, 9); + WAIT(data_hi, 50, 10); // clear buffer to get response correctly recv_data = 0xFFFF; -- 2.46.2