From 63e5782d2cdf0ee282ad434c773463d9da9db6b3 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sat, 13 Aug 2016 10:43:22 +0200 Subject: [PATCH 1/8] process_unicode: Small refactor & linux fix This moves the unicode input start / end sequences into their own functions, so keymaps and other functionality can build on it too. At the same time, it changes how the Linux variant works, to match reality: CTRL+SHIFT must be unregistered too, and we close the thing with a Space instead. Signed-off-by: Gergely Nagy --- quantum/process_keycode/process_unicode.c | 76 ++++++++++++++--------- quantum/process_keycode/process_unicode.h | 3 + 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index 3fcac15ce..55e47f179 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c @@ -18,40 +18,54 @@ void set_unicode_input_mode(uint8_t os_target) input_mode = os_target; } +void unicode_input_start (void) { + switch(input_mode) { + case UC_OSX: + register_code(KC_LALT); + break; + case UC_LNX: + register_code(KC_LCTL); + register_code(KC_LSFT); + register_code(KC_U); + unregister_code(KC_U); + unregister_code(KC_LSFT); + unregister_code(KC_LCTL); + break; + case UC_WIN: + register_code(KC_LALT); + register_code(KC_PPLS); + unregister_code(KC_PPLS); + break; + } +} + +void unicode_input_finish (void) { + switch(input_mode) { + case UC_OSX: + case UC_WIN: + unregister_code(KC_LALT); + break; + case UC_LNX: + register_code(KC_SPC); + unregister_code(KC_SPC); + break; + } +} + +void register_hex(uint16_t hex) { + for(int i = 3; i >= 0; i--) { + uint8_t digit = ((hex >> (i*4)) & 0xF); + register_code(hex_to_keycode(digit)); + unregister_code(hex_to_keycode(digit)); + } +} + bool process_unicode(uint16_t keycode, keyrecord_t *record) { if (keycode > QK_UNICODE && record->event.pressed) { uint16_t unicode = keycode & 0x7FFF; - switch(input_mode) { - case UC_OSX: - register_code(KC_LALT); - break; - case UC_LNX: - register_code(KC_LCTL); - register_code(KC_LSFT); - register_code(KC_U); - unregister_code(KC_U); - break; - case UC_WIN: - register_code(KC_LALT); - register_code(KC_PPLS); - unregister_code(KC_PPLS); - break; - } - for(int i = 3; i >= 0; i--) { - uint8_t digit = ((unicode >> (i*4)) & 0xF); - register_code(hex_to_keycode(digit)); - unregister_code(hex_to_keycode(digit)); - } - switch(input_mode) { - case UC_OSX: - case UC_WIN: - unregister_code(KC_LALT); - break; - case UC_LNX: - unregister_code(KC_LCTL); - unregister_code(KC_LSFT); - break; - } + unicode_input_start(); + register_hex(unicode); + unicode_input_finish(); } return true; } \ No newline at end of file diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h index ca17f8f66..f719a1226 100644 --- a/quantum/process_keycode/process_unicode.h +++ b/quantum/process_keycode/process_unicode.h @@ -9,6 +9,9 @@ #define UC_BSD 3 void set_unicode_input_mode(uint8_t os_target); +void unicode_input_start(void); +void unicode_input_finish(void); +void register_hex(uint16_t hex); bool process_unicode(uint16_t keycode, keyrecord_t *record); From fa06a163607e8c6c4bd0968c2de96a9a298b777c Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sat, 13 Aug 2016 10:46:38 +0200 Subject: [PATCH 2/8] process_unicode: Add a way to enter unicode symbols by name The purpose of this change is to allow keymaps to specify a dictionary of unicode symbol name to code mappings, and let the person at the keyboard enter unicode symbols by name. This is done by having a way to trigger unicode symbol input mode, when all keys are cached until Esc, Enter or Space are pressed. Once that happens, we try to look up the symbol from our lookup table. If found, we erase back, and type the unicode magic in to get that symbol. If not found, we still erase back, start unicode input mode, and replay what the user typed in. Signed-off-by: Gergely Nagy --- Makefile | 7 +- quantum/process_keycode/process_unicode.c | 93 ++++++++++++++++++++++- quantum/process_keycode/process_unicode.h | 29 ++++++- 3 files changed, 126 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 053c8532a..693edc9f0 100644 --- a/Makefile +++ b/Makefile @@ -198,6 +198,11 @@ ifeq ($(strip $(AUDIO_ENABLE)), yes) SRC += $(QUANTUM_DIR)/audio/luts.c endif +ifeq ($(strip $(UCIS_ENABLE)), yes) + OPT_DEFS += -DUCIS_ENABLE + UNICODE_ENABLE = yes +endif + ifeq ($(strip $(UNICODE_ENABLE)), yes) OPT_DEFS += -DUNICODE_ENABLE SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c @@ -273,4 +278,4 @@ BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S") OPT_DEFS += -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\" $(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(QUANTUM_PATH)/version.h) -$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(QUANTUM_PATH)/version.h) \ No newline at end of file +$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(QUANTUM_PATH)/version.h) diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index 55e47f179..8a6509300 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c @@ -68,4 +68,95 @@ bool process_unicode(uint16_t keycode, keyrecord_t *record) { unicode_input_finish(); } return true; -} \ No newline at end of file +} + +#ifdef UCIS_ENABLE +void qk_ucis_start(void) { + qk_ucis_state.count = 0; + qk_ucis_state.in_progress = true; + + unicode_input_start(); + register_hex(0x2328); + unicode_input_finish(); +} + +static bool is_uni_seq(char *seq) { + uint8_t i; + + for (i = 0; seq[i]; i++) { + uint16_t code; + if (('1' <= seq[i]) && (seq[i] <= '0')) + code = seq[i] - '1' + KC_1; + else + code = seq[i] - 'a' + KC_A; + + if (i > qk_ucis_state.count || qk_ucis_state.codes[i] != code) + return false; + } + + return (qk_ucis_state.codes[i] == KC_ENT || + qk_ucis_state.codes[i] == KC_SPC); +} + +__attribute__((weak)) +void qk_ucis_symbol_fallback (void) { + for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) { + uint8_t code = qk_ucis_state.codes[i]; + register_code(code); + unregister_code(code); + } +} + +bool process_record_ucis (uint16_t keycode, keyrecord_t *record) { + uint8_t i; + + if (!qk_ucis_state.in_progress || !record->event.pressed) + return true; + + qk_ucis_state.codes[qk_ucis_state.count] = keycode; + qk_ucis_state.count++; + + if (keycode == KC_BSPC) { + if (qk_ucis_state.count >= 2) { + qk_ucis_state.count -= 2; + return true; + } else { + qk_ucis_state.count--; + return false; + } + } + + if (keycode == KC_ENT || keycode == KC_SPC || keycode == KC_ESC) { + bool symbol_found = false; + + for (i = qk_ucis_state.count; i > 0; i--) { + register_code (KC_BSPC); + unregister_code (KC_BSPC); + } + + if (keycode == KC_ESC) { + qk_ucis_state.in_progress = false; + return false; + } + + unicode_input_start(); + for (i = 0; ucis_symbol_table[i].symbol; i++) { + if (is_uni_seq (ucis_symbol_table[i].symbol)) { + symbol_found = true; + for (uint8_t j = 0; ucis_symbol_table[i].codes[j]; j++) { + register_hex(ucis_symbol_table[i].codes[j]); + } + break; + } + } + if (!symbol_found) { + qk_ucis_symbol_fallback(); + } + unicode_input_finish(); + + qk_ucis_state.in_progress = false; + return false; + } + return true; +} +#endif diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h index f719a1226..372ea2f0d 100644 --- a/quantum/process_keycode/process_unicode.h +++ b/quantum/process_keycode/process_unicode.h @@ -15,6 +15,33 @@ void register_hex(uint16_t hex); bool process_unicode(uint16_t keycode, keyrecord_t *record); +#ifdef UCIS_ENABLE +#ifndef UCIS_MAX_SYMBOL_LENGTH +#define UCIS_MAX_SYMBOL_LENGTH 32 +#endif + +typedef struct { + char *symbol; + uint16_t codes[4]; +} qk_ucis_symbol_t; + +struct { + uint8_t count; + uint16_t codes[UCIS_MAX_SYMBOL_LENGTH]; + bool in_progress:1; +} qk_ucis_state; + +#define UCIS_TABLE(...) {__VA_ARGS__, {NULL, {}}} +#define UCIS_SYM(name, ...) {name, {__VA_ARGS__, 0}} + +extern const qk_ucis_symbol_t ucis_symbol_table[]; + +void qk_ucis_start(void); +void qk_ucis_symbol_fallback (void); +bool process_record_ucis (uint16_t keycode, keyrecord_t *record); + +#endif + #define UC_BSPC UC(0x0008) #define UC_SPC UC(0x0020) @@ -122,4 +149,4 @@ bool process_unicode(uint16_t keycode, keyrecord_t *record); #define UC_TILD UC(0x007E) #define UC_DEL UC(0x007F) -#endif \ No newline at end of file +#endif From 0b6861827faea747345ea38202d64c8004ab128c Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sat, 13 Aug 2016 11:11:22 +0200 Subject: [PATCH 3/8] process_unicode: Handle too long UCIS symbol names If the symbol name being entered is longer than the max, stop recording it, and stop processing keycodes apart from the ones that can delete, finish or cancel the sequence. Signed-off-by: Gergely Nagy --- quantum/process_keycode/process_unicode.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index 8a6509300..851a96eaa 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c @@ -110,7 +110,15 @@ void qk_ucis_symbol_fallback (void) { bool process_record_ucis (uint16_t keycode, keyrecord_t *record) { uint8_t i; - if (!qk_ucis_state.in_progress || !record->event.pressed) + if (!qk_ucis_state.in_progress) + return true; + + if (qk_ucis_state.count >= UCIS_MAX_SYMBOL_LENGTH && + !(keycode == KC_BSPC || keycode == KC_ESC || keycode == KC_SPC || keycode == KC_ENT)) { + return false; + } + + if (!record->event.pressed) return true; qk_ucis_state.codes[qk_ucis_state.count] = keycode; From 857aa5bef6a74f8785a7039feea5286c07bf7067 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sat, 13 Aug 2016 11:14:42 +0200 Subject: [PATCH 4/8] process_unicode: Call process_ucis() automatically If UCIS is enabled, call process_ucis() automatically from process_record_quantum(). Signed-off-by: Gergely Nagy --- quantum/process_keycode/process_unicode.c | 2 +- quantum/process_keycode/process_unicode.h | 2 +- quantum/quantum.c | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index 851a96eaa..d71434411 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c @@ -107,7 +107,7 @@ void qk_ucis_symbol_fallback (void) { } } -bool process_record_ucis (uint16_t keycode, keyrecord_t *record) { +bool process_ucis (uint16_t keycode, keyrecord_t *record) { uint8_t i; if (!qk_ucis_state.in_progress) diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h index 372ea2f0d..c5005897e 100644 --- a/quantum/process_keycode/process_unicode.h +++ b/quantum/process_keycode/process_unicode.h @@ -38,7 +38,7 @@ extern const qk_ucis_symbol_t ucis_symbol_table[]; void qk_ucis_start(void); void qk_ucis_symbol_fallback (void); -bool process_record_ucis (uint16_t keycode, keyrecord_t *record); +bool process_ucis (uint16_t keycode, keyrecord_t *record); #endif diff --git a/quantum/quantum.c b/quantum/quantum.c index bc2da510f..a4c5c2ddb 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -86,6 +86,9 @@ bool process_record_quantum(keyrecord_t *record) { #endif #ifdef UNICODE_ENABLE process_unicode(keycode, record) && + #endif + #ifdef UCIS_ENABLE + process_ucis(keycode, record) && #endif true)) { return false; From 234dd276cf03be6fd6961473e9d9c8f35deec682 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 14 Aug 2016 10:37:51 +0200 Subject: [PATCH 5/8] process_unicode: Make the startup overridable Extract out the part of `qk_ucis_start` that inputs the placeholder symbol, and make it weak, so it can be overridden. Signed-off-by: Gergely Nagy --- quantum/process_keycode/process_unicode.c | 5 +++++ quantum/process_keycode/process_unicode.h | 1 + 2 files changed, 6 insertions(+) diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index d71434411..c474483e7 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c @@ -75,6 +75,11 @@ void qk_ucis_start(void) { qk_ucis_state.count = 0; qk_ucis_state.in_progress = true; + qk_ucis_start_user(); +} + +__attribute__((weak)) +void qk_ucis_start_user(void) { unicode_input_start(); register_hex(0x2328); unicode_input_finish(); diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h index c5005897e..75607e40e 100644 --- a/quantum/process_keycode/process_unicode.h +++ b/quantum/process_keycode/process_unicode.h @@ -37,6 +37,7 @@ struct { extern const qk_ucis_symbol_t ucis_symbol_table[]; void qk_ucis_start(void); +void qk_ucis_start_user(void); void qk_ucis_symbol_fallback (void); bool process_ucis (uint16_t keycode, keyrecord_t *record); From a312cbf712764277e0dbbbb99410c2f6fc6c7484 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 14 Aug 2016 14:34:52 +0200 Subject: [PATCH 6/8] process_unicode: Use uint32_t for UCIS purposes Use a single uint32_t to store the unicode of a symbol, instead of an array of uint16_ts. Signed-off-by: Gergely Nagy --- quantum/process_keycode/process_unicode.c | 12 +++++++++--- quantum/process_keycode/process_unicode.h | 7 ++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index c474483e7..698cc3c02 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c @@ -60,6 +60,14 @@ void register_hex(uint16_t hex) { } } +void register_hex32(uint32_t hex) { + for(int i = 7; i >= 0; i--) { + uint8_t digit = ((hex >> (i*8)) & 0xF); + register_code(hex_to_keycode(digit)); + unregister_code(hex_to_keycode(digit)); + } +} + bool process_unicode(uint16_t keycode, keyrecord_t *record) { if (keycode > QK_UNICODE && record->event.pressed) { uint16_t unicode = keycode & 0x7FFF; @@ -156,9 +164,7 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) { for (i = 0; ucis_symbol_table[i].symbol; i++) { if (is_uni_seq (ucis_symbol_table[i].symbol)) { symbol_found = true; - for (uint8_t j = 0; ucis_symbol_table[i].codes[j]; j++) { - register_hex(ucis_symbol_table[i].codes[j]); - } + register_hex32(ucis_symbol_table[i].code); break; } } diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h index 75607e40e..dd6dd7138 100644 --- a/quantum/process_keycode/process_unicode.h +++ b/quantum/process_keycode/process_unicode.h @@ -12,6 +12,7 @@ void set_unicode_input_mode(uint8_t os_target); void unicode_input_start(void); void unicode_input_finish(void); void register_hex(uint16_t hex); +void register_hex32(uint32_t hex); bool process_unicode(uint16_t keycode, keyrecord_t *record); @@ -22,7 +23,7 @@ bool process_unicode(uint16_t keycode, keyrecord_t *record); typedef struct { char *symbol; - uint16_t codes[4]; + uint32_t code; } qk_ucis_symbol_t; struct { @@ -31,8 +32,8 @@ struct { bool in_progress:1; } qk_ucis_state; -#define UCIS_TABLE(...) {__VA_ARGS__, {NULL, {}}} -#define UCIS_SYM(name, ...) {name, {__VA_ARGS__, 0}} +#define UCIS_TABLE(...) {__VA_ARGS__, {NULL, 0}} +#define UCIS_SYM(name, code) {name, code} extern const qk_ucis_symbol_t ucis_symbol_table[]; From 43d08629cf275d0b32281ffe8785258fff226b49 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Mon, 15 Aug 2016 10:02:05 +0200 Subject: [PATCH 7/8] process_unicode: Replace register_hex32 It turns out that register_hex32 did not work reliably, and some systems only allow 7 chars after the unicode magic sequence, while others allow 8. To remedy the situation, store the codes as strings, and type those in instead of doing bit shifting magic. Signed-off-by: Gergely Nagy --- quantum/process_keycode/process_unicode.c | 37 +++++++++++++++++------ quantum/process_keycode/process_unicode.h | 8 ++--- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index 698cc3c02..d8a0f667c 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c @@ -60,14 +60,6 @@ void register_hex(uint16_t hex) { } } -void register_hex32(uint32_t hex) { - for(int i = 7; i >= 0; i--) { - uint8_t digit = ((hex >> (i*8)) & 0xF); - register_code(hex_to_keycode(digit)); - unregister_code(hex_to_keycode(digit)); - } -} - bool process_unicode(uint16_t keycode, keyrecord_t *record) { if (keycode > QK_UNICODE && record->event.pressed) { uint16_t unicode = keycode & 0x7FFF; @@ -120,6 +112,33 @@ void qk_ucis_symbol_fallback (void) { } } +void register_ucis(const char *hex) { + for(int i = 0; hex[i]; i++) { + uint8_t kc = 0; + char c = hex[i]; + + switch (c) { + case '0': + kc = KC_0; + break; + case '1' ... '9': + kc = c - '1' + KC_1; + break; + case 'a' ... 'f': + kc = c - 'a' + KC_A; + break; + case 'A' ... 'F': + kc = c - 'A' + KC_A; + break; + } + + if (kc) { + register_code (kc); + unregister_code (kc); + } + } +} + bool process_ucis (uint16_t keycode, keyrecord_t *record) { uint8_t i; @@ -164,7 +183,7 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) { for (i = 0; ucis_symbol_table[i].symbol; i++) { if (is_uni_seq (ucis_symbol_table[i].symbol)) { symbol_found = true; - register_hex32(ucis_symbol_table[i].code); + register_ucis(ucis_symbol_table[i].code + 2); break; } } diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h index dd6dd7138..be24ddc2b 100644 --- a/quantum/process_keycode/process_unicode.h +++ b/quantum/process_keycode/process_unicode.h @@ -12,7 +12,6 @@ void set_unicode_input_mode(uint8_t os_target); void unicode_input_start(void); void unicode_input_finish(void); void register_hex(uint16_t hex); -void register_hex32(uint32_t hex); bool process_unicode(uint16_t keycode, keyrecord_t *record); @@ -23,7 +22,7 @@ bool process_unicode(uint16_t keycode, keyrecord_t *record); typedef struct { char *symbol; - uint32_t code; + char *code; } qk_ucis_symbol_t; struct { @@ -32,14 +31,15 @@ struct { bool in_progress:1; } qk_ucis_state; -#define UCIS_TABLE(...) {__VA_ARGS__, {NULL, 0}} -#define UCIS_SYM(name, code) {name, code} +#define UCIS_TABLE(...) {__VA_ARGS__, {NULL, NULL}} +#define UCIS_SYM(name, code) {name, #code} extern const qk_ucis_symbol_t ucis_symbol_table[]; void qk_ucis_start(void); void qk_ucis_start_user(void); void qk_ucis_symbol_fallback (void); +void register_ucis(const char *hex); bool process_ucis (uint16_t keycode, keyrecord_t *record); #endif From e8845f0daf8dc7a7674dc5420cc5a684bbbea09b Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Mon, 15 Aug 2016 10:07:13 +0200 Subject: [PATCH 8/8] process_unicode: Introduce a slight delay When entering unicode codes, use some delay, so the OS has time to process the information. This is not needed on all systems, but some seem to require it. Signed-off-by: Gergely Nagy --- quantum/process_keycode/process_unicode.c | 4 ++++ quantum/process_keycode/process_unicode.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index d8a0f667c..72c809c30 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c @@ -37,6 +37,7 @@ void unicode_input_start (void) { unregister_code(KC_PPLS); break; } + wait_ms(UNICODE_TYPE_DELAY); } void unicode_input_finish (void) { @@ -109,6 +110,7 @@ void qk_ucis_symbol_fallback (void) { uint8_t code = qk_ucis_state.codes[i]; register_code(code); unregister_code(code); + wait_ms(UNICODE_TYPE_DELAY); } } @@ -135,6 +137,7 @@ void register_ucis(const char *hex) { if (kc) { register_code (kc); unregister_code (kc); + wait_ms (UNICODE_TYPE_DELAY); } } } @@ -172,6 +175,7 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) { for (i = qk_ucis_state.count; i > 0; i--) { register_code (KC_BSPC); unregister_code (KC_BSPC); + wait_ms(UNICODE_TYPE_DELAY); } if (keycode == KC_ESC) { diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h index be24ddc2b..85364e8eb 100644 --- a/quantum/process_keycode/process_unicode.h +++ b/quantum/process_keycode/process_unicode.h @@ -8,6 +8,10 @@ #define UC_WIN 2 #define UC_BSD 3 +#ifndef UNICODE_TYPE_DELAY +#define UNICODE_TYPE_DELAY 10 +#endif + void set_unicode_input_mode(uint8_t os_target); void unicode_input_start(void); void unicode_input_finish(void);