diff options
Diffstat (limited to 'keyboards/hhkb/rn42')
-rw-r--r-- | keyboards/hhkb/rn42/rn42.c | 38 | ||||
-rw-r--r-- | keyboards/hhkb/rn42/rn42_task.c | 14 |
2 files changed, 22 insertions, 30 deletions
diff --git a/keyboards/hhkb/rn42/rn42.c b/keyboards/hhkb/rn42/rn42.c index 06665425ce..1cd24af5e9 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(report_extra_t *report); 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(report_extra_t *report) { - 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->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 + 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(report_extra_t *report); 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(report_extra_t *report) {} diff --git a/keyboards/hhkb/rn42/rn42_task.c b/keyboards/hhkb/rn42/rn42_task.c index 88ae88c150..0e21eb9a79 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 @@ -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'); @@ -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_LBRACKET: return (shifted ? '{' : '['); - case KC_RBRACKET: return (shifted ? '}' : ']'); - case KC_BSLASH: return (shifted ? '|' : '\\'); + case KC_LEFT_BRACKET: return (shifted ? '{' : '['); + case KC_RIGHT_BRACKET: 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 ? '<' : ','); |