X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=protocol%2Flufa%2Fdescriptor.h;h=42af07917c33f5795e538c40e7bf19c6d01d5269;hb=541913029150d57e83396293d35807a16d3755e8;hp=44f20d5a26b36855d24f7cbd59cacb007cc69428;hpb=e075361b6f6bfe24e8d12d125bdab46345087432;p=max%2Ftmk_keyboard.git diff --git a/protocol/lufa/descriptor.h b/protocol/lufa/descriptor.h index 44f20d5a..42af0791 100644 --- a/protocol/lufa/descriptor.h +++ b/protocol/lufa/descriptor.h @@ -1,5 +1,5 @@ /* - * Copyright 2012 Jun Wako + * Copyright 2012,2013 Jun Wako * This file is based on: * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse * LUFA-120219/Demos/Device/Lowlevel/GenericHID @@ -78,6 +78,13 @@ typedef struct USB_Descriptor_Endpoint_t Console_INEndpoint; USB_Descriptor_Endpoint_t Console_OUTEndpoint; #endif + +#ifdef NKRO_ENABLE + // NKRO HID Interface + USB_Descriptor_Interface_t NKRO_Interface; + USB_HID_Descriptor_HID_t NKRO_HID; + USB_Descriptor_Endpoint_t NKRO_INEndpoint; +#endif } USB_Descriptor_Configuration_t; @@ -102,9 +109,15 @@ typedef struct # define CONSOLE_INTERFACE EXTRAKEY_INTERFACE #endif +#ifdef NKRO_ENABLE +# define NKRO_INTERFACE (CONSOLE_INTERFACE + 1) +#else +# define NKRO_INTERFACE CONSOLE_INTERFACE +#endif + /* nubmer of interfaces */ -#define TOTAL_INTERFACES (CONSOLE_INTERFACE + 1) +#define TOTAL_INTERFACES (NKRO_INTERFACE + 1) // Endopoint number and size @@ -124,7 +137,17 @@ typedef struct #ifdef CONSOLE_ENABLE # define CONSOLE_IN_EPNUM (EXTRAKEY_IN_EPNUM + 1) -# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 2) +# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 1) +//# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 2) +#else +# define CONSOLE_OUT_EPNUM EXTRAKEY_IN_EPNUM +#endif + +#ifdef NKRO_ENABLE +# define NKRO_IN_EPNUM (CONSOLE_OUT_EPNUM + 1) +# 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)" +# endif #endif @@ -132,6 +155,7 @@ typedef struct #define MOUSE_EPSIZE 8 #define EXTRAKEY_EPSIZE 8 #define CONSOLE_EPSIZE 32 +#define NKRO_EPSIZE 16 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, @@ -139,4 +163,14 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); + +/* new API */ +#if LUFA_VERSION_INTEGER < 0x140302 + #undef VERSION_BCD + #define VERSION_BCD(Major, Minor, Revision) \ + CPU_TO_LE16( ((Major & 0xFF) << 8) | \ + ((Minor & 0x0F) << 4) | \ + (Revision & 0x0F) ) +#endif + #endif