From 088b64ab3d598574244db5ac67fec889bdc58119 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 25 Feb 2020 12:18:11 +1100 Subject: Improvements to extrakey HID descriptors (#8156) --- tmk_core/protocol/chibios/usb_main.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'tmk_core/protocol/chibios') diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index d5eeffcbe4..ec95167cf6 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -732,7 +732,7 @@ void shared_in_cb(USBDriver *usbp, usbep_t ep) { */ #ifdef EXTRAKEY_ENABLE -static void send_extra_report(uint8_t report_id, uint16_t data) { +static void send_extra(uint8_t report_id, uint16_t data) { osalSysLock(); if (usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { osalSysUnlock(); @@ -744,15 +744,19 @@ static void send_extra_report(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) { send_extra_report(REPORT_ID_SYSTEM, data); } - -void send_consumer(uint16_t data) { send_extra_report(REPORT_ID_CONSUMER, data); } +void send_system(uint16_t data) { +#ifdef EXTRAKEY_ENABLE + send_extra(REPORT_ID_SYSTEM, data); +#endif +} -#else /* EXTRAKEY_ENABLE */ -void send_system(uint16_t data) { (void)data; } -void send_consumer(uint16_t data) { (void)data; } -#endif /* EXTRAKEY_ENABLE */ +void send_consumer(uint16_t data) { +#ifdef EXTRAKEY_ENABLE + send_extra(REPORT_ID_CONSUMER, data); +#endif +} /* --------------------------------------------------------- * Console functions -- cgit v1.2.1