diff options
author | lokher <lokher@gmail.com> | 2023-04-26 16:32:15 +0800 |
---|---|---|
committer | lokher <lokher@gmail.com> | 2023-04-26 16:32:15 +0800 |
commit | e4f4ceaf3f2e3d25fb282273a81f9b58790fc427 (patch) | |
tree | c0a257eab0ffe5238fdf2c04882e8ee1fe8fc46e /users/drashna | |
parent | 103badc87cb50db1ff3851c84331e86ba78fb681 (diff) |
merge upstream 713427c
Diffstat (limited to 'users/drashna')
26 files changed, 344 insertions, 274 deletions
diff --git a/users/drashna/audio_config.h b/users/drashna/audio_config.h new file mode 100644 index 0000000000..21fe27ee6b --- /dev/null +++ b/users/drashna/audio_config.h @@ -0,0 +1,33 @@ +// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define AUDIO_CLICKY +#define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f + +#if __has_include("user_song_list.h") +# include "user_song_list.h" +#endif + +#ifdef USER_SONG_LIST +# define STARTUP_SONG SONG(RICK_ROLL) +# define GOODBYE_SONG SONG(SONIC_RING) +# define DEFAULT_LAYER_SONGS \ + { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(OVERWATCH_THEME) } +# define UNICODE_SONG_MAC SONG(MARIO_THEME) +# define UNICODE_SONG_LNX SONG(MARIO_POWERUP) +# define UNICODE_SONG_WIN SONG(MARIO_ONEUP) +# define UNICODE_SONG_BSD SONG(RICK_ROLL) +# define UNICODE_SONG_WINC SONG(RICK_ROLL) +#else +# define STARTUP_SONG SONG(STARTUP_SOUND) +# define GOODBYE_SONG SONG(GOODBYE_SOUND) +# define DEFAULT_LAYER_SONGS \ + { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(WORKMAN_SOUND) } +# define UNICODE_SONG_MAC SONG(QWERTY_SOUND) +# define UNICODE_SONG_LNX SONG(COLEMAK_SOUND) +# define UNICODE_SONG_WIN SONG(DVORAK_SOUND) +# define UNICODE_SONG_BSD SONG(WORKMAN_SOUND) +# define UNICODE_SONG_WINC SONG(PLOVER_GOODBYE_SOUND) +#endif diff --git a/users/drashna/callbacks.c b/users/drashna/callbacks.c index c2f1156cee..568f56c8d1 100644 --- a/users/drashna/callbacks.c +++ b/users/drashna/callbacks.c @@ -3,9 +3,8 @@ #include "drashna.h" - #ifdef I2C_SCANNER_ENABLE -void matrix_scan_i2c(void); +void housekeeping_task_i2c_scanner(void); void keyboard_post_init_i2c(void); #endif @@ -21,6 +20,64 @@ void keyboard_pre_init_user(void) { // Call user matrix init, set default RGB colors and then // call the keymap's init function +#ifdef CUSTOM_QUANTUM_PAINTER_ENABLE +void keyboard_post_init_qp(void); +#endif + +#ifdef OS_DETECTION_ENABLE +os_variant_t os_type; + +uint32_t startup_exec(uint32_t trigger_time, void *cb_arg) { + /* do something */ + + if (is_keyboard_master()) { + os_type = detected_host_os(); + if (os_type) { + bool is_mac = (os_type == OS_MACOS) || (os_type == OS_IOS); + keymap_config.swap_lctl_lgui = keymap_config.swap_rctl_rgui = is_mac; +# ifdef UNICODE_COMMON_ENABLE + uint8_t mode = is_mac ? UNICODE_MODE_MACOS : UNICODE_MODE_WINCOMPOSE; + if (mode != get_unicode_input_mode()) { + set_unicode_input_mode(mode); + } +# endif + switch (os_type) { + case OS_UNSURE: + xprintf("unknown OS Detected\n"); + break; + case OS_LINUX: + xprintf("Linux Detected\n"); + break; + case OS_WINDOWS: + xprintf("Windows Detected\n"); + break; +# if 0 + case OS_WINDOWS_UNSURE: + xprintf("Windows? Detected\n"); + break; +# endif + case OS_MACOS: + xprintf("MacOS Detected\n"); + break; + case OS_IOS: + xprintf("iOS Detected\n"); + break; +# if 0 + case OS_PS5: + xprintf("PlayStation 5 Detected\n"); + break; + case OS_HANDHELD: + xprintf("Nintend Switch/Quest 2 Detected\n"); + break; +# endif + } + } + } + + return os_type ? 0 : 500; +} +#endif + __attribute__((weak)) void keyboard_post_init_keymap(void) {} void keyboard_post_init_user(void) { #if defined(CUSTOM_RGBLIGHT) @@ -47,6 +104,10 @@ void keyboard_post_init_user(void) { PORTB &= ~(1 << 0); #endif +#ifdef OS_DETECTION_ENABLE + defer_exec(100, startup_exec, NULL); +#endif + keyboard_post_init_keymap(); } @@ -102,25 +163,6 @@ void suspend_wakeup_init_user(void) { // scan function __attribute__((weak)) void matrix_scan_keymap(void) {} void matrix_scan_user(void) { - static bool has_ran_yet; - if (!has_ran_yet) { - has_ran_yet = true; - startup_user(); - } - -#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. - run_diablo_macro_check(); -#endif // TAP_DANCE_ENABLE -#if defined(CUSTOM_RGB_MATRIX) - matrix_scan_rgb_matrix(); -#endif -#ifdef I2C_SCANNER_ENABLE - matrix_scan_i2c(); -#endif -#ifdef CUSTOM_OLED_DRIVER - matrix_scan_oled(); -#endif - matrix_scan_keymap(); } @@ -134,10 +176,6 @@ __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) return state; } layer_state_t layer_state_set_user(layer_state_t state) { - if (!is_keyboard_master()) { - return state; - } - state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); #if defined(CUSTOM_POINTING_DEVICE) state = layer_state_set_pointing(state); @@ -145,18 +183,33 @@ layer_state_t layer_state_set_user(layer_state_t state) { #if defined(CUSTOM_RGBLIGHT) state = layer_state_set_rgb_light(state); #endif // CUSTOM_RGBLIGHT -#if defined(AUDIO_ENABLE) && !defined(__arm__) +#if defined(AUDIO_ENABLE) static bool is_gamepad_on = false; if (layer_state_cmp(state, _GAMEPAD) != is_gamepad_on) { - is_gamepad_on = layer_state_cmp(state, _GAMEPAD); + static bool is_click_on = false; + is_gamepad_on = layer_state_cmp(state, _GAMEPAD); if (is_gamepad_on) { + is_click_on = is_clicky_on(); + if (is_click_on) { + clicky_off(); + } PLAY_LOOP(doom_song); } else { + if (is_click_on) { + clicky_on(); + } stop_all_notes(); } } #endif state = layer_state_set_keymap(state); + +#ifdef CONSOLE_ENABLE + char layer_buffer[16 + 5]; + format_layer_bitmap_string(layer_buffer, state, default_layer_state); + dprintf("layer state: %s\n", layer_buffer); +#endif + return state; } @@ -227,9 +280,27 @@ void matrix_slave_scan_user(void) { #endif __attribute__((weak)) void housekeeping_task_keymap(void) {} -void housekeeping_task_user(void) { +void housekeeping_task_user(void) { + static bool has_ran_yet; + if (!has_ran_yet) { + has_ran_yet = true; + startup_user(); + } +#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. + run_diablo_macro_check(); +#endif // TAP_DANCE_ENABLE +#if defined(CUSTOM_RGB_MATRIX) + housekeeping_task_rgb_matrix(); +#endif +#ifdef I2C_SCANNER_ENABLE + housekeeping_task_i2c_scanner(); +#endif +#ifdef CUSTOM_OLED_DRIVER + housekeeping_task_oled(); +#endif #if defined(SPLIT_KEYBOARD) && defined(SPLIT_TRANSACTION_IDS_USER) housekeeping_task_transport_sync(); #endif + housekeeping_task_keymap(); } diff --git a/users/drashna/callbacks.md b/users/drashna/callbacks.md index 5908a66142..e23f7f6d86 100644 --- a/users/drashna/callbacks.md +++ b/users/drashna/callbacks.md @@ -2,7 +2,7 @@ Specifically QMK works by using customized callback functions for everything. This allows for multiple levels of customization. -`matrix_scan` calls `matrix_scan_quantum`, which calls `matrix_scan_kb`, which calls `matrix_scan_user`. +`matrix_scan` calls `matrix_scan_kb`, which calls `matrix_scan_user`. `process_record` calls a bunch of stuff, but eventually calls `process_record_kb` which calls `process_record_user` The same goes for `matrix_init`, `layer_state_set`, `led_set`, and a few other functions. diff --git a/users/drashna/config.h b/users/drashna/config.h index 5c5c131e36..465ea63ee2 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -11,7 +11,6 @@ #endif #define IS_COMMAND() (((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) - #if defined(SPLIT_KEYBOARD) # include "split/split_config.h" #endif @@ -27,51 +26,26 @@ # include "oled/oled_config.h" #endif +#ifdef POINTING_DEVICE_ENABLE +# include "pointing/pointing_config.h" +#endif // POINTING_DEVICE_ENABLE + +#ifdef AUDIO_ENABLE +# include "audio_config.h" +#endif // AUDIO_ENABLE + #if defined(WPM_ENABLE) // # define WPM_LAUNCH_CONTROL -// # define WPM_ALLOW_COUNT_REGRESSOIN // # define WPM_UNFILTERED +# define WPM_ALLOW_COUNT_REGRESSION # define WPM_SAMPLE_SECONDS 10 # define WPM_SAMPLE_PERIODS 50 # define WPM_ESTIMATED_WORD_SIZE 5 #endif -#ifdef AUDIO_ENABLE -# define AUDIO_CLICKY -# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f - -# ifdef USER_SONG_LIST -# define STARTUP_SONG SONG(RICK_ROLL) -# define GOODBYE_SONG SONG(SONIC_RING) -# define DEFAULT_LAYER_SONGS \ - { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(OVERWATCH_THEME) } -# define UNICODE_SONG_MAC SONG(MARIO_THEME) -# define UNICODE_SONG_LNX SONG(MARIO_POWERUP) -# define UNICODE_SONG_WIN SONG(MARIO_ONEUP) -# define UNICODE_SONG_BSD SONG(RICK_ROLL) -# define UNICODE_SONG_WINC SONG(RICK_ROLL) -# else -# define STARTUP_SONG SONG(STARTUP_SOUND) -# define GOODBYE_SONG SONG(GOODBYE_SOUND) -# define DEFAULT_LAYER_SONGS \ - { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(WORKMAN_SOUND) } -# define UNICODE_SONG_MAC SONG(QWERTY_SOUND) -# define UNICODE_SONG_LNX SONG(COLEMAK_SOUND) -# define UNICODE_SONG_WIN SONG(DVORAK_SOUND) -# define UNICODE_SONG_BSD SONG(WORKMAN_SOUND) -# define UNICODE_SONG_WINC SONG(PLOVER_GOODBYE_SOUND) -# endif -#endif // !AUDIO_ENABLE #define UNICODE_SELECTED_MODES UNICODE_MODE_WINCOMPOSE, UNICODE_MODE_MACOS -// #define WPM_ESTIMATED_WORD_SIZE 5 -#define WPM_ALLOW_COUNT_REGRESSION -// #define WPM_UNFILTERED -// #define WPM_SAMPLE_SECONDS 5 -// #define WPM_SAMPLE_PERIODS 50 -// #define WPM_LAUNCH_CONTROL - #ifndef ONESHOT_TAP_TOGGLE # define ONESHOT_TAP_TOGGLE 2 #endif // !ONESHOT_TAP_TOGGLE @@ -81,9 +55,8 @@ #endif // !ONESHOT_TIMEOUT #if defined(PER_KEY_TAPPING) -# define IGNORE_MOD_TAP_INTERRUPT_PER_KEY # define PERMISSIVE_HOLD_PER_KEY -# define TAPPING_FORCE_HOLD_PER_KEY +# define QUICK_TAP_TERM_PER_KEY # define HOLD_ON_OTHER_KEY # define RETRO_TAPPING_PER_KEY # define HOLD_ON_OTHER_KEY_PRESS_PER_KEY diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 283e82d13d..259810c70f 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -117,7 +117,7 @@ void do_scan(void) { uint16_t scan_timer = 0; -void matrix_scan_i2c(void) { +void housekeeping_task_i2c_scanner(void) { if (timer_elapsed(scan_timer) > 5000) { do_scan(); scan_timer = timer_read(); @@ -139,7 +139,7 @@ float autocorrect_song[][2] = SONG(PLOVER_GOODBYE_SOUND); # endif # endif -bool apply_autocorrect(uint8_t backspaces, const char *str) { +bool apply_autocorrect(uint8_t backspaces, const char* str) { if (layer_state_is(_GAMEPAD)) { return false; } @@ -153,7 +153,31 @@ bool apply_autocorrect(uint8_t backspaces, const char *str) { } #endif -#if defined(CAPS_WORD_ENABLE) && !defined(NO_ACTION_ONESHOT) +#if defined(CAPS_WORD_ENABLE) +bool caps_word_press_user(uint16_t keycode) { + switch (keycode) { + // Keycodes that continue Caps Word, with shift applied. + case KC_MINS: + if (!keymap_config.swap_lctl_lgui) { + return true; + } + case KC_A ... KC_Z: + add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to next key. + return true; + + // Keycodes that continue Caps Word, without shifting. + case KC_1 ... KC_0: + case KC_BSPC: + case KC_DEL: + case KC_UNDS: + return true; + + default: + return false; // Deactivate Caps Word. + } +} + +# if !defined(NO_ACTION_ONESHOT) void oneshot_locked_mods_changed_user(uint8_t mods) { if (mods & MOD_MASK_SHIFT) { del_mods(MOD_MASK_SHIFT); @@ -161,4 +185,25 @@ void oneshot_locked_mods_changed_user(uint8_t mods) { caps_word_on(); } } +# endif #endif + +void format_layer_bitmap_string(char* buffer, layer_state_t state, layer_state_t default_state) { + for (int i = 0; i < 16; i++) { + if (i == 0 || i == 4 || i == 8 || i == 12) { + *buffer = ' '; + ++buffer; + } + + uint8_t layer = i; + if ((default_state & ((layer_state_t)1 << layer)) != 0) { + *buffer = 'D'; + } else if ((state & ((layer_state_t)1 << layer)) != 0) { + *buffer = '1'; + } else { + *buffer = '_'; + } + ++buffer; + } + *buffer = 0; +} diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 16d7cda638..4e2a4d5acb 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -11,7 +11,7 @@ #ifdef TAP_DANCE_ENABLE # include "keyrecords/tap_dances.h" -#endif // TAP_DANCE_ENABLE +#endif // TAP_DANCE_ENABLE #if defined(RGBLIGHT_ENABLE) # include "rgb/rgb_stuff.h" #endif @@ -27,6 +27,9 @@ #ifdef POINTING_DEVICE_ENABLE # include "pointing/pointing.h" #endif +#ifdef OS_DETECTION_ENABLE +# include "os_detection.h" +#endif /* Define layer names */ enum userspace_layers { @@ -79,6 +82,7 @@ bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed); bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); bool hasAllBitsInMask(uint8_t value, uint8_t mask); void tap_code16_nomods(uint16_t kc); +void format_layer_bitmap_string(char* buffer, layer_state_t state, layer_state_t default_state); // clang-format off typedef union { diff --git a/users/drashna/keyrecords/capwords.md b/users/drashna/keyrecords/capwords.md deleted file mode 100644 index 1ca01ed853..0000000000 --- a/users/drashna/keyrecords/capwords.md +++ /dev/null @@ -1,36 +0,0 @@ -# Cap Words - -This is taken from [Pascal Getreuer's implemenation](https://getreuer.info/posts/keyboards/caps-word/index.html), with a number of modifications. - -To enable Caps Word, add `CAPS_WORD_ENABLE = yes` to your `rules.mk`. - -This is mostly a reproduction of Pascal's docs: - -## Overview - -All-caps identifiers like “MOD_MASK_ALT” are awkward to type. - -Caps Lock would be the standard solution to this problem, but it is awkward: it needs a dedicated key to toggle it (an imposition on smaller keyboards), and we need to remember to toggle it off after typing the word. Or with normal shifting, we either perform finger gymnastics or need to stop typing in the middle of the word to release shift with one hand to switch to holding shift with the other hand. In my experience, this is a nuisance especially if your shift keys are mod-taps, as in home row mods. - -Caps Word, implemented here, is a modern alternative to Caps Lock: - -* Caps Word is activated by pressing the left and right shift keys at the same time. This way you don’t need a dedicated key for using Caps Word. -* Caps Word automatically disables itself at the end of the word. - -**Compatibility**: I’ve tested that this implementation works with one-shot mods and Space Cadet Shift, and it predictably handles key repeating. - -Unlike some other QMK Caps Word implementations, this library does not use the Caps Lock (KC_CAPS) keycode. It works even if the OS remaps Caps Lock to Ctrl or something else, as Emacs and Vim users often do. - -## Using Caps Word -With the above flashed to your keyboard: - -1. **Activating**: Press and release both left and right shift keys at the same time. If your shift keys are mod-taps, activate Caps Word by holding both shift mod-tap keys until the tapping term, then release them. -2. Then begin typing to get capitalized letters. -3. **Disabling**: Caps Word disables itself when the next word breaking key is typed. - -If you want to explicitly stop Caps Word, press and release Ctrl or another non-shift modifier or layer key. This also disables Caps Word. - -## Explanation -The code checks the mod bits on each key event, enabling Caps Word when both left and right shifts are active. - -While enabled, Caps Word automatically presses and releases left shift (KC_LSFT) as needed so that letters are shifted and other keys are not. The word continues while typing a–z, 0–9, -, _, and backspace. Any other key is considered “word breaking” and disables Caps Word. You can edit the switch statement at the end of the process_caps_word() function to adjust which keys count as word breaking. diff --git a/users/drashna/keyrecords/process_records.c b/users/drashna/keyrecords/process_records.c index 89d1c80b8f..99d95c3dff 100644 --- a/users/drashna/keyrecords/process_records.c +++ b/users/drashna/keyrecords/process_records.c @@ -3,6 +3,9 @@ #include "drashna.h" #include "version.h" +#ifdef OS_DETECTION_ENABLE +# include "os_detection.h" +#endif uint16_t copy_paste_timer; bool host_driver_disabled = false; @@ -32,15 +35,6 @@ __attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t * @return false Stop process keycode and do not send to host */ bool process_record_user(uint16_t keycode, keyrecord_t *record) { -#ifdef ENCODER_ENABLE // some debouncing for weird issues - if (IS_ENCODEREVENT(record->event)) { - static bool ignore_first = true; - if (ignore_first) { - ignore_first = false; - return false; - } - } -#endif // If console is enabled, it will print the matrix position and status of each key pressed #ifdef KEYLOGGER_ENABLE uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %1d, time: %5u, int: %1d, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); @@ -195,6 +189,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } break; } + case OLED_LOCK: { +#if defined(OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER) + extern bool is_oled_locked; + if (record->event.pressed) { + is_oled_locked = !is_oled_locked; + if (is_oled_locked) { + oled_on(); + } + } +#endif + } break; +#if defined(OS_DETECTION_ENABLE) && defined(OS_DETECTION_DEBUG_ENABLE) + case STORE_SETUPS: + if (record->event.pressed) { + store_setups_in_eeprom(); + } + return false; + case PRINT_SETUPS: + if (record->event.pressed) { + print_stored_setups(); + } + return false; +#endif } return true; } diff --git a/users/drashna/keyrecords/process_records.h b/users/drashna/keyrecords/process_records.h index 0acd7e010d..8073b7adb0 100644 --- a/users/drashna/keyrecords/process_records.h +++ b/users/drashna/keyrecords/process_records.h @@ -4,16 +4,8 @@ #pragma once #include "drashna.h" -#if defined(KEYBOARD_handwired_tractyl_manuform) && defined(POINTING_DEVICE_ENABLE) -# define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE -#elif defined(KEYBOARD_bastardkb_charybdis) -# define PLACEHOLDER_SAFE_RANGE CHARYBDIS_SAFE_RANGE -#else -# define PLACEHOLDER_SAFE_RANGE SAFE_RANGE -#endif - enum userspace_custom_keycodes { - VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info + VRSN = QK_USER, // Prints QMK Firmware and board info KC_QWERTY, // Sets default layer to QWERTY FIRST_DEFAULT_LAYER_KEYCODE = KC_QWERTY, // Sets default layer to QWERTY KC_COLEMAK_DH, // Sets default layer to COLEMAK @@ -47,7 +39,12 @@ enum userspace_custom_keycodes { KC_SUPER, KC_COMIC, KC_ACCEL, - NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes + OLED_LOCK, + + STORE_SETUPS, + PRINT_SETUPS, + + USER_SAFE_RANGE, // use "NEWPLACEHOLDER for keymap specific codes }; bool process_record_secrets(uint16_t keycode, keyrecord_t *record); diff --git a/users/drashna/keyrecords/readme.md b/users/drashna/keyrecords/readme.md index 5f708f9edf..b89777db3d 100644 --- a/users/drashna/keyrecords/readme.md +++ b/users/drashna/keyrecords/readme.md @@ -1,7 +1,5 @@ # Keycode handling and interception - * [Autocorrection](autocorrection/readme.md) - * [Cap Words](capwords.md) * [Diablo Tap Dancing](tap_dance.md) * [Keymap Wrappers](wrappers.md) * [Secret Macros](secrets.md) diff --git a/users/drashna/keyrecords/tap_dance.md b/users/drashna/keyrecords/tap_dance.md index fef1435918..9dff96640f 100644 --- a/users/drashna/keyrecords/tap_dance.md +++ b/users/drashna/keyrecords/tap_dance.md @@ -30,7 +30,7 @@ These are the custom defined dances that I'm using. It sets up everything for l ```c //Tap Dance Definitions, sets the index and the keycode. -qk_tap_dance_action_t tap_dance_actions[] = { +tap_dance_action_t tap_dance_actions[] = { // tap once to disable, and more to enable timed micros [TD_D3_1] = ACTION_TAP_DANCE_DIABLO(0, KC_1), [TD_D3_2] = ACTION_TAP_DANCE_DIABLO(1, KC_2), @@ -82,7 +82,7 @@ The first part of the magic here is the `diablo_tapdance_master` function. The ```c // Cycle through the times for the macro, starting at 0, for disabled. -void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { +void diablo_tapdance_master(tap_dance_state_t *state, void *user_data) { diable_keys_t *diablo_keys = (diable_keys_t *)user_data; // Sets the keycode based on the index diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode; diff --git a/users/drashna/keyrecords/tap_dances.c b/users/drashna/keyrecords/tap_dances.c index 7bdea3cae3..87739c2a18 100644 --- a/users/drashna/keyrecords/tap_dances.c +++ b/users/drashna/keyrecords/tap_dances.c @@ -17,7 +17,7 @@ uint8_t diablo_times[] = {0, 1, 3, 5, 10, 30}; * @param state Main data struction contining information about events * @param user_data Local data for the dance. Allows customization to be passed on to function */ -void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { +void diablo_tapdance_master(tap_dance_state_t *state, void *user_data) { diable_keys_t *diablo_keys = (diable_keys_t *)user_data; // Sets the keycode based on the index diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode; @@ -40,7 +40,7 @@ void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { // clang-format on // Tap Dance Definitions, sets the index and the keycode. -qk_tap_dance_action_t tap_dance_actions[] = { +tap_dance_action_t tap_dance_actions[] = { // tap once to disable, and more to enable timed micros [TD_D3_1] = ACTION_TAP_DANCE_DIABLO(0, KC_1), [TD_D3_2] = ACTION_TAP_DANCE_DIABLO(1, KC_2), diff --git a/users/drashna/keyrecords/tapping.c b/users/drashna/keyrecords/tapping.c index 7496610c2f..6a26a02aca 100644 --- a/users/drashna/keyrecords/tapping.c +++ b/users/drashna/keyrecords/tapping.c @@ -42,29 +42,14 @@ __attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyreco } #endif // HOLD_ON_OTHER_KEY_PRESS_PER_KEY -#ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY -__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { - // Do not force the mod-tap key press to be handled as a modifier - // if any other key was pressed while the mod-tap key is held down. - // return true; - // Force the mod-tap key press to be handled as a modifier if any - // other key was pressed while the mod-tap key is held down. - // return false; - switch (keycode) { - default: - return true; - } -} -#endif // IGNORE_MOD_TAP_INTERRUPT_PER_KEY - -#ifdef TAPPING_FORCE_HOLD_PER_KEY -__attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { +#ifdef QUICK_TAP_TERM_PER_KEY +__attribute__((weak)) uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { default: - return false; + return QUICK_TAP_TERM; } } -#endif // TAPPING_FORCE_HOLD_PER_KEY +#endif // QUICK_TAP_TERM_PER_KEY #ifdef RETRO_TAPPING_PER_KEY __attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) { diff --git a/users/drashna/keyrecords/wrappers.h b/users/drashna/keyrecords/wrappers.h index cb8dc6189a..31efad5f6e 100644 --- a/users/drashna/keyrecords/wrappers.h +++ b/users/drashna/keyrecords/wrappers.h @@ -256,7 +256,7 @@ NOTE: These are all the same length. If you do a search/replace #define _________________ADJUST_L1_________________ RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG -#define _________________ADJUST_L2_________________ MU_TOG , CK_TOGG, AU_ON, AU_OFF, CG_NORM +#define _________________ADJUST_L2_________________ MU_TOGG, CK_TOGG, AU_ON, AU_OFF, CG_NORM #define _________________ADJUST_L3_________________ RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T #define _________________ADJUST_R1_________________ KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5 diff --git a/users/drashna/oled/oled_stuff.c b/users/drashna/oled/oled_stuff.c index 6dbe3b4812..98506247df 100644 --- a/users/drashna/oled/oled_stuff.c +++ b/users/drashna/oled/oled_stuff.c @@ -25,7 +25,7 @@ #endif #include <string.h> -bool is_oled_enabled = true; +bool is_oled_enabled = true, is_oled_locked = false; extern bool host_driver_disabled; @@ -75,9 +75,9 @@ void add_keylog(uint16_t keycode, keyrecord_t *record) { keycode = QK_MODS_GET_BASIC_KEYCODE(keycode); } - if ((keycode == KC_BSPC) && mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_CTRL) { memset(keylog_str, ' ', OLED_KEYLOGGER_LENGTH); + keylog_str[OLED_KEYLOGGER_LENGTH-1] = 0x00; return; } if (record->tap.count) { @@ -86,10 +86,10 @@ void add_keylog(uint16_t keycode, keyrecord_t *record) { return; } - memmove(keylog_str, keylog_str + 1, OLED_KEYLOGGER_LENGTH - 1); + memmove(keylog_str, keylog_str + 1, OLED_KEYLOGGER_LENGTH - 2); if (keycode < ARRAY_SIZE(code_to_name)) { - keylog_str[(OLED_KEYLOGGER_LENGTH - 1)] = pgm_read_byte(&code_to_name[keycode]); + keylog_str[(OLED_KEYLOGGER_LENGTH - 2)] = pgm_read_byte(&code_to_name[keycode]); } log_timer = timer_read(); @@ -638,10 +638,10 @@ void render_pointing_dpi_status(uint16_t cpi, uint8_t padding, uint8_t col, uint #define OLED_KAKI_SPEED 40 // above this wpm value typing animation to triggere #define OLED_RTOGI_FRAMES 2 -//#define OLED_LTOGI_FRAMES 2 +// #define OLED_LTOGI_FRAMES 2 -//#define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms -// #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing +// #define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms +// #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing #define OLED_ANIM_SIZE 36 #define OLED_ANIM_ROWS 4 #define OLED_ANIM_MAX_FRAMES 3 @@ -735,7 +735,7 @@ void render_kitty(uint8_t col, uint8_t line) { } void render_unicode_mode(uint8_t col, uint8_t line) { -#ifdef CUSTOM_UNICODE_ENABLE +#if defined(CUSTOM_UNICODE_ENABLE) && defined(UNICODE_COMMON_ENABLE) oled_set_cursor(col, line); oled_write_P(PSTR("Unicode:"), false); oled_write_P(unicode_mode_str[unicode_typing_mode], false); @@ -802,19 +802,6 @@ void render_mouse_mode(uint8_t col, uint8_t line) { } void render_status_right(void) { -#if defined(KEYBOARD_handwired_tractyl_manuform) - oled_set_cursor(7, 0); - oled_write_P(PSTR("Manuform"), true); -#elif defined(KEYBOARD_bastardkb_charybdis) - oled_set_cursor(6, 0); - oled_write_P(PSTR("Charybdis"), true); -#elif defined(KEYBOARD_splitkb_kyria) - oled_set_cursor(8, 0); - oled_write_P(PSTR("Kyria"), true); -#else - oled_set_cursor(8, 0); - oled_write_P(PSTR("Right"), true); -#endif #if defined(OLED_DISPLAY_VER |