diff options
author | Drashna Jaelre <drashna@live.com> | 2019-07-22 20:22:33 -0700 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-07-22 20:22:33 -0700 |
commit | d41961c9eddb78591d3b55ea65e6e0baff4bdd69 (patch) | |
tree | a2e03c31b93dc35fbdb539c59de0d2f7c655f02f /users/drashna | |
parent | 840b9090a0fd4faf070d9bbb9039337ecdb82de4 (diff) |
[Keymap] Drashna's Feature madness (#6128)
* Fix my Tap Dance issues after I broke them
* Cleanup and organization of userspace documentation
As well as some additional cleanup of functions due to review of documentation.
* Enable Tapdance on Glow and remove more animations
* Revert to Eager PR debouncing
* Add better check for startup animation
* Move where RGB Matrix defines are listed
* Limit RGB Matrix max val
* Update keyboard for Iris Rev 3 conflicts
* Enable encoder support on planck ez
* Remove is_master check from corne\'s OLED code
* Overhaul OLED screens for my Corne
* One last removal
* Show RGB valu On both sides
* Updates for OLED display info
* Fix compile issues for rgb config
* Disabled Space Cadet for all drashna keymaps
* Fix OLED Screen configs
* Minor OLED Tweaks
* Revert some Iris changes
* Fix song include
* Handle MAKE macro for the Corne boards better
* Add super hacky-hack for eeconfig initialization
* Add audio support for Fractal since Elite Cs support it
* Add defines for keycode steps
* Add White layout
* Update Corne RGB info
* Add fun effects to layer indication for RGB Matrix enabled boards
* Use proper define for product name detection
* Update formatting
* Use custom timeout mechanism for OLED timeout
* Fix up OLED screen HSV code for new HSV structure
* Better handle turning off RGB Matrix when sleeping
* Disable MultiSplash Animation
* Change Iris back to using serial
* Why was RGB disabled?!?!?!
* Limit val in rgb_matrix_layer_helper function
* Remove EECONFIG setting for RGB matrix
Diffstat (limited to 'users/drashna')
-rw-r--r-- | users/drashna/config.h | 131 | ||||
-rw-r--r-- | users/drashna/drashna.c | 138 | ||||
-rw-r--r-- | users/drashna/drashna.h | 69 | ||||
-rw-r--r-- | users/drashna/process_records.c | 257 | ||||
-rw-r--r-- | users/drashna/process_records.h | 66 | ||||
-rw-r--r-- | users/drashna/readme.md | 192 | ||||
-rw-r--r-- | users/drashna/readme_handlers.md | 97 | ||||
-rw-r--r-- | users/drashna/readme_keycodes.md | 10 | ||||
-rw-r--r-- | users/drashna/readme_rgb.md | 43 | ||||
-rw-r--r-- | users/drashna/readme_secrets.md | 123 | ||||
-rw-r--r-- | users/drashna/readme_tap_dance.md | 119 | ||||
-rw-r--r-- | users/drashna/readme_wrappers.md | 11 | ||||
-rw-r--r-- | users/drashna/rgb_stuff.c | 302 | ||||
-rw-r--r-- | users/drashna/rgb_stuff.h | 22 | ||||
-rw-r--r-- | users/drashna/rules.mk | 1 | ||||
-rw-r--r-- | users/drashna/send_unicode.h | 71 | ||||
-rw-r--r-- | users/drashna/tap_dances.c | 77 | ||||
-rw-r--r-- | users/drashna/tap_dances.h | 16 | ||||
-rw-r--r-- | users/drashna/wrappers.h | 14 |
19 files changed, 996 insertions, 763 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h index a6d8e75263..8f6e700d2b 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -1,47 +1,95 @@ #pragma once - #ifdef AUDIO_ENABLE -# define AUDIO_CLICKY -# 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 AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f - -# define UNICODE_SONG_OSX SONG(RICK_ROLL) -# define UNICODE_SONG_LNX SONG(RICK_ROLL) -# define UNICODE_SONG_WIN SONG(RICK_ROLL) -# define UNICODE_SONG_BSD SONG(RICK_ROLL) -# define UNICODE_SONG_WINC SONG(RICK_ROLL) - -#endif // !AUDIO_ENABLE +# if __GNUC__ > 7 +# if __has_include("drashna_song_list.h") +# include "drashna_song_list.h" +# endif // if file exists +# endif // __GNUC__ + +# define AUDIO_CLICKY +# 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 AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f + +# define UNICODE_SONG_OSX SONG(RICK_ROLL) +# define UNICODE_SONG_LNX SONG(RICK_ROLL) +# define UNICODE_SONG_WIN SONG(RICK_ROLL) +# define UNICODE_SONG_BSD SONG(RICK_ROLL) +# define UNICODE_SONG_WINC SONG(RICK_ROLL) +#endif // !AUDIO_ENABLE #ifdef RGBLIGHT_ENABLE -# define RGBLIGHT_SLEEP -# undef RGBLIGHT_ANIMATIONS -# define RGBLIGHT_EFFECT_BREATHING -# define RGBLIGHT_EFFECT_SNAKE -# define RGBLIGHT_EFFECT_KNIGHT -#endif // RGBLIGHT_ENABLE +# define RGBLIGHT_SLEEP +# undef RGBLIGHT_ANIMATIONS +# define RGBLIGHT_EFFECT_BREATHING +# define RGBLIGHT_EFFECT_SNAKE +# define RGBLIGHT_EFFECT_KNIGHT +#endif // RGBLIGHT_ENABLE + +#ifdef RGB_MATRIX_ENABLE +# define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) +// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) +# define RGB_MATRIX_FRAMEBUFFER_EFFECTS +// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects +# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended +// # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 +// # define EECONFIG_RGB_MATRIX (uint32_t *)16 + +# if defined(__AVR__) && !defined(__AVR_AT90USB1286__) +# define DISABLE_RGB_MATRIX_ALPHAS_MODS +# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN +# define DISABLE_RGB_MATRIX_BREATHING +# define DISABLE_RGB_MATRIX_BAND_SAT +# define DISABLE_RGB_MATRIX_BAND_VAL +# define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +# define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +# define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT +# define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL +# define DISABLE_RGB_MATRIX_CYCLE_ALL +# define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define DISABLE_RGB_MATRIX_CYCLE_OUT_IN +// # define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define DISABLE_RGB_MATRIX_DUAL_BEACON +# define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define DISABLE_RGB_MATRIX_CYCLE_SPIRAL +# define DISABLE_RGB_MATRIX_RAINBOW_BEACON +# define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS +# define DISABLE_RGB_MATRIX_RAINDROPS +# define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +// # define DISABLE_RGB_MATRIX_TYPING_HEATMAP +# define DISABLE_RGB_MATRIX_DIGITAL_RAIN +# define DISABLE_RGB_MATRIX_SOLID_REACTIVE +# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +# define DISABLE_RGB_MATRIX_SPLASH +# define DISABLE_RGB_MATRIX_MULTISPLASH +# define DISABLE_RGB_MATRIX_SOLID_SPLASH +# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH +# endif // AVR +#endif // RGB_MATRIX_ENABLE #ifndef ONESHOT_TAP_TOGGLE -# define ONESHOT_TAP_TOGGLE 2 -#endif // !ONESHOT_TAP_TOGGLE +# define ONESHOT_TAP_TOGGLE 2 +#endif // !ONESHOT_TAP_TOGGLE #ifndef ONESHOT_TIMEOUT -# define ONESHOT_TIMEOUT 3000 -#endif// !ONESHOT_TIMEOUT +# define ONESHOT_TIMEOUT 3000 +#endif // !ONESHOT_TIMEOUT #ifndef QMK_KEYS_PER_SCAN -# define QMK_KEYS_PER_SCAN 4 -#endif // !QMK_KEYS_PER_SCAN - - +# define QMK_KEYS_PER_SCAN 4 +#endif // !QMK_KEYS_PER_SCAN // this makes it possible to do rolling combos (zx) with keys that // convert to other keys on hold (z becomes ctrl when you hold it, @@ -55,27 +103,26 @@ #define FORCE_NKRO #ifndef TAPPING_TOGGLE -# define TAPPING_TOGGLE 1 +# define TAPPING_TOGGLE 1 #endif #ifdef TAPPING_TERM -# undef TAPPING_TERM -#endif // TAPPING_TERM +# undef TAPPING_TERM +#endif // TAPPING_TERM #if defined(KEYBOARD_ergodox_ez) -# define TAPPING_TERM 185 +# define TAPPING_TERM 185 #elif defined(KEYBOARD_crkbd) -# define TAPPING_TERM 200 +# define TAPPING_TERM 200 #else -# define TAPPING_TERM 175 +# define TAPPING_TERM 175 #endif - #define TAP_CODE_DELAY 5 /* Disable unused and unneeded features to reduce on firmware size */ #ifdef LOCKING_SUPPORT_ENABLE -# undef LOCKING_SUPPORT_ENABLE +# undef LOCKING_SUPPORT_ENABLE #endif #ifdef LOCKING_RESYNC_ENABLE -# undef LOCKING_RESYNC_ENABLE +# undef LOCKING_RESYNC_ENABLE #endif diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index acc6b9f9ed..c1809dad0a 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -19,22 +19,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. userspace_config_t userspace_config; #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) - #define DRASHNA_UNICODE_MODE UC_WIN +# define DRASHNA_UNICODE_MODE UC_WIN #else - // set to 2 for UC_WIN, set to 4 for UC_WINC - #define DRASHNA_UNICODE_MODE 2 +// set to 2 for UC_WIN, set to 4 for UC_WINC +# define DRASHNA_UNICODE_MODE 2 #endif - // This block is for all of the gaming macros, as they were all doing // the same thing, but with differring text sent. bool send_game_macro(const char *str, keyrecord_t *record, bool override) { if (!record->event.pressed || override) { uint16_t keycode; if (userspace_config.is_overwatch) { - keycode = KC_BSPC; + keycode = KC_BSPC; } else { - keycode = KC_ENTER; + keycode = KC_ENTER; } clear_keyboard(); tap_code(keycode); @@ -47,12 +46,12 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) { return false; } -bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed) { +bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) { static uint16_t this_timer; - if(pressed) { - this_timer= timer_read(); + if (pressed) { + this_timer = timer_read(); } else { - if (timer_elapsed(this_timer) < TAPPING_TERM){ + if (timer_elapsed(this_timer) < TAPPING_TERM) { tap_code(code); } else { register_code(mod_code); @@ -63,11 +62,11 @@ bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed) { return false; } -bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) { - if(pressed) { - this_timer= timer_read(); +bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) { + if (pressed) { + this_timer = timer_read(); } else { - if (timer_elapsed(this_timer) < TAPPING_TERM){ + if (timer_elapsed(this_timer) < TAPPING_TERM) { tap_code(code); } else { register_code(mod_code); @@ -80,13 +79,13 @@ bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t thi void bootmagic_lite(void) { matrix_scan(); - #if defined(DEBOUNCING_DELAY) && DEBOUNCING_DELAY > 0 - wait_ms(DEBOUNCING_DELAY * 2); - #elif defined(DEBOUNCE) && DEBOUNCE > 0 - wait_ms(DEBOUNCE * 2); - #else - wait_ms(30); - #endif +#if defined(DEBOUNCING_DELAY) && DEBOUNCING_DELAY > 0 + wait_ms(DEBOUNCING_DELAY * 2); +#elif defined(DEBOUNCE) && DEBOUNCE > 0 + wait_ms(DEBOUNCE * 2); +#else + wait_ms(30); +#endif matrix_scan(); if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) { bootloader_jump(); @@ -97,7 +96,7 @@ void bootmagic_lite(void) { // This allows for a global, userspace functions, and continued // customization of the keymap. Use _keymap instead of _user // functions in the keymaps -__attribute__ ((weak)) +__attribute__((weak)) void matrix_init_keymap(void) {} // Call user matrix init, set default RGB colors and then @@ -105,64 +104,63 @@ void matrix_init_keymap(void) {} void matrix_init_user(void) { userspace_config.raw = eeconfig_read_user(); - #ifdef BOOTLOADER_CATERINA - DDRD &= ~(1<<5); - PORTD &= ~(1<<5); +#ifdef BOOTLOADER_CATERINA + DDRD &= ~(1 << 5); + PORTD &= ~(1 << 5); - DDRB &= ~(1<<0); - PORTB &= ~(1<<0); - #endif + DDRB &= ~(1 << 0); + PORTB &= ~(1 << 0); +#endif - #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) - set_unicode_input_mode(DRASHNA_UNICODE_MODE); - get_unicode_input_mode(); - #endif //UNICODE_ENABLE +#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) + set_unicode_input_mode(DRASHNA_UNICODE_MODE); + get_unicode_input_mode(); +#endif // UNICODE_ENABLE matrix_init_keymap(); } __attribute__((weak)) -void keyboard_post_init_keymap(void){ } +void keyboard_post_init_keymap(void) {} -void keyboard_post_init_user(void){ +void keyboard_post_init_user(void) { #ifdef RGBLIGHT_ENABLE keyboard_post_init_rgb(); #endif keyboard_post_init_keymap(); } -__attribute__ ((weak)) +__attribute__((weak)) void shutdown_keymap(void) {} -void shutdown_user (void) { - #ifdef RGBLIGHT_ENABLE - rgblight_enable_noeeprom(); - rgblight_mode_noeeprom(1); - rgblight_setrgb_red(); - #endif // RGBLIGHT_ENABLE - #ifdef RGB_MATRIX_ENABLE - // uint16_t timer_start = timer_read(); - // rgb_matrix_set_color_all( 0xFF, 0x00, 0x00 ); - // while(timer_elapsed(timer_start) < 250) { wait_ms(1); } - #endif //RGB_MATRIX_ENABLE +void shutdown_user(void) { +#ifdef RGBLIGHT_ENABLE + rgblight_enable_noeeprom(); + rgblight_mode_noeeprom(1); + rgblight_setrgb_red(); +#endif // RGBLIGHT_ENABLE +#ifdef RGB_MATRIX_ENABLE + // uint16_t timer_start = timer_read(); + // rgb_matrix_set_color_all( 0xFF, 0x00, 0x00 ); + // while(timer_elapsed(timer_start) < 250) { wait_ms(1); } +#endif // RGB_MATRIX_ENABLE shutdown_keymap(); } -__attribute__ ((weak)) +__attribute__((weak)) void suspend_power_down_keymap(void) {} void suspend_power_down_user(void) { suspend_power_down_keymap(); } -__attribute__ ((weak)) +__attribute__((weak)) void suspend_wakeup_init_keymap(void) {} void suspend_wakeup_init_user(void) { suspend_wakeup_init_keymap(); } - -__attribute__ ((weak)) +__attribute__((weak)) void matrix_scan_keymap(void) {} // No global matrix scan code, so just run keymap's matrix @@ -176,20 +174,17 @@ void matrix_scan_user(void) { #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. run_diablo_macro_check(); -#endif // TAP_DANCE_ENABLE +#endif // TAP_DANCE_ENABLE #ifdef RGBLIGHT_ENABLE matrix_scan_rgb(); -#endif // RGBLIGHT_ENABLE +#endif // RGBLIGHT_ENABLE matrix_scan_keymap(); } - -__attribute__ ((weak)) -layer_state_t layer_state_set_keymap (layer_state_t state) { - return state; -} +__attribute__((weak)) +layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } // on layer change, no matter where the change was initiated // Then runs keymap's layer change check @@ -197,28 +192,25 @@ layer_state_t layer_state_set_user(layer_state_t state) { state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); #ifdef RGBLIGHT_ENABLE state = layer_state_set_rgb(state); -#endif // RGBLIGHT_ENABLE - return layer_state_set_keymap (state); +#endif // RGBLIGHT_ENABLE + return layer_state_set_keymap(state); } - -__attribute__ ((weak)) -layer_state_t default_layer_state_set_keymap (layer_state_t state) { - return state; -} +__attribute__((weak)) +layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; } // Runs state check and changes underglow color and animation layer_state_t default_layer_state_set_user(layer_state_t state) { state = default_layer_state_set_keymap(state); #if 0 -#ifdef RGBLIGHT_ENABLE +# ifdef RGBLIGHT_ENABLE state = default_layer_state_set_rgb(state); -#endif // RGBLIGHT_ENABLE +# endif // RGBLIGHT_ENABLE #endif return state; } -__attribute__ ((weak)) +__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {} // Any custom LED code goes here. @@ -228,17 +220,19 @@ void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); } -__attribute__ ((weak)) +__attribute__((weak)) void eeconfig_init_keymap(void) {} void eeconfig_init_user(void) { - userspace_config.raw = 0; + userspace_config.raw = 0; userspace_config.rgb_layer_change = true; eeconfig_update_user(userspace_config.raw); - #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) +#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) set_unicode_input_mode(DRASHNA_UNICODE_MODE); get_unicode_input_mode(); - #else +#else eeprom_update_byte(EECONFIG_UNICODEMODE, DRASHNA_UNICODE_MODE); - #endif +#endif + eeconfig_init_keymap(); + keyboard_init(); } diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 507504f04e..0d6dac380b 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -22,20 +22,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "wrappers.h" #include "process_records.h" #ifdef TAP_DANCE_ENABLE -# include "tap_dances.h" -#endif // TAP_DANCE_ENABLE +# include "tap_dances.h" +#endif // TAP_DANCE_ENABLE #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) -# include "rgb_stuff.h" -#endif -#if defined(AUDIO_ENABLE) && __GNUC__ > 7 -# if __has_include("drashna_song_list.h") -# include "drashna_song_list.h" -# endif +# include "rgb_stuff.h" #endif /* Define layer names */ enum userspace_layers { - _QWERTY = 0, + _QWERTY = 0, _NUMLOCK = 0, _COLEMAK, _DVORAK, @@ -58,47 +53,45 @@ enum userspace_layers { define modifiers here, since MOD_* doesn't seem to work for these */ - -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 send_game_macro(const char *str, keyrecord_t *record, bool override); -void matrix_init_keymap(void); -void shutdown_keymap(void); -void suspend_power_down_keymap(void); -void suspend_wakeup_init_keymap(void); -void matrix_scan_keymap(void); -layer_state_t layer_state_set_keymap (layer_state_t state); -layer_state_t default_layer_state_set_keymap (layer_state_t state); -void led_set_keymap(uint8_t usb_led); -void eeconfig_init_keymap(void); +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 send_game_macro(const char *str, keyrecord_t *record, bool override); +void matrix_init_keymap(void); +void shutdown_keymap(void); +void suspend_power_down_keymap(void); +void suspend_wakeup_init_keymap(void); +void matrix_scan_keymap(void); +layer_state_t layer_state_set_keymap(layer_state_t state); +layer_state_t default_layer_state_set_keymap(layer_state_t state); +void led_set_keymap(uint8_t usb_led); +void eeconfig_init_keymap(void); typedef union { uint32_t raw; struct { - bool rgb_layer_change :1; - bool is_overwatch :1; - bool nuke_switch :1; - uint8_t unicode_mod :4; - bool swapped_numbers :1; + bool rgb_layer_change :1; + bool is_overwatch :1; + bool nuke_switch :1; + uint8_t unicode_mod :4; + bool swapped_numbers :1; }; } userspace_config_t; extern userspace_config_t userspace_config; - /* Custom Keycodes for Diablo 3 layer But since TD() doesn't work when tap dance is disabled We use custom codes here, so we can substitute the right stuff */ #ifdef TAP_DANCE_ENABLE -# define KC_D3_1 TD(TD_D3_1) -# define KC_D3_2 TD(TD_D3_2) -# define KC_D3_3 TD(TD_D3_3) -# define KC_D3_4 TD(TD_D3_4) -#else // TAP_DANCE_ENABLE -# define KC_D3_1 KC_1 -# define KC_D3_2 KC_2 -# define KC_D3_3 KC_3 -# define KC_D3_4 KC_4 -#endif // TAP_DANCE_ENABLE +# define KC_D3_1 TD(TD_D3_1) +# define KC_D3_2 TD(TD_D3_2) +# define KC_D3_3 TD(TD_D3_3) +# define KC_D3_4 TD(TD_D3_4) +#else // TAP_DANCE_ENABLE +# define KC_D3_1 KC_1 +# define KC_D3_2 KC_2 +# define KC_D3_3 KC_3 +# define KC_D3_4 KC_4 +#endif // TAP_DANCE_ENABLE diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c index 770219917e..5666d052dc 100644 --- a/users/drashna/process_records.c +++ b/users/drashna/process_records.c @@ -2,160 +2,161 @@ uint16_t copy_paste_timer; -__attribute__ ((weak)) -bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - return true; -} +__attribute__((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } -__attribute__ ((weak)) -bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { - return true; -} +__attribute__((weak)) +bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; } // Defines actions tor my global custom keycodes. Defined in drashna.h file // Then runs the _keymap's record handier if not processed here bool process_record_user(uint16_t keycode, keyrecord_t *record) { - - // If console is enabled, it will print the matrix position and status of each key pressed + // If console is enabled, it will print the matrix position and status of each key pressed #ifdef KEYLOGGER_ENABLE -# if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_keebio_iris_rev2) - xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.row, record->event.key.col, record->event.pressed); -# else - xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); -# endif -#endif //KEYLOGGER_ENABLE +# if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_keebio_iris_rev2) + xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.row, record->event.key.col, record->event.pressed); +# else + xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); +# endif +#endif // KEYLOGGER_ENABLE switch (keycode) { - case KC_QWERTY ... KC_CARPLAX: - if (record->event.pressed) { - set_single_persistent_default_layer(keycode - KC_QWERTY); - } - break; + case KC_QWERTY ... KC_CARPLAX: + if (record->event.pressed) { + set_single_persistent_default_layer(keycode - KC_QWERTY); + } + break; - case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader - if (!record->event.pressed) { - uint8_t temp_mod = get_mods(); - uint8_t temp_osm = get_oneshot_mods(); - clear_mods(); clear_oneshot_mods(); - send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), TAP_CODE_DELAY); + case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader + if (!record->event.pressed) { + uint8_t temp_mod = get_mods(); + uint8_t temp_osm = get_oneshot_mods(); + clear_mods(); + clear_oneshot_mods(); + send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), TAP_CODE_DELAY); #ifndef MAKE_BOOTLOADER - if ( ( temp_mod | temp_osm ) & MOD_MASK_SHIFT ) + if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) #endif - { - #if defined(__arm__) - send_string_with_delay_P(PSTR(":dfu-util"), TAP_CODE_DELAY); - #elif defined(BOOTLOADER_DFU) - send_string_with_delay_P(PSTR(":dfu"), TAP_CODE_DELAY); - #elif defined(BOOTLOADER_HALFKAY) - send_string_with_delay_P(PSTR(":teensy"), TAP_CODE_DELAY); - #elif defined(BOOTLOADER_CATERINA) - send_string_with_delay_P(PSTR(":avrdude"), TAP_CODE_DELAY); - #endif // bootloader options - } - if ( ( temp_mod | temp_osm ) & MOD_MASK_CTRL) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), TAP_CODE_DELAY); } + { +#if defined(__arm__) + send_string_with_delay_P(PSTR(":dfu-util"), TAP_CODE_DELAY); +#elif defined(BOOTLOADER_DFU) + send_string_with_delay_P(PSTR(":dfu"), TAP_CODE_DELAY); +#elif defined(BOOTLOADER_HALFKAY) + send_string_with_delay_P(PSTR(":teensy"), TAP_CODE_DELAY); +#elif defined(BOOTLOADER_CATERINA) + send_string_with_delay_P(PSTR(":avrdude"), TAP_CODE_DELAY); +#endif // bootloader options + } + if ((temp_mod | temp_osm) & MOD_MASK_CTRL) { + send_string_with_delay_P(PSTR(" -j8 --output-sync"), TAP_CODE_DELAY); + } #ifdef RGB_MATRIX_SPLIT_RIGHT - send_string_with_delay_P(PSTR(" RGB_MATRIX_SPLIT_RIGHT=yes OLED_DRIVER_ENABLE=no"), TAP_CODE_DELAY); + send_string_with_delay_P(PSTR(" RGB_MATRIX_SPLIT_RIGHT=yes"), TAP_CODE_DELAY); +# ifndef OLED_DRIVER_ENABLE + send_string_with_delay_P(PSTR(" OLED_DRIVER_ENABLE=no"), TAP_CODE_DELAY); +# endif #endif - send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY); - } + send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY); + } - break; + break; - case VRSN: // Prints firmware version - if (record->event.pressed) { - send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY); - } - break; + case VRSN: // Prints firmware version + if (record->event.pressed) { + send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY); + } + break; - // These are a serious of gaming macros. - // Only enables for the viterbi, basically, - // to save on firmware space, since it's limited. + // These are a serious of gaming macros. + // Only enables for the viterbi, basically, + // to save on firmware space, since it's limited. #ifdef MACROS_ENABLED - case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros - if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeconfig_update_user(userspace_config.raw); } -#ifdef RGBLIGHT_ENABLE - userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18); -#endif //RGBLIGHT_ENABLE - break; - case KC_SALT: - return send_game_macro("Salt, salt, salt...", record, false); - case KC_MORESALT: - return send_game_macro("Please sir, can I have some more salt?!", record, false); - case KC_SALTHARD: - return send_game_macro("Your salt only makes me harder, and even more aggressive!", record, false); - case KC_GOODGAME: - return send_game_macro("Good game, everyone!", record, false); - case KC_GLHF: - return send_game_macro("Good luck, have fun!!!", record, false); - case KC_SYMM: - return send_game_macro("Left click to win!", record, false); - case KC_JUSTGAME: - return send_game_macro("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games.", record, false); - case KC_TORB: - return send_game_macro("That was positively riveting!", record, false); - case KC_AIM: - send_game_macro("That aim is absolutely amazing. It's almost like you're a machine!", record, true); - return send_game_macro("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!", record, false); - case KC_C9: - return send_game_macro("OMG!!! C9!!!", record, false); - case KC_GGEZ: - return send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!", record, false); -#endif // MACROS_ENABLED - + case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros + if (record->event.pressed) { + userspace_config.is_overwatch ^= 1; + eeconfig_update_user(userspace_config.raw); + } +# ifdef RGBLIGHT_ENABLE + userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18); +# endif // RGBLIGHT_ENABLE + break; + case KC_SALT: + return send_game_macro("Salt, salt, salt...", record, false); + case KC_MORESALT: + return send_game_macro("Please sir, can I have some more salt?!", record, false); + case KC_SALTHARD: + return send_game_macro("Your salt only makes me harder, and even more aggressive!", record, false); + case KC_GOODGAME: + return send_game_macro("Good game, everyone!", record, false); + case KC_GLHF: + return send_game_macro("Good luck, have fun!!!", record, false); + case KC_SYMM: + return send_game_macro("Left click to win!", record, false); + case KC_JUSTGAME: + return send_game_macro("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games.", record, false); + case KC_TORB: + return send_game_macro("That was positively riveting!", record, false); + case KC_AIM: + send_game_macro("That aim is absolutely amazing. It's almost like you're a machine!", record, true); + return send_game_macro("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!", record, false); + case KC_C9: + return send_game_macro("OMG!!! C9!!!", record, false); + case KC_GGEZ: + return send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!", record, false); +#endif // MACROS_ENABLED - case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them + case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them #ifdef TAP_DANCE_ENABLE - if (record->event.pressed) { - uint8_t dtime; - for (dtime = 0; dtime < 4; dtime++) { - diablo_timer[dtime].key_time = diablo_times[0]; + if (record->event.pressed) { + for (uint8_t index = 0; index < 4; index++) { + diablo_timer[index].key_interval = 0; + } } - } -#endif // TAP_DANCE_ENABLE - break; +#endif // TAP_DANCE_ENABLE + break; - - case KC_CCCV: // One key copy/paste - if(record->event.pressed){ - copy_paste_timer = timer_read(); + case KC_CCCV: // One key copy/paste + if (record->event.pressed) { + copy_paste_timer = timer_read(); } else { - if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy - register_code(KC_LCTL); - tap_code(KC_C); - unregister_code(KC_LCTL); - } else { // Tap, paste - register_code(KC_LCTL); - tap_code(KC_V); - unregister_code(KC_LCTL); + if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy + register_code(KC_LCTL); + tap_code(KC_C); + unregister_code(KC_LCTL); + } else { // Tap, paste + register_code(KC_LCTL); + tap_code(KC_V); + unregister_code(KC_LCTL); + } } - } - break; + break; #ifdef UNICODE_ENABLE - case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻ - if (record->event.pressed) { - send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); - } - break; - case UC_TABL: // ┬─┬ノ( º _ ºノ) - if (record->event.pressed) { - send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 30CE 0029"); - } - break; - case UC_SHRG: // ¯\_(ツ)_/¯ - if (record->event.pressed) { - send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF"); - } - break; - case UC_DISA: // ಠ_ಠ - if (record->event.pressed) { - send_unicode_hex_string("0CA0 005F 0CA0"); - } - break; |