From 09d668eb0ed3ff6fa48ce1db98910b022bca2d90 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 3 Sep 2022 05:38:27 +1000 Subject: 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 --- keyboards/hhkb/rn42/rn42.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) (limited to 'keyboards/hhkb/rn42') 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) {} -- cgit v1.2.3 From 6dbbeea46a0ac7527235982cb6406802df846805 Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 7 Oct 2022 13:35:01 +1100 Subject: Refactor `send_extra` (#18615) --- keyboards/hhkb/rn42/rn42.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'keyboards/hhkb/rn42') diff --git a/keyboards/hhkb/rn42/rn42.c b/keyboards/hhkb/rn42/rn42.c index b35b319352..1cd24af5e9 100644 --- a/keyboards/hhkb/rn42/rn42.c +++ b/keyboards/hhkb/rn42/rn42.c @@ -12,7 +12,7 @@ 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_extra(uint8_t report_id, uint16_t data); +static void send_extra(report_extra_t *report); host_driver_t rn42_driver = { keyboard_leds, @@ -221,10 +221,10 @@ static uint16_t usage2bits(uint16_t usage) } -static void send_extra(uint8_t report_id, uint16_t data) +static void send_extra(report_extra_t *report) { - if (report_id == REPORT_ID_CONSUMER) { - uint16_t bits = usage2bits(data); + if (report->report_id == REPORT_ID_CONSUMER) { + uint16_t bits = usage2bits(report->usage); serial_send(0xFD); // Raw report mode serial_send(3); // length serial_send(3); // descriptor type @@ -238,7 +238,7 @@ static void send_extra(uint8_t report_id, 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_extra(uint8_t report_id, uint16_t data); +static void config_send_extra(report_extra_t *report); host_driver_t rn42_config_driver = { config_keyboard_leds, @@ -250,4 +250,4 @@ host_driver_t rn42_config_driver = { 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_extra(uint8_t report_id, uint16_t data) {} +static void config_send_extra(report_extra_t *report) {} -- cgit v1.2.3 From c6f1b594a2085e67219bd5f0f7ba7898429d331c Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 11 Oct 2022 06:06:26 +1100 Subject: Remove legacy keycodes, part 2 (#18660) * `KC_SYSREQ` -> `KC_SYRQ` And one `KC_ALT_ERASE` -> `KC_ERAS` * `KC_NONUS_BSLASH` -> `KC_NUBS` * `KC_NUMLOCK` -> `KC_NUM` * `KC_CLCK` -> `KC_CAPS` * `KC_SCROLLLOCK` -> `KC_SCRL` * `KC_LBRACKET` -> `KC_LBRC` * `KC_RBRACKET` -> `KC_RBRC` * `KC_CAPSLOCK` -> `KC_CAPS` --- keyboards/hhkb/rn42/rn42_task.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'keyboards/hhkb/rn42') diff --git a/keyboards/hhkb/rn42/rn42_task.c b/keyboards/hhkb/rn42/rn42_task.c index 88ae88c150..3a95ee0ac1 100644 --- a/keyboards/hhkb/rn42/rn42_task.c +++ b/keyboards/hhkb/rn42/rn42_task.c @@ -372,7 +372,7 @@ bool command_extra(uint8_t code) config_mode = false; } return true; - case KC_SCROLLLOCK: + case KC_SCROLL_LOCK: init_rn42(); return true; #ifdef NKRO_ENABLE @@ -451,8 +451,8 @@ static uint8_t code2asc(uint8_t code) case KC_SPACE: return ' '; case KC_MINUS: return (shifted ? '_' : '-'); case KC_EQUAL: return (shifted ? '+' : '='); - case KC_LBRACKET: return (shifted ? '{' : '['); - case KC_RBRACKET: return (shifted ? '}' : ']'); + case KC_LEFT_BRACKET: return (shifted ? '{' : '['); + case KC_RIGHT_BRACKET: return (shifted ? '}' : ']'); case KC_BSLASH: return (shifted ? '|' : '\\'); case KC_NONUS_HASH: return (shifted ? '|' : '\\'); case KC_SCOLON: return (shifted ? ':' : ';'); -- cgit v1.2.3 From 5629ba18077ee5dcde72e497ddf46d848817dd5c Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 14 Oct 2022 04:28:14 +1100 Subject: Remove legacy keycodes, part 4 (#18683) * `KC_PGDOWN` -> `KC_PGDN` * `KC_PSCREEN` -> `KC_PSCR` * `KC_SCOLON` -> `KC_SCLN` * `KC_BSLASH` -> `KC_BSLS` * `KC_BSPACE` -> `KC_BSPC` --- keyboards/hhkb/rn42/rn42_task.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'keyboards/hhkb/rn42') diff --git a/keyboards/hhkb/rn42/rn42_task.c b/keyboards/hhkb/rn42/rn42_task.c index 3a95ee0ac1..26dacbd650 100644 --- a/keyboards/hhkb/rn42/rn42_task.c +++ b/keyboards/hhkb/rn42/rn42_task.c @@ -446,16 +446,16 @@ static uint8_t code2asc(uint8_t code) case KC_0: return (shifted ? ')' : '0'); case KC_ENTER: return '\n'; case KC_ESCAPE: return 0x1B; - case KC_BSPACE: return '\b'; + case KC_BACKSPACE: return '\b'; case KC_TAB: return '\t'; case KC_SPACE: return ' '; case KC_MINUS: return (shifted ? '_' : '-'); case KC_EQUAL: return (shifted ? '+' : '='); case KC_LEFT_BRACKET: return (shifted ? '{' : '['); case KC_RIGHT_BRACKET: return (shifted ? '}' : ']'); - case KC_BSLASH: return (shifted ? '|' : '\\'); + case KC_BACKSLASH: return (shifted ? '|' : '\\'); case KC_NONUS_HASH: return (shifted ? '|' : '\\'); - case KC_SCOLON: return (shifted ? ':' : ';'); + case KC_SEMICOLON: return (shifted ? ':' : ';'); case KC_QUOTE: return (shifted ? '"' : '\''); case KC_GRAVE: return (shifted ? '~' : '`'); case KC_COMMA: return (shifted ? '<' : ','); -- cgit v1.2.3 From 74223c34a969c0877bde035c721c21a1f25890fa Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 17 Oct 2022 00:14:40 +1100 Subject: Remove legacy keycodes, part 6 (#18740) * `KC_RSHIFT` -> `KC_RSFT` * `KC_RCTRL` -> `KC_RCTL` * `KC_LSHIFT` -> `KC_LSFT` * `KC_LCTRL` -> `KC_LCTL` --- keyboards/hhkb/rn42/rn42_task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboards/hhkb/rn42') diff --git a/keyboards/hhkb/rn42/rn42_task.c b/keyboards/hhkb/rn42/rn42_task.c index 26dacbd650..0e21eb9a79 100644 --- a/keyboards/hhkb/rn42/rn42_task.c +++ b/keyboards/hhkb/rn42/rn42_task.c @@ -406,7 +406,7 @@ bool command_console_extra(uint8_t code) // convert keycode into ascii charactor static uint8_t code2asc(uint8_t code) { - bool shifted = (get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))) ? true : false; + bool shifted = (get_mods() & (MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT))) ? true : false; switch (code) { case KC_A: return (shifted ? 'A' : 'a'); case KC_B: return (shifted ? 'B' : 'b'); -- cgit v1.2.3