X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=protocol%2Flufa%2Fdescriptor.h;h=9ee1c04d794c92e4e81fafd04bae28ca55307581;hb=44d2d5f5fda3fbdf73e311067807026bb53798c0;hp=6b1b4d48451a34dca0e03787d884f6f9b3c0a6db;hpb=cc68adeb5744cba9e8650bab04ff0f0a4033db9f;p=max%2Ftmk_keyboard.git diff --git a/protocol/lufa/descriptor.h b/protocol/lufa/descriptor.h index 6b1b4d48..9ee1c04d 100644 --- a/protocol/lufa/descriptor.h +++ b/protocol/lufa/descriptor.h @@ -1,3 +1,10 @@ +/* + * Copyright 2012,2013 Jun Wako + * This file is based on: + * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse + * LUFA-120219/Demos/Device/Lowlevel/GenericHID + */ + /* LUFA Library Copyright (C) Dean Camera, 2012. @@ -50,44 +57,101 @@ typedef struct USB_HID_Descriptor_HID_t Keyboard_HID; USB_Descriptor_Endpoint_t Keyboard_INEndpoint; +#ifdef MOUSE_ENABLE // Mouse HID Interface USB_Descriptor_Interface_t Mouse_Interface; USB_HID_Descriptor_HID_t Mouse_HID; USB_Descriptor_Endpoint_t Mouse_INEndpoint; +#endif +#ifdef EXTRAKEY_ENABLE + // Extrakey HID Interface + USB_Descriptor_Interface_t Extrakey_Interface; + USB_HID_Descriptor_HID_t Extrakey_HID; + USB_Descriptor_Endpoint_t Extrakey_INEndpoint; +#endif + +#ifdef CONSOLE_ENABLE // Console HID Interface USB_Descriptor_Interface_t Console_Interface; USB_HID_Descriptor_HID_t Console_HID; USB_Descriptor_Endpoint_t Console_INEndpoint; USB_Descriptor_Endpoint_t Console_OUTEndpoint; +#endif - // Extra HID Interface - USB_Descriptor_Interface_t Extra_Interface; - USB_HID_Descriptor_HID_t Extra_HID; - USB_Descriptor_Endpoint_t Extra_INEndpoint; +#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; -/* nubmer of interfaces */ -#define TOTAL_INTERFACES 4 - /* index of interface */ #define KEYBOARD_INTERFACE 0 -#define MOUSE_INTERFACE 1 -#define CONSOLE_INTERFACE 2 -#define EXTRA_INTERFACE 3 + +#ifdef MOUSE_ENABLE +# define MOUSE_INTERFACE (KEYBOARD_INTERFACE + 1) +#else +# define MOUSE_INTERFACE KEYBOARD_INTERFACE +#endif + +#ifdef EXTRAKEY_ENABLE +# define EXTRAKEY_INTERFACE (MOUSE_INTERFACE + 1) +#else +# define EXTRAKEY_INTERFACE MOUSE_INTERFACE +#endif + +#ifdef CONSOLE_ENABLE +# define CONSOLE_INTERFACE (EXTRAKEY_INTERFACE + 1) +#else +# 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 (NKRO_INTERFACE + 1) + // Endopoint number and size #define KEYBOARD_IN_EPNUM 1 -#define MOUSE_IN_EPNUM 2 -#define CONSOLE_IN_EPNUM 3 -#define CONSOLE_OUT_EPNUM 4 -#define EXTRA_IN_EPNUM 5 + +#ifdef MOUSE_ENABLE +# define MOUSE_IN_EPNUM (KEYBOARD_IN_EPNUM + 1) +#else +# define MOUSE_IN_EPNUM KEYBOARD_IN_EPNUM +#endif + +#ifdef EXTRAKEY_ENABLE +# define EXTRAKEY_IN_EPNUM (MOUSE_IN_EPNUM + 1) +#else +# define EXTRAKEY_IN_EPNUM MOUSE_IN_EPNUM +#endif + +#ifdef CONSOLE_ENABLE +# define CONSOLE_IN_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) +#endif + #define KEYBOARD_EPSIZE 8 #define MOUSE_EPSIZE 8 -#define CONSOLE_EPSIZE 8 -#define EXTRA_EPSIZE 8 +#define EXTRAKEY_EPSIZE 8 +#define CONSOLE_EPSIZE 32 +#define NKRO_EPSIZE 16 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,