1
0
Fork 0

quantum.c send char cleanups (#11743)

This commit is contained in:
Ryan 2021-02-01 08:18:10 +11:00 committed by GitHub
parent c1361005fa
commit 6bec7fb3fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -571,32 +571,22 @@ void tap_random_base64(void) {
#endif #endif
switch (key) { switch (key) {
case 0 ... 25: case 0 ... 25:
register_code(KC_LSFT); send_char(key + 'A');
register_code(key + KC_A);
unregister_code(key + KC_A);
unregister_code(KC_LSFT);
break; break;
case 26 ... 51: case 26 ... 51:
register_code(key - 26 + KC_A); send_char(key - 26 + 'a');
unregister_code(key - 26 + KC_A);
break; break;
case 52: case 52:
register_code(KC_0); send_char('0');
unregister_code(KC_0);
break; break;
case 53 ... 61: case 53 ... 61:
register_code(key - 53 + KC_1); send_char(key - 53 + '1');
unregister_code(key - 53 + KC_1);
break; break;
case 62: case 62:
register_code(KC_LSFT); send_char('+');
register_code(KC_EQL);
unregister_code(KC_EQL);
unregister_code(KC_LSFT);
break; break;
case 63: case 63:
register_code(KC_SLSH); send_char('/');
unregister_code(KC_SLSH);
break; break;
} }
} }
@ -708,20 +698,7 @@ void send_byte(uint8_t number) {
} }
void send_nibble(uint8_t number) { void send_nibble(uint8_t number) {
switch (number) { tap_code16(hex_to_keycode(number));
case 0:
register_code(KC_0);
unregister_code(KC_0);
break;
case 1 ... 9:
register_code(KC_1 + (number - 1));
unregister_code(KC_1 + (number - 1));
break;
case 0xA ... 0xF:
register_code(KC_A + (number - 0xA));
unregister_code(KC_A + (number - 0xA));
break;
}
} }
__attribute__((weak)) uint16_t hex_to_keycode(uint8_t hex) { __attribute__((weak)) uint16_t hex_to_keycode(uint8_t hex) {