summaryrefslogtreecommitdiffstats
path: root/tmk_core
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/protocol/arm_atsam/main_arm_atsam.c19
-rw-r--r--tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c2
-rw-r--r--tmk_core/protocol/chibios/chibios.c5
-rw-r--r--tmk_core/protocol/chibios/usb_main.c68
-rw-r--r--tmk_core/protocol/host.c86
-rw-r--r--tmk_core/protocol/host_driver.h6
-rw-r--r--tmk_core/protocol/lufa/lufa.c129
-rw-r--r--tmk_core/protocol/report.h6
-rw-r--r--tmk_core/protocol/usb_descriptor.c12
-rw-r--r--tmk_core/protocol/vusb/vusb.c31
-rw-r--r--tmk_core/protocol/vusb/vusb.h2
11 files changed, 123 insertions, 243 deletions
diff --git a/tmk_core/protocol/arm_atsam/main_arm_atsam.c b/tmk_core/protocol/arm_atsam/main_arm_atsam.c
index 8ee9e042e7..0537e3937d 100644
--- a/tmk_core/protocol/arm_atsam/main_arm_atsam.c
+++ b/tmk_core/protocol/arm_atsam/main_arm_atsam.c
@@ -37,14 +37,13 @@ void main_subtasks(void);
uint8_t keyboard_leds(void);
void send_keyboard(report_keyboard_t *report);
void send_mouse(report_mouse_t *report);
-void send_system(uint16_t data);
-void send_consumer(uint16_t data);
+void send_extra(uint8_t report_id, uint16_t data);
#ifdef DEFERRED_EXEC_ENABLE
void deferred_exec_task(void);
#endif // DEFERRED_EXEC_ENABLE
-host_driver_t arm_atsam_driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer};
+host_driver_t arm_atsam_driver = {keyboard_leds, send_keyboard, send_mouse, send_extra};
uint8_t led_states;
@@ -114,8 +113,8 @@ void send_mouse(report_mouse_t *report) {
#endif // MOUSEKEY_ENABLE
}
-#ifdef EXTRAKEY_ENABLE
void send_extra(uint8_t report_id, uint16_t data) {
+#ifdef EXTRAKEY_ENABLE
uint32_t irqflags;
irqflags = __get_PRIMASK();
@@ -129,18 +128,6 @@ void send_extra(uint8_t report_id, uint16_t data) {
__DMB();
__set_PRIMASK(irqflags);
-}
-#endif // EXTRAKEY_ENABLE
-
-void send_system(uint16_t data) {
-#ifdef EXTRAKEY_ENABLE
- send_extra(REPORT_ID_SYSTEM, data);
-#endif // EXTRAKEY_ENABLE
-}
-
-void send_consumer(uint16_t data) {
-#ifdef EXTRAKEY_ENABLE
- send_extra(REPORT_ID_CONSUMER, data);
#endif // EXTRAKEY_ENABLE
}
diff --git a/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c b/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c
index 69b3ad574c..58fc4efd9c 100644
--- a/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c
+++ b/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c
@@ -95,7 +95,7 @@ led_setup_t leds_rainbow_s[] = {
void *led_setups[] = {leds_rainbow_s, leds_rainbow_ns, leds_teal_salmon, leds_yellow, leds_red, leds_green, leds_blue, leds_white, leds_white_with_red_stripe, leds_black_with_red_stripe, leds_off};
-const uint8_t led_setups_count = sizeof(led_setups) / sizeof(led_setups[0]);
+const uint8_t led_setups_count = ARRAY_SIZE(led_setups);
# endif // USE_MASSDROP_CONFIGURATOR
#endif // RGB_MATRIX_ENABLE \ No newline at end of file
diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c
index c9a480c325..024160a925 100644
--- a/tmk_core/protocol/chibios/chibios.c
+++ b/tmk_core/protocol/chibios/chibios.c
@@ -58,13 +58,12 @@
uint8_t keyboard_leds(void);
void send_keyboard(report_keyboard_t *report);
void send_mouse(report_mouse_t *report);
-void send_system(uint16_t data);
-void send_consumer(uint16_t data);
+void send_extra(uint8_t report_id, uint16_t data);
void send_programmable_button(uint32_t data);
void send_digitizer(report_digitizer_t *report);
/* host struct */
-host_driver_t chibios_driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer, send_programmable_button};
+host_driver_t chibios_driver = {keyboard_leds, send_keyboard, send_mouse, send_extra, send_programmable_button};
#ifdef VIRTSER_ENABLE
void virtser_task(void);
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index eb9ef82554..7c44b87bc4 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -50,10 +50,6 @@
extern keymap_config_t keymap_config;
#endif
-#ifdef JOYSTICK_ENABLE
-# include "joystick.h"
-#endif
-
/* ---------------------------------------------------------
* Global interface variables and declarations
* ---------------------------------------------------------
@@ -946,8 +942,8 @@ void shared_in_cb(USBDriver *usbp, usbep_t ep) {
* ---------------------------------------------------------
*/
+void send_extra(uint8_t report_id, uint16_t data) {
#ifdef EXTRAKEY_ENABLE
-static void send_extra(uint8_t report_id, uint16_t data) {
osalSysLock();
if (usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) {
osalSysUnlock();
@@ -970,18 +966,6 @@ static void send_extra(uint8_t report_id, uint16_t data) {
usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)&report, sizeof(report_extra_t));
osalSysUnlock();
-}
-#endif
-
-void send_system(uint16_t data) {
-#ifdef EXTRAKEY_ENABLE
- send_extra(REPORT_ID_SYSTEM, data);
-#endif
-}
-
-void send_consumer(uint16_t data) {
-#ifdef EXTRAKEY_ENABLE
- send_extra(REPORT_ID_CONSUMER, data);
#endif
}
@@ -1163,59 +1147,15 @@ void virtser_task(void) {
#endif
+void send_joystick(report_joystick_t *report) {
#ifdef JOYSTICK_ENABLE
-
-void send_joystick_packet(joystick_t *joystick) {
- static joystick_report_t rep;
- rep = (joystick_report_t) {
-# if JOYSTICK_AXES_COUNT > 0
- .axes =
- { joystick->axes[0],
-
-# if JOYSTICK_AXES_COUNT >= 2
- joystick->axes[1],
-# endif
-# if JOYSTICK_AXES_COUNT >= 3
- joystick->axes[2],
-# endif
-# if JOYSTICK_AXES_COUNT >= 4
- joystick->axes[3],
-# endif
-# if JOYSTICK_AXES_COUNT >= 5
- joystick->axes[4],
-# endif
-# if JOYSTICK_AXES_COUNT >= 6
- joystick->axes[5],
-# endif
- },
-# endif // JOYSTICK_AXES_COUNT>0
-
-# if JOYSTICK_BUTTON_COUNT > 0
- .buttons = {
- joystick->buttons[0],
-
-# if JOYSTICK_BUTTON_COUNT > 8
- joystick->buttons[1],
-# endif
-# if JOYSTICK_BUTTON_COUNT > 16
- joystick->buttons[2],
-# endif
-# if JOYSTICK_BUTTON_COUNT > 24
- joystick->buttons[3],
-# endif
- }
-# endif // JOYSTICK_BUTTON_COUNT>0
- };
-
- // chnWrite(&drivers.joystick_driver.driver, (uint8_t *)&rep, sizeof(rep));
osalSysLock();
if (usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) {
osalSysUnlock();
return;
}
- usbStartTransmitI(&USB_DRIVER, JOYSTICK_IN_EPNUM, (uint8_t *)&rep, sizeof(joystick_report_t));
+ usbStartTransmitI(&USB_DRIVER, JOYSTICK_IN_EPNUM, (uint8_t *)report, sizeof(report_joystick_t));
osalSysUnlock();
-}
-
#endif
+}
diff --git a/tmk_core/protocol/host.c b/tmk_core/protocol/host.c
index 3d8604d541..7b051a881b 100644
--- a/tmk_core/protocol/host.c
+++ b/tmk_core/protocol/host.c
@@ -24,6 +24,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "debug.h"
#include "digitizer.h"
+#ifdef JOYSTICK_ENABLE
+# include "joystick.h"
+#endif
+
+#ifdef BLUETOOTH_ENABLE
+# include "bluetooth.h"
+# include "outputselect.h"
+#endif
+
#ifdef NKRO_ENABLE
# include "keycode_config.h"
extern keymap_config_t keymap_config;
@@ -63,6 +72,13 @@ led_t host_keyboard_led_state(void) {
/* send report */
void host_keyboard_send(report_keyboard_t *report) {
+#ifdef BLUETOOTH_ENABLE
+ if (where_to_send() == OUTPUT_BLUETOOTH) {
+ bluetooth_send_keyboard(report);
+ return;
+ }
+#endif
+
if (!driver) return;
#if defined(NKRO_ENABLE) && defined(NKRO_SHARED_EP)
if (keyboard_protocol && keymap_config.nkro) {
@@ -90,6 +106,13 @@ void host_keyboard_send(report_keyboard_t *report) {
}
void host_mouse_send(report_mouse_t *report) {
+#ifdef BLUETOOTH_ENABLE
+ if (where_to_send() == OUTPUT_BLUETOOTH) {
+ bluetooth_send_mouse(report);
+ return;
+ }
+#endif
+
if (!driver) return;
#ifdef MOUSE_SHARED_EP
report->report_id = REPORT_ID_MOUSE;
@@ -107,16 +130,75 @@ void host_system_send(uint16_t report) {
last_system_report = report;
if (!driver) return;
- (*driver->send_system)(report);
+ (*driver->send_extra)(REPORT_ID_SYSTEM, report);
}
void host_consumer_send(uint16_t report) {
if (report == last_consumer_report) return;
last_consumer_report = report;
+#ifdef BLUETOOTH_ENABLE
+ if (where_to_send() == OUTPUT_BLUETOOTH) {
+ bluetooth_send_consumer(report);
+ return;
+ }
+#endif
+
+ if (!driver) return;
+ (*driver->send_extra)(REPORT_ID_CONSUMER, report);
+}
+
+#ifdef JOYSTICK_ENABLE
+void host_joystick_send(joystick_t *joystick) {
if (!driver) return;
- (*driver->send_consumer)(report);
+
+ report_joystick_t report = {
+# if JOYSTICK_AXES_COUNT > 0
+ .axes =
+ {
+ joystick->axes[0],
+
+# if JOYSTICK_AXES_COUNT >= 2
+ joystick->axes[1],
+# endif
+# if JOYSTICK_AXES_COUNT >= 3
+ joystick->axes[2],
+# endif
+# if JOYSTICK_AXES_COUNT >= 4
+ joystick->axes[3],
+# endif
+# if JOYSTICK_AXES_COUNT >= 5
+ joystick->axes[4],
+# endif
+# if JOYSTICK_AXES_COUNT >= 6
+ joystick->axes[5],
+# endif
+ },
+# endif
+
+# if JOYSTICK_BUTTON_COUNT > 0
+ .buttons =
+ {
+ joystick->buttons[0],
+
+# if JOYSTICK_BUTTON_COUNT > 8
+ joystick->buttons[1],
+# endif
+# if JOYSTICK_BUTTON_COUNT > 16
+ joystick->buttons[2],
+# endif
+# if JOYSTICK_BUTTON_COUNT > 24
+ joystick->buttons[3],
+# endif
+ },
+# endif
+ };
+
+ send_joystick(&report);
}
+#endif
+
+__attribute__((weak)) void send_joystick(report_joystick_t *report) {}
void host_digitizer_send(digitizer_t *digitizer) {
if (!driver) return;
diff --git a/tmk_core/protocol/host_driver.h b/tmk_core/protocol/host_driver.h
index affd0dcb34..ae6e40ddc3 100644
--- a/tmk_core/protocol/host_driver.h
+++ b/tmk_core/protocol/host_driver.h
@@ -27,9 +27,9 @@ typedef struct {
uint8_t (*keyboard_leds)(void);
void (*send_keyboard)(report_keyboard_t *);
void (*send_mouse)(report_mouse_t *);
- void (*send_system)(uint16_t);
- void (*send_consumer)(uint16_t);
+ void (*send_extra)(uint8_t, uint16_t);
void (*send_programmable_button)(uint32_t);
} host_driver_t;
-void send_digitizer(report_digitizer_t *report); \ No newline at end of file
+void send_joystick(report_joystick_t *report);
+void send_digitizer(report_digitizer_t *report);
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index b4b03357a3..6012d96fd5 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -65,15 +65,6 @@ extern keymap_config_t keymap_config;
# include "audio.h"
#endif
-#ifdef BLUETOOTH_ENABLE
-# include "outputselect.h"
-# ifdef BLUETOOTH_BLUEFRUIT_LE
-# include "bluefruit_le.h"
-# elif BLUETOOTH_RN42
-# include "rn42.h"
-# endif
-#endif
-
#ifdef VIRTSER_ENABLE
# include "virtser.h"
#endif
@@ -86,10 +77,6 @@ extern keymap_config_t keymap_config;
# include "raw_hid.h"
#endif
-#ifdef JOYSTICK_ENABLE
-# include "joystick.h"
-#endif
-
uint8_t keyboard_idle = 0;
/* 0: Boot Protocol, 1: Report Protocol(default) */
uint8_t keyboard_protocol = 1;
@@ -101,10 +88,9 @@ static report_keyboard_t keyboard_report_sent;
static uint8_t keyboard_leds(void);
static void send_keyboard(report_keyboard_t *report);
static void send_mouse(report_mouse_t *report);
-static void send_system(uint16_t data);
-static void send_consumer(uint16_t data);
+static void send_extra(uint8_t report_id, uint16_t data);
static void send_programmable_button(uint32_t data);
-host_driver_t lufa_driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer, send_programmable_button};
+host_driver_t lufa_driver = {keyboard_leds, send_keyboard, send_mouse, send_extra, send_programmable_button};
#ifdef VIRTSER_ENABLE
// clang-format off
@@ -271,51 +257,10 @@ static void Console_Task(void) {
/*******************************************************************************
* Joystick
******************************************************************************/
+void send_joystick(report_joystick_t *report) {
#ifdef JOYSTICK_ENABLE
-void send_joystick_packet(joystick_t *joystick) {
uint8_t timeout = 255;
- static joystick_report_t r;
- r = (joystick_report_t) {
-# if JOYSTICK_AXES_COUNT > 0
- .axes =
- { joystick->axes[0],
-
-# if JOYSTICK_AXES_COUNT >= 2
- joystick->axes[1],
-# endif
-# if JOYSTICK_AXES_COUNT >= 3
- joystick->axes[2],
-# endif
-# if JOYSTICK_AXES_COUNT >= 4
- joystick->axes[3],
-# endif
-# if JOYSTICK_AXES_COUNT >= 5
- joystick->axes[4],
-# endif
-# if JOYSTICK_AXES_COUNT >= 6
- joystick->axes[5],
-# endif
- },
-# endif // JOYSTICK_AXES_COUNT>0
-
-# if JOYSTICK_BUTTON_COUNT > 0
- .buttons = {
- joystick->buttons[0],
-
-# if JOYSTICK_BUTTON_COUNT > 8
- joystick->buttons[1],
-# endif
-# if JOYSTICK_BUTTON_COUNT > 16
- joystick->buttons[2],
-# endif
-# if JOYSTICK_BUTTON_COUNT > 24
- joystick->buttons[3],
-# endif
- }
-# endif // JOYSTICK_BUTTON_COUNT>0
- };
-
/* Select the Joystick Report Endpoint */
Endpoint_SelectEndpoint(JOYSTICK_IN_EPNUM);
@@ -325,12 +270,12 @@ void send_joystick_packet(joystick_t *joystick) {
if (!Endpoint_IsReadWriteAllowed()) return;
/* Write Joystick Report Data */
- Endpoint_Write_Stream_LE(&r, sizeof(joystick_report_t), NULL);
+ Endpoint_Write_Stream_LE(report, sizeof(report_joystick_t), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
-}
#endif
+}
/*******************************************************************************
* USB Events
@@ -649,17 +594,6 @@ static uint8_t keyboard_leds(void) {
static void send_keyboard(report_keyboard_t *report) {
uint8_t timeout = 255;
-#ifdef BLUETOOTH_ENABLE
- if (where_to_send() == OUTPUT_BLUETOOTH) {
-# ifdef BLUETOOTH_BLUEFRUIT_LE
- bluefruit_le_send_keys(report->mods, report->keys, sizeof(report->keys));
-# elif BLUETOOTH_RN42
- rn42_send_keyboard(report);
-# endif
- return;
- }
-#endif
-
/* Select the Keyboard Report Endpoint */
uint8_t ep = KEYBOARD_IN_EPNUM;
uint8_t size = KEYBOARD_REPORT_SIZE;
@@ -696,18 +630,6 @@ static void send_mouse(report_mouse_t *report) {
#ifdef MOUSE_ENABLE
uint8_t timeout = 255;
-# ifdef BLUETOOTH_ENABLE
- if (where_to_send() == OUTPUT_BLUETOOTH) {
-# ifdef BLUETOOTH_BLUEFRUIT_LE
- // FIXME: mouse buttons
- bluefruit_le_send_mouse_move(report->x, report->y, report->v, report->h, report->buttons);
-# elif BLUETOOTH_RN42
- rn42_send_mouse(report);
-# endif
- return;
- }
-# endif
-
/* Select the Mouse Report Endpoint */
Endpoint_SelectEndpoint(MOUSE_IN_EPNUM);
@@ -746,42 +668,11 @@ static void send_report(void *report, size_t size) {
*
* FIXME: Needs doc
*/
-#ifdef EXTRAKEY_ENABLE
static void send_extra(uint8_t report_id, uint16_t data) {
+#ifdef EXTRAKEY_ENABLE
static report_extra_t r;
r = (report_extra_t){.report_id = report_id, .usage = data};
send_report(&r, sizeof(r));
-}
-#endif
-
-/** \brief Send System
- *
- * FIXME: Needs doc
- */
-static void send_system(uint16_t data) {
-#ifdef EXTRAKEY_ENABLE
- send_extra(REPORT_ID_SYSTEM, data);
-#endif
-}
-
-/** \brief Send Consumer
- *
- * FIXME: Needs doc
- */
-static void send_consumer(uint16_t data) {
-#ifdef EXTRAKEY_ENABLE
-# ifdef BLUETOOTH_ENABLE
- if (where_to_send() == OUTPUT_BLUETOOTH) {
-# ifdef BLUETOOTH_BLUEFRUIT_LE
- bluefruit_le_send_consumer_key(data);
-# elif BLUETOOTH_RN42
- rn42_send_consumer(data);
-# endif
- return;
- }
-# endif
-
- send_extra(REPORT_ID_CONSUMER, data);
#endif
}
@@ -1028,10 +919,6 @@ void protocol_pre_init(void) {
setup_usb();
sei();
-#if defined(BLUETOOTH_RN42)
- rn42_init();
-#endif
-
/* wait for USB startup & debug output */
#ifdef WAIT_FOR_USB
@@ -1083,10 +970,6 @@ void protocol_post_task(void) {
MIDI_Device_USBTask(&USB_MIDI_Interface);
#endif
-#ifdef BLUETOOTH_BLUEFRUIT_LE
- bluefruit_le_task();
-#endif
-
#ifdef VIRTSER_ENABLE
virtser_task();
CDC_Device_USBTask(&cdc_device);
diff --git a/tmk_core/protocol/report.h b/tmk_core/protocol/report.h
index 735ccdb4a1..8bc4a57c0c 100644
--- a/tmk_core/protocol/report.h
+++ b/tmk_core/protocol/report.h
@@ -245,7 +245,7 @@ typedef struct {
#if JOYSTICK_BUTTON_COUNT > 0
uint8_t buttons[(JOYSTICK_BUTTON_COUNT - 1) / 8 + 1];
#endif
-} __attribute__((packed)) joystick_report_t;
+} __attribute__((packed)) report_joystick_t;
/* keycode to system usage */
static inline uint16_t KEYCODE2SYSTEM(uint8_t key) {
@@ -292,6 +292,10 @@ static inline uint16_t KEYCODE2CONSUMER(uint8_t key) {
return AL_CALCULATOR;
case KC_MY_COMPUTER:
return AL_LOCAL_BROWSER;
+ case KC_CONTROL_PANEL:
+ return AL_CONTROL_PANEL;
+ case KC_ASSISTANT:
+ return AL_ASSISTANT;
case KC_WWW_SEARCH:
return AC_SEARCH;
case KC_WWW_HOME:
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c
index 21795cef60..7117d2fc11 100644
--- a/tmk_core/protocol/usb_descriptor.c
+++ b/tmk_core/protocol/usb_descriptor.c
@@ -1046,7 +1046,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = {
*/
const USB_Descriptor_String_t PROGMEM LanguageString = {
.Header = {
- .Size = USB_STRING_LEN(1),
+ .Size = 4,
.Type = DTYPE_String
},
.UnicodeString = {LANGUAGE_ID_ENG}
@@ -1054,24 +1054,24 @@ const USB_Descriptor_String_t PROGMEM LanguageString = {
const USB_Descriptor_String_t PROGMEM ManufacturerString = {
.Header = {
- .Size = USB_STRING_LEN(sizeof(STR(MANUFACTURER)) - 1), // Subtract 1 for null terminator
+ .Size = sizeof(USBSTR(MANUFACTURER)),
.Type = DTYPE_String
},
- .UnicodeString = LSTR(MANUFACTURER)
+ .UnicodeString = USBSTR(MANUFACTURER)
};
const USB_Descriptor_String_t PROGMEM ProductString = {
.Header = {
- .Size = USB_STRING_LEN(sizeof(STR(PRODUCT)) - 1), // Subtract 1 for null terminator
+ .Size = sizeof(USBSTR(PRODUCT)),
.Type = DTYPE_String
},
- .UnicodeString = LSTR(PRODUCT)
+ .UnicodeString = USBSTR(PRODUCT)
};
#if defined(SERIAL_NUMBER)
const USB_Descriptor_String_t PROGMEM SerialNumberString = {
.Header = {
- .Size = USB_STRING_LEN(sizeof(SERIAL_NUMBER) - 1), // Subtract 1 for null terminator
+ .Size = sizeof(USBSTR(SERIAL_NUMBER)),
.Type = DTYPE_String
},
.UnicodeString = USBSTR(SERIAL_NUMBER)
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index d07cc0d27e..013d637b6f 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -224,11 +224,10 @@ void console_task(void) {
static uint8_t keyboard_leds(void);
static void send_keyboard(report_keyboard_t *report);
static void send_mouse(report_mouse_t *report);
-static void send_system(uint16_t data);
-static void send_consumer(uint16_t data);
+static void send_extra(uint8_t report_id, uint16_t data);
static void send_programmable_button(uint32_t data);
-static host_driver_t driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer, send_programmable_button};
+static host_driver_t driver = {keyboard_leds, send_keyboard, send_mouse, send_extra, send_programmable_button};
host_driver_t *vusb_driver(void) {
return &driver;
@@ -269,8 +268,8 @@ static void send_mouse(report_mouse_t *report) {
#endif
}
-#ifdef EXTRAKEY_ENABLE
static void send_extra(uint8_t report_id, uint16_t data) {
+#ifdef EXTRAKEY_ENABLE
static uint8_t last_id = 0;
static uint16_t last_data = 0;
if ((report_id == last_id) && (data == last_data)) return;
@@ -282,18 +281,6 @@ static void send_extra(uint8_t report_id, uint16_t data) {
if (usbInterruptIsReadyShared()) {
usbSetInterruptShared((void *)&report, sizeof(report_extra_t));
}
-}
-#endif
-
-static void send_system(uint16_t data) {
-#ifdef EXTRAKEY_ENABLE
- send_extra(REPORT_ID_SYSTEM, data);
-#endif
-}
-
-static void send_consumer(uint16_t data) {
-#ifdef EXTRAKEY_ENABLE
- send_extra(REPORT_ID_CONSUMER, data);
#endif
}
@@ -672,7 +659,7 @@ const PROGMEM uchar console_hid_report[] = {
// clang-format off
const PROGMEM usbStringDescriptor_t usbStringDescriptorZero = {
.header = {
- .bLength = USB_STRING_LEN(1),
+ .bLength = 4,
.bDescriptorType = USBDESCR_STRING
},
.bString = {0x0409} // US English
@@ -680,24 +667,24 @@ const PROGMEM usbStringDescriptor_t usbStringDescriptorZero = {
const PROGMEM usbStringDescriptor_t usbStringDescriptorManufacturer = {
.header = {
- .bLength = USB_STRING_LEN(sizeof(STR(MANUFACTURER)) - 1),
+ .bLength = sizeof(USBSTR(MANUFACTURER)),
.bDescriptorType = USBDESCR_STRING
},
- .bString = LSTR(MANUFACTURER)
+ .bString = USBSTR(MANUFACTURER)
};
const PROGMEM usbStringDescriptor_t usbStringDescriptorProduct = {
.header = {
- .bLength = USB_STRING_LEN(sizeof(STR(PRODUCT)) - 1),
+ .bLength = sizeof(USBSTR(PRODUCT)),
.bDescriptorType = USBDESCR_STRING
},
- .bString = LSTR(PRODUCT)
+ .bString = USBSTR(PRODUCT)
};
#if defined(SERIAL_NUMBER)
const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = {
.header = {
- .bLength = USB_STRING_LEN(sizeof(SERIAL_NUMBER) - 1),
+ .bLength = sizeof(USBSTR(SERIAL_NUMBER)),
.bDescriptorType = USBDESCR_STRING
},
.bString = USBSTR(SERIAL_NUMBER)
diff --git a/tmk_core/protocol/vusb/vusb.h b/tmk_core/protocol/vusb/vusb.h
index b1ecc98f37..c5cb27ded6 100644
--- a/tmk_core/protocol/vusb/vusb.h
+++ b/tmk_core/protocol/vusb/vusb.h
@@ -118,8 +118,6 @@ typedef struct usbConfigurationDescriptor {
#endif
} __attribute__((packed)) usbConfigurationDescriptor_t;
-#define USB_STRING_LEN(s) (sizeof(usbDescriptorHeader_t) + ((s) << 1))
-
extern bool vusb_suspended;
host_driver_t *vusb_driver(void);