summaryrefslogtreecommitdiffstats
path: root/keyboards/bioi/ble.c
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2022-09-03 05:38:27 +1000
committerGitHub <noreply@github.com>2022-09-02 20:38:27 +0100
commit09d668eb0ed3ff6fa48ce1db98910b022bca2d90 (patch)
treeda13eca69e7e24e439c4bccdd1296fc4de212085 /keyboards/bioi/ble.c
parent0ceaaaae8e71f4713d232ac1b657906f4a45833f (diff)
Simplify extrakeys sending at the host driver level (#18230)
* Simplify extrakeys sending at the host driver level * There are two arguments here * Wrong syntax * Adjust keyboards which use a custom host driver
Diffstat (limited to 'keyboards/bioi/ble.c')
-rw-r--r--keyboards/bioi/ble.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/keyboards/bioi/ble.c b/keyboards/bioi/ble.c
index d941f7c43d..b050b2f6cb 100644
--- a/keyboards/bioi/ble.c
+++ b/keyboards/bioi/ble.c
@@ -96,15 +96,14 @@ static void bluefruit_serial_send(uint8_t data)
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);
host_driver_t bluefruit_driver = {
keyboard_leds,
send_keyboard,
send_mouse,
- send_system,
- send_consumer};
+ send_extra
+};
host_driver_t null_driver = {};
@@ -156,10 +155,6 @@ static void send_mouse(report_mouse_t *report)
#endif
}
-static void send_system(uint16_t data)
-{
-}
-
/*
+-----------------+-------------------+-------+
| Consumer Key | Bit Map | Hex |
@@ -182,30 +177,32 @@ static void send_system(uint16_t data)
#define CONSUMER2BLUEFRUIT(usage) \
(usage == AUDIO_MUTE ? 0x00e2 : (usage == AUDIO_VOL_UP ? 0x00e9 : (usage == AUDIO_VOL_DOWN ? 0x00ea : (usage == TRANSPORT_NEXT_TRACK ? 0x00b5 : (usage == TRANSPORT_PREV_TRACK ? 0x00b6 : (usage == TRANSPORT_STOP ? 0x00b7 : (usage == TRANSPORT_STOP_EJECT ? 0x00b8 : (usage == TRANSPORT_PLAY_PAUSE ? 0x00b1 : (usage == AL_CC_CONFIG ? 0x0183 : (usage == AL_EMAIL ? 0x018c : (usage == AL_CALCULATOR ? 0x0192 : (usage == AL_LOCAL_BROWSER ? 0x0196 : (usage == AC_SEARCH ? 0x021f : (usage == AC_HOME ? 0x0223 : (usage == AC_BACK ? 0x0224 : (usage == AC_FORWARD ? 0x0225 : (usage == AC_STOP ? 0x0226 : (usage == AC_REFRESH ? 0x0227 : (usage == AC_BOOKMARKS ? 0x022a : 0)))))))))))))))))))
-static void send_consumer(uint16_t data)
+static void send_extra(uint8_t report_id, uint16_t data)
{
- static uint16_t last_data = 0;
- if (data == last_data)
- return;
- last_data = data;
+ if (report_id == REPORT_ID_CONSUMER) {
+ static uint16_t last_data = 0;
+ if (data == last_data)
+ return;
+ last_data = data;
- uint16_t bitmap = CONSUMER2BLUEFRUIT(data);
+ uint16_t bitmap = CONSUMER2BLUEFRUIT(data);
#ifdef BLUEFRUIT_TRACE_SERIAL
- dprintf("\nData: ");
- debug_hex16(data);
- dprintf("; bitmap: ");
- debug_hex16(bitmap);
- dprintf("\n");
- bluefruit_trace_header();
+ dprintf("\nData: ");
+ debug_hex16(data);
+ dprintf("; bitmap: ");
+ debug_hex16(bitmap);
+ dprintf("\n");
+ bluefruit_trace_header();
#endif
- send_str(PSTR("AT+BLEHIDCONTROLKEY=0x"));
- send_bytes((bitmap >> 8) & 0xFF);
- send_bytes(bitmap & 0xFF);
- send_str(PSTR("\r\n"));
+ send_str(PSTR("AT+BLEHIDCONTROLKEY=0x"));
+ send_bytes((bitmap >> 8) & 0xFF);
+ send_bytes(bitmap & 0xFF);
+ send_str(PSTR("\r\n"));
#ifdef BLUEFRUIT_TRACE_SERIAL
- bluefruit_trace_footer();
+ bluefruit_trace_footer();
#endif
+ }
}
void usart_init(void)