diff options
author | nielsenz <nielsen.zac@gmail.com> | 2017-03-30 19:15:43 -0700 |
---|---|---|
committer | nielsenz <nielsen.zac@gmail.com> | 2017-03-30 19:15:43 -0700 |
commit | 7e54332890f4c376314f942574c6183c87a6e9c8 (patch) | |
tree | 1332d84f9c7f8bda515ad26af22601b8273cbbfc /quantum/process_keycode/process_unicode.c | |
parent | b9225a28f253e1ec33b8c96798bfef4b8cc0918d (diff) | |
download | qmk_firmware-7e54332890f4c376314f942574c6183c87a6e9c8.tar.gz qmk_firmware-7e54332890f4c376314f942574c6183c87a6e9c8.zip |
Pulling and pushing troubles
Diffstat (limited to 'quantum/process_keycode/process_unicode.c')
-rw-r--r-- | quantum/process_keycode/process_unicode.c | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index cecfaeee9..1f16b9bdb 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c | |||
@@ -16,81 +16,6 @@ | |||
16 | #include "process_unicode.h" | 16 | #include "process_unicode.h" |
17 | #include "action_util.h" | 17 | #include "action_util.h" |
18 | 18 | ||
19 | static uint8_t input_mode; | ||
20 | static uint8_t first_flag = 0; | ||
21 | |||
22 | __attribute__((weak)) | ||
23 | uint16_t hex_to_keycode(uint8_t hex) | ||
24 | { | ||
25 | if (hex == 0x0) { | ||
26 | return KC_0; | ||
27 | } else if (hex < 0xA) { | ||
28 | return KC_1 + (hex - 0x1); | ||
29 | } else { | ||
30 | return KC_A + (hex - 0xA); | ||
31 | } | ||
32 | } | ||
33 | |||
34 | void set_unicode_input_mode(uint8_t os_target) | ||
35 | { | ||
36 | input_mode = os_target; | ||
37 | eeprom_update_byte(EECONFIG_UNICODEMODE, os_target); | ||
38 | } | ||
39 | |||
40 | uint8_t get_unicode_input_mode(void) { | ||
41 | return input_mode; | ||
42 | } | ||
43 | |||
44 | __attribute__((weak)) | ||
45 | void unicode_input_start (void) { | ||
46 | switch(input_mode) { | ||
47 | case UC_OSX: | ||
48 | register_code(KC_LALT); | ||
49 | break; | ||
50 | case UC_LNX: | ||
51 | register_code(KC_LCTL); | ||
52 | register_code(KC_LSFT); | ||
53 | register_code(KC_U); | ||
54 | unregister_code(KC_U); | ||
55 | unregister_code(KC_LSFT); | ||
56 | unregister_code(KC_LCTL); | ||
57 | break; | ||
58 | case UC_WIN: | ||
59 | register_code(KC_LALT); | ||
60 | register_code(KC_PPLS); | ||
61 | unregister_code(KC_PPLS); | ||
62 | break; | ||
63 | case UC_WINC: | ||
64 | register_code(KC_RALT); | ||
65 | unregister_code(KC_RALT); | ||
66 | register_code(KC_U); | ||
67 | unregister_code(KC_U); | ||
68 | } | ||
69 | wait_ms(UNICODE_TYPE_DELAY); | ||
70 | } | ||
71 | |||
72 | __attribute__((weak)) | ||
73 | void unicode_input_finish (void) { | ||
74 | switch(input_mode) { | ||
75 | case UC_OSX: | ||
76 | case UC_WIN: | ||
77 | unregister_code(KC_LALT); | ||
78 | break; | ||
79 | case UC_LNX: | ||
80 | register_code(KC_SPC); | ||
81 | unregister_code(KC_SPC); | ||
82 | break; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | void register_hex(uint16_t hex) { | ||
87 | for(int i = 3; i >= 0; i--) { | ||
88 | uint8_t digit = ((hex >> (i*4)) & 0xF); | ||
89 | register_code(hex_to_keycode(digit)); | ||
90 | unregister_code(hex_to_keycode(digit)); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | 19 | ||
95 | bool process_unicode(uint16_t keycode, keyrecord_t *record) { | 20 | bool process_unicode(uint16_t keycode, keyrecord_t *record) { |
96 | if (keycode > QK_UNICODE && record->event.pressed) { | 21 | if (keycode > QK_UNICODE && record->event.pressed) { |