diff options
| author | Ryan <fauxpark@gmail.com> | 2020-04-21 08:38:34 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-20 15:38:34 -0700 |
| commit | 99f7fe6bd4ab7bc332fcbe35ef741a4142a73b1f (patch) | |
| tree | 53b41f59ccaef201012b619ca49393e4429ee3f5 /tmk_core | |
| parent | d0c3a4c8d58c1b8c60426ea2f1572fe1fe3bcd01 (diff) | |
| download | qmk_firmware-99f7fe6bd4ab7bc332fcbe35ef741a4142a73b1f.tar.gz qmk_firmware-99f7fe6bd4ab7bc332fcbe35ef741a4142a73b1f.zip | |
Clean up ATSAM ifdefs (#8808)
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/protocol/arm_atsam/usb/conf_usb.h | 20 | ||||
| -rw-r--r-- | tmk_core/protocol/arm_atsam/usb/main_usb.c | 15 | ||||
| -rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udi_cdc.c | 2 | ||||
| -rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udi_cdc.h | 6 | ||||
| -rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udi_device_conf.h | 479 | ||||
| -rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c | 24 | ||||
| -rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.h | 22 | ||||
| -rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c | 28 | ||||
| -rw-r--r-- | tmk_core/protocol/arm_atsam/usb/usb_main.h | 22 | ||||
| -rw-r--r-- | tmk_core/protocol/arm_atsam/usb/usb_protocol_cdc.h | 2 |
10 files changed, 418 insertions, 202 deletions
diff --git a/tmk_core/protocol/arm_atsam/usb/conf_usb.h b/tmk_core/protocol/arm_atsam/usb/conf_usb.h index f236427ca..184a2e81d 100644 --- a/tmk_core/protocol/arm_atsam/usb/conf_usb.h +++ b/tmk_core/protocol/arm_atsam/usb/conf_usb.h | |||
| @@ -116,34 +116,32 @@ | |||
| 116 | * @{ | 116 | * @{ |
| 117 | */ | 117 | */ |
| 118 | //! Interface callback definition | 118 | //! Interface callback definition |
| 119 | #ifdef KBD | 119 | #define UDI_HID_KBD_ENABLE_EXT() main_kbd_enable() |
| 120 | # define UDI_HID_KBD_ENABLE_EXT() main_kbd_enable() | 120 | #define UDI_HID_KBD_DISABLE_EXT() main_kbd_disable() |
| 121 | # define UDI_HID_KBD_DISABLE_EXT() main_kbd_disable() | 121 | //#define UDI_HID_KBD_CHANGE_LED(value) ui_kbd_led(value) |
| 122 | //#define UDI_HID_KBD_CHANGE_LED(value) ui_kbd_led(value) | ||
| 123 | #endif | ||
| 124 | 122 | ||
| 125 | #ifdef NKRO | 123 | #ifdef NKRO_ENABLE |
| 126 | # define UDI_HID_NKRO_ENABLE_EXT() main_nkro_enable() | 124 | # define UDI_HID_NKRO_ENABLE_EXT() main_nkro_enable() |
| 127 | # define UDI_HID_NKRO_DISABLE_EXT() main_nkro_disable() | 125 | # define UDI_HID_NKRO_DISABLE_EXT() main_nkro_disable() |
| 128 | //#define UDI_HID_NKRO_CHANGE_LED(value) ui_kbd_led(value) | 126 | //#define UDI_HID_NKRO_CHANGE_LED(value) ui_kbd_led(value) |
| 129 | #endif | 127 | #endif |
| 130 | 128 | ||
| 131 | #ifdef EXK | 129 | #ifdef EXTRAKEY_ENABLE |
| 132 | # define UDI_HID_EXK_ENABLE_EXT() main_exk_enable() | 130 | # define UDI_HID_EXK_ENABLE_EXT() main_exk_enable() |
| 133 | # define UDI_HID_EXK_DISABLE_EXT() main_exk_disable() | 131 | # define UDI_HID_EXK_DISABLE_EXT() main_exk_disable() |
| 134 | #endif | 132 | #endif |
| 135 | 133 | ||
| 136 | #ifdef CON | 134 | #ifdef CONSOLE_ENABLE |
| 137 | # define UDI_HID_CON_ENABLE_EXT() main_con_enable() | 135 | # define UDI_HID_CON_ENABLE_EXT() main_con_enable() |
| 138 | # define UDI_HID_CON_DISABLE_EXT() main_con_disable() | 136 | # define UDI_HID_CON_DISABLE_EXT() main_con_disable() |
| 139 | #endif | 137 | #endif |
| 140 | 138 | ||
| 141 | #ifdef MOU | 139 | #ifdef MOUSE_ENABLE |
| 142 | # define UDI_HID_MOU_ENABLE_EXT() main_mou_enable() | 140 | # define UDI_HID_MOU_ENABLE_EXT() main_mou_enable() |
| 143 | # define UDI_HID_MOU_DISABLE_EXT() main_mou_disable() | 141 | # define UDI_HID_MOU_DISABLE_EXT() main_mou_disable() |
| 144 | #endif | 142 | #endif |
| 145 | 143 | ||
| 146 | #ifdef RAW | 144 | #ifdef RAW_ENABLE |
| 147 | # define UDI_HID_RAW_ENABLE_EXT() main_raw_enable() | 145 | # define UDI_HID_RAW_ENABLE_EXT() main_raw_enable() |
| 148 | # define UDI_HID_RAW_DISABLE_EXT() main_raw_disable() | 146 | # define UDI_HID_RAW_DISABLE_EXT() main_raw_disable() |
| 149 | # define UDI_HID_RAW_RECEIVE(buffer, len) main_raw_receive(buffer, len) | 147 | # define UDI_HID_RAW_RECEIVE(buffer, len) main_raw_receive(buffer, len) |
diff --git a/tmk_core/protocol/arm_atsam/usb/main_usb.c b/tmk_core/protocol/arm_atsam/usb/main_usb.c index 3809e1fd0..5fcb9a9c6 100644 --- a/tmk_core/protocol/arm_atsam/usb/main_usb.c +++ b/tmk_core/protocol/arm_atsam/usb/main_usb.c | |||
| @@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 18 | #include "samd51j18a.h" | 18 | #include "samd51j18a.h" |
| 19 | #include "conf_usb.h" | 19 | #include "conf_usb.h" |
| 20 | #include "udd.h" | 20 | #include "udd.h" |
| 21 | #ifdef RAW | 21 | |
| 22 | #ifdef RAW_ENABLE | ||
| 22 | # include "raw_hid.h" | 23 | # include "raw_hid.h" |
| 23 | #endif | 24 | #endif |
| 24 | 25 | ||
| @@ -34,7 +35,6 @@ void main_remotewakeup_enable(void) { ui_wakeup_enable(); } | |||
| 34 | 35 | ||
| 35 | void main_remotewakeup_disable(void) { ui_wakeup_disable(); } | 36 | void main_remotewakeup_disable(void) { ui_wakeup_disable(); } |
| 36 | 37 | ||
| 37 | #ifdef KBD | ||
| 38 | volatile bool main_b_kbd_enable = false; | 38 | volatile bool main_b_kbd_enable = false; |
| 39 | bool main_kbd_enable(void) { | 39 | bool main_kbd_enable(void) { |
| 40 | main_b_kbd_enable = true; | 40 | main_b_kbd_enable = true; |
| @@ -42,9 +42,8 @@ bool main_kbd_enable(void) { | |||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | void main_kbd_disable(void) { main_b_kbd_enable = false; } | 44 | void main_kbd_disable(void) { main_b_kbd_enable = false; } |
| 45 | #endif | ||
| 46 | 45 | ||
| 47 | #ifdef NKRO | 46 | #ifdef NKRO_ENABLE |
| 48 | volatile bool main_b_nkro_enable = false; | 47 | volatile bool main_b_nkro_enable = false; |
| 49 | bool main_nkro_enable(void) { | 48 | bool main_nkro_enable(void) { |
| 50 | main_b_nkro_enable = true; | 49 | main_b_nkro_enable = true; |
| @@ -54,7 +53,7 @@ bool main_nkro_enable(void) { | |||
| 54 | void main_nkro_disable(void) { main_b_nkro_enable = false; } | 53 | void main_nkro_disable(void) { main_b_nkro_enable = false; } |
| 55 | #endif | 54 | #endif |
| 56 | 55 | ||
| 57 | #ifdef EXK | 56 | #ifdef EXTRAKEY_ENABLE |
| 58 | volatile bool main_b_exk_enable = false; | 57 | volatile bool main_b_exk_enable = false; |
| 59 | bool main_exk_enable(void) { | 58 | bool main_exk_enable(void) { |
| 60 | main_b_exk_enable = true; | 59 | main_b_exk_enable = true; |
| @@ -64,7 +63,7 @@ bool main_exk_enable(void) { | |||
| 64 | void main_exk_disable(void) { main_b_exk_enable = false; } | 63 | void main_exk_disable(void) { main_b_exk_enable = false; } |
| 65 | #endif | 64 | #endif |
| 66 | 65 | ||
| 67 | #ifdef CON | 66 | #ifdef CONSOLE_ENABLE |
| 68 | volatile bool main_b_con_enable = false; | 67 | volatile bool main_b_con_enable = false; |
| 69 | bool main_con_enable(void) { | 68 | bool main_con_enable(void) { |
| 70 | main_b_con_enable = true; | 69 | main_b_con_enable = true; |
| @@ -74,7 +73,7 @@ bool main_con_enable(void) { | |||
| 74 | void main_con_disable(void) { main_b_con_enable = false; } | 73 | void main_con_disable(void) { main_b_con_enable = false; } |
| 75 | #endif | 74 | #endif |
| 76 | 75 | ||
| 77 | #ifdef MOU | 76 | #ifdef MOUSE_ENABLE |
| 78 | volatile bool main_b_mou_enable = false; | 77 | volatile bool main_b_mou_enable = false; |
| 79 | bool main_mou_enable(void) { | 78 | bool main_mou_enable(void) { |
| 80 | main_b_mou_enable = true; | 79 | main_b_mou_enable = true; |
| @@ -84,7 +83,7 @@ bool main_mou_enable(void) { | |||
| 84 | void main_mou_disable(void) { main_b_mou_enable = false; } | 83 | void main_mou_disable(void) { main_b_mou_enable = false; } |
| 85 | #endif | 84 | #endif |
| 86 | 85 | ||
| 87 | #ifdef RAW | 86 | #ifdef RAW_ENABLE |
| 88 | volatile bool main_b_raw_enable = false; | 87 | volatile bool main_b_raw_enable = false; |
| 89 | bool main_raw_enable(void) { | 88 | bool main_raw_enable(void) { |
| 90 | main_b_raw_enable = true; | 89 | main_b_raw_enable = true; |
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_cdc.c b/tmk_core/protocol/arm_atsam/usb/udi_cdc.c index 8271f3b97..27db4017c 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_cdc.c +++ b/tmk_core/protocol/arm_atsam/usb/udi_cdc.c | |||
| @@ -57,7 +57,7 @@ | |||
| 57 | #include "stdarg.h" | 57 | #include "stdarg.h" |
| 58 | #include "tmk_core/protocol/arm_atsam/clks.h" | 58 | #include "tmk_core/protocol/arm_atsam/clks.h" |
| 59 | 59 | ||
| 60 | #ifdef CDC | 60 | #ifdef VIRTSER_ENABLE |
| 61 | 61 | ||
| 62 | # ifdef UDI_CDC_LOW_RATE | 62 | # ifdef UDI_CDC_LOW_RATE |
| 63 | # ifdef USB_DEVICE_HS_SUPPORT | 63 | # ifdef USB_DEVICE_HS_SUPPORT |
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_cdc.h b/tmk_core/protocol/arm_atsam/usb/udi_cdc.h index 9135bab54..406023980 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_cdc.h +++ b/tmk_core/protocol/arm_atsam/usb/udi_cdc.h | |||
| @@ -47,7 +47,7 @@ | |||
| 47 | #ifndef _UDI_CDC_H_ | 47 | #ifndef _UDI_CDC_H_ |
| 48 | #define _UDI_CDC_H_ | 48 | #define _UDI_CDC_H_ |
| 49 | 49 | ||
| 50 | #ifdef CDC | 50 | #ifdef VIRTSER_ENABLE |
| 51 | 51 | ||
| 52 | # include "conf_usb.h" | 52 | # include "conf_usb.h" |
| 53 | # include "usb_protocol.h" | 53 | # include "usb_protocol.h" |
| @@ -346,7 +346,7 @@ typedef struct { | |||
| 346 | char buf[CDC_INBUF_SIZE]; | 346 | char buf[CDC_INBUF_SIZE]; |
| 347 | } inbuf_t; | 347 | } inbuf_t; |
| 348 | 348 | ||
| 349 | #else // CDC | 349 | #else // VIRTSER_ENABLE |
| 350 | 350 | ||
| 351 | // keep these to accommodate calls if remaining | 351 | // keep these to accommodate calls if remaining |
| 352 | # define CDC_PRINTBUF_SIZE 1 | 352 | # define CDC_PRINTBUF_SIZE 1 |
| @@ -362,7 +362,7 @@ typedef struct { | |||
| 362 | 362 | ||
| 363 | extern inbuf_t inbuf; | 363 | extern inbuf_t inbuf; |
| 364 | 364 | ||
| 365 | #endif // CDC | 365 | #endif // VIRTSER_ENABLE |
| 366 | 366 | ||
| 367 | uint32_t CDC_print(char* printbuf); | 367 | uint32_t CDC_print(char* printbuf); |
| 368 | int CDC_printf(const char* _Format, ...); | 368 | int CDC_printf(const char* _Format, ...); |
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h b/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h index 80556205f..505db47b0 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h +++ b/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h | |||
| @@ -23,77 +23,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 23 | #include "compiler.h" | 23 | #include "compiler.h" |
| 24 | #include "usb_protocol_hid.h" | 24 | #include "usb_protocol_hid.h" |
| 25 | 25 | ||
| 26 | #define DEVICE_CLASS 0 | ||
| 27 | #define DEVICE_SUBCLASS 0 | ||
| 28 | #define DEVICE_PROTOCOL 0 | ||
| 29 | |||
| 30 | #define KBD | ||
| 31 | |||
| 32 | //#define MOUSE_ENABLE //rules.mk | ||
| 33 | #ifdef MOUSE_ENABLE | ||
| 34 | # define MOU | ||
| 35 | #endif | ||
| 36 | |||
| 37 | //#define EXTRAKEY_ENABLE //rules.mk | ||
| 38 | #ifdef EXTRAKEY_ENABLE | ||
| 39 | # define EXK | ||
| 40 | #endif | ||
| 41 | |||
| 42 | //#define RAW_ENABLE //rules.mk | ||
| 43 | #ifdef RAW_ENABLE | ||
| 44 | # define RAW | ||
| 45 | #endif | ||
| 46 | |||
| 47 | //#define CONSOLE_ENABLE //rules.mk | ||
| 48 | #ifdef CONSOLE_ENABLE | ||
| 49 | # define CON | ||
| 50 | #endif | ||
| 51 | |||
| 52 | //#define NKRO_ENABLE //rules.mk | ||
| 53 | #ifdef NKRO_ENABLE | ||
| 54 | # define NKRO | ||
| 55 | #endif | ||
| 56 | |||
| 57 | //#define MIDI_ENABLE //deferred implementation | ||
| 58 | //#ifdef MIDI_ENABLE | ||
| 59 | //#define MIDI | ||
| 60 | //#endif | ||
| 61 | |||
| 62 | //#define VIRTSER_ENABLE //rules.mk | ||
| 63 | #ifdef VIRTSER_ENABLE | 26 | #ifdef VIRTSER_ENABLE |
| 64 | # define CDC | ||
| 65 | // because CDC uses IAD (interface association descriptor | 27 | // because CDC uses IAD (interface association descriptor |
| 66 | // per USB Interface Association Descriptor Device Class Code and Use Model 7/23/2003 Rev 1.0) | 28 | // per USB Interface Association Descriptor Device Class Code and Use Model 7/23/2003 Rev 1.0) |
| 67 | # undef DEVICE_CLASS | ||
| 68 | # define DEVICE_CLASS 0xEF | 29 | # define DEVICE_CLASS 0xEF |
| 69 | # undef DEVICE_SUBCLASS | ||
| 70 | # define DEVICE_SUBCLASS 0x02 | 30 | # define DEVICE_SUBCLASS 0x02 |
| 71 | # undef DEVICE_PROTOCOL | ||
| 72 | # define DEVICE_PROTOCOL 0x01 | 31 | # define DEVICE_PROTOCOL 0x01 |
| 32 | #else | ||
| 33 | # define DEVICE_CLASS 0x00 | ||
| 34 | # define DEVICE_SUBCLASS 0x00 | ||
| 35 | # define DEVICE_PROTOCOL 0x00 | ||
| 73 | #endif | 36 | #endif |
| 74 | 37 | ||
| 75 | /* number of interfaces */ | 38 | /* number of interfaces */ |
| 76 | #define NEXT_INTERFACE_0 0 | 39 | #define NEXT_INTERFACE_0 0 |
| 77 | 40 | ||
| 78 | #ifdef KBD | 41 | #define KEYBOARD_INTERFACE NEXT_INTERFACE_0 |
| 79 | # define KEYBOARD_INTERFACE NEXT_INTERFACE_0 | 42 | #define NEXT_INTERFACE_1 (KEYBOARD_INTERFACE + 1) |
| 80 | # define NEXT_INTERFACE_1 (KEYBOARD_INTERFACE + 1) | 43 | #define UDI_HID_KBD_IFACE_NUMBER KEYBOARD_INTERFACE |
| 81 | # define UDI_HID_KBD_IFACE_NUMBER KEYBOARD_INTERFACE | ||
| 82 | #else | ||
| 83 | # define NEXT_INTERFACE_1 NEXT_INTERFACE_0 | ||
| 84 | #endif | ||
| 85 | 44 | ||
| 86 | // It is important that the Raw HID interface is at a constant | 45 | // It is important that the Raw HID interface is at a constant |
| 87 | // interface number, to support Linux/OSX platforms and chrome.hid | 46 | // interface number, to support Linux/OSX platforms and chrome.hid |
| 88 | // If Raw HID is enabled, let it be always 1. | 47 | // If Raw HID is enabled, let it be always 1. |
| 89 | #ifdef RAW | 48 | #ifdef RAW_ENABLE |
| 90 | # define RAW_INTERFACE NEXT_INTERFACE_1 | 49 | # define RAW_INTERFACE NEXT_INTERFACE_1 |
| 91 | # define NEXT_INTERFACE_2 (RAW_INTERFACE + 1) | 50 | # define NEXT_INTERFACE_2 (RAW_INTERFACE + 1) |
| 92 | #else | 51 | #else |
| 93 | # define NEXT_INTERFACE_2 NEXT_INTERFACE_1 | 52 | # define NEXT_INTERFACE_2 NEXT_INTERFACE_1 |
| 94 | #endif | 53 | #endif |
| 95 | 54 | ||
| 96 | #ifdef MOU | 55 | #ifdef MOUSE_ENABLE |
| 97 | # define MOUSE_INTERFACE NEXT_INTERFACE_2 | 56 | # define MOUSE_INTERFACE NEXT_INTERFACE_2 |
| 98 | # define UDI_HID_MOU_IFACE_NUMBER MOUSE_INTERFACE | 57 | # define UDI_HID_MOU_IFACE_NUMBER MOUSE_INTERFACE |
| 99 | # define NEXT_INTERFACE_3 (MOUSE_INTERFACE + 1) | 58 | # define NEXT_INTERFACE_3 (MOUSE_INTERFACE + 1) |
| @@ -101,7 +60,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 101 | # define NEXT_INTERFACE_3 NEXT_INTERFACE_2 | 60 | # define NEXT_INTERFACE_3 NEXT_INTERFACE_2 |
| 102 | #endif | 61 | #endif |
| 103 | 62 | ||
| 104 | #ifdef EXK | 63 | #ifdef EXTRAKEY_ENABLE |
| 105 | # define EXTRAKEY_INTERFACE NEXT_INTERFACE_3 | 64 | # define EXTRAKEY_INTERFACE NEXT_INTERFACE_3 |
| 106 | # define NEXT_INTERFACE_4 (EXTRAKEY_INTERFACE + 1) | 65 | # define NEXT_INTERFACE_4 (EXTRAKEY_INTERFACE + 1) |
| 107 | # define UDI_HID_EXK_IFACE_NUMBER EXTRAKEY_INTERFACE | 66 | # define UDI_HID_EXK_IFACE_NUMBER EXTRAKEY_INTERFACE |
| @@ -109,7 +68,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 109 | # define NEXT_INTERFACE_4 NEXT_INTERFACE_3 | 68 | # define NEXT_INTERFACE_4 NEXT_INTERFACE_3 |
| 110 | #endif | 69 | #endif |
| 111 | 70 | ||
| 112 | #ifdef CON | 71 | #ifdef CONSOLE_ENABLE |
| 113 | # define CON_INTERFACE NEXT_INTERFACE_4 | 72 | # define CON_INTERFACE NEXT_INTERFACE_4 |
| 114 | # define NEXT_INTERFACE_5 (CON_INTERFACE + 1) | 73 | # define NEXT_INTERFACE_5 (CON_INTERFACE + 1) |
| 115 | # define UDI_HID_CON_IFACE_NUMBER CON_INTERFACE | 74 | # define UDI_HID_CON_IFACE_NUMBER CON_INTERFACE |
| @@ -117,7 +76,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 117 | # define NEXT_INTERFACE_5 NEXT_INTERFACE_4 | 76 | # define NEXT_INTERFACE_5 NEXT_INTERFACE_4 |
| 118 | #endif | 77 | #endif |
| 119 | 78 | ||
| 120 | #ifdef NKRO | 79 | #ifdef NKRO_ENABLE |
| 121 | # define NKRO_INTERFACE NEXT_INTERFACE_5 | 80 | # define NKRO_INTERFACE NEXT_INTERFACE_5 |
| 122 | # define NEXT_INTERFACE_6 (NKRO_INTERFACE + 1) | 81 | # define NEXT_INTERFACE_6 (NKRO_INTERFACE + 1) |
| 123 | # define UDI_HID_NKRO_IFACE_NUMBER NKRO_INTERFACE | 82 | # define UDI_HID_NKRO_IFACE_NUMBER NKRO_INTERFACE |
| @@ -125,7 +84,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 125 | # define NEXT_INTERFACE_6 NEXT_INTERFACE_5 | 84 | # define NEXT_INTERFACE_6 NEXT_INTERFACE_5 |
| 126 | #endif | 85 | #endif |
| 127 | 86 | ||
| 128 | #ifdef MIDI | 87 | #ifdef MIDI_ENABLE |
| 129 | # define AC_INTERFACE NEXT_INTERFACE_6 | 88 | # define AC_INTERFACE NEXT_INTERFACE_6 |
| 130 | # define AS_INTERFACE (AC_INTERFACE + 1) | 89 | # define AS_INTERFACE (AC_INTERFACE + 1) |
| 131 | # define NEXT_INTERFACE_7 (AS_INTERFACE + 1) | 90 | # define NEXT_INTERFACE_7 (AS_INTERFACE + 1) |
| @@ -133,7 +92,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 133 | # define NEXT_INTERFACE_7 NEXT_INTERFACE_6 | 92 | # define NEXT_INTERFACE_7 NEXT_INTERFACE_6 |
| 134 | #endif | 93 | #endif |
| 135 | 94 | ||
| 136 | #ifdef CDC | 95 | #ifdef VIRTSER_ENABLE |
| 137 | # define CCI_INTERFACE NEXT_INTERFACE_7 | 96 | # define CCI_INTERFACE NEXT_INTERFACE_7 |
| 138 | # define CDI_INTERFACE (CCI_INTERFACE + 1) | 97 | # define CDI_INTERFACE (CCI_INTERFACE + 1) |
| 139 | # define NEXT_INTERFACE_8 (CDI_INTERFACE + 1) | 98 | # define NEXT_INTERFACE_8 (CDI_INTERFACE + 1) |
| @@ -155,20 +114,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 155 | #define NEXT_IN_EPNUM_0 1 | 114 | #define NEXT_IN_EPNUM_0 1 |
| 156 | #define NEXT_OUT_EPNUM_0 1 | 115 | #define NEXT_OUT_EPNUM_0 1 |
| 157 | 116 | ||
| 158 | #ifdef KBD | 117 | #define KEYBOARD_IN_EPNUM NEXT_IN_EPNUM_0 |
| 159 | # define KEYBOARD_IN_EPNUM NEXT_IN_EPNUM_0 | 118 | #define UDI_HID_KBD_EP_IN KEYBOARD_IN_EPNUM |
| 160 | # define UDI_HID_KBD_EP_IN KEYBOARD_IN_EPNUM | 119 | #define NEXT_IN_EPNUM_1 (KEYBOARD_IN_EPNUM + 1) |
| 161 | # define NEXT_IN_EPNUM_1 (KEYBOARD_IN_EPNUM + 1) | 120 | #define UDI_HID_KBD_EP_SIZE KEYBOARD_EPSIZE |
| 162 | # define UDI_HID_KBD_EP_SIZE KEYBOARD_EPSIZE | 121 | #define KBD_POLLING_INTERVAL 10 |
| 163 | # define KBD_POLLING_INTERVAL 10 | 122 | #ifndef UDI_HID_KBD_STRING_ID |
| 164 | # ifndef UDI_HID_KBD_STRING_ID | 123 | # define UDI_HID_KBD_STRING_ID 0 |
| 165 | # define UDI_HID_KBD_STRING_ID 0 | ||
| 166 | # endif | ||
| 167 | #else | ||
| 168 | # define NEXT_IN_EPNUM_1 NEXT_IN_EPNUM_0 | ||
| 169 | #endif | 124 | #endif |
| 170 | 125 | ||
| 171 | #ifdef MOU | 126 | #ifdef MOUSE_ENABLE |
| 172 | # define MOUSE_IN_EPNUM NEXT_IN_EPNUM_1 | 127 | # define MOUSE_IN_EPNUM NEXT_IN_EPNUM_1 |
| 173 | # define NEXT_IN_EPNUM_2 (MOUSE_IN_EPNUM + 1) | 128 | # define NEXT_IN_EPNUM_2 (MOUSE_IN_EPNUM + 1) |
| 174 | # define UDI_HID_MOU_EP_IN MOUSE_IN_EPNUM | 129 | # define UDI_HID_MOU_EP_IN MOUSE_IN_EPNUM |
| @@ -181,7 +136,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 181 | # define NEXT_IN_EPNUM_2 NEXT_IN_EPNUM_1 | 136 | # define NEXT_IN_EPNUM_2 NEXT_IN_EPNUM_1 |
| 182 | #endif | 137 | #endif |
| 183 | 138 | ||
| 184 | #ifdef EXK | 139 | #ifdef EXTRAKEY_ENABLE |
| 185 | # define EXTRAKEY_IN_EPNUM NEXT_IN_EPNUM_2 | 140 | # define EXTRAKEY_IN_EPNUM NEXT_IN_EPNUM_2 |
| 186 | # define UDI_HID_EXK_EP_IN EXTRAKEY_IN_EPNUM | 141 | # define UDI_HID_EXK_EP_IN EXTRAKEY_IN_EPNUM |
| 187 | # define NEXT_IN_EPNUM_3 (EXTRAKEY_IN_EPNUM + 1) | 142 | # define NEXT_IN_EPNUM_3 (EXTRAKEY_IN_EPNUM + 1) |
| @@ -194,7 +149,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 194 | # define NEXT_IN_EPNUM_3 NEXT_IN_EPNUM_2 | 149 | # define NEXT_IN_EPNUM_3 NEXT_IN_EPNUM_2 |
| 195 | #endif | 150 | #endif |
| 196 | 151 | ||
| 197 | #ifdef RAW | 152 | #ifdef RAW_ENABLE |
| 198 | # define RAW_IN_EPNUM NEXT_IN_EPNUM_3 | 153 | # define RAW_IN_EPNUM NEXT_IN_EPNUM_3 |
| 199 | # define UDI_HID_RAW_EP_IN RAW_IN_EPNUM | 154 | # define UDI_HID_RAW_EP_IN RAW_IN_EPNUM |
| 200 | # define NEXT_IN_EPNUM_4 (RAW_IN_EPNUM + 1) | 155 | # define NEXT_IN_EPNUM_4 (RAW_IN_EPNUM + 1) |
| @@ -210,7 +165,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 210 | # define NEXT_OUT_EPNUM_1 NEXT_OUT_EPNUM_0 | 165 | # define NEXT_OUT_EPNUM_1 NEXT_OUT_EPNUM_0 |
| 211 | #endif | 166 | #endif |
| 212 | 167 | ||
| 213 | #ifdef CON | 168 | #ifdef CONSOLE_ENABLE |
| 214 | # define CON_IN_EPNUM NEXT_IN_EPNUM_4 | 169 | # define CON_IN_EPNUM NEXT_IN_EPNUM_4 |
| 215 | # define UDI_HID_CON_EP_IN CON_IN_EPNUM | 170 | # define UDI_HID_CON_EP_IN CON_IN_EPNUM |
| 216 | # define NEXT_IN_EPNUM_5 (CON_IN_EPNUM + 1) | 171 | # define NEXT_IN_EPNUM_5 (CON_IN_EPNUM + 1) |
| @@ -226,7 +181,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 226 | # define NEXT_OUT_EPNUM_2 NEXT_OUT_EPNUM_1 | 181 | # define NEXT_OUT_EPNUM_2 NEXT_OUT_EPNUM_1 |
| 227 | #endif | 182 | #endif |
| 228 | 183 | ||
| 229 | #ifdef NKRO | 184 | #ifdef NKRO_ENABLE |
| 230 | # define NKRO_IN_EPNUM NEXT_IN_EPNUM_5 | 185 | # define NKRO_IN_EPNUM NEXT_IN_EPNUM_5 |
| 231 | # define UDI_HID_NKRO_EP_IN NKRO_IN_EPNUM | 186 | # define UDI_HID_NKRO_EP_IN NKRO_IN_EPNUM |
| 232 | # define NEXT_IN_EPNUM_6 (NKRO_IN_EPNUM + 1) | 187 | # define NEXT_IN_EPNUM_6 (NKRO_IN_EPNUM + 1) |
| @@ -239,7 +194,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 239 | # define NEXT_IN_EPNUM_6 NEXT_IN_EPNUM_5 | 194 | # define NEXT_IN_EPNUM_6 NEXT_IN_EPNUM_5 |
| 240 | #endif | 195 | #endif |
| 241 | 196 | ||
| 242 | #ifdef MIDI | 197 | #ifdef MIDI_ENABLE |
| 243 | # define MIDI_STREAM_IN_EPNUM NEXT_IN_EPNUM_6 | 198 | # define MIDI_STREAM_IN_EPNUM NEXT_IN_EPNUM_6 |
| 244 | # define NEXT_IN_EPNUM_7 (MIDI_STREAM_IN_EPNUM + 1) | 199 | # define NEXT_IN_EPNUM_7 (MIDI_STREAM_IN_EPNUM + 1) |
| 245 | # define MIDI_STREAM_OUT_EPNUM NEXT_OUT_EPNUM_2 | 200 | # define MIDI_STREAM_OUT_EPNUM NEXT_OUT_EPNUM_2 |
| @@ -250,7 +205,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 250 | # define NEXT_OUT_EPNUM_3 NEXT_OUT_EPNUM_2 | 205 | # define NEXT_OUT_EPNUM_3 NEXT_OUT_EPNUM_2 |
| 251 | #endif | 206 | #endif |
| 252 | 207 | ||
| 253 | #ifdef CDC | 208 | #ifdef VIRTSER_ENABLE |
| 254 | # define CDC_NOTIFICATION_EPNUM NEXT_IN_EPNUM_7 | 209 | # define CDC_NOTIFICATION_EPNUM NEXT_IN_EPNUM_7 |
| 255 | # define CDC_ACM_ENDPOINT CDC_NOTIFICATION_EPNUM | 210 | # define CDC_ACM_ENDPOINT CDC_NOTIFICATION_EPNUM |
| 256 | # define CDC_TX_ENDPOINT (CDC_NOTIFICATION_EPNUM + 1) | 211 | # define CDC_TX_ENDPOINT (CDC_NOTIFICATION_EPNUM + 1) |
| @@ -285,8 +240,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 285 | // ********************************************************************** | 240 | // ********************************************************************** |
| 286 | // KBD Descriptor structure and content | 241 | // KBD Descriptor structure and content |
| 287 | // ********************************************************************** | 242 | // ********************************************************************** |
| 288 | #ifdef KBD | ||
| 289 | |||
| 290 | COMPILER_PACK_SET(1) | 243 | COMPILER_PACK_SET(1) |
| 291 | 244 | ||
| 292 | typedef struct { | 245 | typedef struct { |
| @@ -299,8 +252,40 @@ typedef struct { | |||
| 299 | uint8_t array[59]; | 252 | uint8_t array[59]; |
| 300 | } udi_hid_kbd_report_desc_t; | 253 | } udi_hid_kbd_report_desc_t; |
| 301 | 254 | ||
| 302 | # define UDI_HID_KBD_DESC \ | 255 | // clang-format off |
| 303 | { .iface.bLength = sizeof(usb_iface_desc_t), .iface.bDescriptorType = USB_DT_INTERFACE, .iface.bInterfaceNumber = UDI_HID_KBD_IFACE_NUMBER, .iface.bAlternateSetting = 0, .iface.bNumEndpoints = 1, .iface.bInterfaceClass = HID_CLASS, .iface.bInterfaceSubClass = HID_SUB_CLASS_BOOT, .iface.bInterfaceProtocol = HID_PROTOCOL_KEYBOARD, .iface.iInterface = UDI_HID_KBD_STRING_ID, .hid.bLength = sizeof(usb_hid_descriptor_t), .hid.bDescriptorType = USB_DT_HID, .hid.bcdHID = LE16(USB_HID_BDC_V1_11), .hid.bCountryCode = USB_HID_NO_COUNTRY_CODE, .hid.bNumDescriptors = USB_HID_NUM_DESC, .hid.bRDescriptorType = USB_DT_HID_REPORT, .hid.wDescriptorLength = LE16(sizeof(udi_hid_kbd_report_desc_t)), .ep.bLength = sizeof(usb_ep_desc_t), .ep.bDescriptorType = USB_DT_ENDPOINT, .ep.bEndpointAddress = UDI_HID_KBD_EP_IN | USB_EP_DIR_IN, .ep.bmAttributes = USB_EP_TYPE_INTERRUPT, .ep.wMaxPacketSize = LE16(UDI_HID_KBD_EP_SIZE), .ep.bInterval = KBD_POLLING_INTERVAL, } | 256 | |
| 257 | # define UDI_HID_KBD_DESC { \ | ||
| 258 | .iface = { \ | ||
| 259 | .bLength = sizeof(usb_iface_desc_t), \ | ||
| 260 | .bDescriptorType = USB_DT_INTERFACE, \ | ||
| 261 | .bInterfaceNumber = UDI_HID_KBD_IFACE_NUMBER, \ | ||
| 262 | .bAlternateSetting = 0, \ | ||
| 263 | .bNumEndpoints = 1, \ | ||
| 264 | .bInterfaceClass = HID_CLASS, \ | ||
| 265 | .bInterfaceSubClass = HID_SUB_CLASS_BOOT, \ | ||
| 266 | .bInterfaceProtocol = HID_PROTOCOL_KEYBOARD, \ | ||
| 267 | .iInterface = UDI_HID_KBD_STRING_ID, \ | ||
| 268 | }, \ | ||
| 269 | .hid = { \ | ||
| 270 | .bLength = sizeof(usb_hid_descriptor_t), \ | ||
| 271 | .bDescriptorType = USB_DT_HID, \ | ||
| 272 | .bcdHID = LE16(USB_HID_BDC_V1_11), \ | ||
| 273 | .bCountryCode = USB_HID_NO_COUNTRY_CODE, \ | ||
| 274 | .bNumDescriptors = USB_HID_NUM_DESC, \ | ||
| 275 | .bRDescriptorType = USB_DT_HID_REPORT, \ | ||
| 276 | .wDescriptorLength = LE16(sizeof(udi_hid_kbd_report_desc_t)), \ | ||
| 277 | }, \ | ||
| 278 | .ep = { \ | ||
| 279 | .bLength = sizeof(usb_ep_desc_t), \ | ||
| 280 | .bDescriptorType = USB_DT_ENDPOINT, \ | ||
| 281 | .bEndpointAddress = UDI_HID_KBD_EP_IN | USB_EP_DIR_IN, \ | ||
| 282 | .bmAttributes = USB_EP_TYPE_INTERRUPT, \ | ||
| 283 | .wMaxPacketSize = LE16(UDI_HID_KBD_EP_SIZE), \ | ||
| 284 | .bInterval = KBD_POLLING_INTERVAL \ | ||
| 285 | } \ | ||
| 286 | } | ||
| 287 | |||
| 288 | // clang-format on | ||
| 304 | 289 | ||
| 305 | // set report buffer (from host) | 290 | // set report buffer (from host) |
| 306 | extern uint8_t udi_hid_kbd_report_set; | 291 | extern uint8_t udi_hid_kbd_report_set; |
| @@ -311,12 +296,10 @@ extern uint8_t udi_hid_kbd_report[UDI_HID_KBD_REPORT_SIZE]; | |||
| 311 | 296 | ||
| 312 | COMPILER_PACK_RESET() | 297 | COMPILER_PACK_RESET() |
| 313 | 298 | ||
| 314 | #endif // KBD | ||
| 315 | |||
| 316 | // ********************************************************************** | 299 | // ********************************************************************** |
| 317 | // EXK Descriptor structure and content | 300 | // EXK Descriptor structure and content |
| 318 | // ********************************************************************** | 301 | // ********************************************************************** |
| 319 | #ifdef EXK | 302 | #ifdef EXTRAKEY_ENABLE |
| 320 | 303 | ||
| 321 | COMPILER_PACK_SET(1) | 304 | COMPILER_PACK_SET(1) |
| 322 | 305 | ||
| @@ -330,8 +313,40 @@ typedef struct { | |||
| 330 | uint8_t array[50]; | 313 | uint8_t array[50]; |
| 331 | } udi_hid_exk_report_desc_t; | 314 | } udi_hid_exk_report_desc_t; |
| 332 | 315 | ||
| 333 | # define UDI_HID_EXK_DESC \ | 316 | // clang-format off |
| 334 | { .iface.bLength = sizeof(usb_iface_desc_t), .iface.bDescriptorType = USB_DT_INTERFACE, .iface.bInterfaceNumber = UDI_HID_EXK_IFACE_NUMBER, .iface.bAlternateSetting = 0, .iface.bNumEndpoints = 1, .iface.bInterfaceClass = HID_CLASS, .iface.bInterfaceSubClass = HID_SUB_CLASS_BOOT, .iface.bInterfaceProtocol = HID_PROTOCOL_GENERIC, .iface.iInterface = UDI_HID_EXK_STRING_ID, .hid.bLength = sizeof(usb_hid_descriptor_t), .hid.bDescriptorType = USB_DT_HID, .hid.bcdHID = LE16(USB_HID_BDC_V1_11), .hid.bCountryCode = USB_HID_NO_COUNTRY_CODE, .hid.bNumDescriptors = USB_HID_NUM_DESC, .hid.bRDescriptorType = USB_DT_HID_REPORT, .hid.wDescriptorLength = LE16(sizeof(udi_hid_exk_report_desc_t)), .ep.bLength = sizeof(usb_ep_desc_t), .ep.bDescriptorType = USB_DT_ENDPOINT, .ep.bEndpointAddress = UDI_HID_EXK_EP_IN | USB_EP_DIR_IN, .ep.bmAttributes = USB_EP_TYPE_INTERRUPT, .ep.wMaxPacketSize = LE16(UDI_HID_EXK_EP_SIZE), .ep.bInterval = EXTRAKEY_POLLING_INTERVAL, } | 317 | |
| 318 | # define UDI_HID_EXK_DESC { \ | ||
| 319 | .iface = { \ | ||
| 320 | .bLength = sizeof(usb_iface_desc_t), \ | ||
| 321 | .bDescriptorType = USB_DT_INTERFACE, \ | ||
| 322 | .bInterfaceNumber = UDI_HID_EXK_IFACE_NUMBER, \ | ||
| 323 | .bAlternateSetting = 0, \ | ||
| 324 | .bNumEndpoints = 1, \ | ||
| 325 | .bInterfaceClass = HID_CLASS, \ | ||
| 326 | .bInterfaceSubClass = HID_SUB_CLASS_BOOT, \ | ||
| 327 | .bInterfaceProtocol = HID_PROTOCOL_GENERIC, \ | ||
| 328 | .iInterface = UDI_HID_EXK_STRING_ID \ | ||
| 329 | }, \ | ||
| 330 | .hid = { \ | ||
| 331 | .bLength = sizeof(usb_hid_descriptor_t), \ | ||
| 332 | .bDescriptorType = USB_DT_HID, \ | ||
| 333 | .bcdHID = LE16(USB_HID_BDC_V1_11), \ | ||
| 334 | .bCountryCode = USB_HID_NO_COUNTRY_CODE, \ | ||
| 335 | .bNumDescriptors = USB_HID_NUM_DESC, \ | ||
| 336 | .bRDescriptorType = USB_DT_HID_REPORT, \ | ||
| 337 | .wDescriptorLength = LE16(sizeof(udi_hid_exk_report_desc_t)) \ | ||
| 338 | }, \ | ||
| 339 | .ep = { \ | ||
| 340 | .bLength = sizeof(usb_ep_desc_t), \ | ||
| 341 | .bDescriptorType = USB_DT_ENDPOINT, \ | ||
| 342 | .bEndpointAddress = UDI_HID_EXK_EP_IN | USB_EP_DIR_IN, \ | ||
| 343 | .bmAttributes = USB_EP_TYPE_INTERRUPT, \ | ||
| 344 | .wMaxPacketSize = LE16(UDI_HID_EXK_EP_SIZE), \ | ||
| 345 | .bInterval = EXTRAKEY_POLLING_INTERVAL \ | ||
| 346 | } \ | ||
| 347 | } | ||
| 348 | |||
| 349 | // clang-format on | ||
| 335 | 350 | ||
| 336 | // set report buffer (from host) | 351 | // set report buffer (from host) |
| 337 | extern uint8_t udi_hid_exk_report_set; | 352 | extern uint8_t udi_hid_exk_report_set; |
| @@ -351,12 +366,12 @@ extern udi_hid_exk_report_t udi_hid_exk_report; | |||
| 351 | 366 | ||
| 352 | COMPILER_PACK_RESET() | 367 | COMPILER_PACK_RESET() |
| 353 | 368 | ||
| 354 | #endif // EXK | 369 | #endif // EXTRAKEY_ENABLE |
| 355 | 370 | ||
| 356 | // ********************************************************************** | 371 | // ********************************************************************** |
| 357 | // NKRO Descriptor structure and content | 372 | // NKRO Descriptor structure and content |
| 358 | // ********************************************************************** | 373 | // ********************************************************************** |
| 359 | #ifdef NKRO | 374 | #ifdef NKRO_ENABLE |
| 360 | 375 | ||
| 361 | COMPILER_PACK_SET(1) | 376 | COMPILER_PACK_SET(1) |
| 362 | 377 | ||
| @@ -370,8 +385,40 @@ typedef struct { | |||
| 370 | uint8_t array[57]; | 385 | uint8_t array[57]; |
| 371 | } udi_hid_nkro_report_desc_t; | 386 | } udi_hid_nkro_report_desc_t; |
| 372 | 387 | ||
| 373 | # define UDI_HID_NKRO_DESC \ | 388 | // clang-format off |
| 374 | { .iface.bLength = sizeof(usb_iface_desc_t), .iface.bDescriptorType = USB_DT_INTERFACE, .iface.bInterfaceNumber = UDI_HID_NKRO_IFACE_NUMBER, .iface.bAlternateSetting = 0, .iface.bNumEndpoints = 1, .iface.bInterfaceClass = HID_CLASS, .iface.bInterfaceSubClass = HID_SUB_CLASS_NOBOOT, .iface.bInterfaceProtocol = HID_PROTOCOL_KEYBOARD, .iface.iInterface = UDI_HID_NKRO_STRING_ID, .hid.bLength = sizeof(usb_hid_descriptor_t), .hid.bDescriptorType = USB_DT_HID, .hid.bcdHID = LE16(USB_HID_BDC_V1_11), .hid.bCountryCode = USB_HID_NO_COUNTRY_CODE, .hid.bNumDescriptors = USB_HID_NUM_DESC, .hid.bRDescriptorType = USB_DT_HID_REPORT, .hid.wDescriptorLength = LE16(sizeof(udi_hid_nkro_report_desc_t)), .ep.bLength = sizeof(usb_ep_desc_t), .ep.bDescriptorType = USB_DT_ENDPOINT, .ep.bEndpointAddress = UDI_HID_NKRO_EP_IN | USB_EP_DIR_IN, .ep.bmAttributes = USB_EP_TYPE_INTERRUPT, .ep.wMaxPacketSize = LE16(UDI_HID_NKRO_EP_SIZE), .ep.bInterval = NKRO_POLLING_INTERVAL, } | 389 | |
| 390 | # define UDI_HID_NKRO_DESC { \ | ||
| 391 | .iface = { \ | ||
| 392 | .bLength = sizeof(usb_iface_desc_t), \ | ||
| 393 | .bDescriptorType = USB_DT_INTERFACE, \ | ||
| 394 | .bInterfaceNumber = UDI_HID_NKRO_IFACE_NUMBER, \ | ||
| 395 | .bAlternateSetting = 0, \ | ||
| 396 | .bNumEndpoints = 1, \ | ||
| 397 | .bInterfaceClass = HID_CLASS, \ | ||
| 398 | .bInterfaceSubClass = HID_SUB_CLASS_NOBOOT, \ | ||
| 399 | .bInterfaceProtocol = HID_PROTOCOL_KEYBOARD, \ | ||
| 400 | .iInterface = UDI_HID_NKRO_STRING_ID \ | ||
| 401 | }, \ | ||
| 402 | .hid = { \ | ||
| 403 | .bLength = sizeof(usb_hid_descriptor_t), \ | ||
| 404 | .bDescriptorType = USB_DT_HID, \ | ||
| 405 | .bcdHID = LE16(USB_HID_BDC_V1_11), \ | ||
| 406 | .bCountryCode = USB_HID_NO_COUNTRY_CODE, \ | ||
| 407 | .bNumDescriptors = USB_HID_NUM_DESC, \ | ||
| 408 | .bRDescriptorType = USB_DT_HID_REPORT, \ | ||
| 409 | .wDescriptorLength = LE16(sizeof(udi_hid_nkro_report_desc_t)) \ | ||
| 410 | }, \ | ||
| 411 | .ep = { \ | ||
| 412 | .bLength = sizeof(usb_ep_desc_t), \ | ||
| 413 | .bDescriptorType = USB_DT_ENDPOINT, \ | ||
| 414 | .bEndpointAddress = UDI_HID_NKRO_EP_IN | USB_EP_DIR_IN, \ | ||
| 415 | .bmAttributes = USB_EP_TYPE_INTERRUPT, \ | ||
| 416 | .wMaxPacketSize = LE16(UDI_HID_NKRO_EP_SIZE), \ | ||
| 417 | .bInterval = NKRO_POLLING_INTERVAL \ | ||
| 418 | } \ | ||
| 419 | } | ||
| 420 | |||
| 421 | // clang-format on | ||
| 375 | 422 | ||
| 376 | // set report buffer | 423 | // set report buffer |
| 377 | extern uint8_t udi_hid_nkro_report_set; | 424 | extern uint8_t udi_hid_nkro_report_set; |
| @@ -382,12 +429,12 @@ extern uint8_t udi_hid_nkro_report[UDI_HID_NKRO_REPORT_SIZE]; | |||
| 382 | 429 | ||
| 383 | COMPILER_PACK_RESET() | 430 | COMPILER_PACK_RESET() |
| 384 | 431 | ||
| 385 | #endif // NKRO | 432 | #endif // NKRO_ENABLE |
| 386 | 433 | ||
| 387 | // ********************************************************************** | 434 | // ********************************************************************** |
| 388 | // MOU Descriptor structure and content | 435 | // MOU Descriptor structure and content |
| 389 | // ********************************************************************** | 436 | // ********************************************************************** |
| 390 | #ifdef MOU | 437 | #ifdef MOUSE_ENABLE |
| 391 | 438 | ||
| 392 | COMPILER_PACK_SET(1) | 439 | COMPILER_PACK_SET(1) |
| 393 | 440 | ||
| @@ -401,10 +448,40 @@ typedef struct { | |||
| 401 | uint8_t array[77]; // MOU PDS | 448 | uint8_t array[77]; // MOU PDS |
| 402 | } udi_hid_mou_report_desc_t; | 449 | } udi_hid_mou_report_desc_t; |
| 403 | 450 | ||
| 404 | # define UDI_HID_MOU_DESC \ | 451 | // clang-format off |
| 405 | { .iface.bLength = sizeof(usb_iface_desc_t), .iface.bDescriptorType = USB_DT_INTERFACE, .iface.bInterfaceNumber = MOUSE_INTERFACE, .iface.bAlternateSetting = 0, .iface.bNumEndpoints = 1, .iface.bInterfaceClass = HID_CLASS, .iface.bInterfaceSubClass = HID_SUB_CLASS_BOOT, .iface.bInterfaceProtocol = HID_PROTOCOL_MOUSE, .iface.iInterface = UDI_HID_MOU_STRING_ID, .hid.bLength = sizeof(usb_hid_descriptor_t), .hid.bDescriptorType = USB_DT_HID, .hid.bcdHID = LE16(USB_HID_BDC_V1_11), .hid.bCountryCode = USB_HID_NO_COUNTRY_CODE, .hid.bNumDescriptors = USB_HID_NUM_DESC, .hid.bRDescriptorType = USB_DT_HID_REPORT, .hid.wDescriptorLength = LE16(sizeof(udi_hid_mou_report_desc_t)), .ep.bLength = sizeof(usb_ep_desc_t), .ep.bDescriptorType = USB_DT_ENDPOINT, .ep.bEndpointAddress = UDI_HID_MOU_EP_IN | USB_EP_DIR_IN, .ep.bmAttributes = USB_EP_TYPE_INTERRUPT, .ep.wMaxPacketSize = LE16(UDI_HID_MOU_EP_SIZE), .ep.bInterval = MOU_POLLING_INTERVAL, } | 452 | |
| 406 | 453 | # define UDI_HID_MOU_DESC { \ | |
| 407 | // no set report buffer | 454 | .iface = { \ |
| 455 | .bLength = sizeof(usb_iface_desc_t), \ | ||
| 456 | .bDescriptorType = USB_DT_INTERFACE, \ | ||
| 457 | .bInterfaceNumber = MOUSE_INTERFACE, \ | ||
| 458 | .bAlternateSetting = 0, \ | ||
| 459 | .bNumEndpoints = 1, \ | ||
| 460 | .bInterfaceClass = HID_CLASS, \ | ||
| 461 | .bInterfaceSubClass = HID_SUB_CLASS_BOOT, \ | ||
| 462 | .bInterfaceProtocol = HID_PROTOCOL_MOUSE, \ | ||
| 463 | .iInterface = UDI_HID_MOU_STRING_ID \ | ||
| 464 | }, \ | ||
| 465 | .hid = { \ | ||
| 466 | .bLength = sizeof(usb_hid_descriptor_t), \ | ||
| 467 | .bDescriptorType = USB_DT_HID, \ | ||
| 468 | .bcdHID = LE16(USB_HID_BDC_V1_11), \ | ||
| 469 | .bCountryCode = USB_HID_NO_COUNTRY_CODE, \ | ||
| 470 | .bNumDescriptors = USB_HID_NUM_DESC, \ | ||
| 471 | .bRDescriptorType = USB_DT_HID_REPORT, \ | ||
| 472 | .wDescriptorLength = LE16(sizeof(udi_hid_mou_report_desc_t)) \ | ||
| 473 | }, \ | ||
| 474 | .ep = { \ | ||
| 475 | .bLength = sizeof(usb_ep_desc_t), \ | ||
| 476 | .bDescriptorType = USB_DT_ENDPOINT, \ | ||
| 477 | .bEndpointAddress = UDI_HID_MOU_EP_IN | USB_EP_DIR_IN, \ | ||
| 478 | .bmAttributes = USB_EP_TYPE_INTERRUPT, \ | ||
| 479 | .wMaxPacketSize = LE16(UDI_HID_MOU_EP_SIZE), \ | ||
| 480 | .bInterval = MOU_POLLING_INTERVAL \ | ||
| 481 | } \ | ||
| 482 | } | ||
| 483 | |||
| 484 | // clang-format on | ||
| 408 | 485 | ||
| 409 | // report buffer | 486 | // report buffer |
| 410 | # define UDI_HID_MOU_REPORT_SIZE 5 // MOU PDS | 487 | # define UDI_HID_MOU_REPORT_SIZE 5 // MOU PDS |
| @@ -412,12 +489,12 @@ extern uint8_t udi_hid_mou_report[UDI_HID_MOU_REPORT_SIZE]; | |||
| 412 | 489 | ||
| 413 | COMPILER_PACK_RESET() | 490 | COMPILER_PACK_RESET() |
| 414 | 491 | ||
| 415 | #endif // MOU | 492 | #endif // MOUSE_ENABLE |
| 416 | 493 | ||
| 417 | // ********************************************************************** | 494 | // ********************************************************************** |
| 418 | // RAW Descriptor structure and content | 495 | // RAW Descriptor structure and content |
| 419 | // ********************************************************************** | 496 | // ********************************************************************** |
| 420 | #ifdef RAW | 497 | #ifdef RAW_ENABLE |
| 421 | 498 | ||
| 422 | COMPILER_PACK_SET(1) | 499 | COMPILER_PACK_SET(1) |
| 423 | 500 | ||
| @@ -432,11 +509,48 @@ typedef struct { | |||
| 432 | uint8_t array[26]; | 509 | uint8_t array[26]; |
| 433 | } udi_hid_raw_report_desc_t; | 510 | } udi_hid_raw_report_desc_t; |
| 434 | 511 | ||
| 435 | # define UDI_HID_RAW_DESC \ | 512 | // clang-format off |
| 436 | { \ | 513 | |
| 437 | .iface.bLength = sizeof(usb_iface_desc_t), .iface.bDescriptorType = USB_DT_INTERFACE, .iface.bInterfaceNumber = RAW_INTERFACE, .iface.bAlternateSetting = 0, .iface.bNumEndpoints = 2, .iface.bInterfaceClass = HID_CLASS, .iface.bInterfaceSubClass = HID_SUB_CLASS_NOBOOT, .iface.bInterfaceProtocol = HID_SUB_CLASS_NOBOOT, .iface.iInterface = UDI_HID_RAW_STRING_ID, .hid.bLength = sizeof(usb_hid_descriptor_t), .hid.bDescriptorType = USB_DT_HID, .hid.bcdHID = LE16(USB_HID_BDC_V1_11), .hid.bCountryCode = USB_HID_NO_COUNTRY_CODE, .hid.bNumDescriptors = USB_HID_NUM_DESC, .hid.bRDescriptorType = USB_DT_HID_REPORT, .hid.wDescriptorLength = LE16(sizeof(udi_hid_raw_report_desc_t)), .ep_out.bLength = sizeof(usb_ep_desc_t), .ep_out.bDescriptorType = USB_DT_ENDPOINT, .ep_out.bEndpointAddress = UDI_HID_RAW_EP_OUT | USB_EP_DIR_OUT, .ep_out.bmAttributes = USB_EP_TYPE_INTERRUPT, .ep_out.wMaxPacketSize = LE16(RAW_EPSIZE), .ep_out.bInterval = RAW_POLLING_INTERVAL, \ | 514 | # define UDI_HID_RAW_DESC { \ |
| 438 | .ep_in.bLength = sizeof(usb_ep_desc_t), .ep_in.bDescriptorType = USB_DT_ENDPOINT, .ep_in.bEndpointAddress = UDI_HID_RAW_EP_IN | USB_EP_DIR_IN, .ep_in.bmAttributes = USB_EP_TYPE_INTERRUPT, .ep_in.wMaxPacketSize = LE16(RAW_EPSIZE), .ep_in.bInterval = RAW_POLLING_INTERVAL, \ | 515 | .iface = { \ |
| 439 | } | 516 | .bLength = sizeof(usb_iface_desc_t), \ |
| 517 | .bDescriptorType = USB_DT_INTERFACE, \ | ||
| 518 | .bInterfaceNumber = RAW_INTERFACE, \ | ||
| 519 | .bAlternateSetting = 0, \ | ||
| 520 | .bNumEndpoints = 2, \ | ||
| 521 | .bInterfaceClass = HID_CLASS, \ | ||
| 522 | .bInterfaceSubClass = HID_SUB_CLASS_NOBOOT, \ | ||
| 523 | .bInterfaceProtocol = HID_SUB_CLASS_NOBOOT, \ | ||
| 524 | .iInterface = UDI_HID_RAW_STRING_ID \ | ||
| 525 | }, \ | ||
| 526 | .hid = { \ | ||
| 527 | .bLength = sizeof(usb_hid_descriptor_t), \ | ||
| 528 | .bDescriptorType = USB_DT_HID, \ | ||
| 529 | .bcdHID = LE16(USB_HID_BDC_V1_11), \ | ||
| 530 | .bCountryCode = USB_HID_NO_COUNTRY_CODE, \ | ||
| 531 | .bNumDescriptors = USB_HID_NUM_DESC, \ | ||
| 532 | .bRDescriptorType = USB_DT_HID_REPORT, \ | ||
| 533 | .wDescriptorLength = LE16(sizeof(udi_hid_raw_report_desc_t)) \ | ||
| 534 | }, \ | ||
| 535 | .ep_out = { \ | ||
| 536 | .bLength = sizeof(usb_ep_desc_t), \ | ||
| 537 | .bDescriptorType = USB_DT_ENDPOINT, \ | ||
| 538 | .bEndpointAddress = UDI_HID_RAW_EP_OUT | USB_EP_DIR_OUT, \ | ||
| 539 | .bmAttributes = USB_EP_TYPE_INTERRUPT, \ | ||
| 540 | .wMaxPacketSize = LE16(RAW_EPSIZE), \ | ||
| 541 | .bInterval = RAW_POLLING_INTERVAL \ | ||
| 542 | }, \ | ||
| 543 | .ep_in = { \ | ||
| 544 | .bLength = sizeof(usb_ep_desc_t), \ | ||
| 545 | .bDescriptorType = USB_DT_ENDPOINT, \ | ||
| 546 | .bEndpointAddress = UDI_HID_RAW_EP_IN | USB_EP_DIR_IN, \ | ||
| 547 | .bmAttributes = USB_EP_TYPE_INTERRUPT, \ | ||
| 548 | .wMaxPacketSize = LE16(RAW_EPSIZE), \ | ||
| 549 | .bInterval = RAW_POLLING_INTERVAL \ | ||
| 550 | } \ | ||
| 551 | } | ||
| 552 | |||
| 553 | // clang-format on | ||
| 440 | 554 | ||
| 441 | # define UDI_HID_RAW_REPORT_SIZE RAW_EPSIZE | 555 | # define UDI_HID_RAW_REPORT_SIZE RAW_EPSIZE |
| 442 | 556 | ||
| @@ -447,12 +561,12 @@ extern uint8_t udi_hid_raw_report[UDI_HID_RAW_REPORT_SIZE]; | |||
| 447 | 561 | ||
| 448 | COMPILER_PACK_RESET() | 562 | COMPILER_PACK_RESET() |
| 449 | 563 | ||
| 450 | #endif // RAW | 564 | #endif // RAW_ENABLE |
| 451 | 565 | ||
| 452 | // ********************************************************************** | 566 | // ********************************************************************** |
| 453 | // CON Descriptor structure and content | 567 | // CON Descriptor structure and content |
| 454 | // ********************************************************************** | 568 | // ********************************************************************** |
| 455 | #ifdef CON | 569 | #ifdef CONSOLE_ENABLE |
| 456 | 570 | ||
| 457 | COMPILER_PACK_SET(1) | 571 | COMPILER_PACK_SET(1) |
| 458 | 572 | ||
| @@ -467,11 +581,48 @@ typedef struct { | |||
| 467 | uint8_t array[34]; | 581 | uint8_t array[34]; |
| 468 | } udi_hid_con_report_desc_t; | 582 | } udi_hid_con_report_desc_t; |
| 469 | 583 | ||
| 470 | # define UDI_HID_CON_DESC \ | 584 | // clang-format off |
| 471 | { \ | 585 | |
| 472 | .iface.bLength = sizeof(usb_iface_desc_t), .iface.bDescriptorType = USB_DT_INTERFACE, .iface.bInterfaceNumber = UDI_HID_CON_IFACE_NUMBER, .iface.bAlternateSetting = 0, .iface.bNumEndpoints = 2, .iface.bInterfaceClass = HID_CLASS, .iface.bInterfaceSubClass = HID_SUB_CLASS_NOBOOT, .iface.bInterfaceProtocol = HID_SUB_CLASS_NOBOOT, .iface.iInterface = UDI_HID_CON_STRING_ID, .hid.bLength = sizeof(usb_hid_descriptor_t), .hid.bDescriptorType = USB_DT_HID, .hid.bcdHID = LE16(USB_HID_BDC_V1_11), .hid.bCountryCode = USB_HID_NO_COUNTRY_CODE, .hid.bNumDescriptors = USB_HID_NUM_DESC, .hid.bRDescriptorType = USB_DT_HID_REPORT, .hid.wDescriptorLength = LE16(sizeof(udi_hid_con_report_desc_t)), .ep_out.bLength = sizeof(usb_ep_desc_t), .ep_out.bDescriptorType = USB_DT_ENDPOINT, .ep_out.bEndpointAddress = UDI_HID_CON_EP_OUT | USB_EP_DIR_OUT, .ep_out.bmAttributes = USB_EP_TYPE_INTERRUPT, .ep_out.wMaxPacketSize = LE16(CONSOLE_EPSIZE), .ep_out.bInterval = CON_POLLING_INTERVAL, \ | 586 | # define UDI_HID_CON_DESC { \ |
| 473 | .ep_in.bLength = sizeof(usb_ep_desc_t), .ep_in.bDescriptorType = USB_DT_ENDPOINT, .ep_in.bEndpointAddress = UDI_HID_CON_EP_IN | USB_EP_DIR_IN, .ep_in.bmAttributes = USB_EP_TYPE_INTERRUPT, .ep_in.wMaxPacketSize = LE16(CONSOLE_EPSIZE), .ep_in.bInterval = CON_POLLING_INTERVAL, \ | 587 | .iface = { \ |
| 474 | } | 588 | .bLength = sizeof(usb_iface_desc_t), \ |
| 589 | .bDescriptorType = USB_DT_INTERFACE, \ | ||
| 590 | .bInterfaceNumber = UDI_HID_CON_IFACE_NUMBER, \ | ||
| 591 | .bAlternateSetting = 0, \ | ||
| 592 | .bNumEndpoints = 2, \ | ||
| 593 | .bInterfaceClass = HID_CLASS, \ | ||
| 594 | .bInterfaceSubClass = HID_SUB_CLASS_NOBOOT, \ | ||
| 595 | .bInterfaceProtocol = HID_SUB_CLASS_NOBOOT, \ | ||
| 596 | .iInterface = UDI_HID_CON_STRING_ID \ | ||
| 597 | }, \ | ||
| 598 | .hid = { \ | ||
| 599 | .bLength = sizeof(usb_hid_descriptor_t), \ | ||
| 600 | .bDescriptorType = USB_DT_HID, \ | ||
| 601 | .bcdHID = LE16(USB_HID_BDC_V1_11), \ | ||
| 602 | .bCountryCode = USB_HID_NO_COUNTRY_CODE, \ | ||
| 603 | .bNumDescriptors = USB_HID_NUM_DESC, \ | ||
| 604 | .bRDescriptorType = USB_DT_HID_REPORT, \ | ||
| 605 | .wDescriptorLength = LE16(sizeof(udi_hid_con_report_desc_t)) \ | ||
| 606 | }, \ | ||
| 607 | .ep_out = { \ | ||
| 608 | .bLength = sizeof(usb_ep_desc_t), \ | ||
| 609 | .bDescriptorType = USB_DT_ENDPOINT, \ | ||
| 610 | .bEndpointAddress = UDI_HID_CON_EP_OUT | USB_EP_DIR_OUT, \ | ||
| 611 | .bmAttributes = USB_EP_TYPE_INTERRUPT, \ | ||
| 612 | .wMaxPacketSize = LE16(CONSOLE_EPSIZE), \ | ||
| 613 | .bInterval = CON_POLLING_INTERVAL \ | ||
| 614 | }, \ | ||
| 615 | .ep_in = { \ | ||
| 616 | .bLength = sizeof(usb_ep_desc_t), \ | ||
| 617 | .bDescriptorType = USB_DT_ENDPOINT, \ | ||
| 618 | .bEndpointAddress = UDI_HID_CON_EP_IN | USB_EP_DIR_IN, \ | ||
| 619 | .bmAttributes = USB_EP_TYPE_INTERRUPT, \ | ||
| 620 | .wMaxPacketSize = LE16(CONSOLE_EPSIZE), \ | ||
| 621 | .bInterval = CON_POLLING_INTERVAL \ | ||
| 622 | } \ | ||
| 623 | } | ||
| 624 | |||
| 625 | // clang-format on | ||
| 475 | 626 | ||
| 476 | # define UDI_HID_CON_REPORT_SIZE CONSOLE_EPSIZE | 627 | # define UDI_HID_CON_REPORT_SIZE CONSOLE_EPSIZE |
| 477 | 628 | ||
| @@ -482,12 +633,12 @@ extern uint8_t udi_hid_con_report[UDI_HID_CON_REPORT_SIZE]; | |||
| 482 | 633 | ||
| 483 | COMPILER_PACK_RESET() | 634 | COMPILER_PACK_RESET() |
| 484 | 635 | ||
| 485 | #endif // CON | 636 | #endif // CONSOLE_ENABLE |
| 486 | 637 | ||
| 487 | // ********************************************************************** | 638 | // ********************************************************************** |
| 488 | // CDC Descriptor structure and content | 639 | // CDC Descriptor structure and content |
| 489 | // ********************************************************************** | 640 | // ********************************************************************** |
| 490 | #ifdef CDC | 641 | #ifdef VIRTSER_ENABLE |
| 491 | 642 | ||
| 492 | COMPILER_PACK_SET(1) | 643 | COMPILER_PACK_SET(1) |
| 493 | 644 | ||
| @@ -534,16 +685,98 @@ typedef struct { | |||
| 534 | usb_ep_desc_t ep_rx; | 685 | usb_ep_desc_t ep_rx; |
| 535 | } udi_cdc_desc_t; | 686 | } udi_cdc_desc_t; |
| 536 | 687 | ||
| 537 | # define CDC_DESCRIPTOR \ | 688 | // clang-format off |
| 538 | { \ | 689 | |
| 539 | .iaface.bLength = sizeof(usb_association_desc_t), .iaface.bDescriptorType = USB_DT_IAD, .iaface.bFirstInterface = CDC_STATUS_INTERFACE, .iaface.bInterfaceCount = 2, .iaface.bFunctionClass = CDC_CLASS_DEVICE, .iaface.bFunctionSubClass = CDC_SUBCLASS_ACM, .iaface.bFunctionProtocol = CDC_PROTOCOL_V25TER, .iaface.iFunction = 0, .iface_c.bLength = sizeof(usb_iface_desc_t), .iface_c.bDescriptorType = USB_DT_INTERFACE, .iface_c.bInterfaceNumber = CDC_STATUS_INTERFACE, .iface_c.bAlternateSetting = 0, .iface_c.bNumEndpoints = 1, .iface_c.bInterfaceClass = 0x02, .iface_c.bInterfaceSubClass = 0x02, .iface_c.bInterfaceProtocol = CDC_PROTOCOL_V25TER, .iface_c.iInterface = 0, .fd.bFunctionLength = sizeof(usb_cdc_hdr_desc_t), .fd.bDescriptorType = CDC_CS_INTERFACE, .fd.bDescriptorSubtype = CDC_SCS_HEADER, .fd.bcdCDC = 0x0110, .mfd.bFunctionLength = sizeof(usb_cdc_call_mgmt_desc_t), .mfd.bDescriptorType = CDC_CS_INTERFACE, .mfd.bDescriptorSubtype = CDC_SCS_CALL_MGMT, \ | 690 | # define CDC_DESCRIPTOR { \ |
| 540 | .mfd.bmCapabilities = CDC_CALL_MGMT_SUPPORTED, .mfd.bDataInterface = CDC_DATA_INTERFACE, .acmd.bFunctionLength = sizeof(usb_cdc_acm_desc_t), .acmd.bDescriptorType = CDC_CS_INTERFACE, .acmd.bDescriptorSubtype = CDC_SCS_ACM, .acmd.bmCapabilities = CDC_ACM_SUPPORT_LINE_REQUESTS, .ufd.bFunctionLength = sizeof(usb_cdc_union_desc_t), .ufd.bDescriptorType = CDC_CS_INTERFACE, .ufd.bDescriptorSubtype = CDC_SCS_UNION, .ufd.bMasterInterface = CDC_STATUS_INTERFACE, .ufd.bSlaveInterface0 = CDC_DATA_INTERFACE, .ep_c.bLength = sizeof(usb_ep_desc_t), .ep_c.bDescriptorType = USB_DT_ENDPOINT, .ep_c.bEndpointAddress = CDC_ACM_ENDPOINT | USB_EP_DIR_IN, .ep_c.bmAttributes = USB_EP_TYPE_INTERRUPT, .ep_c.wMaxPacketSize = LE16(CDC_ACM_SIZE), .ep_c.bInterval = CDC_EP_INTERVAL_STATUS, .iface_d.bLength = sizeof(usb_iface_desc_t), .iface_d.bDescriptorType = USB_DT_INTERFACE, .iface_d.bInterfaceNumber = CDC_DATA_INTERFACE, .iface_d.bAlternateSetting = 0, .iface_d.bNumEndpoints = 2, \ | 691 | .iaface = { \ |
| 541 | .iface_d.bInterfaceClass = CDC_CLASS_DATA, .iface_d.bInterfaceSubClass = 0, .iface_d.bInterfaceProtocol = 0, .iface_d.iInterface = 0, .ep_rx.bLength = sizeof(usb_ep_desc_t), .ep_rx.bDescriptorType = USB_DT_ENDPOINT, .ep_rx.bEndpointAddress = CDC_RX_ENDPOINT | USB_EP_DIR_OUT, .ep_rx.bmAttributes = USB_EP_TYPE_BULK, .ep_rx.wMaxPacketSize = LE16(CDC_RX_SIZE), .ep_rx.bInterval = CDC_EP_INTERVAL_DATA, .ep_tx.bLength = sizeof(usb_ep_desc_t), .ep_tx.bDescriptorType = USB_DT_ENDPOINT, .ep_tx.bEndpointAddress = CDC_TX_ENDPOINT | USB_EP_DIR_IN, .ep_tx.bmAttributes = USB_EP_TYPE_BULK, .ep_tx.wMaxPacketSize = LE16(CDC_TX_SIZE), .ep_tx.bInterval = CDC_EP_INTERVAL_DATA, \ | 692 | .bLength = sizeof(usb_association_desc_t), \ |
| 542 | } | 693 | .bDescriptorType = USB_DT_IAD, \ |
| 694 | .bFirstInterface = CDC_STATUS_INTERFACE, \ | ||
| 695 | .bInterfaceCount = 2, \ | ||
| 696 | .bFunctionClass = CDC_CLASS_DEVICE, \ | ||
| 697 | .bFunctionSubClass = CDC_SUBCLASS_ACM, \ | ||
| 698 | .bFunctionProtocol = CDC_PROTOCOL_V25TER, \ | ||
| 699 | .iFunction = 0 \ | ||
| 700 | }, \ | ||
| 701 | .iface_c = { \ | ||
| 702 | .bLength = sizeof(usb_iface_desc_t), \ | ||
| 703 | .bDescriptorType = USB_DT_INTERFACE, \ | ||
| 704 | .bInterfaceNumber = CDC_STATUS_INTERFACE, \ | ||
| 705 | .bAlternateSetting = 0, \ | ||
| 706 | .bNumEndpoints = 1, \ | ||
| 707 | .bInterfaceClass = 0x02, \ | ||
| 708 | .bInterfaceSubClass = 0x02, \ | ||
| 709 | .bInterfaceProtocol = CDC_PROTOCOL_V25TER, \ | ||
| 710 | .iInterface = 0 \ | ||
| 711 | }, \ | ||
| 712 | .fd = { \ | ||
| 713 | .bFunctionLength = sizeof(usb_cdc_hdr_desc_t), \ | ||
| 714 | .bDescriptorType = CDC_CS_INTERFACE, \ | ||
| 715 | .bDescriptorSubtype = CDC_SCS_HEADER, \ | ||
| 716 | .bcdCDC = 0x0110 \ | ||
| 717 | }, \ | ||
| 718 | .mfd = { \ | ||
| 719 | .bFunctionLength = sizeof(usb_cdc_call_mgmt_desc_t), \ | ||
| 720 | .bDescriptorType = CDC_CS_INTERFACE, \ | ||
| 721 | .bDescriptorSubtype = CDC_SCS_CALL_MGMT, \ | ||
| 722 | .bmCapabilities = CDC_CALL_MGMT_SUPPORTED, \ | ||
| 723 | .bDataInterface = CDC_DATA_INTERFACE \ | ||
| 724 | }, \ | ||
| 725 | .acmd = { \ | ||
| 726 | .bFunctionLength = sizeof(usb_cdc_acm_desc_t), \ | ||
| 727 | .bDescriptorType = CDC_CS_INTERFACE, \ | ||
| 728 | .bDescriptorSubtype = CDC_SCS_ACM, \ | ||
| 729 | .bmCapabilities = CDC_ACM_SUPPORT_LINE_REQUESTS \ | ||
| 730 | }, \ | ||
| 731 | .ufd = { \ | ||
| 732 | .bFunctionLength = sizeof(usb_cdc_union_desc_t), \ | ||
| 733 | .bDescriptorType = CDC_CS_INTERFACE, \ | ||
| 734 | .bDescriptorSubtype = CDC_SCS_UNION, \ | ||
| 735 | .bMasterInterface = CDC_STATUS_INTERFACE, \ | ||
| 736 | .bSlaveInterface0 = CDC_DATA_INTERFACE \ | ||
| 737 | }, \ | ||
| 738 | .ep_c = { \ | ||
| 739 | .bLength = sizeof(usb_ep_desc_t), \ | ||
| 740 | .bDescriptorType = USB_DT_ENDPOINT, \ | ||
| 741 | .bEndpointAddress = CDC_ACM_ENDPOINT | USB_EP_DIR_IN, \ | ||
| 742 | .bmAttributes = USB_EP_TYPE_INTERRUPT, \ | ||
| 743 | .wMaxPacketSize = LE16(CDC_ACM_SIZE), \ | ||
| 744 | .bInterval = CDC_EP_INTERVAL_STATUS \ | ||
| 745 | }, \ | ||
| 746 | .iface_d = { \ | ||
| 747 | .bLength = sizeof(usb_iface_desc_t), \ | ||
| 748 | .bDescriptorType = USB_DT_INTERFACE, \ | ||
| 749 | .bInterfaceNumber = CDC_DATA_INTERFACE, \ | ||
| 750 | .bAlternateSetting = 0, \ | ||
| 751 | .bNumEndpoints = 2, \ | ||
| 752 | .bInterfaceClass = CDC_CLASS_DATA, \ | ||
| 753 | .bInterfaceSubClass = 0, \ | ||
| 754 | .bInterfaceProtocol = 0, \ | ||
| 755 | .iInterface = 0 \ | ||
| 756 | }, \ | ||
| 757 | .ep_rx = { \ | ||
| 758 | .bLength = sizeof(usb_ep_desc_t), \ | ||
| 759 | .bDescriptorType = USB_DT_ENDPOINT, \ | ||
| 760 | .bEndpointAddress = CDC_RX_ENDPOINT | USB_EP_DIR_OUT, \ | ||
| 761 | .bmAttributes = USB_EP_TYPE_BULK, \ | ||
| 762 | .wMaxPacketSize = LE16(CDC_RX_SIZE), \ | ||
| 763 | .bInterval = CDC_EP_INTERVAL_DATA \ | ||
| 764 | }, \ | ||
| 765 | .ep_tx = { \ | ||
| 766 | .bLength = sizeof(usb_ep_desc_t), \ | ||
| 767 | .bDescriptorType = USB_DT_ENDPOINT, \ | ||
| 768 | .bEndpointAddress = CDC_TX_ENDPOINT | USB_EP_DIR_IN, \ | ||
| 769 | .bmAttributes = USB_EP_TYPE_BULK, \ | ||
| 770 | .wMaxPacketSize = LE16(CDC_TX_SIZE), \ | ||
| 771 | .bInterval = CDC_EP_INTERVAL_DATA \ | ||
| 772 | } \ | ||
| 773 | } | ||
| 774 | |||
| 775 | // clang-format on | ||
| 543 | 776 | ||
| 544 | COMPILER_PACK_RESET() | 777 | COMPILER_PACK_RESET() |
| 545 | 778 | ||
| 546 | #endif // CDC | 779 | #endif // VIRTSER_ENABLE |
| 547 | 780 | ||
| 548 | // ********************************************************************** | 781 | // ********************************************************************** |
| 549 | // CONFIGURATION Descriptor structure and content | 782 | // CONFIGURATION Descriptor structure and content |
| @@ -552,28 +785,26 @@ COMPILER_PACK_SET(1) | |||
| 552 | 785 | ||
| 553 | typedef struct { | 786 | typedef struct { |
| 554 | usb_conf_desc_t conf; | 787 | usb_conf_desc_t conf; |
| 555 | #ifdef KBD | ||
| 556 | udi_hid_kbd_desc_t hid_kbd; | 788 | udi_hid_kbd_desc_t hid_kbd; |
| 557 | #endif | 789 | #ifdef MOUSE_ENABLE |
| 558 | #ifdef MOU | ||
| 559 | udi_hid_mou_desc_t hid_mou; | 790 | udi_hid_mou_desc_t hid_mou; |
| 560 | #endif | 791 | #endif |
| 561 | #ifdef EXK | 792 | #ifdef EXTRAKEY_ENABLE |
| 562 | udi_hid_exk_desc_t hid_exk; | 793 | udi_hid_exk_desc_t hid_exk; |
| 563 | #endif | 794 | #endif |
| 564 | #ifdef RAW | 795 | #ifdef RAW_ENABLE |
| 565 | udi_hid_raw_desc_t hid_raw; | 796 | udi_hid_raw_desc_t hid_raw; |
| 566 | #endif | 797 | #endif |
| 567 | #ifdef CON | 798 | #ifdef CONSOLE_ENABLE |
| 568 | udi_hid_con_desc_t hid_con; | 799 | udi_hid_con_desc_t hid_con; |
| 569 | #endif | 800 | #endif |
| 570 | #ifdef NKRO | 801 | #ifdef NKRO_ENABLE |
| 571 | udi_hid_nkro_desc_t hid_nkro; | 802 | udi_hid_nkro_desc_t hid_nkro; |
| 572 | #endif | 803 | #endif |
| 573 | #ifdef MIDI | 804 | #ifdef MIDI_ENABLE |
| 574 | udi_hid_midi_desc_t hid_midi; | 805 | udi_hid_midi_desc_t hid_midi; |
| 575 | #endif | 806 | #endif |
| 576 | #ifdef CDC | 807 | #ifdef VIRTSER_ENABLE |
| 577 | udi_cdc_desc_t cdc_serial; | 808 | udi_cdc_desc_t cdc_serial; |
| 578 | #endif | 809 | #endif |
| 579 | } udc_desc_t; | 810 | } udc_desc_t; |
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c index 8142f297d..3e9fbfdbe 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c +++ b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c | |||
| @@ -59,8 +59,6 @@ | |||
| 59 | //*************************************************************************** | 59 | //*************************************************************************** |
| 60 | // KBD | 60 | // KBD |
| 61 | //*************************************************************************** | 61 | //*************************************************************************** |
| 62 | #ifdef KBD | ||
| 63 | |||
| 64 | bool udi_hid_kbd_enable(void); | 62 | bool udi_hid_kbd_enable(void); |
| 65 | void udi_hid_kbd_disable(void); | 63 | void udi_hid_kbd_disable(void); |
| 66 | bool udi_hid_kbd_setup(void); | 64 | bool udi_hid_kbd_setup(void); |
| @@ -196,12 +194,10 @@ static void udi_hid_kbd_setreport_valid(void) { | |||
| 196 | // UDI_HID_KBD_CHANGE_LED(udi_hid_kbd_report_set); | 194 | // UDI_HID_KBD_CHANGE_LED(udi_hid_kbd_report_set); |
| 197 | } | 195 | } |
| 198 | 196 | ||
| 199 | #endif // KBD | ||
| 200 | |||
| 201 | //******************************************************************************************** | 197 | //******************************************************************************************** |
| 202 | // NKRO Keyboard | 198 | // NKRO Keyboard |
| 203 | //******************************************************************************************** | 199 | //******************************************************************************************** |
| 204 | #ifdef NKRO | 200 | #ifdef NKRO_ENABLE |
| 205 | 201 | ||
| 206 | bool udi_hid_nkro_enable(void); | 202 | bool udi_hid_nkro_enable(void); |
| 207 | void udi_hid_nkro_disable(void); | 203 | void udi_hid_nkro_disable(void); |
| @@ -336,12 +332,12 @@ static void udi_hid_nkro_setreport_valid(void) { | |||
| 336 | // UDI_HID_NKRO_CHANGE_LED(udi_hid_nkro_report_set); | 332 | // UDI_HID_NKRO_CHANGE_LED(udi_hid_nkro_report_set); |
| 337 | } | 333 | } |
| 338 | 334 | ||
| 339 | #endif // NKRO | 335 | #endif // NKRO_ENABLE |
| 340 | 336 | ||
| 341 | //******************************************************************************************** | 337 | //******************************************************************************************** |
| 342 | // EXK (extra-keys) SYS-CTRL Keyboard | 338 | // EXK (extra-keys) SYS-CTRL Keyboard |
| 343 | //******************************************************************************************** | 339 | //******************************************************************************************** |
| 344 | #ifdef EXK | 340 | #ifdef EXTRAKEY_ENABLE |
| 345 | 341 | ||
| 346 | bool udi_hid_exk_enable(void); | 342 | bool udi_hid_exk_enable(void); |
| 347 | void udi_hid_exk_disable(void); | 343 | void udi_hid_exk_disable(void); |
| @@ -467,12 +463,12 @@ static void udi_hid_exk_report_sent(udd_ep_status_t status, iram_size_t nb_sent, | |||
| 467 | 463 | ||
| 468 | static void udi_hid_exk_setreport_valid(void) {} | 464 | static void udi_hid_exk_setreport_valid(void) {} |
| 469 | 465 | ||
| 470 | #endif // EXK | 466 | #endif // EXTRAKEY_ENABLE |
| 471 | 467 | ||
| 472 | //******************************************************************************************** | 468 | //******************************************************************************************** |
| 473 | // MOU Mouse | 469 | // MOU Mouse |
| 474 | //******************************************************************************************** | 470 | //******************************************************************************************** |
| 475 | #ifdef MOU | 471 | #ifdef MOUSE_ENABLE |
| 476 | 472 | ||
| 477 | bool udi_hid_mou_enable(void); | 473 | bool udi_hid_mou_enable(void); |
| 478 | void udi_hid_mou_disable(void); | 474 | void udi_hid_mou_disable(void); |
| @@ -601,12 +597,12 @@ static void udi_hid_mou_report_sent(udd_ep_status_t status, iram_size_t nb_sent, | |||
| 601 | } | 597 | } |
| 602 | } | 598 | } |
| 603 | 599 | ||
| 604 | #endif // MOU | 600 | #endif // MOUSE_ENABLE |
| 605 | 601 | ||
| 606 | //******************************************************************************************** | 602 | //******************************************************************************************** |
| 607 | // RAW | 603 | // RAW |
| 608 | //******************************************************************************************** | 604 | //******************************************************************************************** |
| 609 | #ifdef RAW | 605 | #ifdef RAW_ENABLE |
| 610 | 606 | ||
| 611 | bool udi_hid_raw_enable(void); | 607 | bool udi_hid_raw_enable(void); |
| 612 | void udi_hid_raw_disable(void); | 608 | void udi_hid_raw_disable(void); |
| @@ -746,12 +742,12 @@ static void udi_hid_raw_report_rcvd(udd_ep_status_t status, iram_size_t nb_rcvd, | |||
| 746 | } | 742 | } |
| 747 | } | 743 | } |
| 748 | 744 | ||
| 749 | #endif //RAW | 745 | #endif // RAW_ENABLE |
| 750 | 746 | ||
| 751 | //******************************************************************************************** | 747 | //******************************************************************************************** |
| 752 | // CON | 748 | // CON |
| 753 | //******************************************************************************************** | 749 | //******************************************************************************************** |
| 754 | #ifdef CON | 750 | #ifdef CONSOLE_ENABLE |
| 755 | 751 | ||
| 756 | bool udi_hid_con_enable(void); | 752 | bool udi_hid_con_enable(void); |
| 757 | void udi_hid_con_disable(void); | 753 | void udi_hid_con_disable(void); |
| @@ -866,4 +862,4 @@ static void udi_hid_con_report_sent(udd_ep_status_t status, iram_size_t nb_sent, | |||
| 866 | 862 | ||
| 867 | static void udi_hid_con_setreport_valid(void) {} | 863 | static void udi_hid_con_setreport_valid(void) {} |
| 868 | 864 | ||
| 869 | #endif // CON | 865 | #endif // CONSOLE_ENABLE |
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.h b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.h index 6dc1fed3e..a2d228162 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.h +++ b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.h | |||
| @@ -57,62 +57,60 @@ extern "C" { | |||
| 57 | //****************************************************************************** | 57 | //****************************************************************************** |
| 58 | // Keyboard interface definitions | 58 | // Keyboard interface definitions |
| 59 | //****************************************************************************** | 59 | //****************************************************************************** |
| 60 | #ifdef KBD | ||
| 61 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_kbd; | 60 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_kbd; |
| 62 | extern bool udi_hid_kbd_b_report_valid; | 61 | extern bool udi_hid_kbd_b_report_valid; |
| 63 | extern volatile bool udi_hid_kbd_b_report_trans_ongoing; | 62 | extern volatile bool udi_hid_kbd_b_report_trans_ongoing; |
| 64 | extern uint8_t udi_hid_kbd_report_set; | 63 | extern uint8_t udi_hid_kbd_report_set; |
| 65 | bool udi_hid_kbd_send_report(void); | 64 | bool udi_hid_kbd_send_report(void); |
| 66 | #endif // KBD | ||
| 67 | 65 | ||
| 68 | //******************************************************************************************** | 66 | //******************************************************************************************** |
| 69 | // NKRO Keyboard | 67 | // NKRO Keyboard |
| 70 | //******************************************************************************************** | 68 | //******************************************************************************************** |
| 71 | #ifdef NKRO | 69 | #ifdef NKRO_ENABLE |
| 72 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_nkro; | 70 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_nkro; |
| 73 | extern bool udi_hid_nkro_b_report_valid; | 71 | extern bool udi_hid_nkro_b_report_valid; |
| 74 | extern volatile bool udi_hid_nkro_b_report_trans_ongoing; | 72 | extern volatile bool udi_hid_nkro_b_report_trans_ongoing; |
| 75 | bool udi_hid_nkro_send_report(void); | 73 | bool udi_hid_nkro_send_report(void); |
| 76 | #endif // NKRO | 74 | #endif // NKRO_ENABLE |
| 77 | 75 | ||
| 78 | //******************************************************************************************** | 76 | //******************************************************************************************** |
| 79 | // SYS-CTRL interface | 77 | // SYS-CTRL interface |
| 80 | //******************************************************************************************** | 78 | //******************************************************************************************** |
| 81 | #ifdef EXK | 79 | #ifdef EXTRAKEY_ENABLE |
| 82 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_exk; | 80 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_exk; |
| 83 | extern bool udi_hid_exk_b_report_valid; | 81 | extern bool udi_hid_exk_b_report_valid; |
| 84 | extern uint8_t udi_hid_exk_report_set; | 82 | extern uint8_t udi_hid_exk_report_set; |
| 85 | bool udi_hid_exk_send_report(void); | 83 | bool udi_hid_exk_send_report(void); |
| 86 | #endif // EXK | 84 | #endif // EXTRAKEY_ENABLE |
| 87 | 85 | ||
| 88 | //******************************************************************************************** | 86 | //******************************************************************************************** |
| 89 | // CON Console | 87 | // CON Console |
| 90 | //******************************************************************************************** | 88 | //******************************************************************************************** |
| 91 | #ifdef CON | 89 | #ifdef CONSOLE_ENABLE |
| 92 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_con; | 90 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_con; |
| 93 | extern bool udi_hid_con_b_report_valid; | 91 | extern bool udi_hid_con_b_report_valid; |
| 94 | extern uint8_t udi_hid_con_report_set[UDI_HID_CON_REPORT_SIZE]; | 92 | extern uint8_t udi_hid_con_report_set[UDI_HID_CON_REPORT_SIZE]; |
| 95 | extern volatile bool udi_hid_con_b_report_trans_ongoing; | 93 | extern volatile bool udi_hid_con_b_report_trans_ongoing; |
| 96 | bool udi_hid_con_send_report(void); | 94 | bool udi_hid_con_send_report(void); |
| 97 | #endif // CON | 95 | #endif // CONSOLE_ENABLE |
| 98 | 96 | ||
| 99 | //******************************************************************************************** | 97 | //******************************************************************************************** |
| 100 | // MOU Mouse | 98 | // MOU Mouse |
| 101 | //******************************************************************************************** | 99 | //******************************************************************************************** |
| 102 | #ifdef MOU | 100 | #ifdef MOUSE_ENABLE |
| 103 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_mou; | 101 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_mou; |
| 104 | extern bool udi_hid_mou_b_report_valid; | 102 | extern bool udi_hid_mou_b_report_valid; |
| 105 | bool udi_hid_mou_send_report(void); | 103 | bool udi_hid_mou_send_report(void); |
| 106 | #endif // MOU | 104 | #endif // MOUSE_ENABLE |
| 107 | 105 | ||
| 108 | //******************************************************************************************** | 106 | //******************************************************************************************** |
| 109 | // RAW Raw | 107 | // RAW Raw |
| 110 | //******************************************************************************************** | 108 | //******************************************************************************************** |
| 111 | #ifdef RAW | 109 | #ifdef RAW_ENABLE |
| 112 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_raw; | 110 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_raw; |
| 113 | bool udi_hid_raw_send_report(void); | 111 | bool udi_hid_raw_send_report(void); |
| 114 | bool udi_hid_raw_receive_report(void); | 112 | bool udi_hid_raw_receive_report(void); |
| 115 | #endif // RAW | 113 | #endif // RAW_ENABLE |
| 116 | 114 | ||
| 117 | //@} | 115 | //@} |
| 118 | 116 | ||
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c index 4e7deaaa3..a3fb46a3d 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c +++ b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c | |||
| @@ -120,49 +120,45 @@ UDC_DESC_STORAGE udc_desc_t udc_desc = { | |||
| 120 | .conf.iConfiguration = 0, | 120 | .conf.iConfiguration = 0, |
| 121 | .conf.bmAttributes = /* USB_CONFIG_ATTR_MUST_SET | */ USB_DEVICE_ATTR, | 121 | .conf.bmAttributes = /* USB_CONFIG_ATTR_MUST_SET | */ USB_DEVICE_ATTR, |
| 122 | .conf.bMaxPower = USB_CONFIG_MAX_POWER(USB_DEVICE_POWER), | 122 | .conf.bMaxPower = USB_CONFIG_MAX_POWER(USB_DEVICE_POWER), |
| 123 | #ifdef KBD | ||
| 124 | .hid_kbd = UDI_HID_KBD_DESC, | 123 | .hid_kbd = UDI_HID_KBD_DESC, |
| 125 | #endif | 124 | #ifdef RAW_ENABLE |
| 126 | #ifdef RAW | ||
| 127 | .hid_raw = UDI_HID_RAW_DESC, | 125 | .hid_raw = UDI_HID_RAW_DESC, |
| 128 | #endif | 126 | #endif |
| 129 | #ifdef MOU | 127 | #ifdef MOUSE_ENABLE |
| 130 | .hid_mou = UDI_HID_MOU_DESC, | 128 | .hid_mou = UDI_HID_MOU_DESC, |
| 131 | #endif | 129 | #endif |
| 132 | #ifdef EXK | 130 | #ifdef EXTRAKEY_ENABLE |
| 133 | .hid_exk = UDI_HID_EXK_DESC, | 131 | .hid_exk = UDI_HID_EXK_DESC, |
| 134 | #endif | 132 | #endif |
| 135 | #ifdef CON | 133 | #ifdef CONSOLE_ENABLE |
| 136 | .hid_con = UDI_HID_CON_DESC, | 134 | .hid_con = UDI_HID_CON_DESC, |
| 137 | #endif | 135 | #endif |
| 138 | #ifdef NKRO | 136 | #ifdef NKRO_ENABLE |
| 139 | .hid_nkro = UDI_HID_NKRO_DESC, | 137 | .hid_nkro = UDI_HID_NKRO_DESC, |
| 140 | #endif | 138 | #endif |
| 141 | #ifdef CDC | 139 | #ifdef VIRTSER_ENABLE |
| 142 | .cdc_serial = CDC_DESCRIPTOR, | 140 | .cdc_serial = CDC_DESCRIPTOR, |
| 143 | #endif | 141 | #endif |
| 144 | }; | 142 | }; |
| 145 | 143 | ||
| 146 | UDC_DESC_STORAGE udi_api_t *udi_apis[USB_DEVICE_NB_INTERFACE] = { | 144 | UDC_DESC_STORAGE udi_api_t *udi_apis[USB_DEVICE_NB_INTERFACE] = { |
| 147 | #ifdef KBD | ||
| 148 | &udi_api_hid_kbd, | 145 | &udi_api_hid_kbd, |
| 149 | #endif | 146 | #ifdef RAW_ENABLE |
| 150 | #ifdef RAW | ||
| 151 | &udi_api_hid_raw, | 147 | &udi_api_hid_raw, |
| 152 | #endif | 148 | #endif |
| 153 | #ifdef MOU | 149 | #ifdef MOUSE_ENABLE |
| 154 | &udi_api_hid_mou, | 150 | &udi_api_hid_mou, |
| 155 | #endif | 151 | #endif |
| 156 | #ifdef EXK | 152 | #ifdef EXTRAKEY_ENABLE |
| 157 | &udi_api_hid_exk, | 153 | &udi_api_hid_exk, |
| 158 | #endif | 154 | #endif |
| 159 | #ifdef CON | 155 | #ifdef CONSOLE_ENABLE |
| 160 | &udi_api_hid_con, | 156 | &udi_api_hid_con, |
| 161 | #endif | 157 | #endif |
| 162 | #ifdef NKRO | 158 | #ifdef NKRO_ENABLE |
| 163 | &udi_api_hid_nkro, | 159 | &udi_api_hid_nkro, |
| 164 | #endif | 160 | #endif |
| 165 | #ifdef CDC | 161 | #ifdef VIRTSER_ENABLE |
| 166 | &udi_api_cdc_comm, &udi_api_cdc_data, | 162 | &udi_api_cdc_comm, &udi_api_cdc_data, |
| 167 | #endif | 163 | #endif |
| 168 | }; | 164 | }; |
diff --git a/tmk_core/protocol/arm_atsam/usb/usb_main.h b/tmk_core/protocol/arm_atsam/usb/usb_main.h index 3191b2fc1..d8461c6c9 100644 --- a/tmk_core/protocol/arm_atsam/usb/usb_main.h +++ b/tmk_core/protocol/arm_atsam/usb/usb_main.h | |||
| @@ -63,41 +63,39 @@ void main_remotewakeup_enable(void); | |||
| 63 | // Called by UDC when USB Host request to disable remote wakeup | 63 | // Called by UDC when USB Host request to disable remote wakeup |
| 64 | void main_remotewakeup_disable(void); | 64 | void main_remotewakeup_disable(void); |
| 65 | 65 | ||
| 66 | #ifdef KBD | ||
| 67 | extern volatile bool main_b_kbd_enable; | 66 | extern volatile bool main_b_kbd_enable; |
| 68 | bool main_kbd_enable(void); | 67 | bool main_kbd_enable(void); |
| 69 | void main_kbd_disable(void); | 68 | void main_kbd_disable(void); |
| 70 | #endif // KBD | ||
| 71 | 69 | ||
| 72 | #ifdef NKRO | 70 | #ifdef NKRO_ENABLE |
| 73 | extern volatile bool main_b_nkro_enable; | 71 | extern volatile bool main_b_nkro_enable; |
| 74 | bool main_nkro_enable(void); | 72 | bool main_nkro_enable(void); |
| 75 | void main_nkro_disable(void); | 73 | void main_nkro_disable(void); |
| 76 | #endif // NKRO | 74 | #endif // NKRO_ENABLE |
| 77 | 75 | ||
| 78 | #ifdef EXK | 76 | #ifdef EXTRAKEY_ENABLE |
| 79 | extern volatile bool main_b_exk_enable; | 77 | extern volatile bool main_b_exk_enable; |
| 80 | bool main_exk_enable(void); | 78 | bool main_exk_enable(void); |
| 81 | void main_exk_disable(void); | 79 | void main_exk_disable(void); |
| 82 | #endif // EXK | 80 | #endif // EXTRAKEY_ENABLE |
| 83 | 81 | ||
| 84 | #ifdef CON | 82 | #ifdef CONSOLE_ENABLE |
| 85 | extern volatile bool main_b_con_enable; | 83 | extern volatile bool main_b_con_enable; |
| 86 | bool main_con_enable(void); | 84 | bool main_con_enable(void); |
| 87 | void main_con_disable(void); | 85 | void main_con_disable(void); |
| 88 | #endif // CON | 86 | #endif // CONSOLE_ENABLE |
| 89 | 87 | ||
| 90 | #ifdef MOU | 88 | #ifdef MOUSE_ENABLE |
| 91 | extern volatile bool main_b_mou_enable; | 89 | extern volatile bool main_b_mou_enable; |
| 92 | bool main_mou_enable(void); | 90 | bool main_mou_enable(void); |
| 93 | void main_mou_disable(void); | 91 | void main_mou_disable(void); |
| 94 | #endif // MOU | 92 | #endif // MOUSE_ENABLE |
| 95 | 93 | ||
| 96 | #ifdef RAW | 94 | #ifdef RAW_ENABLE |
| 97 | extern volatile bool main_b_raw_enable; | 95 | extern volatile bool main_b_raw_enable; |
| 98 | bool main_raw_enable(void); | 96 | bool main_raw_enable(void); |
| 99 | void main_raw_disable(void); | 97 | void main_raw_disable(void); |
| 100 | void main_raw_receive(uint8_t *buffer, uint8_t len); | 98 | void main_raw_receive(uint8_t *buffer, uint8_t len); |
| 101 | #endif // RAW | 99 | #endif // RAW_ENABLE |
| 102 | 100 | ||
| 103 | #endif // _MAIN_H_ | 101 | #endif // _MAIN_H_ |
diff --git a/tmk_core/protocol/arm_atsam/usb/usb_protocol_cdc.h b/tmk_core/protocol/arm_atsam/usb/usb_protocol_cdc.h index aa639a6e5..f35503a3b 100644 --- a/tmk_core/protocol/arm_atsam/usb/usb_protocol_cdc.h +++ b/tmk_core/protocol/arm_atsam/usb/usb_protocol_cdc.h | |||
| @@ -48,7 +48,7 @@ | |||
| 48 | 48 | ||
| 49 | #include "compiler.h" | 49 | #include "compiler.h" |
| 50 | 50 | ||
| 51 | #ifdef CDC | 51 | #ifdef VIRTSER_ENABLE |
| 52 | 52 | ||
| 53 | # define CDC_CLASS_DEVICE 0x02 //!< USB Communication Device Class | 53 | # define CDC_CLASS_DEVICE 0x02 //!< USB Communication Device Class |
| 54 | # define CDC_CLASS_COMM 0x02 //!< CDC Communication Class Interface | 54 | # define CDC_CLASS_COMM 0x02 //!< CDC Communication Class Interface |
