X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=tmk_core%2Fprotocol%2Flufa%2Flufa.c;h=54221591b388b3729077b68ac23cabe6b624ae7e;hb=2b74203bd7ed7bec3cdf779a5752eb7495de4e02;hp=a709d1f1b1d7bfa1f3c9561c9fa84635c77be92a;hpb=00f5ed3210e1241da04b7c6970bb53ce912cf3f4;p=max%2Ftmk_keyboard.git diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index a709d1f1..54221591 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -52,16 +52,20 @@ #include "hook.h" #include "timer.h" -#ifdef LUFA_DEBUG_SUART +#ifdef TMK_LUFA_DEBUG_SUART #include "avr/suart.h" #endif +#ifdef TMK_LUFA_DEBUG_UART +#include "uart.h" +#endif + #include "matrix.h" #include "descriptor.h" #include "lufa.h" -//#define LUFA_DEBUG +//#define TMK_LUFA_DEBUG uint8_t keyboard_idle = 0; @@ -116,20 +120,35 @@ static bool console_is_ready(void) static bool console_putc(uint8_t c) { - if (!console_is_ready()) - goto EXIT; - // return immediately if called while interrupt if (!(SREG & (1<> 8); -#ifdef LUFA_DEBUG +#ifdef TMK_LUFA_DEBUG xprintf("[I%d]%d", USB_ControlRequest.wIndex, (USB_ControlRequest.wValue & 0xFF00) >> 8); #endif } @@ -445,7 +490,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_Write_8(keyboard_idle); Endpoint_ClearIN(); Endpoint_ClearStatusStage(); -#ifdef LUFA_DEBUG +#ifdef TMK_LUFA_DEBUG print("[i]"); #endif } @@ -535,7 +580,7 @@ static void send_system(uint16_t data) report_extra_t r = { .report_id = REPORT_ID_SYSTEM, - .usage = data + .usage = data - SYSTEM_POWER_DOWN + 1 }; Endpoint_SelectEndpoint(EXTRAKEY_IN_EPNUM); @@ -575,25 +620,22 @@ static void send_consumer(uint16_t data) /******************************************************************************* * sendchar ******************************************************************************/ -#ifdef CONSOLE_ENABLE int8_t sendchar(uint8_t c) { - #ifdef LUFA_DEBUG_SUART + #ifdef TMK_LUFA_DEBUG_SUART xmit(c); #endif - bool r = console_putc(c); - return (r ? 0 : -1); -} -#else -int8_t sendchar(uint8_t c) -{ - #ifdef LUFA_DEBUG_SUART - xmit(c); + #ifdef TMK_LUFA_DEBUG_UART + uart_putchar(c); + #endif + + #ifdef CONSOLE_ENABLE + console_putc(c); #endif + return 0; } -#endif /******************************************************************************* @@ -615,8 +657,6 @@ static void setup_usb(void) USB_Disable(); USB_Init(); - - USB_Device_EnableSOFEvents(); } int main(void) __attribute__ ((weak)); @@ -624,16 +664,20 @@ int main(void) { setup_mcu(); -#ifdef LUFA_DEBUG_SUART +#ifdef TMK_LUFA_DEBUG_SUART SUART_OUT_DDR |= (1<