]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
FIX: error handling in ps2.c
authortmk <nobody@nowhere>
Tue, 11 Jan 2011 12:30:35 +0000 (21:30 +0900)
committertmk <nobody@nowhere>
Tue, 11 Jan 2011 12:30:35 +0000 (21:30 +0900)
ps2.c

diff --git a/ps2.c b/ps2.c
index adb425ae3345e0d548a80a5cdcb8c0e0c5d9474b..a388b7489203de15abca5580826c6adb16d506f1 100644 (file)
--- a/ps2.c
+++ b/ps2.c
@@ -104,9 +104,9 @@ uint8_t ps2_host_send(uint8_t data)
 
     /* request to send */
     clock_lo();
-    data_lo();
     _delay_us(100);
     /* start bit [1] */
+    data_lo();
     clock_hi();
     WAIT(clock_lo, 15000, 1);
     /* data [2-9] */
@@ -137,6 +137,9 @@ uint8_t ps2_host_send(uint8_t data)
 
     return 1;
 ERROR:
+    /* inhibit device to send */
+    data_hi();
+    clock_lo();
     return 0;
 }
 
@@ -187,6 +190,9 @@ uint8_t ps2_host_recv(void)
 
     return data;
 ERROR:
+    /* inhibit device to send */
+    data_hi();
+    clock_lo();
     return 0;
 }