From 80d10bef073e3d32149aa4a137d8016ac999dffc Mon Sep 17 00:00:00 2001 From: Jason Green Date: Mon, 1 Aug 2016 05:02:52 +0000 Subject: Added USB Virtual Serial support --- tmk_core/protocol/lufa/descriptor.h | 43 ++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'tmk_core/protocol/lufa/descriptor.h') diff --git a/tmk_core/protocol/lufa/descriptor.h b/tmk_core/protocol/lufa/descriptor.h index 4fd81a0e87..316650a7b1 100644 --- a/tmk_core/protocol/lufa/descriptor.h +++ b/tmk_core/protocol/lufa/descriptor.h @@ -104,6 +104,21 @@ typedef struct USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC; #endif +#ifdef VIRTSER_ENABLE + USB_Descriptor_Interface_Association_t CDC_Interface_Association; + + // CDC Control Interface + USB_Descriptor_Interface_t CDC_CCI_Interface; + USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header; + USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM; + USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union; + USB_Descriptor_Endpoint_t CDC_NotificationEndpoint; + + // CDC Data Interface + USB_Descriptor_Interface_t CDC_DCI_Interface; + USB_Descriptor_Endpoint_t CDC_DataOutEndpoint; + USB_Descriptor_Endpoint_t CDC_DataInEndpoint; +#endif } USB_Descriptor_Configuration_t; @@ -141,8 +156,15 @@ typedef struct # define AS_INTERFACE NKRO_INTERFACE #endif +#ifdef VIRTSER_ENABLE +# define CCI_INTERFACE (AS_INTERFACE + 1) +# define CDI_INTERFACE (AS_INTERFACE + 2) +#else +# define CDI_INTERFACE AS_INTERFACE +#endif + /* nubmer of interfaces */ -#define TOTAL_INTERFACES AS_INTERFACE + 1 +#define TOTAL_INTERFACES (CDI_INTERFACE + 1) // Endopoint number and size @@ -180,11 +202,24 @@ typedef struct # define MIDI_STREAM_OUT_EPNUM (NKRO_IN_EPNUM + 2) # define MIDI_STREAM_IN_EPADDR (ENDPOINT_DIR_IN | MIDI_STREAM_IN_EPNUM) # define MIDI_STREAM_OUT_EPADDR (ENDPOINT_DIR_OUT | MIDI_STREAM_OUT_EPNUM) +#else +# define MIDI_STREAM_OUT_EPNUM NKRO_IN_EPNUM +#endif + +#ifdef VIRTSER_ENABLE +# define CDC_NOTIFICATION_EPNUM (MIDI_STREAM_OUT_EPNUM + 1) +# define CDC_IN_EPNUM (MIDI_STREAM_OUT_EPNUM + 2) +# define CDC_OUT_EPNUM (MIDI_STREAM_OUT_EPNUM + 3) +# define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM) +# define CDC_IN_EPADDR (ENDPOINT_DIR_IN | CDC_IN_EPNUM) +# define CDC_OUT_EPADDR (ENDPOINT_DIR_OUT | CDC_OUT_EPNUM) +#else +# define CDC_OUT_EPNUM MIDI_STREAM_OUT_EPNUM #endif -#if defined(__AVR_ATmega32U2__) && MIDI_STREAM_OUT_EPADDR > 4 -# error "Endpoints are not available enough to support all functions. Remove some in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO, MIDI)" +#if defined(__AVR_ATmega32U2__) && CDC_OUT_EPNUM > 4 +# error "Endpoints are not available enough to support all functions. Remove some in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO, MIDI, SERIAL)" #endif #define KEYBOARD_EPSIZE 8 @@ -193,6 +228,8 @@ typedef struct #define CONSOLE_EPSIZE 32 #define NKRO_EPSIZE 16 #define MIDI_STREAM_EPSIZE 64 +#define CDC_NOTIFICATION_EPSIZE 8 +#define CDC_EPSIZE 16 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, -- cgit v1.2.3 From 16e706214fad14856603fb439dc830c47ef83527 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Tue, 6 Sep 2016 14:59:12 -0500 Subject: Change NKRO size fron 16 bytes to 32 bytes. --- tmk_core/protocol/lufa/descriptor.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tmk_core/protocol/lufa/descriptor.h') diff --git a/tmk_core/protocol/lufa/descriptor.h b/tmk_core/protocol/lufa/descriptor.h index 316650a7b1..c6c94e3618 100644 --- a/tmk_core/protocol/lufa/descriptor.h +++ b/tmk_core/protocol/lufa/descriptor.h @@ -1,4 +1,4 @@ -/* +/* * Copyright 2012,2013 Jun Wako * This file is based on: * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse @@ -129,13 +129,13 @@ typedef struct # define MOUSE_INTERFACE (KEYBOARD_INTERFACE + 1) #else # define MOUSE_INTERFACE KEYBOARD_INTERFACE -#endif +#endif #ifdef EXTRAKEY_ENABLE # define EXTRAKEY_INTERFACE (MOUSE_INTERFACE + 1) #else # define EXTRAKEY_INTERFACE MOUSE_INTERFACE -#endif +#endif #ifdef CONSOLE_ENABLE # define CONSOLE_INTERFACE (EXTRAKEY_INTERFACE + 1) @@ -171,7 +171,7 @@ typedef struct #define KEYBOARD_IN_EPNUM 1 #ifdef MOUSE_ENABLE -# define MOUSE_IN_EPNUM (KEYBOARD_IN_EPNUM + 1) +# define MOUSE_IN_EPNUM (KEYBOARD_IN_EPNUM + 1) #else # define MOUSE_IN_EPNUM KEYBOARD_IN_EPNUM #endif @@ -179,7 +179,7 @@ typedef struct #ifdef EXTRAKEY_ENABLE # define EXTRAKEY_IN_EPNUM (MOUSE_IN_EPNUM + 1) #else -# define EXTRAKEY_IN_EPNUM MOUSE_IN_EPNUM +# define EXTRAKEY_IN_EPNUM MOUSE_IN_EPNUM #endif #ifdef CONSOLE_ENABLE @@ -226,7 +226,7 @@ typedef struct #define MOUSE_EPSIZE 8 #define EXTRAKEY_EPSIZE 8 #define CONSOLE_EPSIZE 32 -#define NKRO_EPSIZE 16 +#define NKRO_EPSIZE 32 #define MIDI_STREAM_EPSIZE 64 #define CDC_NOTIFICATION_EPSIZE 8 #define CDC_EPSIZE 16 -- cgit v1.2.3