From d74ba8f1735a0dc06473237dbdc7ae1c5597a704 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 2 Feb 2022 18:08:08 +0900 Subject: [PATCH] lufa: Use 64B and double bank for console endpoint --- tmk_core/protocol/lufa/descriptor.h | 12 +++++++++--- tmk_core/protocol/lufa/lufa.c | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tmk_core/protocol/lufa/descriptor.h b/tmk_core/protocol/lufa/descriptor.h index 39bb3fe7..4dfb37fc 100644 --- a/tmk_core/protocol/lufa/descriptor.h +++ b/tmk_core/protocol/lufa/descriptor.h @@ -127,8 +127,14 @@ typedef struct #endif #ifdef CONSOLE_ENABLE -# define CONSOLE_IN_EPNUM (MOUSE_IN_EPNUM + 1) -# define CONSOLE_OUT_EPNUM (MOUSE_IN_EPNUM + 1) + // ATMega32U2 doesn't support double bank on endpoint 1 and 2, use 3 or 4 +# if MOUSE_IN_EPNUM < 2 +# define CONSOLE_IN_EPNUM 3 +# define CONSOLE_OUT_EPNUM 3 +# else +# define CONSOLE_IN_EPNUM (MOUSE_IN_EPNUM + 1) +# define CONSOLE_OUT_EPNUM (MOUSE_IN_EPNUM + 1) +# endif #else # define CONSOLE_OUT_EPNUM MOUSE_IN_EPNUM #endif @@ -153,7 +159,7 @@ typedef struct #define MOUSE_EPSIZE 8 #endif -#define CONSOLE_EPSIZE 32 +#define CONSOLE_EPSIZE 64 #define NKRO_EPSIZE 32 diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 8653c46e..0660c9d3 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -354,9 +354,10 @@ void EVENT_USB_Device_ConfigurationChanged(void) #endif #ifdef CONSOLE_ENABLE + // ATMega32U2 doesn't support double bank on endpoint 1 and 2, use 3 or 4 /* Setup Console HID Report Endpoints */ ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, - CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE); + CONSOLE_EPSIZE, ENDPOINT_BANK_DOUBLE); #if 0 ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT, CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);