diff options
| -rw-r--r-- | keyboards/handwired/tractyl_manuform/5x6_right/config.h | 3 | ||||
| -rw-r--r-- | keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk | 2 | ||||
| -rw-r--r-- | keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h | 1 | ||||
| -rw-r--r-- | keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c | 6 | ||||
| -rw-r--r-- | keyboards/handwired/tractyl_manuform/5x6_right/rules.mk | 2 | ||||
| -rw-r--r-- | keyboards/handwired/tractyl_manuform/tm_sync.c | 111 | ||||
| -rw-r--r-- | keyboards/handwired/tractyl_manuform/tractyl_manuform.c | 16 | ||||
| -rw-r--r-- | keyboards/handwired/tractyl_manuform/tractyl_manuform.h | 9 | ||||
| -rw-r--r-- | keyboards/moonlander/keymaps/drashna/keymap.c | 16 | ||||
| -rw-r--r-- | layouts/community/split_3x6_3/drashna/rules.mk | 6 | ||||
| -rw-r--r-- | users/drashna/config.h | 9 | ||||
| -rw-r--r-- | users/drashna/oled_stuff.c | 37 | ||||
| -rw-r--r-- | users/drashna/process_records.c | 25 | ||||
| -rw-r--r-- | users/drashna/process_records.h | 17 | ||||
| -rw-r--r-- | users/drashna/rules.mk | 12 | ||||
| -rw-r--r-- | users/drashna/transport_sync.c | 3 | ||||
| -rw-r--r-- | users/drashna/unicoooode.c | 282 |
17 files changed, 459 insertions, 98 deletions
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/config.h index 6f702bd59..d7618912f 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/config.h | |||
| @@ -51,3 +51,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 51 | #define NO_ACTION_FUNCTION | 51 | #define NO_ACTION_FUNCTION |
| 52 | 52 | ||
| 53 | #define OLED_DISPLAY_128X64 | 53 | #define OLED_DISPLAY_128X64 |
| 54 | |||
| 55 | #define POINTING_DEVICE_TASK_THROTTLE | ||
| 56 | #define POINTING_DEVICE_RIGHT | ||
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk index d6f972b46..0a4fbee0e 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk | |||
| @@ -6,7 +6,7 @@ BOOTLOADER = stm32-dfu | |||
| 6 | 6 | ||
| 7 | KEYBOARD_SHARED_EP = yes | 7 | KEYBOARD_SHARED_EP = yes |
| 8 | CONSOLE_ENABLE = yes | 8 | CONSOLE_ENABLE = yes |
| 9 | MOUSE_SHARED_EP = no | 9 | MOUSE_SHARED_EP = yes |
| 10 | 10 | ||
| 11 | EEPROM_DRIVER = spi | 11 | EEPROM_DRIVER = spi |
| 12 | WS2812_DRIVER = pwm | 12 | WS2812_DRIVER = pwm |
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h index 577b709bb..85ddef103 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h | |||
| @@ -19,3 +19,4 @@ | |||
| 19 | #define TRACKBALL_DPI_OPTIONS { 1200, 1800, 2600, 3400 } | 19 | #define TRACKBALL_DPI_OPTIONS { 1200, 1800, 2600, 3400 } |
| 20 | 20 | ||
| 21 | #define DEBOUNCE 45 | 21 | #define DEBOUNCE 45 |
| 22 | #define ENCODER_DEFAULT_POS 0x3 | ||
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c index 3de8bcf10..f893a8cc4 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c | |||
| @@ -125,7 +125,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 125 | _______, _______, _______, _______ | 125 | _______, _______, _______, _______ |
| 126 | ), | 126 | ), |
| 127 | [_ADJUST] = LAYOUT_5x6_right_wrapper( | 127 | [_ADJUST] = LAYOUT_5x6_right_wrapper( |
| 128 | KC_MAKE, ___________________BLANK___________________, _________________ADJUST_R1_________________, KC_RST, | 128 | KC_MAKE, KC_WIDE,KC_AUSSIE,KC_SCRIPT,KC_ZALGO,KC_NOMODE, KC_NOMODE,KC_BLOCKS,KC_REGIONAL,_______,_______, KC_RST, |
| 129 | VRSN, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, EEP_RST, | 129 | VRSN, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, EEP_RST, |
| 130 | KEYLOCK, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG_MODS, | 130 | KEYLOCK, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG_MODS, |
| 131 | UC_MOD, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY, | 131 | UC_MOD, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY, |
| @@ -407,9 +407,9 @@ void oled_driver_render_logo_left(void) { | |||
| 407 | render_kitty(); | 407 | render_kitty(); |
| 408 | 408 | ||
| 409 | oled_set_cursor(6, 0); | 409 | oled_set_cursor(6, 0); |
| 410 | oled_write_P(PSTR(" Tractyl "), true); | 410 | oled_write_P(PSTR(" Tractyl "), false); |
| 411 | oled_set_cursor(6, 1); | 411 | oled_set_cursor(6, 1); |
| 412 | oled_write_P(PSTR(" Manuform "), true); | 412 | oled_write_P(PSTR(" Manuform "), false); |
| 413 | oled_set_cursor(6, 2); | 413 | oled_set_cursor(6, 2); |
| 414 | # if defined(WPM_ENABLE) | 414 | # if defined(WPM_ENABLE) |
| 415 | render_wpm(1); | 415 | render_wpm(1); |
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk index 699e82648..1c615a783 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk +++ b/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk | |||
| @@ -17,7 +17,7 @@ SWAP_HANDS_ENABLE = yes | |||
| 17 | 17 | ||
| 18 | POINTING_DEVICE_ENABLE = yes | 18 | POINTING_DEVICE_ENABLE = yes |
| 19 | POINTING_DEVICE_DRIVER = pmw3360 | 19 | POINTING_DEVICE_DRIVER = pmw3360 |
| 20 | MOUSE_SHARED_EP = no | 20 | MOUSE_SHARED_EP = yes |
| 21 | 21 | ||
| 22 | SPLIT_KEYBOARD = yes | 22 | SPLIT_KEYBOARD = yes |
| 23 | 23 | ||
diff --git a/keyboards/handwired/tractyl_manuform/tm_sync.c b/keyboards/handwired/tractyl_manuform/tm_sync.c index 4739af1e7..733f09a22 100644 --- a/keyboards/handwired/tractyl_manuform/tm_sync.c +++ b/keyboards/handwired/tractyl_manuform/tm_sync.c | |||
| @@ -14,19 +14,29 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include "tractyl_manuform.h" | 17 | #include QMK_KEYBOARD_H |
| 18 | #include "pointing_device.h" | ||
| 18 | #include "transactions.h" | 19 | #include "transactions.h" |
| 19 | #include <string.h> | 20 | #include <string.h> |
| 21 | #ifdef MOUSEKEY_ENABLE | ||
| 22 | # include "mousekey.h" | ||
| 23 | #endif | ||
| 20 | 24 | ||
| 21 | kb_config_data_t kb_config; | 25 | // typedef struct { |
| 22 | kb_mouse_report_t sync_mouse_report; | 26 | // uint16_t device_cpi; |
| 27 | // } kb_config_data_t; | ||
| 28 | |||
| 29 | kb_config_data_t kb_config; | ||
| 30 | static report_mouse_t shared_mouse_report; | ||
| 31 | extern const pointing_device_driver_t pointing_device_driver; | ||
| 23 | 32 | ||
| 24 | void kb_pointer_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { | 33 | void kb_pointer_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { |
| 25 | if (target2initiator_buffer_size == sizeof(sync_mouse_report)) { | 34 | shared_mouse_report = pointing_device_driver.get_report(shared_mouse_report); |
| 26 | memcpy(target2initiator_buffer, &sync_mouse_report, sizeof(sync_mouse_report)); | 35 | memcpy(target2initiator_buffer, &shared_mouse_report, sizeof(report_mouse_t)); |
| 27 | } | 36 | shared_mouse_report.x = 0; |
| 28 | sync_mouse_report.x = 0; | 37 | shared_mouse_report.y = 0; |
| 29 | sync_mouse_report.y = 0; | 38 | shared_mouse_report.h = 0; |
| 39 | shared_mouse_report.v = 0; | ||
| 30 | } | 40 | } |
| 31 | 41 | ||
| 32 | void kb_config_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { | 42 | void kb_config_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { |
| @@ -38,12 +48,15 @@ void kb_config_sync_handler(uint8_t initiator2target_buffer_size, const void* in | |||
| 38 | // Check if the state values are different | 48 | // Check if the state values are different |
| 39 | if (cpi != kb_config.device_cpi) { | 49 | if (cpi != kb_config.device_cpi) { |
| 40 | cpi = kb_config.device_cpi; | 50 | cpi = kb_config.device_cpi; |
| 51 | if (!is_keyboard_left()) { | ||
| 52 | pointing_device_set_cpi(cpi); | ||
| 53 | } | ||
| 41 | } | 54 | } |
| 42 | } | 55 | } |
| 43 | 56 | ||
| 44 | void keyboard_pre_init_sync(void) { | 57 | void keyboard_pre_init_sync(void) { |
| 45 | memset(&kb_config, 0, sizeof(kb_config)); | 58 | memset(&kb_config, 0, sizeof(kb_config)); |
| 46 | memset(&sync_mouse_report, 0, sizeof(sync_mouse_report)); | 59 | memset(&shared_mouse_report, 0, sizeof(shared_mouse_report)); |
| 47 | } | 60 | } |
| 48 | 61 | ||
| 49 | void keyboard_post_init_sync(void) { | 62 | void keyboard_post_init_sync(void) { |
| @@ -84,3 +97,83 @@ void trackball_set_cpi(uint16_t cpi) { | |||
| 84 | pointing_device_set_cpi(cpi); | 97 | pointing_device_set_cpi(cpi); |
| 85 | } | 98 | } |
| 86 | } | 99 | } |
| 100 | |||
| 101 | void pointing_device_task(void) { | ||
| 102 | if (!is_keyboard_master()) { | ||
| 103 | return; | ||
| 104 | } | ||
| 105 | |||
| 106 | #if defined(POINTING_DEVICE_TASK_THROTTLE) | ||
| 107 | static uint32_t last_exec = 0; | ||
| 108 | if (timer_elapsed32(last_exec) < 1) { | ||
| 109 | return; | ||
| 110 | } | ||
| 111 | last_exec = timer_read32(); | ||
| 112 | #endif | ||
| 113 | |||
| 114 | report_mouse_t local_report = pointing_device_get_report(); | ||
| 115 | |||
| 116 | // Gather report info | ||
| 117 | #ifdef POINTING_DEVICE_MOTION_PIN | ||
| 118 | if (!readPin(POINTING_DEVICE_MOTION_PIN)) | ||
| 119 | #endif | ||
| 120 | #if defined(POINTING_DEVICE_COMBINED) | ||
| 121 | local_report = pointing_device_driver.get_report(local_report); | ||
| 122 | transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(report_mouse_t), &shared_mouse_report); | ||
| 123 | local_report.x = local_report.x | shared_mouse_report.x; | ||
| 124 | local_report.y = local_report.y | shared_mouse_report.y; | ||
| 125 | local_report.h = local_report.h | shared_mouse_report.h; | ||
| 126 | local_report.v = local_report.v | shared_mouse_report.v; | ||
| 127 | #elif defined(POINTING_DEVICE_LEFT) | ||
| 128 | if (is_keyboard_left()) { | ||
| 129 | local_report = pointing_device_driver.get_report(local_report); | ||
| 130 | } else { | ||
| 131 | transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(report_mouse_t), &local_report); | ||
| 132 | } | ||
| 133 | #elif defined(POINTING_DEVICE_RIGHT) | ||
| 134 | if (!is_keyboard_left()) { | ||
| 135 | local_report = pointing_device_driver.get_report(local_report); | ||
| 136 | } else { | ||
| 137 | transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(report_mouse_t), &local_report); | ||
| 138 | } | ||
| 139 | #else | ||
| 140 | # error "You need to define the side(s) the pointing device is on. POINTING_DEVICE_COMBINED / POINTING_DEVICE_LEFT / POINTING_DEVICE_RIGHT" | ||
| 141 | #endif | ||
| 142 | |||
| 143 | // Support rotation of the sensor data | ||
| 144 | #if defined(POINTING_DEVICE_ROTATION_90) || defined(POINTING_DEVICE_ROTATION_180) || defined(POINTING_DEVICE_ROTATION_270) | ||
| 145 | int8_t x = local_report.x, y = local_report.y; | ||
| 146 | # if defined(POINTING_DEVICE_ROTATION_90) | ||
| 147 | local_report.x = y; | ||
| 148 | local_report.y = -x; | ||
| 149 | # elif defined(POINTING_DEVICE_ROTATION_180) | ||
| 150 | local_report.x = -x; | ||
| 151 | local_report.y = -y; | ||
| 152 | # elif defined(POINTING_DEVICE_ROTATION_270) | ||
| 153 | local_report.x = -y; | ||
| 154 | local_report.y = x; | ||
| 155 | # else | ||
| 156 | # error "How the heck did you get here?!" | ||
| 157 | # endif | ||
| 158 | #endif | ||
| 159 | // Support Inverting the X and Y Axises | ||
| 160 | #if defined(POINTING_DEVICE_INVERT_X) | ||
| 161 | local_report.x = -local_report.x; | ||
| 162 | #endif | ||
| 163 | #if defined(POINTING_DEVICE_INVERT_Y) | ||
| 164 | local_report.y = -local_report.y; | ||
| 165 | #endif | ||
| 166 | |||
| 167 | // allow kb to intercept and modify report | ||
| 168 | local_report = pointing_device_task_kb(local_report); | ||
| 169 | // combine with mouse report to ensure that the combined is sent correctly | ||
| 170 | #ifdef MOUSEKEY_ENABLE | ||
| 171 | report_mouse_t mousekey_report = mousekey_get_report(); | ||
| 172 | local_report.buttons = local_report.buttons | mousekey_report.buttons; | ||
| 173 | #endif | ||
| 174 | #if defined(POINTING_DEVICE_COMBINED) | ||
| 175 | local_report.buttons = local_report.buttons | shared_mouse_report.buttons; | ||
| 176 | #endif | ||
| 177 | pointing_device_set_report(local_report); | ||
| 178 | pointing_device_send(); | ||
| 179 | } | ||
diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c index 5f476fcc9..4b36fab54 100644 --- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c +++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c | |||
| @@ -99,20 +99,8 @@ void pointing_device_init_kb(void) { | |||
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { | 101 | report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { |
| 102 | if (is_keyboard_left()) { | 102 | if (is_keyboard_master()) { |
| 103 | if (is_keyboard_master()) { | 103 | mouse_report = pointing_device_task_user(mouse_report); |
| 104 | transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(sync_mouse_report), &sync_mouse_report); | ||
| 105 | mouse_report.x = sync_mouse_report.x; | ||
| 106 | mouse_report.y = sync_mouse_report.y; | ||
| 107 | pointing_device_task_user(mouse_report); | ||
| 108 | } | ||
| 109 | } else { | ||
| 110 | if (is_keyboard_master()) { | ||
| 111 | pointing_device_task_user(mouse_report); | ||
| 112 | } else { | ||
| 113 | sync_mouse_report.x = mouse_report.x; | ||
| 114 | sync_mouse_report.y = mouse_report.y; | ||
| 115 | } | ||
| 116 | } | 104 | } |
| 117 | return mouse_report; | 105 | return mouse_report; |
| 118 | } | 106 | } |
diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h index f6a6c0752..6aa40fc18 100644 --- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h +++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h | |||
| @@ -43,15 +43,6 @@ typedef struct { | |||
| 43 | uint16_t device_cpi; | 43 | uint16_t device_cpi; |
| 44 | } kb_config_data_t; | 44 | } kb_config_data_t; |
| 45 | 45 | ||
| 46 | __attribute__((aligned(16))) typedef struct { | ||
| 47 | int8_t x; | ||
| 48 | int8_t y; | ||
| 49 | } kb_mouse_report_t; | ||
| 50 | |||
| 51 | extern kb_mouse_report_t sync_mouse_report; | ||
| 52 | |||
| 53 | void process_mouse(void); | ||
| 54 | void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y); | ||
| 55 | void trackball_set_cpi(uint16_t cpi); | 46 | void trackball_set_cpi(uint16_t cpi); |
| 56 | void matrix_init_sub_kb(void); | 47 | void matrix_init_sub_kb(void); |
| 57 | void matrix_scan_sub_kb(void); | 48 | void matrix_scan_sub_kb(void); |
diff --git a/keyboards/moonlander/keymaps/drashna/keymap.c b/keyboards/moonlander/keymaps/drashna/keymap.c index 2d90a3172..cd53b1e10 100644 --- a/keyboards/moonlander/keymaps/drashna/keymap.c +++ b/keyboards/moonlander/keymaps/drashna/keymap.c | |||
| @@ -16,10 +16,6 @@ | |||
| 16 | 16 | ||
| 17 | #include "drashna.h" | 17 | #include "drashna.h" |
| 18 | 18 | ||
| 19 | #ifndef UNICODE_ENABLE | ||
| 20 | # define UC(x) KC_NO | ||
| 21 | #endif | ||
| 22 | |||
| 23 | enum more_custom_keycodes { KC_SWAP_NUM = NEW_SAFE_RANGE }; | 19 | enum more_custom_keycodes { KC_SWAP_NUM = NEW_SAFE_RANGE }; |
| 24 | 20 | ||
| 25 | // clang-format off | 21 | // clang-format off |
| @@ -32,10 +28,10 @@ enum more_custom_keycodes { KC_SWAP_NUM = NEW_SAFE_RANGE }; | |||
| 32 | ) \ | 28 | ) \ |
| 33 | LAYOUT_moonlander_wrapper( \ | 29 | LAYOUT_moonlander_wrapper( \ |
| 34 | KC_ESC, ________________NUMBER_LEFT________________, UC_FLIP, UC_TABL, ________________NUMBER_RIGHT_______________, KC_MINS, \ | 30 | KC_ESC, ________________NUMBER_LEFT________________, UC_FLIP, UC_TABL, ________________NUMBER_RIGHT_______________, KC_MINS, \ |
| 35 | KC_TAB, K01, K02, K03, K04, K05, TG_DBLO,TG_DBLO, K06, K07, K08, K09, K0A, KC_BSLS, \ | 31 | KC_TAB, K01, K02, K03, K04, K05, TG_DBLO, TG_DBLO, K06, K07, K08, K09, K0A, KC_BSLS, \ |
| 36 | KC_C1R3, K11, K12, K13, K14, K15, TG_GAME,TG_GAME, K16, K17, K18, K19, K1A, RALT_T(K1B), \ | 32 | KC_C1R3, K11, K12, K13, K14, K15, TG_GAME, TG_GAME, K16, K17, K18, K19, K1A, RALT_T(K1B), \ |
| 37 | KC_MLSF, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A),KC_MRSF, \ | 33 | KC_MLSF, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A),KC_MRSF, \ |
| 38 | KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, KC_NO, KC_DEL, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC(0x2E2E), \ | 34 | KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, UC_CLUE, KC_DEL, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC_IRNY, \ |
| 39 | KC_SPC, BK_LWER, OS_LALT, OS_RGUI, DL_RAIS, KC_ENT \ | 35 | KC_SPC, BK_LWER, OS_LALT, OS_RGUI, DL_RAIS, KC_ENT \ |
| 40 | ) | 36 | ) |
| 41 | 37 | ||
| @@ -110,10 +106,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 110 | ), | 106 | ), |
| 111 | 107 | ||
| 112 | [_ADJUST] = LAYOUT_moonlander_wrapper( | 108 | [_ADJUST] = LAYOUT_moonlander_wrapper( |
| 113 | KC_MAKE, _________________FUNC_LEFT_________________, UC_MOD, KC_NUKE, _________________ADJUST_R1_________________, KC_RST, | 109 | KC_MAKE, KC_WIDE,KC_AUSSIE,KC_SCRIPT,KC_ZALGO,KC_NOMODE,_______, KC_NUKE,KC_NOMODE,KC_BLOCKS,KC_REGIONAL,_______,_______, KC_RST, |
| 114 | VRSN, _________________ADJUST_L1_________________, TG(_DIABLOII), _______, _________________ADJUST_R1_________________, EEP_RST, | 110 | VRSN, _________________ADJUST_L1_________________, TG(_DIABLOII), _______, _________________ADJUST_R1_________________, EEP_RST, |
| 115 | _______, _________________ADJUST_L2_________________, _______, _______, _________________ADJUST_R2_________________, RGB_IDL, | 111 | KEYLOCK, _________________ADJUST_L2_________________, _______, _______, _________________ADJUST_R2_________________, RGB_IDL, |
| 116 | KEYLOCK, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, TG_MODS, | 112 | UC_MOD, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, TG_MODS, |
| 117 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PAUS, | 113 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PAUS, |
| 118 | _______, _______, _______, _______, _______, _______ | 114 | _______, _______, _______, _______, _______, _______ |
| 119 | ), | 115 | ), |
diff --git a/layouts/community/split_3x6_3/drashna/rules.mk b/layouts/community/split_3x6_3/drashna/rules.mk index 2238b5701..edc9304fe 100644 --- a/layouts/community/split_3x6_3/drashna/rules.mk +++ b/layouts/community/split_3x6_3/drashna/rules.mk | |||
| @@ -23,7 +23,6 @@ ifeq ($(strip $(KEYBOARD)), crkbd/rev1) | |||
| 23 | OLED_ENABLE = yes | 23 | OLED_ENABLE = yes |
| 24 | RGB_MATRIX_ENABLE = yes | 24 | RGB_MATRIX_ENABLE = yes |
| 25 | HAPTIC_ENABLE = no | 25 | HAPTIC_ENABLE = no |
| 26 | BOOTLOADER = qmk-dfu | ||
| 27 | endif | 26 | endif |
| 28 | 27 | ||
| 29 | ifeq ($(strip $(CTPC)), yes) | 28 | ifeq ($(strip $(CTPC)), yes) |
| @@ -31,5 +30,8 @@ ifeq ($(strip $(CTPC)), yes) | |||
| 31 | WS2812_DRIVER = pwm # won't work without a patch to the ctpc mk file | 30 | WS2812_DRIVER = pwm # won't work without a patch to the ctpc mk file |
| 32 | SERIAL_DRIVER = usart | 31 | SERIAL_DRIVER = usart |
| 33 | SWAP_HANDS_ENABLE = yes | 32 | SWAP_HANDS_ENABLE = yes |
| 34 | WPM_ENABLE = yes | 33 | WPM_ENABLE = yes |
| 34 | else | ||
| 35 | BOOTLOADER = qmk-hid | ||
| 36 | BOOTLOADER_SIZE = 512 | ||
| 35 | endif | 37 | endif |
diff --git a/users/drashna/config.h b/users/drashna/config.h index ebb8d7b7a..8b5d5ba93 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h | |||
| @@ -41,6 +41,15 @@ | |||
| 41 | # endif | 41 | # endif |
| 42 | #endif | 42 | #endif |
| 43 | 43 | ||
| 44 | #if defined(WPM_ENABLE) | ||
| 45 | // # define WPM_LAUNCH_CONTROL | ||
| 46 | // # define WPM_ALLOW_COUNT_REGRESSOIN | ||
| 47 | // # define WPM_UNFILTERED | ||
| 48 | # define WPM_SAMPLE_SECONDS 6 | ||
| 49 | # define WPM_SAMPLE_PERIODS 50 | ||
| 50 | # define WPM_ESTIMATED_WORD_SIZE 6 | ||
| 51 | #endif | ||
| 52 | |||
| 44 | #ifdef AUDIO_ENABLE | 53 | #ifdef AUDIO_ENABLE |
| 45 | # define AUDIO_CLICKY | 54 | # define AUDIO_CLICKY |
| 46 | # define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f | 55 | # define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f |
diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c index 396e5e05b..2c92ac6e9 100644 --- a/users/drashna/oled_stuff.c +++ b/users/drashna/oled_stuff.c | |||
| @@ -15,6 +15,10 @@ | |||
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include "drashna.h" | 17 | #include "drashna.h" |
| 18 | #ifdef CUSTOM_UNICODE_ENABLE | ||
| 19 | # include "process_unicode_common.h" | ||
| 20 | #endif | ||
| 21 | #include <string.h> | ||
| 18 | 22 | ||
| 19 | extern bool host_driver_disabled; | 23 | extern bool host_driver_disabled; |
| 20 | 24 | ||
| @@ -59,7 +63,7 @@ void add_keylog(uint16_t keycode, keyrecord_t *record) { | |||
| 59 | return; | 63 | return; |
| 60 | } | 64 | } |
| 61 | if (record->tap.count) { | 65 | if (record->tap.count) { |
| 62 | keycode = keycode & 0xFF; | 66 | keycode &= 0xFF; |
| 63 | } else if (keycode > 0xFF) { | 67 | } else if (keycode > 0xFF) { |
| 64 | return; | 68 | return; |
| 65 | } | 69 | } |
| @@ -150,8 +154,10 @@ void render_keylock_status(uint8_t led_usb_state) { | |||
| 150 | oled_write_P(PSTR(OLED_RENDER_LOCK_NUML), led_usb_state & (1 << USB_LED_NUM_LOCK)); | 154 | oled_write_P(PSTR(OLED_RENDER_LOCK_NUML), led_usb_state & (1 << USB_LED_NUM_LOCK)); |
| 151 | oled_write_P(PSTR(" "), false); | 155 | oled_write_P(PSTR(" "), false); |
| 152 | oled_write_P(PSTR(OLED_RENDER_LOCK_CAPS), led_usb_state & (1 << USB_LED_CAPS_LOCK)); | 156 | oled_write_P(PSTR(OLED_RENDER_LOCK_CAPS), led_usb_state & (1 << USB_LED_CAPS_LOCK)); |
| 153 | // oled_write_P(PSTR(" "), false); | 157 | #if defined(OLED_DISPLAY_128X64) |
| 154 | // oled_write_P(PSTR(OLED_RENDER_LOCK_SCLK), led_usb_state & (1 << USB_LED_SCROLL_LOCK)); | 158 | oled_write_P(PSTR(" "), false); |
| 159 | oled_write_P(PSTR(OLED_RENDER_LOCK_SCLK), led_usb_state & (1 << USB_LED_SCROLL_LOCK)); | ||
| 160 | #endif | ||
| 155 | } | 161 | } |
| 156 | 162 | ||
| 157 | void render_matrix_scan_rate(void) { | 163 | void render_matrix_scan_rate(void) { |
| @@ -296,7 +302,7 @@ void render_user_status(void) { | |||
| 296 | oled_write_P(rgb_layer_status[userspace_config.rgb_layer_change], false); | 302 | oled_write_P(rgb_layer_status[userspace_config.rgb_layer_change], false); |
| 297 | static const char PROGMEM cat_mode[2][3] = {{0xF8, 0xF9, 0}, {0xF6, 0xF7, 0}}; | 303 | static const char PROGMEM cat_mode[2][3] = {{0xF8, 0xF9, 0}, {0xF6, 0xF7, 0}}; |
| 298 | oled_write_P(cat_mode[0], host_driver_disabled); | 304 | oled_write_P(cat_mode[0], host_driver_disabled); |
| 299 | #if defined(UNICODE_ENABLE) | 305 | #if defined(CUSTOM_UNICODE_ENABLE) |
| 300 | static const char PROGMEM uc_mod_status[5][3] = {{0xEA, 0xEB, 0}, {0xEC, 0xED, 0}}; | 306 | static const char PROGMEM uc_mod_status[5][3] = {{0xEA, 0xEB, 0}, {0xEC, 0xED, 0}}; |
| 301 | oled_write_P(uc_mod_status[get_unicode_input_mode() == UC_MAC], false); | 307 | oled_write_P(uc_mod_status[get_unicode_input_mode() == UC_MAC], false); |
| 302 | #endif | 308 | #endif |
| @@ -327,39 +333,28 @@ void oled_driver_render_logo(void) { | |||
| 327 | 333 | ||
| 328 | void render_wpm(uint8_t padding) { | 334 | void render_wpm(uint8_t padding) { |
| 329 | #ifdef WPM_ENABLE | 335 | #ifdef WPM_ENABLE |
| 330 | uint8_t n = get_current_wpm(); | 336 | |
| 331 | char wpm_counter[4]; | ||
| 332 | wpm_counter[3] = '\0'; | ||
| 333 | wpm_counter[2] = '0' + n % 10; | ||
| 334 | wpm_counter[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' '; | ||
| 335 | wpm_counter[0] = n / 10 ? '0' + n / 10 : ' '; | ||
| 336 | oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false); | 337 | oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false); |
| 337 | if (padding) { | 338 | if (padding) { |
| 338 | for (uint8_t n = padding; n > 0; n--) { | 339 | for (uint8_t n = padding; n > 0; n--) { |
| 339 | oled_write_P(PSTR(" "), false); | 340 | oled_write_P(PSTR(" "), false); |
| 340 | } | 341 | } |
| 341 | } | 342 | } |
| 342 | oled_write(wpm_counter, false); | 343 | oled_write(get_u8_str(get_current_wpm(), ' '), false); |
| 343 | #endif | 344 | #endif |
| 344 | } | 345 | } |
| 345 | 346 | ||
| 346 | #if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right) | 347 | #if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right) |
| 347 | extern kb_config_data_t kb_config; | 348 | extern kb_config_data_t kb_config; |
| 348 | void render_pointing_dpi_status(uint8_t padding) { | 349 | void render_pointing_dpi_status(uint8_t padding) { |
| 349 | char dpi_status[5]; | 350 | oled_write_P(PSTR("CPI:"), false); |
| 350 | uint16_t n = kb_config.device_cpi; | ||
| 351 | dpi_status[4] = '\0'; | ||
| 352 | dpi_status[3] = '0' + n % 10; | ||
| 353 | dpi_status[2] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' '; | ||
| 354 | dpi_status[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' '; | ||
| 355 | dpi_status[0] = n / 10 ? '0' + n / 10 : ' '; | ||
| 356 | oled_write_P(PSTR("DPI: "), false); | ||
| 357 | if (padding) { | 351 | if (padding) { |
| 358 | for (uint8_t n = padding; n > 0; n--) { | 352 | for (uint8_t n = padding - 1; n > 0; n--) { |
| 359 | oled_write_P(PSTR(" "), false); | 353 | oled_write_P(PSTR(" "), false); |
| 360 | } | 354 | } |
| 361 | } | 355 | } |
| 362 | oled_write(dpi_status, false); | 356 | |
| 357 | oled_write(get_u16_str(kb_config.device_cpi, ' '), false); | ||
| 363 | } | 358 | } |
| 364 | #endif | 359 | #endif |
| 365 | 360 | ||
diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c index c16c70c05..de572d893 100644 --- a/users/drashna/process_records.c +++ b/users/drashna/process_records.c | |||
| @@ -40,6 +40,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *re | |||
| 40 | #ifdef RGBLIGHT_ENABLE | 40 | #ifdef RGBLIGHT_ENABLE |
| 41 | && process_record_user_rgb_light(keycode, record) | 41 | && process_record_user_rgb_light(keycode, record) |
| 42 | #endif | 42 | #endif |
| 43 | #ifdef CUSTOM_UNICODE_ENABLE | ||
| 44 | && process_record_unicode(keycode, record) | ||
| 45 | #endif | ||
| 43 | && true)) { | 46 | && true)) { |
| 44 | return false; | 47 | return false; |
| 45 | } | 48 | } |
| @@ -117,28 +120,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *re | |||
| 117 | } | 120 | } |
| 118 | } | 121 | } |
| 119 | break; | 122 | break; |
| 120 | #ifdef UNICODE_ENABLE | ||
| 121 | case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻ | ||
| 122 | if (record->event.pressed) { | ||
| 123 | send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻"); | ||
| 124 | } | ||
| 125 | break; | ||
| 126 | case UC_TABL: // ┬─┬ノ( º _ ºノ) | ||
| 127 | if (record->event.pressed) { | ||
| 128 | send_unicode_string("┬─┬ノ( º _ ºノ)"); | ||
| 129 | } | ||
| 130 | break; | ||
| 131 | case UC_SHRG: // ¯\_(ツ)_/¯ | ||
| 132 | if (record->event.pressed) { | ||
| 133 | send_unicode_string("¯\\_(ツ)_/¯"); | ||
| 134 | } | ||
| 135 | break; | ||
| 136 | case UC_DISA: // ಠ_ಠ | ||
| 137 | if (record->event.pressed) { | ||
| 138 | send_unicode_string("ಠ_ಠ"); | ||
| 139 | } | ||
| 140 | break; | ||
| 141 | #endif | ||
| 142 | case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal | 123 | case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal |
| 143 | #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) | 124 | #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) |
| 144 | if (record->event.pressed) { | 125 | if (record->event.pressed) { |
diff --git a/users/drashna/process_records.h b/users/drashna/process_records.h index 897d7bbcc..d8c198a2d 100644 --- a/users/drashna/process_records.h +++ b/users/drashna/process_records.h | |||
| @@ -46,13 +46,25 @@ enum userspace_custom_keycodes { | |||
| 46 | UC_TABL, // ┬─┬ノ( º _ ºノ) | 46 | UC_TABL, // ┬─┬ノ( º _ ºノ) |
| 47 | UC_SHRG, // ¯\_(ツ)_/¯ | 47 | UC_SHRG, // ¯\_(ツ)_/¯ |
| 48 | UC_DISA, // ಠ_ಠ | 48 | UC_DISA, // ಠ_ಠ |
| 49 | UC_IRNY, | ||
| 50 | UC_CLUE, | ||
| 49 | KEYLOCK, // Locks keyboard by unmounting driver | 51 | KEYLOCK, // Locks keyboard by unmounting driver |
| 50 | NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes | 52 | KC_NOMODE, |
| 53 | KC_WIDE, | ||
| 54 | KC_SCRIPT, | ||
| 55 | KC_BLOCKS, | ||
| 56 | KC_REGIONAL, | ||
| 57 | KC_AUSSIE, | ||
| 58 | KC_ZALGO, | ||
| 59 | NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes | ||
| 51 | }; | 60 | }; |
| 52 | 61 | ||
| 53 | bool process_record_secrets(uint16_t keycode, keyrecord_t *record); | 62 | bool process_record_secrets(uint16_t keycode, keyrecord_t *record); |
| 54 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record); | 63 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record); |
| 55 | void post_process_record_keymap(uint16_t keycode, keyrecord_t *record); | 64 | void post_process_record_keymap(uint16_t keycode, keyrecord_t *record); |
| 65 | #ifdef CUSTOM_UNICODE_ENABLE | ||
| 66 | bool process_record_unicode(uint16_t keycode, keyrecord_t *record); | ||
| 67 | #endif | ||
| 56 | 68 | ||
| 57 | #define LOWER MO(_LOWER) | 69 | #define LOWER MO(_LOWER) |
| 58 | #define RAISE MO(_RAISE) | 70 | #define RAISE MO(_RAISE) |
| @@ -125,6 +137,3 @@ void post_process_record_keymap(uint16_t keycode, keyrecord_t *record); | |||
| 125 | #define ALT_APP ALT_T(KC_APP) | 137 | #define ALT_APP ALT_T(KC_APP) |
| 126 | 138 | ||
| 127 | #define MG_NKRO MAGIC_TOGGLE_NKRO | 139 | #define MG_NKRO MAGIC_TOGGLE_NKRO |
| 128 | |||
| 129 | #define UC_IRNY UC(0x2E2E) | ||
| 130 | #define UC_CLUE UC(0x203D) | ||
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index e9911979c..bd661e00a 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk | |||
| @@ -18,8 +18,18 @@ ifneq ($(strip $(NO_SECRETS)), yes) | |||
| 18 | endif | 18 | endif |
| 19 | endif | 19 | endif |
| 20 | 20 | ||
| 21 | CUSTOM_UNICODE_ENABLE ?= yes | ||
| 22 | ifeq ($(strip $(CUSTOM_UNICODE_ENABLE)), yes) | ||
| 23 | UNICODE_ENABLE = no | ||
| 24 | UNICODEMAP_ENABLE = no | ||
| 25 | UCIS_ENABLE = no | ||
| 26 | UNICODE_COMMON = yes | ||
| 27 | OPT_DEFS += -DCUSTOM_UNICODE_ENABLE | ||
| 28 | SRC += unicoooode.c | ||
| 29 | endif | ||
| 30 | |||
| 21 | CUSTOM_TAP_DANCE ?= yes | 31 | CUSTOM_TAP_DANCE ?= yes |
| 22 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | 32 | ifeq ($(strip $(CUSTOM_TAP_DANCE)), yes) |
| 23 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | 33 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) |
| 24 | SRC += $(USER_PATH)/tap_dances.c | 34 | SRC += $(USER_PATH)/tap_dances.c |
| 25 | endif | 35 | endif |
diff --git a/users/drashna/transport_sync.c b/users/drashna/transport_sync.c index daa14bbef..cee3f04c8 100644 --- a/users/drashna/transport_sync.c +++ b/users/drashna/transport_sync.c | |||
| @@ -18,7 +18,8 @@ | |||
| 18 | #include "transactions.h" | 18 | #include "transactions.h" |
| 19 | #include <string.h> | 19 | #include <string.h> |
| 20 | 20 | ||
| 21 | #ifdef UNICODE_ENABLE | 21 | #ifdef CUSTOM_UNICODE_ENABLE |
| 22 | #include "process_unicode_common.h" | ||
| 22 | extern unicode_config_t unicode_config; | 23 | extern unicode_config_t unicode_config; |
| 23 | #endif | 24 | #endif |
| 24 | #ifdef AUDIO_ENABLE | 25 | #ifdef AUDIO_ENABLE |
diff --git a/users/drashna/unicoooode.c b/users/drashna/unicoooode.c new file mode 100644 index 000000000..0e276dec1 --- /dev/null +++ b/users/drashna/unicoooode.c | |||
| @@ -0,0 +1,282 @@ | |||
| 1 | /* Copyright 2020 @tzarc | ||
| 2 | * 2021 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> | ||
| 3 | * | ||
| 4 | * This program is free software: you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation, either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "drashna.h" | ||
| 19 | #include "process_unicode_common.h" | ||
| 20 | |||
| 21 | uint16_t typing_mode; | ||
| 22 | |||
| 23 | void tap_code16_nomods(uint8_t kc) { | ||
| 24 | uint8_t temp_mod = get_mods(); | ||
| 25 | clear_mods(); | ||
| 26 | clear_oneshot_mods(); | ||
| 27 | tap_code16(kc); | ||
| 28 | set_mods(temp_mod); | ||
| 29 | } | ||
| 30 | |||
| 31 | void tap_unicode_glyph_nomods(uint32_t glyph) { | ||
| 32 | uint8_t temp_mod = get_mods(); | ||
| 33 | clear_mods(); | ||
| 34 | clear_oneshot_mods(); | ||
| 35 | register_unicode(glyph); | ||
| 36 | set_mods(temp_mod); | ||
| 37 | } | ||
| 38 | |||
| 39 | typedef uint32_t (*translator_function_t)(bool is_shifted, uint32_t keycode); | ||
| 40 | |||
| 41 | #define DEFINE_UNICODE_RANGE_TRANSLATOR(translator_name, lower_alpha, upper_alpha, zero_glyph, number_one, space_glyph) \ | ||
| 42 | static inline uint32_t translator_name(bool is_shifted, uint32_t keycode) { \ | ||
| 43 | switch (keycode) { \ | ||
| 44 | case KC_A ... KC_Z: \ | ||
| 45 | return (is_shifted ? upper_alpha : lower_alpha) + keycode - KC_A; \ | ||
| 46 | case KC_0: \ | ||
| 47 | return zero_glyph; \ | ||
| 48 | case KC_1 ... KC_9: \ | ||
| 49 | return (number_one + keycode - KC_1); \ | ||
| 50 | case KC_SPACE: \ | ||
| 51 | return space_glyph; \ | ||
| 52 | } \ | ||
| 53 | return keycode; \ | ||
| 54 | } | ||
| 55 | |||
| 56 | #define DEFINE_UNICODE_LUT_TRANSLATOR(translator_name, ...) \ | ||
| 57 | static inline uint32_t translator_name(bool is_shifted, uint32_t keycode) { \ | ||
| 58 | static const uint32_t translation[] = {__VA_ARGS__}; \ | ||
| 59 | uint32_t ret = keycode; \ | ||
| 60 | if ((keycode - KC_A) < (sizeof(translation) / sizeof(uint32_t))) { \ | ||
| 61 | ret = translation[keycode - KC_A]; \ | ||
| 62 | } \ | ||
| 63 | return ret; \ | ||
| 64 | } | ||
| 65 | |||
| 66 | bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, translator_function_t translator) { | ||
| 67 | uint8_t temp_mod = get_mods(); | ||
| 68 | uint8_t temp_osm = get_oneshot_mods(); | ||
| 69 | bool is_shifted = (temp_mod | temp_osm) & MOD_MASK_SHIFT; | ||
| 70 | if (((temp_mod | temp_osm) & (MOD_MASK_CTRL | MOD_MASK_ALT | MOD_MASK_GUI)) == 0) { | ||
| 71 | if (KC_A <= keycode && keycode <= KC_Z) { | ||
| 72 | if (record->event.pressed) { | ||
| 73 | tap_unicode_glyph_nomods(translator(is_shifted, keycode)); | ||
| 74 | } | ||
| 75 | return false; | ||
| 76 | } else if (KC_1 <= keycode && keycode <= KC_0) { | ||
| 77 | if (is_shifted) { // skip shifted numbers, so that we can still use symbols etc. | ||
| 78 | return process_record_keymap(keycode, record); | ||
| 79 | } | ||
| 80 | if (record->event.pressed) { | ||
| 81 | register_unicode(translator(is_shifted, keycode)); | ||
| 82 | } | ||
| 83 | return false; | ||
| 84 | } else if (keycode == KC_SPACE) { | ||
| 85 | if (record->event.pressed) { | ||
| 86 | register_unicode(translator(is_shifted, keycode)); | ||
| 87 | } | ||
| 88 | return false; | ||
| 89 | } | ||
| 90 | } | ||
| 91 | return true; | ||
| 92 | } | ||
| 93 | |||
| 94 | DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_wide, 0xFF41, 0xFF21, 0xFF10, 0xFF11, 0x2003); | ||
| 95 | DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_script, 0x1D4EA, 0x1D4D0, 0x1D7CE, 0x1D7C1, 0x2002); | ||
| 96 | DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_boxes, 0x1F170, 0x1F170, '0', '1', 0x2002); | ||
| 97 | DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_regional, 0x1F1E6, 0x1F1E6, '0', '1', 0x2003); | ||
| 98 | |||
| 99 | DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_aussie, | ||
| 100 | 0x0250, // a | ||
| 101 | 'q', // b | ||
| 102 | 0x0254, // c | ||
| 103 | 'p', // d | ||
| 104 | 0x01DD, // e | ||
| 105 | 0x025F, // f | ||
| 106 | 0x0183, // g | ||
| 107 | 0x0265, // h | ||
| 108 | 0x1D09, // i | ||
| 109 | 0x027E, // j | ||
| 110 | 0x029E, // k | ||
| 111 | 'l', // l | ||
| 112 | 0x026F, // m | ||
| 113 | 'u', // n | ||
| 114 | 'o', // o | ||
| 115 | 'd', // p | ||
| 116 | 'b', // q | ||
| 117 | 0x0279, // r | ||
| 118 | 's', // s | ||
| 119 | 0x0287, // t | ||
| 120 | 'n', // u | ||
| 121 | 0x028C, // v | ||
| 122 | 0x028D, // w | ||
| 123 | 0x2717, // x | ||
| 124 | 0x028E, // y | ||
| 125 | 'z', // z | ||
| 126 | 0x0269, // 1 | ||
| 127 | 0x3139, // 2 | ||
| 128 | 0x0190, // 3 | ||
| 129 | 0x3123, // 4 | ||
| 130 | 0x03DB, // 5 | ||
| 131 | '9', // 6 | ||
| 132 | 0x3125, // 7 | ||
| 133 | '8', // 8 | ||
| 134 | '6', // 9 | ||
| 135 | '0' // 0 | ||
| 136 | ); | ||
| 137 | |||
| 138 | bool process_record_aussie(uint16_t keycode, keyrecord_t *record) { | ||
| 139 | bool is_shifted = (get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT; | ||
| 140 | if ((KC_A <= keycode) && (keycode <= KC_0)) { | ||
| 141 | if (record->event.pressed) { | ||
| 142 | if (!process_record_glyph_replacement(keycode, record, unicode_lut_translator_aussie)) { | ||
| 143 | tap_code16_nomods(KC_LEFT); | ||
| 144 | return false; | ||
| 145 | } | ||
| 146 | } | ||
| 147 | } else if (record->event.pressed && keycode == KC_SPACE) { | ||
| 148 | tap_code16_nomods(KC_SPACE); | ||
| 149 | tap_code16_nomods(KC_LEFT); | ||
| 150 | return false; | ||
| 151 | } else if (record->event.pressed && keycode == KC_ENTER) { | ||
| 152 | tap_code16_nomods(KC_END); | ||
| 153 | tap_code16_nomods(KC_ENTER); | ||
| 154 | return false; | ||
| 155 | } else if (record->event.pressed && keycode == KC_HOME) { | ||
| 156 | tap_code16_nomods(KC_END); | ||
| 157 | return false; | ||
| 158 | } else if (record->event.pressed && keycode == KC_END) { | ||
| 159 | tap_code16_nomods(KC_HOME); | ||
| 160 | return false; | ||
| 161 | } else if (record->event.pressed && keycode == KC_BSPC) { | ||
| 162 | tap_code16_nomods(KC_DELT); | ||
| 163 | return false; | ||
| 164 | } else if (record->event.pressed && keycode == KC_DELT) { | ||
| 165 | tap_code16_nomods(KC_BSPC); | ||
| 166 | return false; | ||
| 167 | } else if (record->event.pressed && keycode == KC_QUOT) { | ||
| 168 | tap_unicode_glyph_nomods(is_shifted ? 0x201E : 0x201A); | ||
| 169 | tap_code16_nomods(KC_LEFT); | ||
| 170 | return false; | ||
| 171 | } else if (record->event.pressed && keycode == KC_COMMA) { | ||
| 172 | tap_unicode_glyph_nomods(is_shifted ? '<' : 0x2018); | ||
| 173 | tap_code16_nomods(KC_LEFT); | ||
| 174 | return false; | ||
| 175 | } else if (record->event.pressed && keycode == KC_DOT) { | ||
| 176 | tap_unicode_glyph_nomods(is_shifted ? '>' : 0x02D9); | ||
| 177 | tap_code16_nomods(KC_LEFT); | ||
| 178 | return false; | ||
| 179 | } else if (record->event.pressed && keycode == KC_SLASH) { | ||
| 180 | tap_unicode_glyph_nomods(is_shifted ? 0x00BF : '/'); | ||
| 181 | tap_code16_nomods(KC_LEFT); | ||
| 182 | return false; | ||
| 183 | } | ||
| 184 | return true; | ||
| 185 | } | ||
| 186 | |||
| 187 | bool process_record_zalgo(uint16_t keycode, keyrecord_t *record) { | ||
| 188 | if ((KC_A <= keycode) && (keycode <= KC_0)) { | ||
| 189 | if (record->event.pressed) { | ||
| 190 | tap_code16_nomods(keycode); | ||
| 191 | |||
| 192 | int number = (rand() % (8 + 1 - 2)) + 2; | ||
| 193 | for (int index = 0; index < number; index++) { | ||
| 194 | uint16_t hex = (rand() % (0x036F + 1 - 0x0300)) + 0x0300; | ||
| 195 | register_unicode(hex); | ||
| 196 | } | ||
| 197 | |||
| 198 | return false; | ||
| 199 | } | ||
| 200 | } | ||
| 201 | return true; | ||
| 202 | } | ||
| 203 | |||
| 204 | bool process_record_unicode(uint16_t keycode, keyrecord_t *record) { | ||
| 205 | switch (keycode) { | ||
| 206 | case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻ | ||
| 207 | if (record->event.pressed) { | ||
| 208 | send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻"); | ||
| 209 | } | ||
| 210 | break; | ||
| 211 | |||
| 212 | case UC_TABL: // ┬─┬ノ( º _ ºノ) | ||
| 213 | if (record->event.pressed) { | ||
| 214 | send_unicode_string("┬─┬ノ( º _ ºノ)"); | ||
| 215 | } | ||
| 216 | break; | ||
| 217 | |||
| 218 | case UC_SHRG: // ¯\_(ツ)_/¯ | ||
| 219 | if (record->event.pressed) { | ||
| 220 | send_unicode_string("¯\\_(ツ)_/¯"); | ||
| 221 | } | ||
| 222 | break; | ||
| 223 | |||
| 224 | case UC_DISA: // ಠ_ಠ | ||
| 225 | if (record->event.pressed) { | ||
| 226 | send_unicode_string("ಠ_ಠ"); | ||
| 227 | } | ||
| 228 | break; | ||
| 229 | |||
| 230 | case UC_IRNY: // ⸮ | ||
| 231 | if (record->event.pressed) { | ||
| 232 | register_unicode(0x2E2E); | ||
| 233 | } | ||
| 234 | break; | ||
| 235 | case UC_CLUE: // ‽ | ||
| 236 | if (record->event.pressed) { | ||
| 237 | register_unicode(0x203D); | ||
| 238 | } | ||
| 239 | break; | ||
| 240 | case KC_NOMODE ... KC_ZALGO: | ||
| 241 | if (record->event.pressed) { | ||
| 242 | if (typing_mode != keycode) { | ||
| 243 | typing_mode = keycode; | ||
| 244 | } else { | ||
| 245 | typing_mode = 0; | ||
| 246 | } | ||
| 247 | } | ||
| 248 | break; | ||
| 249 | |||
| 250 | break; | ||
| 251 | } | ||
| 252 | if (((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) && record->tap.count) { | ||
| 253 | keycode &= 0xFF; | ||
| 254 | } | ||
| 255 | |||
| 256 | if (typing_mode == KC_WIDE) { | ||
| 257 | if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) { | ||
| 258 | return process_record_glyph_replacement(keycode, record, unicode_range_translator_wide); | ||
| 259 | } | ||
| 260 | } else if (typing_mode == KC_SCRIPT) { | ||
| 261 | if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) { | ||
| 262 | return process_record_glyph_replacement(keycode, record, unicode_range_translator_script); | ||
| 263 | } | ||
| 264 | } else if (typing_mode == KC_BLOCKS) { | ||
| 265 | if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) { | ||
| 266 | return process_record_glyph_replacement(keycode, record, unicode_range_translator_boxes); | ||
| 267 | } | ||
| 268 | } else if (typing_mode == KC_REGIONAL) { | ||
| 269 | if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) { | ||
| 270 | if (!process_record_glyph_replacement(keycode, record, unicode_range_translator_regional)) { | ||
| 271 | wait_us(500); | ||
| 272 | tap_unicode_glyph_nomods(0x200C); | ||
| 273 | return false; | ||
| 274 | } | ||
| 275 | } | ||
| 276 | } else if (typing_mode == KC_AUSSIE) { | ||
| 277 | return process_record_aussie(keycode, record); | ||
| 278 | } else if (typing_mode == KC_ZALGO) { | ||
| 279 | return process_record_zalgo(keycode, record); | ||
| 280 | } | ||
| 281 | return true; | ||
| 282 | } | ||
