]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
xt_usb: Read data earlier as possible in ISR
authortmk <hasu@tmk-kbd.com>
Thu, 1 Mar 2018 17:31:44 +0000 (02:31 +0900)
committertmk <hasu@tmk-kbd.com>
Wed, 14 Mar 2018 12:32:22 +0000 (21:32 +0900)
tmk_core/protocol/xt_interrupt.c

index 8c8408bac6335e1754626a06ce84b9db9921da0a..5531464d742c2342f5beef62d1ced098e61eb053 100644 (file)
@@ -93,17 +93,18 @@ ISR(XT_INT_VECT)
     } state = START;
     static uint8_t data = 0;
 
+    uint8_t dbit = data_in();
     // This is needed if using PCINT which can be called on both falling and rising edge
     if (clock_in()) return;
 
     switch (state) {
         case START:
             // ignore start(0) bit
-            if (!data_in()) return;
+            if (!dbit) return;
             break;
         case BIT0 ... BIT7:
             data >>= 1;
-            if (data_in())
+            if (dbit)
                 data |= 0x80;
             break;
     }