···11-/*
22- * Copyright 2022
33- *
44- * This program is free software: you can redistribute it and/or modify
55- * it under the terms of the GNU General Public License as published by
66- * the Free Software Foundation, either version 2 of the License, or
77- * (at your option) any later version.
88- *
99- * This program is distributed in the hope that it will be useful,
1010- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1111- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1212- * GNU General Public License for more details.
1313- *
1414- * You should have received a copy of the GNU General Public License
1515- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1616- */
11+// Copyright 2025 QMK
22+// SPDX-License-Identifier: GPL-2.0-or-later
173184#include "bluetooth.h"
1952020-#if defined(BLUETOOTH_BLUEFRUIT_LE)
2121-# include "bluefruit_le.h"
2222-#elif defined(BLUETOOTH_RN42)
2323-# include "rn42.h"
2424-#endif
66+__attribute__((weak)) void bluetooth_init(void) {}
2572626-void bluetooth_init(void) {
2727-#if defined(BLUETOOTH_BLUEFRUIT_LE)
2828- bluefruit_le_init();
2929-#elif defined(BLUETOOTH_RN42)
3030- rn42_init();
3131-#endif
3232-}
88+__attribute__((weak)) void bluetooth_task(void) {}
3393434-void bluetooth_task(void) {
3535-#if defined(BLUETOOTH_BLUEFRUIT_LE)
3636- bluefruit_le_task();
3737-#endif
1010+__attribute__((weak)) bool bluetooth_is_connected(void) {
1111+ return true;
3812}
39134040-void bluetooth_send_keyboard(report_keyboard_t *report) {
4141-#if defined(BLUETOOTH_BLUEFRUIT_LE)
4242- bluefruit_le_send_keyboard(report);
4343-#elif defined(BLUETOOTH_RN42)
4444- rn42_send_keyboard(report);
4545-#endif
1414+__attribute__((weak)) uint8_t bluetooth_keyboard_leds(void) {
1515+ return 0;
4616}
47174848-void bluetooth_send_mouse(report_mouse_t *report) {
4949-#if defined(BLUETOOTH_BLUEFRUIT_LE)
5050- bluefruit_le_send_mouse(report);
5151-#elif defined(BLUETOOTH_RN42)
5252- rn42_send_mouse(report);
5353-#endif
5454-}
1818+__attribute__((weak)) void bluetooth_send_keyboard(report_keyboard_t *report) {}
1919+2020+__attribute__((weak)) void bluetooth_send_nkro(report_nkro_t *report) {}
2121+2222+__attribute__((weak)) void bluetooth_send_mouse(report_mouse_t *report) {}
2323+2424+__attribute__((weak)) void bluetooth_send_consumer(uint16_t usage) {}
55255656-void bluetooth_send_consumer(uint16_t usage) {
5757-#if defined(BLUETOOTH_BLUEFRUIT_LE)
5858- bluefruit_le_send_consumer(usage);
5959-#elif defined(BLUETOOTH_RN42)
6060- rn42_send_consumer(usage);
6161-#endif
6262-}
2626+__attribute__((weak)) void bluetooth_send_system(uint16_t usage) {}
+26
drivers/bluetooth/bluetooth.h
···3131void bluetooth_task(void);
32323333/**
3434+ * \brief Detects if Bluetooth is connected.
3535+ *
3636+ * \return `true` if connected, `false` otherwise.
3737+ */
3838+bool bluetooth_is_connected(void);
3939+4040+/**
4141+ * \brief Get current LED state.
4242+ */
4343+uint8_t bluetooth_keyboard_leds(void);
4444+4545+/**
3446 * \brief Send a keyboard report.
3547 *
3648 * \param report The keyboard report to send.
···3850void bluetooth_send_keyboard(report_keyboard_t *report);
39514052/**
5353+ * \brief Send a nkro report.
5454+ *
5555+ * \param report The nkro report to send.
5656+ */
5757+void bluetooth_send_nkro(report_nkro_t *report);
5858+5959+/**
4160 * \brief Send a mouse report.
4261 *
4362 * \param report The mouse report to send.
···5069 * \param usage The consumer usage to send.
5170 */
5271void bluetooth_send_consumer(uint16_t usage);
7272+7373+/**
7474+ * \brief Send a system usage.
7575+ *
7676+ * \param usage The system usage to send.
7777+ */
7878+void bluetooth_send_system(uint16_t usage);
+71
drivers/bluetooth/bluetooth_drivers.c
···11+/*
22+ * Copyright 2022
33+ *
44+ * This program is free software: you can redistribute it and/or modify
55+ * it under the terms of the GNU General Public License as published by
66+ * the Free Software Foundation, either version 2 of the License, or
77+ * (at your option) any later version.
88+ *
99+ * This program is distributed in the hope that it will be useful,
1010+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1111+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1212+ * GNU General Public License for more details.
1313+ *
1414+ * You should have received a copy of the GNU General Public License
1515+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1616+ */
1717+1818+#include "bluetooth.h"
1919+2020+#if defined(BLUETOOTH_BLUEFRUIT_LE)
2121+# include "bluefruit_le.h"
2222+#elif defined(BLUETOOTH_RN42)
2323+# include "rn42.h"
2424+#endif
2525+2626+void bluetooth_init(void) {
2727+#if defined(BLUETOOTH_BLUEFRUIT_LE)
2828+ bluefruit_le_init();
2929+#elif defined(BLUETOOTH_RN42)
3030+ rn42_init();
3131+#endif
3232+}
3333+3434+void bluetooth_task(void) {
3535+#if defined(BLUETOOTH_BLUEFRUIT_LE)
3636+ bluefruit_le_task();
3737+#endif
3838+}
3939+4040+bool bluetooth_is_connected(void) {
4141+#if defined(BLUETOOTH_BLUEFRUIT_LE)
4242+ return bluefruit_le_is_connected();
4343+#else
4444+ // TODO: drivers should check if BT is connected here
4545+ return true;
4646+#endif
4747+}
4848+4949+void bluetooth_send_keyboard(report_keyboard_t *report) {
5050+#if defined(BLUETOOTH_BLUEFRUIT_LE)
5151+ bluefruit_le_send_keyboard(report);
5252+#elif defined(BLUETOOTH_RN42)
5353+ rn42_send_keyboard(report);
5454+#endif
5555+}
5656+5757+void bluetooth_send_mouse(report_mouse_t *report) {
5858+#if defined(BLUETOOTH_BLUEFRUIT_LE)
5959+ bluefruit_le_send_mouse(report);
6060+#elif defined(BLUETOOTH_RN42)
6161+ rn42_send_mouse(report);
6262+#endif
6363+}
6464+6565+void bluetooth_send_consumer(uint16_t usage) {
6666+#if defined(BLUETOOTH_BLUEFRUIT_LE)
6767+ bluefruit_le_send_consumer(usage);
6868+#elif defined(BLUETOOTH_RN42)
6969+ rn42_send_consumer(usage);
7070+#endif
7171+}
+4-10
quantum/connection/connection.c
···55#include "usb_util.h"
66#include "util.h"
7788+#ifdef BLUETOOTH_ENABLE
99+# include "bluetooth.h"
1010+#endif
1111+812// ======== DEPRECATED DEFINES - DO NOT USE ========
913#ifdef OUTPUT_DEFAULT
1014# undef CONNECTION_HOST_DEFAULT
···13171418__attribute__((weak)) void set_output_user(uint8_t output) {}
1519// ========
1616-1717-#ifdef BLUETOOTH_ENABLE
1818-# ifdef BLUETOOTH_BLUEFRUIT_LE
1919-# include "bluefruit_le.h"
2020-# define bluetooth_is_connected() bluefruit_le_is_connected()
2121-# else
2222-// TODO: drivers should check if BT is connected here
2323-# define bluetooth_is_connected() true
2424-# endif
2525-#endif
26202721#define CONNECTION_HOST_INVALID 0xFF
2822