]> git.friedersdorff.com Git - max/tmk_keyboard.git/blobdiff - tmk_core/protocol/lufa/lufa.c
xt_usb: Replace function with macro
[max/tmk_keyboard.git] / tmk_core / protocol / lufa / lufa.c
index 93fe9a2facd586e369a34ef2daf6eefc6525a913..60849aea4c935da108839c6e583d596540624719 100644 (file)
@@ -431,7 +431,7 @@ static void send_keyboard(report_keyboard_t *report)
         Endpoint_SelectEndpoint(NKRO_IN_EPNUM);
 
         /* Check if write ready for a polling interval around 1ms */
-        while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(4);
+        while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(8);
         if (!Endpoint_IsReadWriteAllowed()) return;
 
         /* Write Keyboard Report Data */
@@ -482,6 +482,7 @@ static void send_mouse(report_mouse_t *report)
 
 static void send_system(uint16_t data)
 {
+#ifdef EXTRAKEY_ENABLE
     uint8_t timeout = 255;
 
     if (USB_DeviceState != DEVICE_STATE_Configured)
@@ -499,10 +500,12 @@ static void send_system(uint16_t data)
 
     Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL);
     Endpoint_ClearIN();
+#endif
 }
 
 static void send_consumer(uint16_t data)
 {
+#ifdef EXTRAKEY_ENABLE
     uint8_t timeout = 255;
 
     if (USB_DeviceState != DEVICE_STATE_Configured)
@@ -520,6 +523,7 @@ static void send_consumer(uint16_t data)
 
     Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL);
     Endpoint_ClearIN();
+#endif
 }
 
 
@@ -647,6 +651,17 @@ int main(void)
         USB_USBTask();
 #endif
     }
+
+    /* wait for Console startup */
+    // TODO: long delay often works anyhoo but proper startup would be better
+    uint16_t delay = 2000;
+    while (delay--) {
+#ifndef INTERRUPT_CONTROL_ENDPOINT
+        USB_USBTask();
+#endif
+        _delay_ms(1);
+    }
+
     print("USB configured.\n");
 
     /* init modules */