From a567fec91c0f9020cf050ae80410b891486f2ba3 Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 4 Jan 2018 13:12:14 +0900 Subject: [PATCH] core: LUFA: Fix checking num of endpoints for 32u2 --- tmk_core/protocol/lufa/descriptor.h | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/tmk_core/protocol/lufa/descriptor.h b/tmk_core/protocol/lufa/descriptor.h index 4af872b7..8aaa32c5 100644 --- a/tmk_core/protocol/lufa/descriptor.h +++ b/tmk_core/protocol/lufa/descriptor.h @@ -121,34 +121,33 @@ typedef struct // Endopoint number and size -#define KEYBOARD_IN_EPNUM 1 +#define CUR_EPNUM 1 +#define KEYBOARD_IN_EPNUM CUR_EPNUM #ifdef MOUSE_ENABLE -# define MOUSE_IN_EPNUM (KEYBOARD_IN_EPNUM + 1) -#else -# define MOUSE_IN_EPNUM KEYBOARD_IN_EPNUM +# define CUR_EPNUM (CUR_EPNUM + 1) +# define MOUSE_IN_EPNUM CUR_EPNUM #endif #ifdef EXTRAKEY_ENABLE -# define EXTRAKEY_IN_EPNUM (MOUSE_IN_EPNUM + 1) -#else -# define EXTRAKEY_IN_EPNUM MOUSE_IN_EPNUM +# define CUR_EPNUM (CUR_EPNUM + 1) +# define EXTRAKEY_IN_EPNUM CUR_EPNUM #endif #ifdef CONSOLE_ENABLE -# define CONSOLE_IN_EPNUM (EXTRAKEY_IN_EPNUM + 1) -# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 1) -//# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 2) -#else -# define CONSOLE_OUT_EPNUM EXTRAKEY_IN_EPNUM +# define CUR_EPNUM (CUR_EPNUM + 1) +# define CONSOLE_IN_EPNUM CUR_EPNUM +# define CONSOLE_OUT_EPNUM CUR_EPNUM #endif #ifdef NKRO_ENABLE -# define NKRO_IN_EPNUM (CONSOLE_OUT_EPNUM + 1) +# define CUR_EPNUM (CUR_EPNUM + 1) +# define NKRO_IN_EPNUM CUR_EPNUM #endif -#if defined(__AVR_ATmega32U2__) && NKRO_IN_EPNUM > 4 -# error "Endpoints are not available enough to support all functions. Remove some in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO)" +/* Check number of endpoints. ATmega32u2 has only four except for control endpoint. */ +#if defined(__AVR_ATmega32U2__) && CUR_EPNUM > 4 +# error "Endpoints are not available enough to support all functions. Disable some of build options in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO)" #endif -- 2.46.2