summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/vusb/vusb.c
diff options
context:
space:
mode:
authoryiancar <yiangosyiangou@cytanet.com.cy>2020-08-19 02:16:35 +0100
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2020-08-29 14:30:02 -0700
commit47f8947bf5aa3ff1cbb484a2d6dc3fa818987700 (patch)
tree3aeba94ac3c304f38a7f943db18450ca0267cd67 /tmk_core/protocol/vusb/vusb.c
parent9ef4526a2f6cdd2e708e7cfc37845a04749665dd (diff)
Update vusb to match 3rd endpoint. (#9020)
* Update vusb to match 3rd endpoint. - With the addition of https://github.com/qmk/v-usb/pull/1 a 3rd endpoint (endpoint4) becomes available. - We can assign mouse/extrakeys to that endpoint as its a desirable feature and leave rawhid and console to compete for the 2nd endpoint. NOTE: The version of vusb.c in future branch is older than master. Just remember that it will need a #error if both raw_hid and console are enabled at the same time. * Final Fixes * Update tmk_core/protocol/vusb/vusb.c * Update tmk_core/protocol/vusb/vusb.c * Update tmk_core/protocol/vusb/usbconfig.h * Update tmk_core/protocol/vusb/usbconfig.h * Update tmk_core/protocol/vusb/usbconfig.h * Update tmk_core/protocol/vusb/usbconfig.h * Updated vusb submodule to latest commit
Diffstat (limited to 'tmk_core/protocol/vusb/vusb.c')
-rw-r--r--tmk_core/protocol/vusb/vusb.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index 735a1c1d30..77bbbd7bd4 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -62,12 +62,16 @@ enum usb_interfaces {
TOTAL_INTERFACES = NEXT_INTERFACE
};
-#define MAX_INTERFACES 2
+#define MAX_INTERFACES 3
#if (NEXT_INTERFACE - 1) > MAX_INTERFACES
# error There are not enough available interfaces to support all functions. Please disable one or more of the following: Mouse Keys, Extra Keys, Raw HID, Console
#endif
+#if (defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)) && CONSOLE_ENABLE
+# error Mouse/Extra Keys share an endpoint with Console. Please disable one of the two.
+#endif
+
static uint8_t keyboard_led_state = 0;
static uint8_t vusb_idle_rate = 0;
@@ -116,16 +120,16 @@ void raw_hid_send(uint8_t *data, uint8_t length) {
uint8_t *temp = data;
for (uint8_t i = 0; i < 4; i++) {
- while (!usbInterruptIsReady3()) {
+ while (!usbInterruptIsReady4()) {
usbPoll();
}
- usbSetInterrupt3(temp, 8);
+ usbSetInterrupt4(temp, 8);
temp += 8;
}
- while (!usbInterruptIsReady3()) {
+ while (!usbInterruptIsReady4()) {
usbPoll();
}
- usbSetInterrupt3(0, 0);
+ usbSetInterrupt4(0, 0);
}
__attribute__((weak)) void raw_hid_receive(uint8_t *data, uint8_t length) {
@@ -683,7 +687,7 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = {
.bLength = sizeof(usbEndpointDescriptor_t),
.bDescriptorType = USBDESCR_ENDPOINT
},
- .bEndpointAddress = (USBRQ_DIR_DEVICE_TO_HOST | USB_CFG_EP3_NUMBER),
+ .bEndpointAddress = (USBRQ_DIR_DEVICE_TO_HOST | USB_CFG_EP4_NUMBER),
.bmAttributes = 0x03,
.wMaxPacketSize = RAW_EPSIZE,
.bInterval = USB_POLLING_INTERVAL_MS
@@ -693,7 +697,7 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = {
.bLength = sizeof(usbEndpointDescriptor_t),
.bDescriptorType = USBDESCR_ENDPOINT
},
- .bEndpointAddress = (USBRQ_DIR_HOST_TO_DEVICE | USB_CFG_EP3_NUMBER),
+ .bEndpointAddress = (USBRQ_DIR_HOST_TO_DEVICE | USB_CFG_EP4_NUMBER),
.bmAttributes = 0x03,
.wMaxPacketSize = RAW_EPSIZE,
.bInterval = USB_POLLING_INTERVAL_MS