]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
ad hoc fix for wrong bit read problem of adb.c.
authortmk <nobody@nowhere>
Wed, 19 Sep 2012 03:05:47 +0000 (12:05 +0900)
committertmk <nobody@nowhere>
Wed, 19 Sep 2012 03:05:47 +0000 (12:05 +0900)
protocol/adb.c

index d60b8608b1ee9ce222b41f7d821fcdab1f044609..d7105b3a9ae5b44564088f2923ea290da7c67113 100644 (file)
@@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
 #include <stdbool.h>
 #include <util/delay.h>
 #include <avr/io.h>
+#include <avr/interrupt.h>
 #include "adb.h"
 
 
@@ -85,8 +86,13 @@ uint16_t adb_host_kbd_recv(void)
         return 0;               // No data to send
     if (!read_bit())            // Startbit(1)
         return -2;
+
+    // ad hoc fix: without block inerrupt read wrong bit occasionally and get keys stuck
+    cli();
     data = read_byte();
     data = (data<<8) | read_byte();
+    sei();
+
     if (read_bit())             // Stopbit(0)
         return -3;
     return data;