summaryrefslogtreecommitdiff
path: root/keyboards/hhkb/rn42/rn42.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/hhkb/rn42/rn42.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/hhkb/rn42/rn42.c')
-rw-r--r--keyboards/hhkb/rn42/rn42.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/keyboards/hhkb/rn42/rn42.c b/keyboards/hhkb/rn42/rn42.c
index 06665425ce..b35b319352 100644
--- a/keyboards/hhkb/rn42/rn42.c
+++ b/keyboards/hhkb/rn42/rn42.c
@@ -12,15 +12,13 @@
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 rn42_driver = {
keyboard_leds,
send_keyboard,
send_mouse,
- send_system,
- send_consumer
+ send_extra
};
@@ -198,12 +196,6 @@ static void send_mouse(report_mouse_t *report)
serial_send(report->v);
}
-static void send_system(uint16_t data)
-{
- // Table 5-6 of RN-BT-DATA-UB
- // 81,82,83 scan codes can be used?
-}
-
static uint16_t usage2bits(uint16_t usage)
{
@@ -228,14 +220,17 @@ static uint16_t usage2bits(uint16_t usage)
return 0;
}
-static void send_consumer(uint16_t data)
+
+static void send_extra(uint8_t report_id, uint16_t data)
{
- uint16_t bits = usage2bits(data);
- serial_send(0xFD); // Raw report mode
- serial_send(3); // length
- serial_send(3); // descriptor type
- serial_send(bits&0xFF);
- serial_send((bits>>8)&0xFF);
+ if (report_id == REPORT_ID_CONSUMER) {
+ uint16_t bits = usage2bits(data);
+ serial_send(0xFD); // Raw report mode
+ serial_send(3); // length
+ serial_send(3); // descriptor type
+ serial_send(bits&0xFF);
+ serial_send((bits>>8)&0xFF);
+ }
}
@@ -243,19 +238,16 @@ static void send_consumer(uint16_t data)
static uint8_t config_keyboard_leds(void);
static void config_send_keyboard(report_keyboard_t *report);
static void config_send_mouse(report_mouse_t *report);
-static void config_send_system(uint16_t data);
-static void config_send_consumer(uint16_t data);
+static void config_send_extra(uint8_t report_id, uint16_t data);
host_driver_t rn42_config_driver = {
config_keyboard_leds,
config_send_keyboard,
config_send_mouse,
- config_send_system,
- config_send_consumer
+ config_send_extra
};
static uint8_t config_keyboard_leds(void) { return leds; }
static void config_send_keyboard(report_keyboard_t *report) {}
static void config_send_mouse(report_mouse_t *report) {}
-static void config_send_system(uint16_t data) {}
-static void config_send_consumer(uint16_t data) {}
+static void config_send_extra(uint8_t report_id, uint16_t data) {}