Skip to content
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.

Commit

Permalink
Allow modified keycodes in Unicode input (qmk#10658)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored and Oscar Carlsson committed Nov 2, 2020
1 parent 1aeb07f commit 247b3bd
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions quantum/process_keycode/process_unicode_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,10 @@ __attribute__((weak)) void unicode_input_cancel(void) {
set_mods(unicode_saved_mods); // Reregister previously set mods
}

__attribute__((weak)) uint16_t hex_to_keycode(uint8_t hex) {
if (hex == 0x0) {
return KC_0;
} else if (hex < 0xA) {
return KC_1 + (hex - 0x1);
} else {
return KC_A + (hex - 0xA);
}
}

void register_hex(uint16_t hex) {
for (int i = 3; i >= 0; i--) {
uint8_t digit = ((hex >> (i * 4)) & 0xF);
tap_code(hex_to_keycode(digit));
tap_code16(hex_to_keycode(digit));
}
}

Expand All @@ -162,10 +152,10 @@ void register_hex32(uint32_t hex) {
uint8_t digit = ((hex >> (i * 4)) & 0xF);
if (digit == 0) {
if (!onzerostart) {
tap_code(hex_to_keycode(digit));
tap_code16(hex_to_keycode(digit));
}
} else {
tap_code(hex_to_keycode(digit));
tap_code16(hex_to_keycode(digit));
onzerostart = false;
}
}
Expand Down

0 comments on commit 247b3bd

Please sign in to comment.