summaryrefslogtreecommitdiff
path: root/users/drashna/keyrecords
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2022-11-29 11:43:42 -0800
committerGitHub <noreply@github.com>2022-11-29 11:43:42 -0800
commit4a87af0e9af046d5fc00d930476920c0c34a57a7 (patch)
treecb2da20c670a49b9fcada84822a7bdb2bd144d60 /users/drashna/keyrecords
parent8a8000b4ec379448848f561f57bbe2c781376357 (diff)
[Keymap] Drashna updates for 0.19 (#19175)
* Fix up bastardkb boards since blackpill support is officially added. * Check for blackpill version, not elite c. * Add checks in chibiOS config since multiple ARM controllers supported. * Rework rules.mk for keymaps to better handle arm vs avr support * Start moving away from `matrix_*_*` functions. * `housekeeping_task_*` instead of `matrix_scan_*` * `keyboard_(pre|post)_init_*` instead of `matrix_init_*` * Add ℂℴmⅈℂ unicode input method. * Clean up unicode code to be more compact and flexible. * Remove/move Pro Micro LED commands to userspace and better filter them * Fixup OLED code * Use newer quantum keycode functions/preprocessors rather than manual bit manipulation * Make unicode mode render much more compact/simple. * Make qmk secrets more self contained * Remove custom implementation of split watchdog
Diffstat (limited to 'users/drashna/keyrecords')
-rw-r--r--users/drashna/keyrecords/process_records.h1
-rw-r--r--users/drashna/keyrecords/unicode.c128
-rw-r--r--users/drashna/keyrecords/unicode.h7
3 files changed, 118 insertions, 18 deletions
diff --git a/users/drashna/keyrecords/process_records.h b/users/drashna/keyrecords/process_records.h
index 2ee7551648..0acd7e010d 100644
--- a/users/drashna/keyrecords/process_records.h
+++ b/users/drashna/keyrecords/process_records.h
@@ -45,6 +45,7 @@ enum userspace_custom_keycodes {
KC_AUSSIE,
KC_ZALGO,
KC_SUPER,
+ KC_COMIC,
KC_ACCEL,
NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes
};
diff --git a/users/drashna/keyrecords/unicode.c b/users/drashna/keyrecords/unicode.c
index 753fca3231..16390074ca 100644
--- a/users/drashna/keyrecords/unicode.c
+++ b/users/drashna/keyrecords/unicode.c
@@ -7,7 +7,18 @@
#include "unicode.h"
#include "process_unicode_common.h"
-uint8_t typing_mode = UCTM_NO_MODE;
+uint8_t unicode_typing_mode = UCTM_NO_MODE;
+const char unicode_mode_str[UNCODES_MODE_END][13] PROGMEM = {
+ " Normal\0",
+ " Wide\0",
+ " Script\0",
+ " Blocks\0",
+ " Regional\0",
+ " Aussie\0",
+ " Zalgo\0",
+ "Super Script\0",
+ " Comic\0",
+};
/**
* @brief Registers the unicode keystrokes based on desired unicode
@@ -91,6 +102,45 @@ DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_script, 0x1D4EA, 0x1D4D
DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_boxes, 0x1F170, 0x1F170, '0', '1', 0x2002);
DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_regional, 0x1F1E6, 0x1F1E6, '0', '1', 0x2003);
+// DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_normal,
+// 'a', // a
+// 'b', // b
+// 'c', // c
+// 'd', // d
+// 'e', // e
+// 'f', // f
+// 'g', // g
+// 'h', // h
+// 'i', // i
+// 'j', // j
+// 'k', // k
+// 'l', // l
+// 'm', // m
+// 'n', // n
+// 'o', // o
+// 'p', // p
+// 'q', // q
+// 'r', // r
+// 's', // s
+// 't', // t
+// 'u', // u
+// 'v', // v
+// 'w', // w
+// 'x', // x
+// 'y', // y
+// 'z', // z
+// '1', // 1
+// '2', // 2
+// '3', // 3
+// '4', // 4
+// '5', // 5
+// '6', // 6
+// '7', // 7
+// '8', // 8
+// '9', // 9
+// '0' // 0
+// );
+
DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_aussie,
0x0250, // a
'q', // b
@@ -169,6 +219,45 @@ DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_super,
0x2070 // 0
);
+DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_comic,
+ 0x212B, // a
+ 0x212C, // b
+ 0x2102, // c
+ 0x2145, // d
+ 0x2107, // e
+ 0x2132, // f
+ 0x2141, // g
+ 0x210D, // h
+ 0x2148, // i
+ 0x2111, // j
+ 'k', // k
+ 0x2143, // l
+ 'm', // m
+ 0x2115, // n
+ 0x2134, // o
+ 0x2119, // p
+ 0x211A, // q
+ 0x211B, // r
+ 0x20B7, // s
+ 0x20B8, // t
+ 0x2127, // u
+ 'v', // v
+ 0x20A9, // w
+ 'x', // x
+ 0x213D, // y
+ 'z', // z
+ '1', // 1
+ '2', // 2
+ '3', // 3
+ '4', // 4
+ '5', // 5
+ '6', // 6
+ '7', // 7
+ '8', // 8
+ '9', // 9
+ '0' // 0
+);
+
bool process_record_aussie(uint16_t keycode, keyrecord_t *record) {
bool is_shifted = (get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT;
if ((KC_A <= keycode) && (keycode <= KC_0)) {
@@ -280,12 +369,12 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) {
register_unicode(0x203D);
}
break;
- case KC_NOMODE ... KC_SUPER:
+ case KC_NOMODE ... KC_COMIC:
if (record->event.pressed) {
- if (typing_mode != keycode - KC_NOMODE) {
- typing_mode = keycode - KC_NOMODE;
+ if (unicode_typing_mode != keycode - KC_NOMODE) {
+ unicode_typing_mode = keycode - KC_NOMODE;
} else {
- typing_mode = UCTM_NO_MODE;
+ unicode_typing_mode = UCTM_NO_MODE;
}
}
break;
@@ -295,23 +384,26 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) {
return true;
}
- if (((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) && record->tap.count) {
- keycode &= 0xFF;
+ if (IS_QK_MOD_TAP(keycode) && record->tap.count) {
+ keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
+ }
+ if (IS_QK_LAYER_TAP(keycode) && record->tap.count) {
+ keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
}
- if (typing_mode == UCTM_WIDE) {
+ if (unicode_typing_mode == UCTM_WIDE) {
if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) {
return process_record_glyph_replacement(keycode, record, unicode_range_translator_wide);
}
- } else if (typing_mode == UCTM_SCRIPT) {
+ } else if (unicode_typing_mode == UCTM_SCRIPT) {
if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) {
return process_record_glyph_replacement(keycode, record, unicode_range_translator_script);
}
- } else if (typing_mode == UCTM_BLOCKS) {
+ } else if (unicode_typing_mode == UCTM_BLOCKS) {
if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) {
return process_record_glyph_replacement(keycode, record, unicode_range_translator_boxes);
}
- } else if (typing_mode == UCTM_REGIONAL) {
+ } else if (unicode_typing_mode == UCTM_REGIONAL) {
if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) {
if (!process_record_glyph_replacement(keycode, record, unicode_range_translator_regional)) {
wait_us(500);
@@ -319,22 +411,26 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) {
return false;
}
}
- } else if (typing_mode == UCTM_SUPER) {
+ } else if (unicode_typing_mode == UCTM_SUPER) {
if (((KC_A <= keycode) && (keycode <= KC_0))) {
return process_record_glyph_replacement(keycode, record, unicode_lut_translator_super);
}
- } else if (typing_mode == UCTM_AUSSIE) {
+ } else if (unicode_typing_mode == UCTM_COMIC) {
+ if (((KC_A <= keycode) && (keycode <= KC_0))) {
+ return process_record_glyph_replacement(keycode, record, unicode_lut_translator_comic);
+ }
+ } else if (unicode_typing_mode == UCTM_AUSSIE) {
return process_record_aussie(keycode, record);
- } else if (typing_mode == UCTM_ZALGO) {
+ } else if (unicode_typing_mode == UCTM_ZALGO) {
return process_record_zalgo(keycode, record);
}
return true;
}
/**
- * @brief Initialize the default unicode mode on firmware startu
+ * @brief Initialize the default unicode mode on firmware startup
*
*/
-void matrix_init_unicode(void) {
+void keyboard_post_init_unicode(void) {
unicode_input_mode_init();
}
diff --git a/users/drashna/keyrecords/unicode.h b/users/drashna/keyrecords/unicode.h
index 6885d4dd7f..43c2db89c0 100644
--- a/users/drashna/keyrecords/unicode.h
+++ b/users/drashna/keyrecords/unicode.h
@@ -3,7 +3,7 @@
#pragma once
-enum unicode_typing_mode {
+enum unicode_typing_modes {
UCTM_NO_MODE,
UCTM_WIDE,
UCTM_SCRIPT,
@@ -12,6 +12,9 @@ enum unicode_typing_mode {
UCTM_AUSSIE,
UCTM_ZALGO,
UCTM_SUPER,
+ UCTM_COMIC,
+ UNCODES_MODE_END,
};
-extern uint8_t typing_mode;
+extern uint8_t unicode_typing_mode;
+extern const PROGMEM char unicode_mode_str[UNCODES_MODE_END][13];