diff --git a/drivers/bluetooth/bluetooth.c b/drivers/bluetooth/bluetooth.c index d5382401e7e5..85144983addb 100644 --- a/drivers/bluetooth/bluetooth.c +++ b/drivers/bluetooth/bluetooth.c @@ -60,3 +60,17 @@ void bluetooth_send_consumer(uint16_t usage) { rn42_send_consumer(usage); #endif } + +void bluetooth_send_system(uint16_t usage) { +#if defined(BLUETOOTH_ITON_BT) + iton_bt_send_system(usage); +#endif +} + +uint8_t bluetooth_led_state(void) { +#if defined(BLUETOOTH_ITON_BT) + return iton_bt_led_state; +#else + return 0; +#endif +} diff --git a/drivers/bluetooth/bluetooth.h b/drivers/bluetooth/bluetooth.h index 2e4d0df5381a..fd34c2bb11fb 100644 --- a/drivers/bluetooth/bluetooth.h +++ b/drivers/bluetooth/bluetooth.h @@ -50,3 +50,15 @@ void bluetooth_send_mouse(report_mouse_t *report); * \param usage The consumer usage to send. */ void bluetooth_send_consumer(uint16_t usage); + +/** + * \brief Send a system usage. + * + * \param usage The system usage to send. + */ +void bluetooth_send_system(uint16_t usage); + +/** + * \brief Get the current state of the status LEDs. + */ +uint8_t bluetooth_led_state(void); diff --git a/tmk_core/protocol/host.c b/tmk_core/protocol/host.c index 2c6654e9a652..43600b4d670c 100644 --- a/tmk_core/protocol/host.c +++ b/tmk_core/protocol/host.c @@ -63,6 +63,13 @@ uint8_t host_keyboard_leds(void) { #ifdef SPLIT_KEYBOARD if (!is_keyboard_master()) return split_led_state; #endif + +#ifdef BLUETOOTH_ENABLE + if (where_to_send() == OUTPUT_BLUETOOTH) { + return bluetooth_led_state(); + } +#endif + if (!driver) return 0; return (*driver->keyboard_leds)(); } @@ -130,6 +137,13 @@ void host_system_send(uint16_t usage) { if (usage == last_system_usage) return; last_system_usage = usage; +#ifdef BLUETOOTH_ENABLE + if (where_to_send() == OUTPUT_BLUETOOTH) { + bluetooth_send_system(usage); + return; + } +#endif + if (!driver) return; report_extra_t report = {