diff options
| author | Drashna Jaelre <drashna@live.com> | 2018-10-01 18:00:14 -0700 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2018-10-01 21:00:14 -0400 |
| commit | 1512a6bfd48fb75619a1f77394d41bdca7ea28b1 (patch) | |
| tree | 54aea79710b4101b9fce20d4ff43d60eda24242b /users/drashna | |
| parent | f5ae3760c6be7e927fba74aca4a0cf21a44113af (diff) | |
| download | qmk_firmware-1512a6bfd48fb75619a1f77394d41bdca7ea28b1.tar.gz qmk_firmware-1512a6bfd48fb75619a1f77394d41bdca7ea28b1.zip | |
Keymap: Update to drashna keymaps and userspace (#3992)
* Enabled unicode support and send_unicode function
* Unicode cleanup
* More unicode tweaking
* Update EEPROM stuff
* Account for keyboard macros
* Switch Equal to Plus on Ergodox
* more tweaks
* Minor Unicode tweaks
* Correct matrix printing for keylogger
* Fix unicode functions
* Fix unicode mode set since it actually uses EEPROM
* Re-add DISABLE_LEADER
* Ergodox is easier to hit the tapping term, fix that
* Fix stupid type on unicode mode check
* Preliminary CRKBD/HeliDox support
* Fixes to Helidox
* Cleanup userspace from old merge stuff
* Remove CCCV sounds
* Make Mode NOEEPROM Again
Diffstat (limited to 'users/drashna')
| -rw-r--r-- | users/drashna/config.h | 10 | ||||
| -rw-r--r-- | users/drashna/drashna.c | 75 | ||||
| -rw-r--r-- | users/drashna/drashna.h | 28 | ||||
| -rw-r--r-- | users/drashna/rgb_stuff.c | 5 | ||||
| -rw-r--r-- | users/drashna/rules.mk | 7 | ||||
| -rw-r--r-- | users/drashna/send_unicode.c | 58 | ||||
| -rw-r--r-- | users/drashna/send_unicode.h (renamed from users/drashna/drashna_unicode.h) | 10 |
7 files changed, 138 insertions, 55 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h index 92efcc5c7..3ddec93b1 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h | |||
| @@ -55,7 +55,11 @@ | |||
| 55 | #ifdef TAPPING_TERM | 55 | #ifdef TAPPING_TERM |
| 56 | #undef TAPPING_TERM | 56 | #undef TAPPING_TERM |
| 57 | #endif // TAPPING_TERM | 57 | #endif // TAPPING_TERM |
| 58 | #define TAPPING_TERM 175 | 58 | #ifdef KEYBOARD_ergodox_ez |
| 59 | #define TAPPING_TERM 185 | ||
| 60 | #else | ||
| 61 | #define TAPPING_TERM 175 | ||
| 62 | #endif | ||
| 59 | 63 | ||
| 60 | 64 | ||
| 61 | // Disable action_get_macro and fn_actions, since we don't use these | 65 | // Disable action_get_macro and fn_actions, since we don't use these |
| @@ -63,4 +67,8 @@ | |||
| 63 | #define NO_ACTION_MACRO | 67 | #define NO_ACTION_MACRO |
| 64 | #define NO_ACTION_FUNCTION | 68 | #define NO_ACTION_FUNCTION |
| 65 | 69 | ||
| 70 | #define DISABLE_LEADER | ||
| 71 | |||
| 66 | #define MACRO_TIMER 5 | 72 | #define MACRO_TIMER 5 |
| 73 | |||
| 74 | |||
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 9489fb456..aad9fab61 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c | |||
| @@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 21 | 21 | ||
| 22 | userspace_config_t userspace_config; | 22 | userspace_config_t userspace_config; |
| 23 | 23 | ||
| 24 | uint16_t copy_paste_timer; | ||
| 24 | // Helper Functions | 25 | // Helper Functions |
| 25 | 26 | ||
| 26 | 27 | ||
| @@ -131,7 +132,7 @@ void led_set_keymap(uint8_t usb_led) {} | |||
| 131 | // Call user matrix init, set default RGB colors and then | 132 | // Call user matrix init, set default RGB colors and then |
| 132 | // call the keymap's init function | 133 | // call the keymap's init function |
| 133 | void matrix_init_user(void) { | 134 | void matrix_init_user(void) { |
| 134 | userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE); | 135 | userspace_config.raw = eeprom_read_dword(EECONFIG_USERSPACE); |
| 135 | 136 | ||
| 136 | 137 | ||
| 137 | #ifdef BOOTLOADER_CATERINA | 138 | #ifdef BOOTLOADER_CATERINA |
| @@ -143,7 +144,9 @@ void matrix_init_user(void) { | |||
| 143 | #endif | 144 | #endif |
| 144 | 145 | ||
| 145 | #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) | 146 | #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) |
| 146 | set_unicode_input_mode(UC_WINC); | 147 | if (eeprom_read_byte(EECONFIG_UNICODEMODE) != UC_WIN) { |
| 148 | set_unicode_input_mode(UC_WIN); | ||
| 149 | } | ||
| 147 | #endif //UNICODE_ENABLE | 150 | #endif //UNICODE_ENABLE |
| 148 | matrix_init_keymap(); | 151 | matrix_init_keymap(); |
| 149 | } | 152 | } |
| @@ -173,17 +176,12 @@ void shutdown_user (void) { | |||
| 173 | shutdown_keymap(); | 176 | shutdown_keymap(); |
| 174 | } | 177 | } |
| 175 | 178 | ||
| 176 | void suspend_power_down_user(void) | 179 | void suspend_power_down_user(void) { |
| 177 | { | ||
| 178 | suspend_power_down_keymap(); | 180 | suspend_power_down_keymap(); |
| 179 | } | 181 | } |
| 180 | 182 | ||
| 181 | void suspend_wakeup_init_user(void) | 183 | void suspend_wakeup_init_user(void) { |
| 182 | { | ||
| 183 | suspend_wakeup_init_keymap(); | 184 | suspend_wakeup_init_keymap(); |
| 184 | #ifdef KEYBOARD_ergodox_ez | ||
| 185 | wait_ms(10); | ||
| 186 | #endif | ||
| 187 | } | 185 | } |
| 188 | 186 | ||
| 189 | 187 | ||
| @@ -216,7 +214,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 216 | 214 | ||
| 217 | // If console is enabled, it will print the matrix position and status of each key pressed | 215 | // If console is enabled, it will print the matrix position and status of each key pressed |
| 218 | #ifdef KEYLOGGER_ENABLE | 216 | #ifdef KEYLOGGER_ENABLE |
| 219 | xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed); | 217 | #if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_iris_rev2) |
| 218 | xprintf("KL: col: %u, row: %u, pressed: %u\n", record->event.key.row, record->event.key.col, record->event.pressed); | ||
| 219 | #else | ||
| 220 | xprintf("KL: col: %u, row: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed); | ||
| 221 | #endif | ||
| 220 | #endif //KEYLOGGER_ENABLE | 222 | #endif //KEYLOGGER_ENABLE |
| 221 | 223 | ||
| 222 | switch (keycode) { | 224 | switch (keycode) { |
| @@ -249,7 +251,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 249 | case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader | 251 | case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader |
| 250 | if (!record->event.pressed) { | 252 | if (!record->event.pressed) { |
| 251 | send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP | 253 | send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP |
| 252 | #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) | 254 | #if defined(__ARM__) |
| 255 | ":dfu-util" | ||
| 256 | #elif defined(BOOTLOADER_DFU) | ||
| 253 | ":dfu" | 257 | ":dfu" |
| 254 | #elif defined(BOOTLOADER_HALFKAY) | 258 | #elif defined(BOOTLOADER_HALFKAY) |
| 255 | ":teensy" | 259 | ":teensy" |
| @@ -291,7 +295,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 291 | // to save on firmware space, since it's limited. | 295 | // to save on firmware space, since it's limited. |
| 292 | #ifdef MACROS_ENABLED | 296 | #ifdef MACROS_ENABLED |
| 293 | case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros | 297 | case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros |
| 294 | if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); } | 298 | if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeprom_update_dword(EECONFIG_USERSPACE, userspace_config.raw); } |
| 295 | #ifdef RGBLIGHT_ENABLE | 299 | #ifdef RGBLIGHT_ENABLE |
| 296 | userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18); | 300 | userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18); |
| 297 | #endif //RGBLIGHT_ENABLE | 301 | #endif //RGBLIGHT_ENABLE |
| @@ -342,45 +346,40 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 342 | register_code(KC_LCTL); | 346 | register_code(KC_LCTL); |
| 343 | tap(KC_C); | 347 | tap(KC_C); |
| 344 | unregister_code(KC_LCTL); | 348 | unregister_code(KC_LCTL); |
| 345 | #ifdef AUDIO_ENABLE | ||
| 346 | PLAY_SONG(tone_copy); | ||
| 347 | #endif | ||
| 348 | } else { // Tap, paste | 349 | } else { // Tap, paste |
| 349 | register_code(KC_LCTL); | 350 | register_code(KC_LCTL); |
| 350 | tap(KC_V); | 351 | tap(KC_V); |
| 351 | unregister_code(KC_LCTL); | 352 | unregister_code(KC_LCTL); |
| 352 | #ifdef AUDIO_ENABLE | ||
| 353 | PLAY_SONG(tone_paste); | ||
| 354 | #endif | ||
| 355 | } | 353 | } |
| 356 | } | 354 | } |
| 357 | return false; | 355 | return false; |
| 358 | break; | 356 | break; |
| 359 | #ifdef UNICODE_ENABLE | 357 | #ifdef UNICODE_ENABLE |
| 360 | case UC_FLIP: // (╯°□°) ︵ ━┻ | 358 | case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻ |
| 361 | if (record->event.pressed) { | 359 | if (record->event.pressed) { |
| 362 | register_code(KC_RSFT); | 360 | send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); |
| 363 | tap(KC_9); | ||
| 364 | unregister_code(KC_RSFT); | ||
| 365 | process_unicode((0x256F | QK_UNICODE), record); // Arm | ||
| 366 | process_unicode((0x00B0 | QK_UNICODE), record); // Eye | ||
| 367 | process_unicode((0x25A1 | QK_UNICODE), record); // Mouth | ||
| 368 | process_unicode((0x00B0 | QK_UNICODE), record); // Eye | ||
| 369 | register_code(KC_RSFT); | ||
| 370 | tap(KC_0); | ||
| 371 | unregister_code(KC_RSFT); | ||
| 372 | process_unicode((0x256F | QK_UNICODE), record); // Arm | ||
| 373 | tap(KC_SPC); | ||
| 374 | process_unicode((0x0361 | QK_UNICODE), record); // Flippy | ||
| 375 | tap(KC_SPC); | ||
| 376 | process_unicode((0x253B | QK_UNICODE), record); // Table | ||
| 377 | process_unicode((0x2501 | QK_UNICODE), record); // Table | ||
| 378 | process_unicode((0x253B | QK_UNICODE), record); // Table | ||
| 379 | } | 361 | } |
| 380 | return false; | 362 | return false; |
| 381 | break; | 363 | break; |
| 382 | #endif // UNICODE_ENABLE | 364 | case UC_TABL: // ┬─┬ノ( º _ ºノ) |
| 383 | 365 | if (record->event.pressed) { | |
| 366 | send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 30CE 0029"); | ||
| 367 | } | ||
| 368 | return false; | ||
| 369 | break; | ||
| 370 | case UC_SHRG: // ¯\_(ツ)_/¯ | ||
| 371 | if (record->event.pressed) { | ||
| 372 | send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF"); | ||
| 373 | } | ||
| 374 | return false; | ||
| 375 | break; | ||
| 376 | case UC_DISA: // ಠ_ಠ | ||
| 377 | if (record->event.pressed) { | ||
| 378 | send_unicode_hex_string("0CA0 005F 0CA0"); | ||
| 379 | } | ||
| 380 | return false; | ||
| 381 | break; | ||
| 382 | #endif | ||
| 384 | } | 383 | } |
| 385 | return process_record_keymap(keycode, record) && | 384 | return process_record_keymap(keycode, record) && |
| 386 | #ifdef RGBLIGHT_ENABLE | 385 | #ifdef RGBLIGHT_ENABLE |
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index de8c3ba94..49e3fc870 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h | |||
| @@ -19,9 +19,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 19 | #include "quantum.h" | 19 | #include "quantum.h" |
| 20 | #include "version.h" | 20 | #include "version.h" |
| 21 | #include "eeprom.h" | 21 | #include "eeprom.h" |
| 22 | #include "send_unicode.h" | ||
| 23 | |||
| 22 | #ifdef RGB_MATRIX_ENABLE | 24 | #ifdef RGB_MATRIX_ENABLE |
| 23 | #include "rgb_matrix.h" | 25 | #include "rgb_matrix.h" |
| 24 | #endif | 26 | #endif |
| 27 | |||
| 28 | |||
| 25 | // Define layer names | 29 | // Define layer names |
| 26 | enum userspace_layers { | 30 | enum userspace_layers { |
| 27 | _QWERTY = 0, | 31 | _QWERTY = 0, |
| @@ -59,19 +63,26 @@ inline void tap(uint16_t keycode){ register_code(keycode); unregister_code(keyco | |||
| 59 | bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed); | 63 | bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed); |
| 60 | bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); | 64 | bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); |
| 61 | 65 | ||
| 62 | #define EECONFIG_USERSPACE (uint8_t *)19 | 66 | #define EECONFIG_USERSPACE (uint32_t *)19 |
| 63 | 67 | ||
| 64 | typedef union { | 68 | typedef union { |
| 65 | uint8_t raw; | 69 | uint32_t raw; |
| 66 | struct { | 70 | struct { |
| 67 | bool rgb_layer_change :1; | 71 | bool rgb_layer_change :1; |
| 68 | bool is_overwatch :1; | 72 | bool is_overwatch :1; |
| 69 | bool nuke_switch :1; | 73 | bool nuke_switch :1; |
| 74 | uint8_t unicode_mod :4; | ||
| 70 | }; | 75 | }; |
| 71 | } userspace_config_t; | 76 | } userspace_config_t; |
| 72 | 77 | ||
| 78 | #if defined(KEYMAP_SAFE_RANGE) | ||
| 79 | #define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE | ||
| 80 | #else | ||
| 81 | #define PLACEHOLDER_SAFE_RANGE SAFE_RANGE | ||
| 82 | #endif | ||
| 83 | |||
| 73 | enum userspace_custom_keycodes { | 84 | enum userspace_custom_keycodes { |
| 74 | EPRM = SAFE_RANGE, // Resets EEPROM do defaults (as in eeconfig_init) | 85 | EPRM = PLACEHOLDER_SAFE_RANGE, // Resets EEPROM do defaults (as in eeconfig_init) |
| 75 | VRSN, // Prints QMK Firmware and board info | 86 | VRSN, // Prints QMK Firmware and board info |
| 76 | KC_QWERTY, // Sets default layer to QWERTY | 87 | KC_QWERTY, // Sets default layer to QWERTY |
| 77 | KC_COLEMAK, // Sets default layer to COLEMAK | 88 | KC_COLEMAK, // Sets default layer to COLEMAK |
| @@ -99,13 +110,14 @@ enum userspace_custom_keycodes { | |||
| 99 | KC_SECRET_5, // test5 | 110 | KC_SECRET_5, // test5 |
| 100 | KC_CCCV, // Hold to copy, tap to paste | 111 | KC_CCCV, // Hold to copy, tap to paste |
| 101 | KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! | 112 | KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! |
| 102 | 113 | UC_FLIP, // (ಠ痊ಠ)┻━┻ | |
| 103 | #ifdef UNICODE_ENABLE | 114 | UC_TABL, // ┬─┬ノ( º _ ºノ) |
| 104 | UC_FLIP, // Table flip (not working?) | 115 | UC_SHRG, // ¯\_(ツ)_/¯ |
| 105 | #endif //UNICODE_ENABLE | 116 | UC_DISA, // ಠ_ಠ |
| 106 | NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes | 117 | NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes |
| 107 | }; | 118 | }; |
| 108 | 119 | ||
| 120 | |||
| 109 | #define LOWER MO(_LOWER) | 121 | #define LOWER MO(_LOWER) |
| 110 | #define RAISE MO(_RAISE) | 122 | #define RAISE MO(_RAISE) |
| 111 | #define ADJUST MO(_ADJUST) | 123 | #define ADJUST MO(_ADJUST) |
| @@ -153,6 +165,8 @@ enum userspace_custom_keycodes { | |||
| 153 | 165 | ||
| 154 | #define MG_NKRO MAGIC_TOGGLE_NKRO | 166 | #define MG_NKRO MAGIC_TOGGLE_NKRO |
| 155 | 167 | ||
| 168 | #define UC_IRNY UC(0x2E2E) | ||
| 169 | #define UC_CLUE UC(0x203D) | ||
| 156 | 170 | ||
| 157 | #ifdef TAP_DANCE_ENABLE | 171 | #ifdef TAP_DANCE_ENABLE |
| 158 | enum { | 172 | enum { |
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index 03c55b132..4a1a8de69 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c | |||
| @@ -230,7 +230,7 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { | |||
| 230 | if (record->event.pressed) { | 230 | if (record->event.pressed) { |
| 231 | userspace_config.rgb_layer_change ^= 1; | 231 | userspace_config.rgb_layer_change ^= 1; |
| 232 | xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); | 232 | xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); |
| 233 | eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); | 233 | eeprom_update_dword(EECONFIG_USERSPACE, userspace_config.raw); |
| 234 | if (userspace_config.rgb_layer_change) { | 234 | if (userspace_config.rgb_layer_change) { |
| 235 | layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) | 235 | layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) |
| 236 | } | 236 | } |
| @@ -243,7 +243,7 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { | |||
| 243 | if (userspace_config.rgb_layer_change) { | 243 | if (userspace_config.rgb_layer_change) { |
| 244 | userspace_config.rgb_layer_change = false; | 244 | userspace_config.rgb_layer_change = false; |
| 245 | xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); | 245 | xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); |
| 246 | eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); | 246 | eeprom_update_dword(EECONFIG_USERSPACE, userspace_config.raw); |
| 247 | } | 247 | } |
| 248 | } | 248 | } |
| 249 | return true; break; | 249 | return true; break; |
| @@ -273,6 +273,7 @@ void matrix_init_rgb(void) { | |||
| 273 | default: | 273 | default: |
| 274 | rgblight_sethsv_noeeprom_cyan(); break; | 274 | rgblight_sethsv_noeeprom_cyan(); break; |
| 275 | } | 275 | } |
| 276 | rgblight_mode_noeeprom(1); | ||
| 276 | } | 277 | } |
| 277 | } | 278 | } |
| 278 | 279 | ||
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index e299f24a1..3d6213eff 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | |||
| 2 | SRC += drashna.c | 1 | SRC += drashna.c |
| 3 | 2 | ||
| 4 | ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") | 3 | ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") |
| @@ -9,7 +8,7 @@ ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | |||
| 9 | SRC += tap_dances.c | 8 | SRC += tap_dances.c |
| 10 | endif | 9 | endif |
| 11 | 10 | ||
| 12 | EXTRAFLAGS += -flto | 11 | EXTRAFLAGS += -flto |
| 13 | 12 | ||
| 14 | ifeq ($(strip $(NO_SECRETS)), yes) | 13 | ifeq ($(strip $(NO_SECRETS)), yes) |
| 15 | OPT_DEFS += -DNO_SECRETS | 14 | OPT_DEFS += -DNO_SECRETS |
| @@ -37,3 +36,7 @@ ifdef CONSOLE_ENABLE | |||
| 37 | OPT_DEFS += -DKEYLOGGER_ENABLE | 36 | OPT_DEFS += -DKEYLOGGER_ENABLE |
| 38 | endif | 37 | endif |
| 39 | endif | 38 | endif |
| 39 | |||
| 40 | ifeq ($(strip $(UNICODE_ENABLE)), yes) | ||
| 41 | SRC += send_unicode.c | ||
| 42 | endif | ||
diff --git a/users/drashna/send_unicode.c b/users/drashna/send_unicode.c new file mode 100644 index 000000000..cacfe1dc8 --- /dev/null +++ b/users/drashna/send_unicode.c | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | // Written by konstantin: vomindoraan | ||
| 2 | #include "send_unicode.h" | ||
| 3 | #include <ctype.h> | ||
| 4 | #include <string.h> | ||
| 5 | |||
| 6 | __attribute__((weak)) | ||
| 7 | void send_unicode_hex_string(const char* str) { | ||
| 8 | if (!str) { return; } // Safety net | ||
| 9 | |||
| 10 | while (*str) { | ||
| 11 | // Find the next code point (token) in the string | ||
| 12 | for (; *str == ' '; str++); | ||
| 13 | size_t n = strcspn(str, " "); // Length of the current token | ||
| 14 | char code_point[n+1]; | ||
| 15 | strncpy(code_point, str, n); | ||
| 16 | code_point[n] = '\0'; // Make sure it's null-terminated | ||
| 17 | |||
| 18 | // Normalize the code point: make all hex digits lowercase | ||
| 19 | for (char *p = code_point; *p; p++) { | ||
| 20 | *p = tolower((unsigned char)*p); | ||
| 21 | } | ||
| 22 | |||
| 23 | // Send the code point as a Unicode input string | ||
| 24 | unicode_input_start(); | ||
| 25 | send_string(code_point); | ||
| 26 | unicode_input_finish(); | ||
| 27 | |||
| 28 | str += n; // Move to the first ' ' (or '\0') after the current token | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | // (ノಠ痊ಠ)ノ彡┻━┻ | ||
| 33 | // send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); | ||
| 34 | |||
| 35 | //Old code | ||
| 36 | // (╯°□°)╯ ︵ ┻━┻ | ||
| 37 | #if 0 | ||
| 38 | register_code(KC_RSFT); | ||
| 39 | tap(KC_9); | ||
| 40 | unregister_code(KC_RSFT); | ||
| 41 | process_unicode((0x256F | QK_UNICODE), record); // Arm | ||
| 42 | process_unicode((0x00B0 | QK_UNICODE), record); // Eye | ||
| 43 | process_unicode((0x25A1 | QK_UNICODE), record); // Mouth | ||
| 44 | process_unicode((0x00B0 | QK_UNICODE), record); // Eye | ||
| 45 | register_code(KC_RSFT); | ||
| 46 | tap(KC_0); | ||
| 47 | unregister_code(KC_RSFT); | ||
| 48 | process_unicode((0x256F | QK_UNICODE), record); // Arm | ||
| 49 | tap(KC_SPC); | ||
| 50 | process_unicode((0x0361 | QK_UNICODE), record); // Flippy | ||
| 51 | tap(KC_SPC); | ||
| 52 | process_unicode((0x253B | QK_UNICODE), record); // Table | ||
| 53 | process_unicode((0x2501 | QK_UNICODE), record); // Table | ||
| 54 | process_unicode((0x253B | QK_UNICODE), record); // Table | ||
| 55 | #endif | ||
| 56 | |||
| 57 | |||
| 58 | // If you need a good converter: https://r12a.github.io/app-conversion/ | ||
diff --git a/users/drashna/drashna_unicode.h b/users/drashna/send_unicode.h index 3d1bc03f9..818b6e571 100644 --- a/users/drashna/drashna_unicode.h +++ b/users/drashna/send_unicode.h | |||
| @@ -1,10 +1,11 @@ | |||
| 1 | #ifndef UNICODE_USERSPACE_H | 1 | #pragma once |
| 2 | #define UNICODE_USERSPACE_H | ||
| 3 | 2 | ||
| 3 | #include "quantum.h" | ||
| 4 | 4 | ||
| 5 | void send_unicode_hex_string(const char* str); | ||
| 5 | 6 | ||
| 6 | /* use X(n) to call the */ | 7 | /* use X(n) to call the */ |
| 7 | 8 | #ifdef UNICODEMAP_ENABLE | |
| 8 | enum unicode_name { | 9 | enum unicode_name { |
| 9 | THINK, // thinking face 🤔 | 10 | THINK, // thinking face 🤔 |
| 10 | GRIN, // grinning face 😊 | 11 | GRIN, // grinning face 😊 |
| @@ -67,5 +68,4 @@ const uint32_t PROGMEM unicode_map[] = { | |||
| 67 | [IRONY] = 0x02E2E, | 68 | [IRONY] = 0x02E2E, |
| 68 | [DEGREE] = 0x000B0 | 69 | [DEGREE] = 0x000B0 |
| 69 | }; | 70 | }; |
| 70 | 71 | #endif // UNICODEMAP_ENABLE | |
| 71 | #endif | ||
