diff options
author | William Chang <william@factual.com> | 2019-05-09 21:16:15 -0700 |
---|---|---|
committer | William Chang <william@factual.com> | 2019-05-09 21:16:15 -0700 |
commit | 9ce186860e78d5afe350636cb7445e18c2577f33 (patch) | |
tree | b7f5dded777a950e63c4dd967260744336bfaa6b /users | |
parent | 57a6ea11df685d84a1ea07953e88f224ce2b24f7 (diff) | |
parent | 4b2d3288d013b1a71ea25402224c4a8225a099e9 (diff) |
Merge branch 'qmk-master'
Diffstat (limited to 'users')
37 files changed, 1533 insertions, 992 deletions
diff --git a/users/drashna/.gitignore b/users/drashna/.gitignore new file mode 100644 index 0000000000..f84d34d907 --- /dev/null +++ b/users/drashna/.gitignore @@ -0,0 +1,3 @@ +secrets.c +secrets.h +drashna_song_list.h
\ No newline at end of file diff --git a/users/drashna/.gitlab-ci.yml b/users/drashna/.gitlab-ci.yml index 9b18d44fb3..679bdf4351 100644 --- a/users/drashna/.gitlab-ci.yml +++ b/users/drashna/.gitlab-ci.yml @@ -1,9 +1,7 @@ stages: - test - - build - - deploy -Tests: +QMK Firmware: stage: test variables: GIT_SUBMODULE_STRATEGY: recursive @@ -12,64 +10,13 @@ Tests: image: ubuntu:18.10 before_script: - apt-get update -qy - - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util gcc gcc-arm-none-eabi gcc-avr git libnewlib-arm-none-eabi unzip wget zip + - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util gcc gcc-arm-none-eabi git libnewlib-arm-none-eabi gcc-avr unzip wget zip - avr-gcc --version - uname -a script: - make test:all - - make planck/rev6:default - -QMK Firmware Defaults: - stage: deploy - variables: - GIT_SUBMODULE_STRATEGY: recursive - tags: - - linux - image: ubuntu:18.10 - before_script: - - apt-get update -qy - - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util gcc gcc-arm-none-eabi gcc-avr git libnewlib-arm-none-eabi unzip wget zip - - avr-gcc --version - - uname -a - script: - - make test:all - - make all:default -j16 - -Drashna Firmware: - stage: build - variables: - GIT_SUBMODULE_STRATEGY: recursive - tags: - - linux - image: ubuntu:18.10 - before_script: - - apt-get update -qy - - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util gcc gcc-arm-none-eabi gcc-avr git libnewlib-arm-none-eabi unzip wget zip - - avr-gcc --version - script: - - make iris/rev2:drashna iris/rev2:drashna_old ergodox_ez:drashna ergodox_ez:drashna_glow viterbi/rev1:drashna orthodox/rev1:drashna orthodox/rev3:drashna crkbd:drashna planck/light:drashna planck/rev6:drashna fractal:drashna - artifacts: - name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" - paths: - - ./*.hex - - ./*.bin - expire_in: 1 month - -Firmware Deploy: - stage: deploy - dependencies: - - Drashna Firmware - variables: - GIT_SUBMODULE_STRATEGY: recursive - tags: - - linux - image: ubuntu:18.10 - before_script: - - apt-get update -qy - - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util gcc gcc-arm-none-eabi gcc-avr git libnewlib-arm-none-eabi unzip wget zip - - avr-gcc --version - script: - - make iris/rev2:drashna:production iris/rev2:drashna_old:production ergodox_ez:drashna ergodox_ez:drashna_glow viterbi/rev1:drashna:production orthodox/rev1:drashna:production orthodox/rev3:drashna:production crkbd:drashna:production planck/light:drashna planck/rev6:drashna fractal:drashna:production + - make planck/rev6:default planck/rev5:default + - make keebio/iris/rev2:drashna keebio/iris/rev2:drashna_old ergodox_ez:drashna ergodox_ez:drashna_glow keebio/viterbi/rev1:drashna orthodox/rev1:drashna orthodox/rev3:drashna crkbd:drashna planck/light:drashna planck/rev6:drashna fractal:drashna primekb/prime_m:drashna -j2 --output-sync artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" paths: diff --git a/users/drashna/config.h b/users/drashna/config.h index 2abd326dac..a6d8e75263 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -2,50 +2,43 @@ #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), \ +# 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 - // #ifdef RGBLIGHT_ENABLE - // #define NO_MUSIC_MODE - // #endif //RGBLIGHT_ENABLE/ - // #ifndef __arm__ - // #undef NOTE_REST - // #define NOTE_REST 1.00f - // #endif // !__arm__ - -#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) + } + +# 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 +# define RGBLIGHT_SLEEP +# undef RGBLIGHT_ANIMATIONS +# define RGBLIGHT_EFFECT_BREATHING +# define RGBLIGHT_EFFECT_SNAKE +# define RGBLIGHT_EFFECT_KNIGHT #endif // RGBLIGHT_ENABLE #ifndef ONESHOT_TAP_TOGGLE - #define ONESHOT_TAP_TOGGLE 2 +# define ONESHOT_TAP_TOGGLE 2 #endif // !ONESHOT_TAP_TOGGLE #ifndef ONESHOT_TIMEOUT - #define ONESHOT_TIMEOUT 3000 +# define ONESHOT_TIMEOUT 3000 #endif// !ONESHOT_TIMEOUT #ifndef QMK_KEYS_PER_SCAN - #define QMK_KEYS_PER_SCAN 4 +# define QMK_KEYS_PER_SCAN 4 #endif // !QMK_KEYS_PER_SCAN @@ -62,24 +55,27 @@ #define FORCE_NKRO #ifndef TAPPING_TOGGLE - #define TAPPING_TOGGLE 1 +# define TAPPING_TOGGLE 1 #endif #ifdef TAPPING_TERM - #undef 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 -// Disable action_get_macro and fn_actions, since we don't use these -// and it saves on space in the firmware. -#define NO_ACTION_MACRO -#define NO_ACTION_FUNCTION +#define TAP_CODE_DELAY 5 -#define MACRO_TIMER 5 +/* Disable unused and unneeded features to reduce on firmware size */ +#ifdef LOCKING_SUPPORT_ENABLE +# undef LOCKING_SUPPORT_ENABLE +#endif +#ifdef LOCKING_RESYNC_ENABLE +# undef LOCKING_RESYNC_ENABLE +#endif diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 6968a4b928..7c60a2e4a5 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -19,82 +19,78 @@ 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 + #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; - } else { - keycode = KC_ENTER; + if (!record->event.pressed || override) { + uint16_t keycode; + if (userspace_config.is_overwatch) { + keycode = KC_BSPC; + } else { + keycode = KC_ENTER; + } + clear_keyboard(); + tap_code(keycode); + wait_ms(TAP_CODE_DELAY); + send_string_with_delay(str, TAP_CODE_DELAY); + wait_ms(TAP_CODE_DELAY); + tap_code(KC_ENTER); } - clear_keyboard(); - tap_code(keycode); - wait_ms(50); - send_string_with_delay(str, MACRO_TIMER); - wait_ms(50); - tap_code(KC_ENTER); - } - if (override) wait_ms(3000); - return false; + if (override) wait_ms(3000); + return false; } 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(); - } else { - if (timer_elapsed(this_timer) < TAPPING_TERM){ - register_code(code); - unregister_code(code); - } else { - register_code(mod_code); - register_code(code); - unregister_code(code); - unregister_code(mod_code); - } - } - return false; + static uint16_t this_timer; + if(pressed) { + this_timer= timer_read(); + } else { + if (timer_elapsed(this_timer) < TAPPING_TERM){ + tap_code(code); + } else { + register_code(mod_code); + tap_code(code); + unregister_code(mod_code); + } + } + 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(); - } else { - if (timer_elapsed(this_timer) < TAPPING_TERM){ - register_code(code); - unregister_code(code); - } else { - register_code(mod_code); - register_code(code); - unregister_code(code); - unregister_code(mod_code); - } - } - return false; + if(pressed) { + this_timer= timer_read(); + } else { + if (timer_elapsed(this_timer) < TAPPING_TERM){ + tap_code(code); + } else { + register_code(mod_code); + tap_code(code); + unregister_code(mod_code); + } + } + return false; } 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 - matrix_scan(); - if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) { - bootloader_jump(); - } + 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 + matrix_scan(); + if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) { + bootloader_jump(); + } } // Add reconfigurable functions here, for keymap customization @@ -107,21 +103,21 @@ void matrix_init_keymap(void) {} // Call user matrix init, set default RGB colors and then // call the keymap's init function void matrix_init_user(void) { - userspace_config.raw = eeconfig_read_user(); + 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 - matrix_init_keymap(); + #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)) @@ -129,26 +125,26 @@ void keyboard_post_init_keymap(void){ } void keyboard_post_init_user(void){ #ifdef RGBLIGHT_ENABLE - keyboard_post_init_rgb(); + keyboard_post_init_rgb(); #endif - keyboard_post_init_keymap(); + keyboard_post_init_keymap(); } __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 - shutdown_keymap(); + #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)) @@ -162,7 +158,7 @@ __attribute__ ((weak)) void suspend_wakeup_init_keymap(void) {} void suspend_wakeup_init_user(void) { - suspend_wakeup_init_keymap(); + suspend_wakeup_init_keymap(); } @@ -172,54 +168,54 @@ void matrix_scan_keymap(void) {} // No global matrix scan code, so just run keymap's matrix // scan function void matrix_scan_user(void) { - static bool has_ran_yet; - if (!has_ran_yet) { - has_ran_yet = true; - startup_user(); - } + 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(); + run_diablo_macro_check(); #endif // TAP_DANCE_ENABLE #ifdef RGBLIGHT_ENABLE - matrix_scan_rgb(); + matrix_scan_rgb(); #endif // RGBLIGHT_ENABLE - matrix_scan_keymap(); + matrix_scan_keymap(); } __attribute__ ((weak)) uint32_t layer_state_set_keymap (uint32_t state) { - return state; + return state; } // on layer change, no matter where the change was initiated // Then runs keymap's layer change check uint32_t layer_state_set_user(uint32_t state) { - state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); + state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); #ifdef RGBLIGHT_ENABLE - state = layer_state_set_rgb(state); + state = layer_state_set_rgb(state); #endif // RGBLIGHT_ENABLE - return layer_state_set_keymap (state); + return layer_state_set_keymap (state); } __attribute__ ((weak)) uint32_t default_layer_state_set_keymap (uint32_t state) { - return state; + return state; } // Runs state check and changes underglow color and animation uint32_t default_layer_state_set_user(uint32_t state) { - state = default_layer_state_set_keymap(state); + state = default_layer_state_set_keymap(state); #if 0 #ifdef RGBLIGHT_ENABLE state = default_layer_state_set_rgb(state); #endif // RGBLIGHT_ENABLE #endif - return state; + return state; } __attribute__ ((weak)) @@ -229,16 +225,16 @@ void led_set_keymap(uint8_t usb_led) {} // So far, I only have keyboard specific code, // So nothing goes here. void led_set_user(uint8_t usb_led) { - led_set_keymap(usb_led); + led_set_keymap(usb_led); } __attribute__ ((weak)) void eeconfig_init_keymap(void) {} void eeconfig_init_user(void) { - userspace_config.raw = 0; - userspace_config.rgb_layer_change = true; - eeconfig_update_user(userspace_config.raw); + 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)) set_unicode_input_mode(DRASHNA_UNICODE_MODE); get_unicode_input_mode(); diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index c19b189434..5df67792a5 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -22,32 +22,36 @@ 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" +# include "tap_dances.h" #endif // TAP_DANCE_ENABLE #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) - #include "rgb_stuff.h" +# include "rgb_stuff.h" +#endif +#if defined(AUDIO_ENABLE) && __GNUC__ > 7 +# if __has_include("drashna_song_list.h") +# include "drashna_song_list.h" +# endif #endif - /* Define layer names */ enum userspace_layers { - _QWERTY = 0, - _NUMLOCK = 0, - _COLEMAK, - _DVORAK, - _WORKMAN, - _NORMAN, - _MALTRON, - _EUCALYN, - _CARPLAX, - _MODS, /* layer 8 */ - _GAMEPAD, - _DIABLO, - _MACROS, - _MEDIA, - _LOWER, - _RAISE, - _ADJUST, + _QWERTY = 0, + _NUMLOCK = 0, + _COLEMAK, + _DVORAK, + _WORKMAN, + _NORMAN, + _MALTRON, + _EUCALYN, + _CARPLAX, + _MODS, /* layer 8 */ + _GAMEPAD, + _DIABLO, + _MACROS, + _MEDIA, + _LOWER, + _RAISE, + _ADJUST, }; /* @@ -69,14 +73,14 @@ 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; - }; + 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; + }; } userspace_config_t; extern userspace_config_t userspace_config; @@ -88,13 +92,13 @@ 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) +# 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 +# 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 2d9025b375..a5487b5855 100644 --- a/users/drashna/process_records.c +++ b/users/drashna/process_records.c @@ -4,12 +4,12 @@ uint16_t copy_paste_timer; __attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - return true; + return true; } __attribute__ ((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { - return true; + return true; } // Defines actions tor my global custom keycodes. Defined in drashna.h file @@ -18,142 +18,140 @@ 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 #ifdef KEYLOGGER_ENABLE - #if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_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 +# 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; + switch (keycode) { + 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), MACRO_TIMER); + 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"), MACRO_TIMER); - #elif defined(BOOTLOADER_DFU) - send_string_with_delay_P(PSTR(":dfu"), MACRO_TIMER); - #elif defined(BOOTLOADER_HALFKAY) - send_string_with_delay_P(PSTR(":teensy"), MACRO_TIMER); - #elif defined(BOOTLOADER_CATERINA) - send_string_with_delay_P(PSTR(":avrdude"), MACRO_TIMER); - #endif // bootloader options - } - if ( ( temp_mod | temp_osm ) & MOD_MASK_CTRL) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), MACRO_TIMER); } - send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), MACRO_TIMER); - set_mods(temp_mod); - set_oneshot_mods(temp_osm); - } - break; + { + #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); } + send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), 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), MACRO_TIMER); - } - 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); } + 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); + 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); + 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_key_time[dtime] = diablo_times[0]; - } - } + if (record->event.pressed) { + uint8_t dtime; + for (dtime = 0; dtime < 4; dtime++) { + diablo_timer[dtime].key_time = diablo_times[0]; + } + } #endif // TAP_DANCE_ENABLE - break; + break; 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); - } - } - break; + 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); + } + } + 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; + 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; #endif - } - return process_record_keymap(keycode, record) && + } + return process_record_keymap(keycode, record) && #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) - process_record_user_rgb(keycode, record) && + process_record_user_rgb(keycode, record) && #endif // RGBLIGHT_ENABLE - process_record_secrets(keycode, record); + process_record_secrets(keycode, record); } diff --git a/users/drashna/process_records.h b/users/drashna/process_records.h index f7f2193ec6..35adec84cc 100644 --- a/users/drashna/process_records.h +++ b/users/drashna/process_records.h @@ -2,48 +2,48 @@ #include "drashna.h" #if defined(KEYMAP_SAFE_RANGE) - #define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE +# define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE #else - #define PLACEHOLDER_SAFE_RANGE SAFE_RANGE +# define PLACEHOLDER_SAFE_RANGE SAFE_RANGE #endif enum userspace_custom_keycodes { - VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info - KC_QWERTY, // Sets default layer to QWERTY - KC_COLEMAK, // Sets default layer to COLEMAK - KC_DVORAK, // Sets default layer to DVORAK - KC_WORKMAN, // Sets default layer to WORKMAN - KC_NORMAN, // Sets default layer to NORMAN - KC_MALTRON, // Sets default layer to MALTRON - KC_EUCALYN, // Sets default layer to EUCALYN - KC_CARPLAX, // Sets default layer to CARPLAX - KC_DIABLO_CLEAR, // Clears all Diablo Timers - KC_OVERWATCH, // Toggles game macro input mode (so in OW, it defaults to game chat) - KC_SALT, // See drashna.c for details - KC_MORESALT, - KC_SALTHARD, - KC_GOODGAME, - KC_SYMM, - KC_JUSTGAME, - KC_GLHF, - KC_TORB, - KC_AIM, - KC_C9, - KC_GGEZ, - KC_MAKE, // Run keyboard's customized make command - KC_RGB_T, // Toggles RGB Layer Indication mode - KC_SECRET_1, // test1 - KC_SECRET_2, // test2 - KC_SECRET_3, // test3 - KC_SECRET_4, // test4 - KC_SECRET_5, // test5 - KC_CCCV, // Hold to copy, tap to paste - KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! - UC_FLIP, // (ಠ痊ಠ)┻━┻ - UC_TABL, // ┬─┬ノ( º _ ºノ) - UC_SHRG, // ¯\_(ツ)_/¯ - UC_DISA, // ಠ_ಠ - NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes + VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info + KC_QWERTY, // Sets default layer to QWERTY + KC_COLEMAK, // Sets default layer to COLEMAK + KC_DVORAK, // Sets default layer to DVORAK + KC_WORKMAN, // Sets default layer to WORKMAN + KC_NORMAN, // Sets default layer to NORMAN + KC_MALTRON, // Sets default layer to MALTRON + KC_EUCALYN, // Sets default layer to EUCALYN + KC_CARPLAX, // Sets default layer to CARPLAX + KC_DIABLO_CLEAR, // Clears all Diablo Timers + KC_OVERWATCH, // Toggles game macro input mode (so in OW, it defaults to game chat) + KC_SALT, // See drashna.c for details + KC_MORESALT, + KC_SALTHARD, + KC_GOODGAME, + KC_SYMM, + KC_JUSTGAME, + KC_GLHF, + KC_TORB, + KC_AIM, + KC_C9, + KC_GGEZ, + KC_MAKE, // Run keyboard's customized make command + KC_RGB_T, // Toggles RGB Layer Indication mode + KC_SECRET_1, // test1 + KC_SECRET_2, // test2 + KC_SECRET_3, // test3 + KC_SECRET_4, // test4 + KC_SECRET_5, // test5 + KC_CCCV, // Hold to copy, tap to paste + KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! + UC_FLIP, // (ಠ痊ಠ)┻━┻ + UC_TABL, // ┬─┬ノ( º _ ºノ) + UC_SHRG, // ¯\_(ツ)_/¯ + UC_DISA, // ಠ_ಠ + NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes }; bool process_record_secrets(uint16_t keycode, keyrecord_t *record); @@ -56,6 +56,8 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record); #define ADJUST MO(_ADJUST) #define TG_MODS TG(_MODS) #define TG_GAME TG(_GAMEPAD) +#define OS_LWR OSL(_LOWER) +#define OS_RSE OSL(_RAISE) #define KC_SEC1 KC_SECRET_1 #define KC_SEC2 KC_SECRET_2 diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index a98ad590cc..38e86ae0ea 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -11,80 +11,80 @@ extern rgb_config_t rgb_matrix_config; #ifdef RGBLIGHT_ENABLE void rgblight_sethsv_default_helper(uint8_t index) { - rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, index); + rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, index); } #endif // RGBLIGHT_ENABLE #ifdef INDICATOR_LIGHTS void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { - if (userspace_config.rgb_layer_change && biton32(layer_state) == 0) { - if ( (this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1<<USB_LED_CAPS_LOCK) ) { - #ifdef SHFT_LED1 - rgblight_sethsv_at(120, 255, 255, SHFT_LED1); - #endif // SHFT_LED1 - #ifdef SHFT_LED2 - rgblight_sethsv_at(120, 255, 255, SHFT_LED2); - #endif // SHFT_LED2 - } else { - #ifdef SHFT_LED1 - rgblight_sethsv_default_helper(SHFT_LED1); - #endif // SHFT_LED1 - #ifdef SHFT_LED2 - rgblight_sethsv_default_helper(SHFT_LED2); - #endif // SHFT_LED2 - } - if ( (this_mod | this_osm) & MOD_MASK_CTRL) { - #ifdef CTRL_LED1 - rgblight_sethsv_at(0, 255, 255, CTRL_LED1); - #endif // CTRL_LED1 - #ifdef CTRL_LED2 - rgblight_sethsv_at(0, 255, 255, CTRL_LED2); - #endif // CTRL_LED2 - } else { - #ifdef CTRL_LED1 - rgblight_sethsv_default_helper(CTRL_LED1); - #endif // CTRL_LED1 - #ifdef CTRL_LED2 - rgblight_sethsv_default_helper(CTRL_LED2); - #endif // CTRL_LED2 - } - if ( (this_mod | this_osm) & MOD_MASK_GUI) { - #ifdef GUI_LED1 - rgblight_sethsv_at(51, 255, 255, GUI_LED1); - #endif // GUI_LED1 - #ifdef GUI_LED2 - rgblight_sethsv_at(51, 255, 255, GUI_LED2); - #endif // GUI_LED2 - } else { - #ifdef GUI_LED1 - rgblight_sethsv_default_helper(GUI_LED1); - #endif // GUI_LED1 - #ifdef GUI_LED2 - rgblight_sethsv_default_helper(GUI_LED2); - #endif // GUI_LED2 - } - if ( (this_mod | this_osm) & MOD_MASK_ALT) { - #ifdef ALT_LED1 - rgblight_sethsv_at(240, 255, 255, ALT_LED1); - #endif // ALT_LED1 - #ifdef GUI_LED2 - rgblight_sethsv_at(240, 255, 255, ALT_LED2); - #endif // GUI_LED2 - } else { - #ifdef GUI_LED1 - rgblight_sethsv_default_helper(ALT_LED1); - #endif // GUI_LED1 - #ifdef GUI_LED2 - rgblight_sethsv_default_helper(ALT_LED2); - #endif // GUI_LED2 + if (userspace_config.rgb_layer_change && biton32(layer_state) == 0) { + if ( (this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1<<USB_LED_CAPS_LOCK) ) { + #ifdef SHFT_LED1 + rgblight_sethsv_at(120, 255, 255, SHFT_LED1); + #endif // SHFT_LED1 + #ifdef SHFT_LED2 + rgblight_sethsv_at(120, 255, 255, SHFT_LED2); + #endif // SHFT_LED2 + } else { + #ifdef SHFT_LED1 + rgblight_sethsv_default_helper(SHFT_LED1); + #endif // SHFT_LED1 + #ifdef SHFT_LED2 + rgblight_sethsv_default_helper(SHFT_LED2); + #endif // SHFT_LED2 + } + if ( (this_mod | this_osm) & MOD_MASK_CTRL) { + #ifdef CTRL_LED1 + rgblight_sethsv_at(0, 255, 255, CTRL_LED1); + #endif // CTRL_LED1 + #ifdef CTRL_LED2 + rgblight_sethsv_at(0, 255, 255, CTRL_LED2); + #endif // CTRL_LED2 + } else { + #ifdef CTRL_LED1 + rgblight_sethsv_default_helper(CTRL_LED1); + #endif // CTRL_LED1 + #ifdef CTRL_LED2 + rgblight_sethsv_default_helper(CTRL_LED2); + #endif // CTRL_LED2 + } + if ( (this_mod | this_osm) & MOD_MASK_GUI) { + #ifdef GUI_LED1 + rgblight_sethsv_at(51, 255, 255, GUI_LED1); + #endif // GUI_LED1 + #ifdef GUI_LED2 + rgblight_sethsv_at(51, 255, 255, GUI_LED2); + #endif // GUI_LED2 + } else { + #ifdef GUI_LED1 + rgblight_sethsv_default_helper(GUI_LED1); + #endif // GUI_LED1 + #ifdef GUI_LED2 + rgblight_sethsv_default_helper(GUI_LED2); + #endif // GUI_LED2 + } + if ( (this_mod | this_osm) & MOD_MASK_ALT) { + #ifdef ALT_LED1 + rgblight_sethsv_at(240, 255, 255, ALT_LED1); + #endif // ALT_LED1 + #ifdef GUI_LED2 + rgblight_sethsv_at(240, 255, 255, ALT_LED2); + #endif // GUI_LED2 + } else { + #ifdef GUI_LED1 + rgblight_sethsv_default_helper(ALT_LED1); + #endif // GUI_LED1 + #ifdef GUI_LED2 + rgblight_sethsv_default_helper(ALT_LED2); + #endif // GUI_LED2 + } } - } } void matrix_scan_indicator(void) { - if (has_initialized) { - set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); - } + if (has_initialized) { + set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); + } } #endif //INDICATOR_LIGHTS @@ -95,69 +95,71 @@ __attribute__ ((weak)) bool rgblight_twinkle_is_led_used_keymap(uint8_t index) { return false; } bool rgblight_twinkle_is_led_used(uint8_t index) { - switch (index) { + switch (index) { #ifdef INDICATOR_LIGHTS #ifdef SHFT_LED1 - case SHFT_LED1: - return true; + case SHFT_LED1: + return true; #endif //SHFT_LED1 #ifdef SHFT_LED2 - case SHFT_LED2: - return true; + case SHFT_LED2: + return true; #endif //SHFT_LED2 #ifdef CTRL_LED1 - case CTRL_LED1: - return true; + case CTRL_LED1: + return true; #endif //CTRL_LED1 #ifdef CTRL_LED2 - case CTRL_LED2: - return true; + case CTRL_LED2: + return true; #endif //CTRL_LED2 #ifdef GUI_LED1 - case GUI_LED1: - return true; + case GUI_LED1: + return true; #endif //GUI_LED1 #ifdef GUI_LED2 - case GUI_LED2: - return true; + case GUI_LED2: + return true; #endif //GUI_LED2 #ifdef ALT_LED1 - case ALT_LED1: - return true; + case ALT_LED1: + return true; #endif //ALT_LED1 #ifdef ALT_LED2 - case ALT_LED2: - return true; + case ALT_LED2: + return true; #endif //ALT_LED2 #endif //INDICATOR_LIGHTS - default: - return rgblight_twinkle_is_led_used_keymap(index); + default: + return rgblight_twinkle_is_led_used_keymap(index); } } void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive - bool litup = false; - for (uint8_t light_index = 0 ; light_index < RGBLED_NUM ; ++light_index ) { - if (lights[light_index].enabled && timer_elapsed(lights[light_index].timer) > 10) { - rgblight_fadeout *light = &lights[light_index]; - litup = true; + bool litup = false; + for (uint8_t light_index = 0 ; light_index < RGBLED_NUM ; ++light_index ) { + if (lights[light_index].enabled && timer_elapsed(lights[light_index].timer) > 10) { + rgblight_fadeout *light = &lights[light_index]; + litup = true; - if (light->life) { - light->life -= 1; - if (biton32(layer_state) == 0) { - sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]); + if (light->life) { + light->life -= 1; + if (biton32(layer_state) == 0) { + sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]); + } + light->timer = timer_read(); + } + else { + if (light->enabled && biton32(layer_state) == 0) { + rgblight_sethsv_default_helper(light_index); + } + litup = light->enabled = false; + } } - light->timer = timer_read(); - } - else { - if (light->enabled && biton32(layer_state) == 0) { rgblight_sethsv_default_helper(light_index); } - litup = light->enabled = false; - } } - } - if (litup && biton32(layer_state) == 0) { - rgblight_set(); - } + if (litup && biton32(layer_state) == 0) { + rgblight_set(); + } } void start_rgb_light(void) { @@ -203,42 +205,42 @@ void start_rgb_light(void) { bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { - if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { - keycode = keycode & 0xFF; - } - switch (keycode) { + if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { + keycode = keycode & 0xFF; + } + switch (keycode) { #ifdef RGBLIGHT_TWINKLE - case KC_A ... KC_SLASH: - case KC_F1 ... KC_F12: - case KC_INSERT ... KC_UP: - case KC_KP_SLASH ... KC_KP_DOT: - case KC_F13 ... KC_F24: - case KC_AUDIO_MUTE ... KC_MEDIA_REWIND: - if (record->event.pressed) { start_rgb_light(); } - return true; break; + case KC_A ... KC_SLASH: + case KC_F1 ... KC_F12: + case KC_INSERT ... KC_UP: + case KC_KP_SLASH ... KC_KP_DOT: + case KC_F13 ... KC_F24: + case KC_AUDIO_MUTE ... KC_MEDIA_REWIND: + if (record->event.pressed) { start_rgb_light(); } + return true; break; #endif // RGBLIGHT_TWINKLE - case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal + case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) - if (record->event.pressed) { - userspace_config.rgb_layer_change ^= 1; - xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); - eeconfig_update_user(userspace_config.raw); - if (userspace_config.rgb_layer_change) { - layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) - } - } + if (record->event.pressed) { + userspace_config.rgb_layer_change ^= 1; + xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); + eeconfig_update_user(userspace_config.raw); + if (userspace_config.rgb_layer_change) { + layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) + } + } #endif // RGBLIGHT_ENABLE - return false; break; + return false; break; #ifdef RGBLIGHT_ENABLE - case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions - if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled - if (userspace_config.rgb_layer_change) { - userspace_config.rgb_layer_change = false; - xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); - eeconfig_update_user(userspace_config.raw); - } - } - return true; break; + case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions + if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled + if (userspace_config.rgb_layer_change) { + userspace_config.rgb_layer_change = false; + xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); + eeconfig_update_user(userspace_config.raw); + } + } + return true; break; #endif // RGBLIGHT_ENABLE } return true; @@ -247,26 +249,29 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { void keyboard_post_init_rgb(void) { -#ifdef RGBLIGHT_ENABLE - rgblight_enable_noeeprom(); - layer_state_set_user(layer_state); - uint16_t old_hue = rgblight_config.hue; - rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); - for (uint16_t i = 360; i > 0; i--) { - rgblight_sethsv_noeeprom( ( i + old_hue) % 360, 255, 255); - wait_ms(10); - } - layer_state_set_user(layer_state); +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_STARTUP_ANIMATION) + if (userspace_config.rgb_layer_change) { rgblight_enable_noeeprom(); } + if (rgblight_config.enable) { + layer_state_set_user(layer_state); + uint16_t old_hue = rgblight_config.hue; + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + for (uint16_t i = 255; i > 0; i--) { + rgblight_sethsv_noeeprom( ( i + old_hue) % 255, 255, 255); + matrix_scan(); + wait_ms(10); + } + } #endif + layer_state_set_user(layer_state); } void matrix_scan_rgb(void) { #ifdef RGBLIGHT_TWINKLE - scan_rgblight_fadeout(); + scan_rgblight_fadeout(); #endif // RGBLIGHT_ENABLE #ifdef INDICATOR_LIGHTS - matrix_scan_indicator(); + matrix_scan_indicator(); #endif } @@ -274,99 +279,60 @@ void matrix_scan_rgb(void) { uint32_t layer_state_set_rgb(uint32_t state) { #ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { - switch (biton32(state)) { - case _MACROS: - rgblight_sethsv_noeeprom_orange(); - userspace_config.is_overwatch ? rgblight_effect_snake(RGBLIGHT_MODE_SNAKE + 2) : rgblight_effect_snake(RGBLIGHT_MODE_SNAKE + 3); - break; - case _MEDIA: - rgblight_sethsv_noeeprom_chartreuse(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 1); - break; - case _GAMEPAD: - rgblight_sethsv_noeeprom_orange(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 2); - break; - case _DIABLO: - rgblight_sethsv_noeeprom_red(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); - break; - case _RAISE: - rgblight_sethsv_noeeprom_yellow(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); - break; - case _LOWER: - rgblight_sethsv_noeeprom_green(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); - break; - case _ADJUST: - rgblight_sethsv_noeeprom_red(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2); - break; - default: // for any other layers, or the default layer - switch (biton32(default_layer_state)) { - case _COLEMAK: - rgblight_sethsv_noeeprom_magenta(); break; - case _DVORAK: - rgblight_sethsv_noeeprom_springgreen(); break; - case _WORKMAN: - rgblight_sethsv_noeeprom_goldenrod(); break; - case _NORMAN: - rgblight_sethsv_noeeprom_coral(); break; - case _MALTRON: - rgblight_sethsv_noeeprom_yellow(); break; - case _EUCALYN: - rgblight_sethsv_noeeprom_pink(); break; - case _CARPLAX: - rgblight_sethsv_noeeprom_blue(); break; - default: - rgblight_sethsv_noeeprom_cyan(); break; - } - biton32(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it - break; + if (userspace_config.rgb_layer_change) { + switch (biton32(state)) { + case _MACROS: + rgblight_sethsv_noeeprom_orange(); + userspace_config.is_overwatch ? rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 2) : rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 3); + break; + case _MEDIA: + rgblight_sethsv_noeeprom_chartreuse(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 1); + break; + case _GAMEPAD: + rgblight_sethsv_noeeprom_orange(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 2); + break; + case _DIABLO: + rgblight_sethsv_noeeprom_red(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); + break; + case _RAISE: + rgblight_sethsv_noeeprom_yellow(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); + break; + case _LOWER: + rgblight_sethsv_noeeprom_green(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); + break; + case _ADJUST: + rgblight_sethsv_noeeprom_red(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2); + break; + default: // for any other layers, or the default layer + switch (biton32(default_layer_state)) { + case _COLEMAK: + rgblight_sethsv_noeeprom_magenta(); break; + case _DVORAK: + rgblight_sethsv_noeeprom_springgreen(); break; + case _WORKMAN: + rgblight_sethsv_noeeprom_goldenrod(); break; + case _NORMAN: + rgblight_sethsv_noeeprom_coral(); break; + case _MALTRON: + rgblight_sethsv_noeeprom_yellow(); break; + case _EUCALYN: + rgblight_sethsv_noeeprom_pink(); break; + case _CARPLAX: + rgblight_sethsv_noeeprom_blue(); break; + default: + rgblight_sethsv_noeeprom_cyan(); break; + } + biton32(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it + break; + } } -// layer_state_set_indicator(); // Runs every scan, so need to call this here .... since I can't get it working "right" anyhow - } #endif // RGBLIGHT_ENABLE - return state; + return state; } - -#if 0 -uint32_t default_layer_state_set_rgb(uint32_t state) { -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { - rgblight_config_t temp_rgblight_config = rgblight_config; - switch (biton32(state)) { - case _COLEMAK: - temp_rgblight_config.hue = 300; - temp_rgblight_config.val = 255; - temp_rgblight_config.sat = 255; - temp_rgblight_config.mode = 1; - break; - case _DVORAK: - temp_rgblight_config.hue = 150; - temp_rgblight_config.val = 255; - temp_rgblight_config.sat = 255; - temp_rgblight_config.mode = 1; - case _WORKMAN: - temp_rgblight_config.hue = 43; - temp_rgblight_config.val = 218; - temp_rgblight_config.sat = 218; - temp_rgblight_config.mode = 1; - default: - temp_rgblight_config.hue = 180; - temp_rgblight_config.val = 255; - temp_rgblight_config.sat = 255; - temp_rgblight_config.mode = 1; - } - if (temp_rgblight_config.raw != eeconfig_read_rgblight()) { - xprintf("rgblight set default layer hsv [EEPROM]: %u,%u,%u,%u\n", temp_rgblight_config.hue, temp_rgblight_config.sat, temp_rgblight_config.val, temp_rgblight_config.mode); - eeconfig_update_rgblight(temp_rgblight_config.raw); - } - } -#endif // RGBLIGHT_ENABLE - return state; -} -#endif diff --git a/users/drashna/rgblight_breathe_table.h b/users/drashna/rgblight_breathe_table.h new file mode 100644 index 0000000000..05d347fcd3 --- /dev/null +++ b/users/drashna/rgblight_breathe_table.h @@ -0,0 +1,116 @@ +#ifndef RGBLIGHT_EFFECT_BREATHE_TABLE +#define RGBLIGHT_EFFECT_BREATHE_TABLE + +const uint8_t rgblight_effect_breathe_table[] PROGMEM = { + /* #define RGBLIGHT_EFFECT_BREATHE_CENTER 0.00 */ + /* #define RGBLIGHT_EFFECT_BREATHE_MAX 255 */ + + #if RGBLIGHT_BREATHE_TABLE_SIZE == 256 + 0x44, 0x45, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x4e, + 0x4f, 0x51, 0x52, 0x54, 0x55, 0x57, 0x58, 0x5a, + 0x5c, 0x5d, 0x5f, 0x60, 0x62, 0x64, 0x65, 0x67, + 0x69, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x73, 0x75, + 0x77, 0x79, 0x7b, 0x7c, 0x7e, 0x80, 0x82, 0x84, + 0x86, 0x88, 0x8a, 0x8b, 0x8d, 0x8f, 0x91, 0x93, + 0x95, 0x97, 0x99, 0x9b, 0x9d, 0x9f, 0xa1, 0xa3, + 0xa5, 0xa7, 0xa9, 0xaa, 0xac, 0xae, 0xb0, 0xb2, + 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, 0xbf, 0xc1, + 0xc3, 0xc5, 0xc7, 0xc9, 0xca, 0xcc, 0xce, 0xd0, + 0xd1, 0xd3, 0xd5, 0xd6, 0xd8, 0xda, 0xdb, 0xdd, + 0xde, 0xe0, 0xe1, 0xe3, 0xe4, 0xe5, 0xe7, 0xe8, + 0xe9, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, + 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf8, + 0xf9, 0xfa, 0xfa, 0xfb, 0xfc, 0xfc, 0xfc, 0xfd, + 0xfd, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, + 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, + 0xfd, 0xfc, 0xfc, 0xfc, 0xfb, 0xfa, 0xfa, 0xf9, + 0xf8, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, + 0xf1, 0xf0, 0xef, 0xee, 0xed, 0xec, 0xeb, 0xe9, + 0xe8, 0xe7, 0xe5, 0xe4, 0xe3, 0xe1, 0xe0, 0xde, + 0xdd, 0xdb, 0xda, 0xd8, 0xd6, 0xd5, 0xd3, 0xd1, + 0xd0, 0xce, 0xcc, 0xca, 0xc9, 0xc7, 0xc5, 0xc3, + 0xc1, 0xbf, 0xbe, 0xbc, 0xba, 0xb8, 0xb6, 0xb4, + 0xb2, 0xb0, 0xae, 0xac, 0xaa, 0xa9, 0xa7, 0xa5, + 0xa3, 0xa1, 0x9f, 0x9d, 0x9b, 0x99, 0x97, 0x95, + 0x93, 0x91, 0x8f, 0x8d, 0x8b, 0x8a, 0x88, 0x86, + 0x84, 0x82, 0x80, 0x7e, 0x7c, 0x7b, 0x79, 0x77, + 0x75, 0x73, 0x72, 0x70, 0x6e, 0x6c, 0x6a, 0x69, + 0x67, 0x65, 0x64, 0x62, 0x60, 0x5f, 0x5d, 0x5c, + 0x5a, 0x58, 0x57, 0x55, 0x54, 0x52, 0x51, 0x4f, + 0x4e, 0x4c, 0x4b, 0x4a, 0x48, 0x47, 0x45, 0x44 + #endif /* 256 bytes table */ + + #if RGBLIGHT_BREATHE_TABLE_SIZE == 128 + 0x44, 0x47, 0x4a, 0x4c, + 0x4f, 0x52, 0x55, 0x58, + 0x5c, 0x5f, 0x62, 0x65, + 0x69, 0x6c, 0x70, 0x73, + 0x77, 0x7b, 0x7e, 0x82, + 0x86, 0x8a, 0x8d, 0x91, + 0x95, 0x99, 0x9d, 0xa1, + 0xa5, 0xa9, 0xac, 0xb0, + 0xb4, 0xb8, 0xbc, 0xbf, + 0xc3, 0xc7, 0xca, 0xce, + 0xd1, 0xd5, 0xd8, 0xdb, + 0xde, 0xe1, 0xe4, 0xe7, + 0xe9, 0xec, 0xee, 0xf0, + 0xf2, 0xf4, 0xf6, 0xf8, + 0xf9, 0xfa, 0xfc, 0xfc, + 0xfd, 0xfe, 0xfe, 0xfe, + 0xfe, 0xfe, 0xfe, 0xfe, + 0xfd, 0xfc, 0xfb, 0xfa, + 0xf8, 0xf7, 0xf5, 0xf3, + 0xf1, 0xef, 0xed, 0xeb, + 0xe8, 0xe5, 0xe3, 0xe0, + 0xdd, 0xda, 0xd6, 0xd3, + 0xd0, 0xcc, 0xc9, 0xc5, + 0xc1, 0xbe, 0xba, 0xb6, + 0xb2, 0xae, 0xaa, 0xa7, + 0xa3, 0x9f, 0x9b, 0x97, + 0x93, 0x8f, 0x8b, 0x88, + 0x84, 0x80, 0x7c, 0x79, + 0x75, 0x72, 0x6e, 0x6a, + 0x67, 0x64, 0x60, 0x5d, + 0x5a, 0x57, 0x54, 0x51, + 0x4e, 0x4b, 0x48, 0x45 + #endif /* 128 bytes table */ + + #if RGBLIGHT_BREATHE_TABLE_SIZE == 64 + 0x44, 0x4a, + 0x4f, 0x55, + 0x5c, 0x62, + 0x69, 0x70, + 0x77, 0x7e, + 0x86, 0x8d, + 0x95, 0x9d, + 0xa5, 0xac, + 0xb4, 0xbc, + 0xc3, 0xca, + 0xd1, 0xd8, + 0xde, 0xe4, + 0xe9, 0xee, + 0xf2, 0xf6, + 0xf9, 0xfc, + 0xfd, 0xfe, + 0xfe, 0xfe, + 0xfd, 0xfb, + 0xf8, 0xf5, + 0xf1, 0xed, + 0xe8, 0xe3, + 0xdd, 0xd6, + 0xd0, 0xc9, + 0xc1, 0xba, + 0xb2, 0xaa, + 0xa3, 0x9b, + 0x93, 0x8b, + 0x84, 0x7c, + 0x75, 0x6e, + 0x67, 0x60, + 0x5a, 0x54, + 0x4e, 0x48 + #endif /* 64 bytes table */ +}; + +static const int table_scale = 256/sizeof(rgblight_effect_breathe_table); + +#endif /* RGBLIGHT_EFFECT_BREATHE_TABLE */ diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index 5050704a53..085840f1cc 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -1,35 +1,40 @@ SRC += drashna.c \ process_records.c +LINK_TIME_OPTIMIZATION_ENABLE = yes + ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") - SRC += secrets.c + SRC += secrets.c endif ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) - SRC += tap_dances.c + SRC += tap_dances.c endif -EXTRAFLAGS += -flto + ifeq ($(strip $(NO_SECRETS)), yes) OPT_DEFS += -DNO_SECRETS endif ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) - SRC += rgb_stuff.c - ifeq ($(strip $(INDICATOR_LIGHTS)), yes) - OPT_DEFS += -DINDICATOR_LIGHTS - endif - ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes) - OPT_DEFS += -DRGBLIGHT_TWINKLE - endif - ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes) - OPT_DEFS += -DRGBLIGHT_NOEEPROM - endif + SRC += rgb_stuff.c + ifeq ($(strip $(INDICATOR_LIGHTS)), yes) + OPT_DEFS += -DINDICATOR_LIGHTS + endif + ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes) + OPT_DEFS += -DRGBLIGHT_TWINKLE + endif + ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes) + OPT_DEFS += -DRGBLIGHT_NOEEPROM + endif + ifeq ($(strip $(RGBLIGHT_STARTUP_ANIMATION)), yes) + OPT_DEFS += -DRGBLIGHT_STARTUP_ANIMATION + endif endif -ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) - SRC += rgb_stuff.c +ifneq ($(strip $(RGB_MATRIX_ENABLE)), no) + SRC += rgb_stuff.c endif @@ -38,9 +43,9 @@ ifeq ($(strip $(MACROS_ENABLED)), yes) endif ifdef CONSOLE_ENABLE - ifeq ($(strip $(KEYLOGGER_ENABLE)), yes) - OPT_DEFS += -DKEYLOGGER_ENABLE - endif + ifeq ($(strip $(KEYLOGGER_ENABLE)), yes) + OPT_DEFS += -DKEYLOGGER_ENABLE + endif endif ifeq ($(strip $(MAKE_BOOTLOADER)), yes) diff --git a/users/drashna/send_unicode.h b/users/drashna/send_unicode.h index 818b6e571b..743abc58b4 100644 --- a/users/drashna/send_unicode.h +++ b/users/drashna/send_unicode.h @@ -7,65 +7,65 @@ void send_unicode_hex_string(const char* str); /* use X(n) to call the */ #ifdef UNICODEMAP_ENABLE enum unicode_name { - THINK, // thinking face 🤔 - GRIN, // grinning face 😊 - SMRK, // smirk 😏 - WEARY, // good shit 😩 - UNAMU, // unamused 😒 + THINK, // thinking face 🤔 + GRIN, // grinning face 😊 + SMRK, // smirk 😏 + WEARY, // good shit 😩 + UNAMU, // unamused 😒 - SNEK, // snke 🐍 - PENGUIN, // 🐧 - DRAGON, // 🐉 - MONKEY, // 🐒 - CHICK, // 🐥 - BOAR, // 🐗 + SNEK, // snke 🐍 + PENGUIN, // 🐧 + DRAGON, // 🐉 + MONKEY, // 🐒 + CHICK, // 🐥 + BOAR, // 🐗 - OKOK, // 👌 - EFFU, // 🖕 - INUP, // 👆 - THUP, // 👍 - THDN, // 👎 + OKOK, // 👌 + EFFU, // 🖕 + INUP, // 👆 + THUP, // 👍 + THDN, // 👎 - BBB, // dat B 🅱 - POO, // poop 💩 - HUNDR, // 100 💯 - EGGPL, // EGGPLANT 🍆 - WATER, // wet 💦 - TUMBLER, // 🥃 + BBB, // dat B 🅱 + POO, // poop 💩 + HUNDR, // 100 💯 + EGGPL, // EGGPLANT 🍆 + WATER, // wet 💦 + TUMBLER, // 🥃 - LIT, // fire 🔥 - BANG, // ‽ - IRONY, // ⸮ - DEGREE // ° + LIT, // fire 🔥 + BANG, // ‽ + IRONY, // ⸮ + DEGREE // ° }; const uint32_t PROGMEM unicode_map[] = { - [THINK] = 0x1F914, - [GRIN] = 0x1F600, - [BBB] = 0x1F171, - [POO] = 0x1F4A9, - [HUNDR] = 0x1F4AF, - [SMRK] = 0x1F60F, - [WEARY] = 0x1F629, - [EGGPL] = 0x1F346, - [WATER] = 0x1F4A6, - [LIT] = 0x1F525, - [UNAMU] = 0x1F612, - [SNEK] = 0x1F40D, - [PENGUIN] = 0x1F427, - [BOAR] = 0x1F417, - [MONKEY] = 0x1F412, - [CHICK] = 0x1F425, - [DRAGON] = 0x1F409, - [OKOK] = 0x1F44C, - [EFFU] = 0x1F595, - [INUP] = 0x1F446, - [THDN] = 0x1F44E, - [THUP] = 0x1F44D, - [TUMBLER] = 0x1F943, - [BANG] = 0x0203D, - [IRONY] = 0x02E2E, - [DEGREE] = 0x000B0 + [THINK] = 0x1F914, + [GRIN] = 0x1F600, + [BBB] = 0x1F171, + [POO] = 0x1F4A9, + [HUNDR] = 0x1F4AF, + [SMRK] = 0x1F60F, + [WEARY] = 0x1F629, + [EGGPL] = 0x1F346, + [WATER] = 0x1F4A6, + [LIT] = 0x1F525, + [UNAMU] = 0x1F612, + [SNEK] = 0x1F40D, + [PENGUIN] = 0x1F427, + [BOAR] = 0x1F417, + [MONKEY] = 0x1F412, + [CHICK] = 0x1F425, + [DRAGON] = 0x1F409, + [OKOK] = 0x1F44C, + [EFFU] = 0x1F595, + [INUP] = 0x1F446, + [THDN] = 0x1F44E, + [THUP] = 0x1F44D, + [TUMBLER] = 0x1F943, + [BANG] = 0x0203D, + [IRONY] = 0x02E2E, + [DEGREE] = 0x000B0 }; #endif // UNICODEMAP_ENABLE diff --git a/users/drashna/tap_dances.c b/users/drashna/tap_dances.c index cbb3cf54ef..18ca96e187 100644 --- a/users/drashna/tap_dances.c +++ b/users/drashna/tap_dances.c @@ -2,63 +2,64 @@ //define diablo macro timer variables -uint16_t diablo_timer[4]; -uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 }; -uint8_t diablo_key_time[4]; +diablo_timer_t diablo_timer[4]; + +uint8_t diablo_times[] = { 0, 0, 1, 3, 5, 10, 30 }; // has the correct number of seconds elapsed (as defined by diablo_times) -bool check_dtimer(uint8_t dtimer) { return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; }; +bool check_dtimer(uint8_t dtimer) { return (timer_elapsed(diablo_timer[dtimer].key_time) < (diablo_timer[dtimer].timer * 1000)) ? false : true; }; // Cycle through the times for the macro, starting at 0, for disabled. // Max of six values, so don't exceed -void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) { - if (state->count >= 7) { - diablo_key_time[diablo_key] = diablo_times[0]; - reset_tap_dance(state); - } else { - diablo_key_time[diablo_key] = diablo_times[state->count - 1]; - } +void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { + int index = (int)user_data; + if (state->count >= 7) { + diablo_timer[index].key_time = diablo_times[0]; + reset_tap_dance(state); + } else { + diablo_timer[index].key_time = diablo_times[state->count]; + } } -// Would rather have one function for all of this, but no idea how to do that... -void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 0); } -void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 1); } -void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 2); } -void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 3); } +// One funtion to rule them all!! +#define ACTION_TAP_DANCE_DIABLO(arg) { \ + .fn = { NULL, (void *)diablo_tapdance_master, NULL }, \ + .user_data = (void *)arg, \ + } //Tap Dance Definitions qk_tap_dance_action_t tap_dance_actions[] = { - // tap once to disable, and more to enable timed micros - [TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1), - [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2), - [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3), - [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4), + // tap once to disable, and more to enable timed micros + [TD_D3_1] = ACTION_TAP_DANCE_DIABLO(0), + [TD_D3_2] = ACTION_TAP_DANCE_DIABLO(1), + [TD_D3_3] = ACTION_TAP_DANCE_DIABLO(2), + [TD_D3_4] = ACTION_TAP_DANCE_DIABLO(3), }; // Sends the key press to system, but only if on the Diablo layer void send_diablo_keystroke(uint8_t diablo_key) { - if (IS_LAYER_ON(_DIABLO)) { - switch (diablo_key) { - case 0: - tap_code(KC_1); break; - case 1: - tap_code(KC_2); break; - case 2: - tap_code(KC_3); break; - case 3: - tap_code(KC_4); break; + if (IS_LAYER_ON(_DIABLO)) { + switch (diablo_key) { + case 0: + tap_code(KC_1); break; + case 1: + tap_code(KC_2); break; + case 2: + tap_code(KC_3); break; + case 3: + tap_code(KC_4); break; + } } - } } // Checks each of the 4 timers/keys to see if enough time has elapsed // Runs the "send string" command if enough time has passed, and resets the timer. void run_diablo_macro_check(void) { - uint8_t dtime; - for (dtime = 0; dtime < 4; dtime++) { - if (check_dtimer(dtime) && diablo_key_time[dtime]) { - diablo_timer[dtime] = timer_read(); - send_diablo_keystroke(dtime); + uint8_t dtime; + for (dtime = 0; dtime < 4; dtime++) { + if (check_dtimer(dtime) && diablo_timer[dtime].key_time) { + diablo_timer[dtime].timer = timer_read(); + send_diablo_keystroke(dtime); + } } - } } diff --git a/users/drashna/tap_dances.h b/users/drashna/tap_dances.h index 41d2bacb7b..4a293b2582 100644 --- a/users/drashna/tap_dances.h +++ b/users/drashna/tap_dances.h @@ -2,18 +2,21 @@ #include "drashna.h" //define diablo macro timer variables -extern uint16_t diablo_timer[4]; extern uint8_t diablo_times[]; -extern uint8_t diablo_key_time[4]; +typedef struct { + uint16_t timer; + uint8_t key_time; +} diablo_timer_t; +extern diablo_timer_t diablo_timer[4]; void run_diablo_macro_check(void); #ifdef TAP_DANCE_ENABLE enum { - TD_D3_1 = 0, - TD_D3_2, - TD_D3_3, - TD_D3_4 + TD_D3_1 = 0, + TD_D3_2, + TD_D3_3, + TD_D3_4 }; #endif // TAP_DANCE_ENABLE diff --git a/users/drashna/wrappers.h b/users/drashna/wrappers.h index 3260c58ae2..93f842f4b2 100644 --- a/users/drashna/wrappers.h +++ b/users/drashna/wrappers.h @@ -6,7 +6,7 @@ arguments, we need a wrapper in order for these definitions to be expanded before being used as arguments to the LAYOUT_xxx macro. */ #if (!defined(LAYOUT) && defined(KEYMAP)) -#define LAYOUT KEYMAP +# define LAYOUT KEYMAP #endif #define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__) @@ -15,6 +15,7 @@ expanded before being used as arguments to the LAYOUT_xxx macro. #define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) #define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__) #define LAYOUT_ortho_5x12_wrapper(...) LAYOUT_ortho_5x12(__VA_ARGS__) +#define LAYOUT_gergo_wrapper(...) LAYOUT_gergo(__VA_ARGS__) /* Blocks for each of the four major keyboard layouts diff --git a/users/konstantin/config.h b/users/konstantin/config.h index f18c4a70e4..4ca19f8245 100644 --- a/users/konstantin/config.h +++ b/users/konstantin/config.h @@ -19,4 +19,4 @@ #define UNICODE_CYCLE_PERSIST false #define UNICODE_SELECTED_MODES UC_WINC, UC_WIN, UC_LNX -#define UNICODE_WINC_KEY KC_RGUI +#define UNICODE_KEY_WINC KC_RGUI diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c index 753742fa78..9e3caca414 100644 --- a/users/konstantin/konstantin.c +++ b/users/konstantin/konstantin.c @@ -4,107 +4,99 @@ __attribute__((weak)) void keyboard_pre_init_keymap(void) {} void keyboard_pre_init_user(void) { - keyboard_pre_init_keymap(); + keyboard_pre_init_keymap(); } __attribute__((weak)) void eeconfig_init_keymap(void) {} void eeconfig_init_user(void) { - eeconfig_init_keymap(); + eeconfig_init_keymap(); } __attribute__((weak)) void keyboard_post_init_keymap(void) {} void keyboard_post_init_user(void) { - keyboard_post_init_keymap(); + keyboard_post_init_keymap(); } __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - return true; + return true; } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if (!process_record_keymap(keycode, record)) { - return false; - } - -#ifdef LAYER_NUMPAD - void toggle_numpad(void) { - layer_invert(L_NUMPAD); - bool numpad = IS_LAYER_ON(L_NUMPAD), num_lock = IS_HOST_LED_ON(USB_LED_NUM_LOCK); - if (num_lock != numpad) { - tap_code(KC_NLCK); // Toggle Num Lock to match layer state + if (!process_record_keymap(keycode, record)) { + return false; } - } -#endif - switch (keycode) { - case CLEAR: - if (record->event.pressed) { - SEND_STRING(SS_LCTRL("a") SS_TAP(X_DELETE)); - } - return false; + switch (keycode) { + case CLEAR: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL("a") SS_TAP(X_DELETE)); + } + return false; - case DST_P_R: - (record->event.pressed ? register_code16 : unregister_code16)( - (get_mods() & DST_MOD_MASK) ? DST_REM : DST_PRV - ); - return false; + case DST_P_R: + (record->event.pressed ? register_code16 : unregister_code16)( + (get_mods() & DST_MOD_MASK) ? DST_REM : DST_PRV + ); + return false; - case DST_N_A: - (record->event.pressed ? register_code16 : unregister_code16)( - (get_mods() & DST_MOD_MASK) ? DST_ADD : DST_NXT - ); - return false; + case DST_N_A: + (record->event.pressed ? register_code16 : unregister_code16)( + (get_mods() & DST_MOD_MASK) ? DST_ADD : DST_NXT + ); + return false; #ifdef LAYER_FN - static bool fn_lock; - - case FN_FNLK: - if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) { - fn_lock = !IS_LAYER_ON(L_FN); // Fn layer will be toggled after this - } - return true; -#endif + static bool fn_lock; -#ifdef LAYER_NUMPAD - case NUMPAD: - if (record->event.pressed) { - toggle_numpad(); - } - return false; + case FN_FNLK: + if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) { + fn_lock = !IS_LAYER_ON(L_FN); // Fn layer will be toggled after this + } + return true; #endif - case KC_ESC: - if (record->event.pressed) { -#ifdef LAYER_NUMPAD - if (IS_LAYER_ON(L_NUMPAD)) { - toggle_numpad(); - return false; - } + case KC_ESC: + if (record->event.pressed) { +#ifdef LAYER_NUMPAD // Disable Numpad layer before Fn layer + if (IS_LAYER_ON(L_NUMPAD)) { + layer_off(L_NUMPAD); + return false; + } #endif #ifdef LAYER_FN - if (IS_LAYER_ON(L_FN) && fn_lock) { - layer_off(L_FN); - return fn_lock = false; - } + if (IS_LAYER_ON(L_FN) && fn_lock) { + layer_off(L_FN); + return fn_lock = false; + } #endif - } - return true; + } + return true; - default: - return true; - } + default: + return true; + } } __attribute__((weak)) uint32_t layer_state_set_keymap(uint32_t state) { - return state; + return state; } uint32_t layer_state_set_user(uint32_t state) { - return layer_state_set_keymap(state); + state = layer_state_set_keymap(state); + +#ifdef LAYER_NUMPAD + bool numpad = state & 1UL<<L_NUMPAD; + bool num_lock = IS_HOST_LED_ON(USB_LED_NUM_LOCK); + if (numpad != num_lock) { + tap_code(KC_NLCK); // Toggle Num Lock to match Numpad layer state + } +#endif + + return state; } diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h index 0639b93a6d..d43712b965 100644 --- a/users/konstantin/konstantin.h +++ b/users/konstantin/konstantin.h @@ -1,20 +1,25 @@ #pragma once #include "quantum.h" -#if defined(RGBLIGHT_ENABLE) || defined(RGBMATRIX_ENABLE) - #include "rgb.h" +#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) + #include "rgb.h" #endif #ifdef TAP_DANCE_ENABLE - #include "tap_dance.h" + #include "tap_dance.h" #endif #if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) - #include "unicode.h" + #include "unicode.h" #endif #ifdef LAYER_FN - #define FN MO(L_FN) - #define FN_CAPS LT(L_FN, KC_CAPS) - #define FN_FNLK TT(L_FN) + #define FN MO(L_FN) + #define FN_CAPS LT(L_FN, KC_CAPS) + #define FN_ESC LT(L_FN, KC_ESC) + #define FN_FNLK TT(L_FN) +#endif + +#ifdef LAYER_NUMPAD + #define NUMPAD TG(L_NUMPAD) #endif #define KC_SYSR LALT(KC_PSCR) @@ -27,50 +32,49 @@ #define MV_RGHT LCTL(KC_RGHT) #define TOP LCTL(KC_HOME) #define BOTTOM LCTL(KC_END) -#define PRV_TAB LCTL(KC_PGUP) -#define NXT_TAB LCTL(KC_PGDN) +#define TAB_PRV LCTL(KC_PGUP) +#define TAB_NXT LCTL(KC_PGDN) +#define DEL_PRV LCTL(KC_BSPC) +#define DEL_NXT LCTL(KC_DEL) #define DST_ADD LCTL(LGUI(KC_D)) #define DST_REM LCTL(LGUI(KC_F4)) #define DST_PRV LCTL(LGUI(KC_LEFT)) #define DST_NXT LCTL(LGUI(KC_RGHT)) #ifndef DST_MOD_MASK - #define DST_MOD_MASK MOD_MASK_CTRL + #define DST_MOD_MASK MOD_MASK_SHIFT #endif #define LCT_CPS LCTL_T(KC_CAPS) #ifdef SEND_STRING_CLEAN - #undef SEND_STRING - #define SEND_STRING(string) { \ - uint8_t ss_mods = get_mods(); \ - clear_mods(); \ - send_string_P(PSTR(string)); \ - set_mods(ss_mods); \ - } + #undef SEND_STRING + #define SEND_STRING(string) { \ + uint8_t ss_mods = get_mods(); \ + clear_mods(); \ + send_string_P(PSTR(string)); \ + set_mods(ss_mods); \ + } #endif enum keycodes_user { - CLEAR = SAFE_RANGE, - DST_P_R, - DST_N_A, -#ifdef LAYER_NUMPAD - NUMPAD, -#endif + CLEAR = SAFE_RANGE, + DST_P_R, + DST_N_A, - RANGE_KEYMAP, + RANGE_KEYMAP, }; enum layers_user { - L_BASE, + L_BASE, #ifdef LAYER_FN - L_FN, + L_FN, #endif #ifdef LAYER_NUMPAD - L_NUMPAD, + L_NUMPAD, #endif - L_RANGE_KEYMAP, + L_RANGE_KEYMAP, }; void keyboard_pre_init_keymap(void); diff --git a/users/konstantin/rgb.h b/users/konstantin/rgb.h index 53b5821b0e..aed855aa05 100644 --- a/users/konstantin/rgb.h +++ b/users/konstantin/rgb.h @@ -3,15 +3,15 @@ #include "quantum.h" typedef struct { - uint16_t h; // 0–360 - uint8_t s; // 0–255 - uint8_t v; // 0–255 + uint16_t h; // 0–360 + uint8_t s; // 0–255 + uint8_t v; // 0–255 } hsv_t; typedef struct { - uint8_t r; // 0–255 - uint8_t g; // 0–255 - uint8_t b; // 0–255 + uint8_t r; // 0–255 + uint8_t g; // 0–255 + uint8_t b; // 0–255 } rgb_t; extern const hsv_t GODSPEED_BLUE; diff --git a/users/konstantin/rules.mk b/users/konstantin/rules.mk index 6bda030fb0..bf0ab979fb 100644 --- a/users/konstantin/rules.mk +++ b/users/konstantin/rules.mk @@ -1,12 +1,16 @@ SRC += konstantin.c -ifneq (,$(filter yes,$(RGBLIGHT_ENABLE) $(RGB_MATRIX_ENABLE))) # if either is yes - SRC += rgb.c +ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) + SRC += rgb.c +endif +RGB_MATRIX_ENABLE ?= no +ifneq ($(strip $(RGB_MATRIX_ENABLE)), no) + SRC += rgb.c endif ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) - SRC += tap_dance.c + SRC += tap_dance.c endif -ifneq (,$(filter yes,$(UNICODE_ENABLE) $(UNICODEMAP_ENABLE))) # if either is yes - SRC += unicode.c +ifneq (,$(filter yes,$(UNICODE_ENABLE) $(UNICODEMAP_ENABLE))) + SRC += unicode.c endif EXTRAFLAGS += -flto diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c index 0b405939b3..fa43288ce7 100644 --- a/users/konstantin/tap_dance.c +++ b/users/konstantin/tap_dance.c @@ -1,117 +1,117 @@ #include "tap_dance.h" #include "konstantin.h" -#define ACTION_TAP_DANCE_DOUBLE_MOD(mod1, mod2) { \ - .fn = { td_double_mod_each, NULL, td_double_mod_reset }, \ - .user_data = &(qk_tap_dance_pair_t){ mod1, mod2 }, \ - } +#define ACTION_TAP_DANCE_DOUBLE_MOD(mod1, mod2) { \ + .fn = { td_double_mod_each, NULL, td_double_mod_reset }, \ + .user_data = &(qk_tap_dance_pair_t){ mod1, mod2 }, \ + } void td_double_mod_each(qk_tap_dance_state_t *state, void *user_data) { - qk_tap_dance_pair_t *data = (qk_tap_dance_pair_t *)user_data; - - // Single tap → mod1, double tap → mod2, triple tap etc. → mod1+mod2 - if (state->count == 1 || state->count == 3) { - register_code(data->kc1); - } else if (state->count == 2) { - unregister_code(data->kc1); - register_code(data->kc2); - } - // Prevent tap dance from sending the mods as weak mods - state->weak_mods &= ~(MOD_BIT(data->kc1) | MOD_BIT(data->kc2)); + qk_tap_dance_pair_t *data = (qk_tap_dance_pair_t *)user_data; + + // Single tap → mod1, double tap → mod2, triple tap etc. → mod1+mod2 + if (state->count == 1 || state->count == 3) { + register_code(data->kc1); + } else if (state->count == 2) { + unregister_code(data->kc1); + register_code(data->kc2); + } + // Prevent tap dance from sending the mods as weak mods + state->weak_mods &= ~(MOD_BIT(data->kc1) | MOD_BIT(data->kc2)); } void td_double_mod_reset(qk_tap_dance_state_t *state, void *user_data) { - qk_tap_dance_pair_t *data = (qk_tap_dance_pair_t *)user_data; - - if (state->count == 1 || state->count >= 3) { - unregister_code(data->kc1); - } - if (state->count >= 2) { - unregister_code(data->kc2); - } + qk_tap_dance_pair_t *data = (qk_tap_dance_pair_t *)user_data; + + if (state->count == 1 || state->count >= 3) { + unregister_code(data->kc1); + } + if (state->count >= 2) { + unregister_code(data->kc2); + } } -#define ACTION_TAP_DANCE_MOD_LAYER(mod, layer) { \ - .fn = { td_mod_layer_each, NULL, td_mod_layer_reset }, \ - .user_data = &(qk_tap_dance_dual_role_t){ mod, layer }, \ - } +#define ACTION_TAP_DANCE_MOD_LAYER(mod, layer) { \ + .fn = { td_mod_layer_each, NULL, td_mod_layer_reset }, \ + .user_data = &(qk_tap_dance_dual_role_t){ mod, layer }, \ + } void td_mod_layer_each(qk_tap_dance_state_t *state, void *user_data) { - qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data; - - // Single tap → mod, double tap → layer, triple tap etc. → mod+layer - if (state->count == 1 || state->count == 3) { - register_code(data->kc); - } else if (state->count == 2) { - unregister_code(data->kc); - // Prevent tap dance from sending the mod as a weak mod - state->weak_mods &= ~MOD_BIT(data->kc); - layer_on(data->layer); - } + qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data; + + // Single tap → mod, double tap → layer, triple tap etc. → mod+layer + if (state->count == 1 || state->count == 3) { + register_code(data->kc); + } else if (state->count == 2) { + unregister_code(data->kc); + // Prevent tap dance from sending the mod as a weak mod + state->weak_mods &= ~MOD_BIT(data->kc); + layer_on(data->layer); + } } void td_mod_layer_reset(qk_tap_dance_state_t *state, void *user_data) { - qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data; - - if (state->count == 1 || state->count >= 3) { - unregister_code(data->kc); - } - if (state->count >= 2) { - layer_off(data->layer); - } + qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data; + + if (state->count == 1 || state->count >= 3) { + unregister_code(data->kc); + } + if (state->count >= 2) { + layer_off(data->layer); + } } -#define ACTION_TAP_DANCE_LAYER_MOD(layer, mod) { \ - .fn = { td_layer_mod_each, NULL, td_layer_mod_reset }, \ - .user_data = &(qk_tap_dance_layer_mod_t){ layer, mod, 0, 0 }, \ - } +#define ACTION_TAP_DANCE_LAYER_MOD(layer, mod) { \ + .fn = { td_layer_mod_each, NULL, td_layer_mod_reset }, \ + .user_data = &(qk_tap_dance_layer_mod_t){ layer, mod, 0, 0 }, \ + } typedef struct { - uint8_t layer; - uint16_t kc; - bool layer_on; // Layer state when tap dance started - bool started; + uint8_t layer; + uint16_t kc; + bool layer_on; // Layer state when tap dance started + bool started; } qk_tap_dance_layer_mod_t; void td_layer_mod_each(qk_tap_dance_state_t *state, void *user_data) { - qk_tap_dance_layer_mod_t *data = (qk_tap_dance_layer_mod_t *)user_data; - if (!data->started) { - data->layer_on = IS_LAYER_ON(data->layer); - data->started = true; - } - - // Single tap → layer, double tap → mod, triple tap etc. → layer+mod - if (state->count == 1 || state->count == 3) { - layer_on(data->layer); - } else if (state->count == 2) { - if (!data->layer_on) { - layer_off(data->layer); + qk_tap_dance_layer_mod_t *data = (qk_tap_dance_layer_mod_t *)user_data; + if (!data->started) { + data->layer_on = IS_LAYER_ON(data->layer); + data->started = true; + } + + // Single tap → layer, double tap → mod, triple tap etc. → layer+mod + if (state->count == 1 || state->count == 3) { + layer_on(data->layer); + } else if (state->count == 2) { + if (!data->layer_on) { + layer_off(data->layer); + } + register_code(data->kc); } - register_code(data->kc); - } } void td_layer_mod_reset(qk_tap_dance_state_t *state, void *user_data) { - qk_tap_dance_layer_mod_t *data = (qk_tap_dance_layer_mod_t *)user_data; + qk_tap_dance_layer_mod_t *data = (qk_tap_dance_layer_mod_t *)user_data; - if ((state->count == 1 || state->count >= 3) && !data->layer_on) { - layer_off(data->layer); - } - if (state->count >= 2) { - unregister_code(data->kc); - } + if ((state->count == 1 || state->count >= 3) && !data->layer_on) { + layer_off(data->layer); + } + if (state->count >= 2) { + unregister_code(data->kc); + } - data->started = false; + data->started = false; } qk_tap_dance_action_t tap_dance_actions[] = { - [TD_DST_A_R] = ACTION_TAP_DANCE_DOUBLE(DST_ADD, DST_REM), + [TD_DST_A_R] = ACTION_TAP_DANCE_DOUBLE(DST_ADD, DST_REM), - [TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RALT, KC_LALT), - [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RALT, KC_RGUI), - [TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RCTL, KC_RSFT), + [TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RALT, KC_LALT), + [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RALT, KC_RGUI), + [TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RCTL, KC_RSFT), - [TD_LSFT_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_LSFT, L_FN), - [TD_RCTL_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_RCTL, L_FN), - [TD_FN_RCTL] = ACTION_TAP_DANCE_LAYER_MOD(L_FN, KC_RCTL), + [TD_LSFT_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_LSFT, L_FN), + [TD_RCTL_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_RCTL, L_FN), + [TD_FN_RCTL] = ACTION_TAP_DANCE_LAYER_MOD(L_FN, KC_RCTL), }; diff --git a/users/konstantin/tap_dance.h b/users/konstantin/tap_dance.h index ad7c04cb7f..13d682a603 100644 --- a/users/konstantin/tap_dance.h +++ b/users/konstantin/tap_dance.h @@ -13,13 +13,13 @@ #define FN_RCTL TD(TD_FN_RCTL) enum tap_dance { - TD_DST_A_R, + TD_DST_A_R, - TD_RAL_LAL, - TD_RAL_RGU, - TD_RCT_RSF, + TD_RAL_LAL, + TD_RAL_RGU, + TD_RCT_RSF, - TD_LSFT_FN, - TD_RCTL_FN, - TD_FN_RCTL, + TD_LSFT_FN, + TD_RCTL_FN, + TD_FN_RCTL, }; diff --git a/users/konstantin/unicode.c b/users/konstantin/unicode.c index 144c0aaf75..8ef5aaa1ec 100644 --- a/users/konstantin/unicode.c +++ b/users/konstantin/unicode.c @@ -2,6 +2,6 @@ #ifdef UNICODEMAP_ENABLE const uint32_t PROGMEM unicode_map[] = { - FOREACH_UNICODE(UCM_ENTRY) + FOREACH_UNICODE(UCM_ENTRY) }; #endif diff --git a/users/konstantin/unicode.h b/users/konstantin/unicode.h index c8eddabb71..b2616d120b 100644 --- a/users/konstantin/unicode.h +++ b/users/konstantin/unicode.h @@ -3,13 +3,13 @@ #include "quantum.h" #define FOREACH_UNICODE(M) \ - M(COMMA, 0x002C) \ - M(L_PAREN, 0x0028) \ - M(R_PAREN, 0x0029) \ - M(EQUALS, 0x003D) \ - M(TIMES, 0x00D7) \ - M(DIVIDE, 0x00F7) \ - M(MINUS, 0x2212) + M(COMMA, 0x002C) \ + M(L_PAREN, 0x0028) \ + M(R_PAREN, 0x0029) \ + M(EQUALS, 0x003D) \ + M(TIMES, 0x00D7) \ + M(DIVIDE, 0x00F7) \ + M(MINUS, 0x2212) #define UC_KEYCODE(name, code) name = UC(code), @@ -19,16 +19,16 @@ #if defined(UNICODE_ENABLE) enum unicode_keycodes { - FOREACH_UNICODE(UC_KEYCODE) + FOREACH_UNICODE(UC_KEYCODE) }; #elif defined(UNICODEMAP_ENABLE) enum unicode_names { - FOREACH_UNICODE(UCM_NAME) + FOREACH_UNICODE(UCM_NAME) }; extern const uint32_t PROGMEM unicode_map[]; enum unicode_keycodes { - FOREACH_UNICODE(UCM_KEYCODE) + FOREACH_UNICODE(UCM_KEYCODE) }; #endif diff --git a/users/mechmerlin/changelog.md b/users/mechmerlin/changelog.md index ec4b20108f..f1116b2d2b 100644 --- a/users/mechmerlin/changelog.md +++ b/users/mechmerlin/changelog.md @@ -1,6 +1,10 @@ # Changelog All notable changes to my userspace will be documented in this file. +## [0.2.2] - 2019-04-22 +### Fixed +- `config.h` usage of turning on `RGBLIGHT_ENABLE` when it is not enabled on boards other than my two clueboards were causing issues with boards that didn't have RGB underglow on it. + ## [0.2.1] - 2019-03-01 ### Fixed - `config.h` usage of `#ifdef RGBLIGHT_ENABLE` caused problems for other of my boards that had `RGBLIGHT_ENABLE`. diff --git a/users/mechmerlin/config.h b/users/mechmerlin/config.h index 9ca39a12ac..fe8f9c9ffb 100644 --- a/users/mechmerlin/config.h +++ b/users/mechmerlin/config.h @@ -21,17 +21,11 @@ #ifndef RGBLIGHT_ENABLE #define RGBLIGHT_ENABLE #endif - #ifndef AUDIO_CLICKY #define AUDIO_CLICKY #endif - #elif defined(KEYBOARD_clueboard_66_hotswap_gen1) #ifndef AUDIO_CLICKY #define AUDIO_CLICKY #endif -#else - #ifndef RGBLIGHT_ENABLE - #define RGBLIGHT_ENABLE - #endif #endif diff --git a/users/rs/karabiner.json b/users/rs/karabiner.json new file mode 100644 index 0000000000..f5214650ad --- /dev/null +++ b/users/rs/karabiner.json @@ -0,0 +1,154 @@ +{ + "title": "RS", + "rules": [{ + "description": "CapsLock to Escape / Control Mod-Tap", + "manipulators": [{ + "type": "basic", + "from": { + "key_code": "caps_lock", + "modifiers": { + "optional": ["any"] + } + }, + "to": [{"key_code": "left_control"}], + "to_if_alone": [{"key_code": "escape"}] + }] + }, + { + "description": "Right-Shift / Enter Mod-Tap", + "manipulators": [{ + "type": "basic", + "from": { + "key_code": "right_shift", + "modifiers": { + "optional": ["any"] + } + }, + "to": [{"key_code": "right_shift"}], + "to_if_alone": [{"key_code": "return_or_enter"}] + }] + }, + { + "description": "Right-Command / Backspace Mod-Tap", + "manipulators": [{ + "type": "basic", + "from": { + "key_code": "right_command", + "modifiers": { + "optional": ["any"] + } + }, + "to": [{"key_code": "right_command"}], + "to_if_alone": [{"key_code": "delete_or_backspace"}] + }] + }, + { + "description": "Right-Command Accents", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "a", + "modifiers": { + "mandatory": ["right_command"], + "optional": ["left_shift", "right_shift"] + } + }, + "to": [ + {"key_code": "grave_accent_and_tilde", "modifiers": ["left_option"]}, + {"key_code": "a"} + ] + }] + }, + { + "description": "Right Command Navigation", + "manipulators": [{ + "type": "basic", + "from": { + "key_code": "j", + "modifiers": { + "mandatory": ["right_command"], + "optional": ["any"] + } + }, + "to": [{"key_code": "left_arrow"}] + }, + { + "type": "basic", + "from": { + "key_code": "k", + "modifiers": { + "mandatory": ["right_command"], + "optional": ["any"] + } + }, + "to": [{"key_code": "down_arrow"}] + }, + { + "type": "basic", + "from": { + "key_code": "i", + "modifiers": { + "mandatory": ["right_command"], + "optional": ["any"] + } + }, + "to": [{"key_code": "up_arrow"}] + }, + { + "type": "basic", + "from": { + "key_code": "l", + "modifiers": { + "mandatory": ["right_command"], + "optional": ["any"] + } + }, + "to": [{"key_code": "right_arrow"}] + }, + { + "type": "basic", + "from": { + "key_code": "e", + "modifiers": { + "mandatory": ["right_command"], + "optional": ["any"] + } + }, + "to": [{"key_code": "page_up"}] + }, + { + "type": "basic", + "from": { + "key_code": "d", + "modifiers": { + "mandatory": ["right_command"], + "optional": ["any"] + } + }, + "to": [{"key_code": "page_down"}] + }, + { + "type": "basic", + "from": { + "key_code": "s", + "modifiers": { + "mandatory": ["right_command"], + "optional": ["any"] + } + }, + "to": [{"key_code": "home"}] + }, + { + "type": "basic", + "from": { + "key_code": "f", + "modifiers": { + "mandatory": ["right_command"], + "optional": ["any"] + } + }, + "to": [{"key_code": "end"}] + }] + }] +} diff --git a/users/rs/readme.md b/users/rs/readme.md new file mode 100644 index 0000000000..60b34ea32f --- /dev/null +++ b/users/rs/readme.md @@ -0,0 +1,30 @@ +# RS: Code Friendly 40% – 60% Keymaps + +The rs keymap collection is an evolution of my previous keymap optimized for coding with a 60% keyboards like the Iris. I tried to keep the simplicity of my previous keymap with all the keys necessary for coding on a single layer in addition to the base one. It work well with any 40% and 60% keyboard, split or not. + +To build it, use: + + make <keyboard>:rs + +Example: + + make keebio/iris:rs + make crkbd:rs + make planck:rs + make preonic:rs + make ergotravel:rs + make handwired/rs60:rs + +Because I sometime have to use my internal keyboard I my macbook, a [karabiner configuration](karabiner.json) is also provided to get most of the features of this keyboard, including the code layer / backspace on right command key etc. + +This set of keymaps have been tested with those keyboards: +- [Planck](../../keyboards/planck/) +- [Preonic](../../keyboards/preonic/) +- [My preonic clone](../../keyboards/handwired/rs60/) + +This keymap in is also available for other keyboards: +- [Crkdb/rs](../../keyboards/crkbd/keymaps/rs/keymap.c) +- [Iris/rs](../../keyboards/keebio/iris/keymaps/rs/keymap.c) +- [Ergotravel/rs](../../keyboards/ergotravel/keymaps/rs/keymap.c) +- [ortho_5x12/rs](../../layouts/community/ortho_5x12/rs/keymap.c) +- [ortho_4x12/rs](../../layouts/community/ortho_4x12/rs/keymap.c) diff --git a/users/rs/rs.c b/users/rs/rs.c new file mode 100644 index 0000000000..fa634bb928 --- /dev/null +++ b/users/rs/rs.c @@ -0,0 +1,74 @@ + +#include "rs.h" + +// process_record_user is like process_record_user for keymaps including this file. +__attribute__ ((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +} + +// rgb_mod_changed_keymap is called any time the RGB mod has been changed. +__attribute__ ((weak)) +void rgb_mod_changed_keymap(void) { +} + +// keylog_set_keymap is called for every key press. +__attribute__ ((weak)) +void keylog_set_keymap(uint16_t keycode, keyrecord_t *record) { +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + keylog_set_keymap(keycode, record); + } + + switch (keycode) { + case NEQL: // != + if (record->event.pressed) { + SEND_STRING("!="); + } + return false; + case LPLT: // ( or < with shift + if (record->event.pressed) { + if (get_mods() & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT))) { + // < + tap_code(KC_COMM); // shift is already registered + } else { + // ( + register_mods(MOD_BIT(KC_LSFT)); + tap_code(KC_9); + unregister_mods(MOD_BIT(KC_LSFT)); + } + } + return false; + case RPGT: // ) or > with shift + if (record->event.pressed) { + if (get_mods() & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT))) { + // < + tap_code(KC_DOT); // shift is already registered + } else { + // ) + register_mods(MOD_BIT(KC_LSFT)); + tap_code(KC_0); + unregister_mods(MOD_BIT(KC_LSFT)); + } + } + return false; +#ifdef RGBLIGHT_ENABLE + case RGB_MOD: + if (record->event.pressed) { + rgblight_step(); + rgb_mod_changed_keymap(); + } + return false; + case RGBRST: + if (record->event.pressed) { + eeconfig_update_rgblight_default(); + rgblight_enable(); + rgb_mod_changed_keymap(); + } + return false; +#endif + } + return process_record_keymap(keycode, record); +}
\ No newline at end of file diff --git a/users/rs/rs.h b/users/rs/rs.h new file mode 100644 index 0000000000..722d6ed19e --- /dev/null +++ b/users/rs/rs.h @@ -0,0 +1,50 @@ +#pragma once +#include "quantum.h" + +enum layers { + _QWERTY, + _CODE, + _FN, +}; + +enum custom_keycodes { + CODE = SAFE_RANGE, + FN, + LPLT, + RPGT, + NEQL, +#ifdef RGBLIGHT_ENABLE + RGBRST, +#endif +}; + +#define KC_ KC_TRNS + +#define KC_ESCC MT(MOD_LCTL, KC_ESC) +#define KC_ENTS MT(MOD_LSFT, KC_ENT) +#define KC_LTGT LTGT // > or < with shift +#define KC_LPLT LPLT // ( or < with shift +#define KC_RPGT RPGT // ) or > with shift +#define KC_NEQL NEQL // != +#define KC_CODE MO(_CODE) +#define KC_BCOD LT(_CODE, KC_BSPC) +#define KC_FN MO(_FN) +#define KC_RST RESET +#define KC_CTRA LCTL(KC_A) +#define KC_CTRE LCTL(KC_E) +#define KC_BLTG BL_TOGG +#define KC_BLUP BL_INC +#define KC_BLDN BL_DEC +#define KC_BLBR BL_BRTG + +#ifdef RGBLIGHT_ENABLE +#define KC_LRST RGBRST +#define KC_LTOG RGB_TOG +#define KC_LHUI RGB_HUI +#define KC_LHUD RGB_HUD +#define KC_LSAI RGB_SAI +#define KC_LSAD RGB_SAD +#define KC_LVAI RGB_VAI +#define KC_LVAD RGB_VAD +#define KC_LMOD RGB_MOD +#endif
\ No newline at end of file diff --git a/users/rs/rules.mk b/users/rs/rules.mk new file mode 100644 index 0000000000..edb5be0f5b --- /dev/null +++ b/users/rs/rules.mk @@ -0,0 +1 @@ +SRC += rs.c
\ No newline at end of file diff --git a/users/wanleg/config.h b/users/wanleg/config.h index 0c8b048af7..d29054694c 100644 --- a/users/wanleg/config.h +++ b/users/wanleg/config.h @@ -6,9 +6,9 @@ //MIGHT HAVE TO SPLIT THIS INTO TWO CONDITIONS -#if defined(TAP_DANCE_ENABLE) && defined(KEYBOARD_lets_split_rev2) || defined(KEYBOARD_iris_rev2) +#if defined(TAP_DANCE_ENABLE) && defined(KEYBOARD_lets_split_rev2) || defined(KEYBOARD_keebio_iris_rev2) //Kailh Coppers activate quickly and don't need a long tapping term -#define TAPPING_TERM 100 +#define TAPPING_TERM 180 #elif defined(TAP_DANCE_ENABLE) && defined(KEYBOARD_bigswitch) #define TAPPING_TERM 700 @@ -38,7 +38,14 @@ #define NO_ACTION_FUNCTION #define NO_ACTION_ONESHOT -// Disable mod tap interrrupt -#ifndef IGNORE_MOD_TAP_INTERRUPT -#define IGNORE_MOD_TAP_INTERRUPT -#endif // !mod tap interrrupt
\ No newline at end of file + +#define PERMISSIVE_HOLD +//// Disable mod tap interrrupt +//#ifndef IGNORE_MOD_TAP_INTERRUPT +//#define IGNORE_MOD_TAP_INTERRUPT +//#endif // !mod tap interrrupt + +//set max breathing brightness on kbd6x +#if defined(KEYBOARD_kbdfans_kbd6x) +#define RGBLIGHT_EFFECT_BREATHE_MAX 128 // 0-255 +#endif diff --git a/users/wanleg/readme.md b/users/wanleg/readme.md index f687b92f48..4276111280 100644 --- a/users/wanleg/readme.md +++ b/users/wanleg/readme.md @@ -1,14 +1,125 @@ -Copyright 2018 Brian Fong @wanleg +# Contents + * [Git Basics](#git-basics) + * [Update a Feature Branch](#update-a-development-branch) + * [Delete Branch Locally and Remotely](#delete-branch-locally-and-remotely) + * [Merge TEST branch into DEV branch](#merge-test-branch-into-dev-branch) + * [STM32F103C8T6 Setup](#STM32F103C8T6-setup) + * [Bootloader](#bootloader) + * [Flashing QMK](#flashing-qmk) -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. +--- +## Git Basics +### Update a Development Branch -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +This is how to update a working branch with upstream changes. +First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch) +```bash +$ git checkout master +``` -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. +Fetch the remote, bringing the branches and their commits from the remote repository. +You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master +```bash +$ git fetch -p origin +``` + +Merge the changes from origin/master into your local master branch. This brings your master branch in sync with the remote repository, without losing your local changes. If your local branch didn't have any unique commits, Git will instead perform a "fast-forward". +```bash +$ git merge origin/master +``` + +Checkout the branch you want to merge into +```bash +$ git checkout <feature-branch> +``` + +Merge your (now updated) master branch into your feature branch to update it with the latest changes from your team. +```bash +$ git merge master +``` + +This will open your git-configured text editor. Edit the message as desired, save, and exit the editor. + +The above steps only update your local feature branch. To update it on GitHub, push your changes. +```bash +$ git push origin <feature-branch> +``` + +### Delete Branch Locally and Remotely + +Executive Summary +```bash +$ git push --delete <remote_name> <branch_name> +$ git branch -d <branch_name> +``` +Note that in most cases the remote name is origin. + +Delete Local Branch +To delete the local branch use one of the following: +```bash +$ git branch -d branch_name +$ git branch -D branch_name +``` +Note: The -d option is an alias for --delete, which only deletes the branch if it has already been fully merged in its upstream branch. You could also use -D, which is an alias for --delete --force, which deletes the branch "irrespective of its merged status." [Source: man git-branch] + +Delete Remote Branch [Updated on 8-Sep-2017] +As of Git v1.7.0, you can delete a remote branch using +```bash +$ git push <remote_name> --delete <branch_name> +``` +which might be easier to remember than +```bash +$ git push <remote_name> :<branch_name> +``` +which was added in Git v1.5.0 "to delete a remote branch or a tag." + +Starting on Git v2.8.0 you can also use `git push` with the `-d` option as an alias for `--delete`. + +Therefore, the version of Git you have installed will dictate whether you need to use the easier or harder syntax. + +### Merge TEST branch into DEV branch + +Executive Summary +```bash +$ git checkout DEV +$ git merge TEST +$ git push <remote_name> DEV +$ git branch -d TEST +$ git push <remote_name> :TEST +``` +Note that in most cases the remote name is origin. +The above code will merge, push to remote, and delete both the local and remote TEST branches + +--- +## STM32F103C8T6 Setup +Cheap "Blue/Black Pills" typically do not come with a bootloader installed. The Black Pill uses [generic_boot20_pb12.bin](https://github.com/rogerclarkmelbourne/STM32duino-bootloader/blob/master/binaries/generic_boot20_pb12.bin). The Blue Pill uses [generic_boot20_pc13.bin](https://github.com/rogerclarkmelbourne/STM32duino-bootloader/blob/master/binaries/generic_boot20_pc13.bin). +The following instructions have been adapted from [here](http://wiki.stm32duino.com/index.php?title=Burning_the_bootloader). +### Bootloader +Flashing a bootloader on to a Black Pill can be done via a USB to Serial converter (e.g. CP2102). This process should be roughly the same for all F103 boards. + +1. Download the correct bootloader binary +2. Set the 'boot 0' pin/jumper high, and 'boot 1' low + B0+ to center pin + B1- to center pin +3. Connect the board to the PC using a USB to serial converter + RX to PA9 + TX to PA10 + GND to Ground + 3.3V to 3.3 Volts +4. Download and install __Flash Loader Demonstrator__ from [here](http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/flasher-stm32.html) +5. Use __Flash Loader Demonstrator__ to flash the bootloader + Ensure the correct COM port is selected. Leave other options with their default values/selections. + Use the "Download to Device" option, with "Erase necessary pages" selected +6. After a successful flash, set 'boot 0' pin/jumper low + B0- to center pin + B1- to center pin (no change) + +### Flashing QMK +As of April 2019, the `:dfu-util` target doesn't work on a \*Pill. You will need to use dfu-util directly. +1. Use QMK to build your `.bin` +2. Run `dfu-util.exe -d 1eaf:0003 -a 2 -D YOUR_FIRMWARE.bin"` + If this is the first QMK flash on the \*Pill, you will need to synchronize your Reset Button-push with starting the command. By default, the \*Pill only stays in bootloader mode for about 3 seconds before returning to normal operation. + +See [this page](https://docs.qmk.fm/#/faq_build?id=unknown-device-for-dfu-bootloader) if Windows can't see anything to upload to. + +--- diff --git a/users/wanleg/rules.mk b/users/wanleg/rules.mk index b069cd8d38..eb66a49e6f 100644 --- a/users/wanleg/rules.mk +++ b/users/wanleg/rules.mk @@ -36,4 +36,10 @@ ifeq ($(strip $(padc)), yes) endif ifeq ($(strip $(padl)), yes) OPT_DEFS += -DPADL +endif + +#change gherkin orientation (i.e. move USB port from right side to left side) +#example usage: make gherkin:wanleg flip=yes +ifeq ($(strip $(flip)), yes) + OPT_DEFS += -DFLIP endif
\ No newline at end of file diff --git a/users/wanleg/wanleg.c b/users/wanleg/wanleg.c index 274c74f728..aa7b1c9a4c 100644 --- a/users/wanleg/wanleg.c +++ b/users/wanleg/wanleg.c @@ -6,20 +6,30 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case QWERTY: if (record->event.pressed) { - print("mode just switched to qwerty and this is a huge string\n"); set_single_persistent_default_layer(_QW); + #if defined(RGBLIGHT_ENABLE) + rgblight_sethsv_noeeprom(0,0,128); + rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING); + #endif } return false; break; case GHERKIN: if (record->event.pressed) { set_single_persistent_default_layer(_GK); + #if defined(RGBLIGHT_ENABLE) + rgblight_sethsv_noeeprom(128,255,64); + #endif } return false; break; case gGHERKIN: if (record->event.pressed) { set_single_persistent_default_layer(gGK); + #if defined(RGBLIGHT_ENABLE) + rgblight_sethsv_noeeprom(128,255,128); + rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT); + #endif } return false; break; @@ -113,6 +123,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; + //on RESET, underglow red if present + case RESET: + if (record->event.pressed) { + #if defined(RGBLIGHT_ENABLE) + rgblight_enable_noeeprom(); // enables Rgb, without saving settings + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + rgblight_sethsv_noeeprom_red(); + #endif + } + return true; // Let QMK send the press/release events as normal + break; } return true; } @@ -128,6 +149,7 @@ void matrix_init_keymap(void) {} // Call user matrix init, then call the keymap's init function void matrix_init_user(void) { +//turn off pro micro LEDs #if defined(KEYBOARD_lets_split_rev2) DDRD &= ~(1<<5); PORTD &= ~(1<<5); @@ -135,5 +157,20 @@ void matrix_init_user(void) { DDRB &= ~(1<<0); PORTB &= ~(1<<0); #endif + +//disable backlight breathing for keyboard using random flashing RGB LEDs for backlight +//(breathing provides insufficient power to integrated LED IC) +#if defined(KEYBOARD_kbdfans_kbd6x) && defined(BACKLIGHT_BREATHING) + breathing_disable(); +#endif matrix_init_keymap(); -}
\ No newline at end of file +} + +//at end of firmware startup process, change powerup default layer and underglow colour for kbd6x +void keyboard_post_init_user(void) { + #if defined(KEYBOARD_kbdfans_kbd6x) + set_single_persistent_default_layer(_QW); + rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 5); + rgblight_sethsv_noeeprom(0,0,128); + #endif +} diff --git a/users/wanleg/wanleg.h b/users/wanleg/wanleg.h index 9d07760a7b..2aea1a31e7 100644 --- a/users/wanleg/wanleg.h +++ b/users/wanleg/wanleg.h @@ -3,7 +3,7 @@ #include "quantum.h" // Define layer names and order -#ifdef KEYBOARD_gherkin +#if defined(KEYBOARD_40percentclub_gherkin) || defined(KEYBOARD_kbdfans_kbd6x) enum userspace_layers { gGK = 0, gNUM, @@ -118,22 +118,22 @@ enum { // lengths consistent. -/* Pure Gherkin +/* Gherkin * .-----------------------------------------------------------------------------------------. * | Q//ESC | W | E | R | T | Y | U | I | O | P | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| * | A | S | D | F | G | H | J | K | L | SPACE | * | | | | | | | | | |SFThold | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | Z | X | C | V/gNUM | B/gETC | N | M/gDIR | ,/GUI | ./ALT | BSPC | + * | Z | X | C | V/gNUM | B/gETC | N/Fn | M/gDIR | ,/GUI | ./ALT | BSPC | * | SFThold| | | | | | | | |CTRLhold| * '-----------------------------------------------------------------------------------------' */ #define _______________Gherkin_Row_0_______________ TD(TD_Q_ESC), KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P #define _______________Gherkin_Row_1_______________ KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, SFT_T(KC_SPC) -#define _______________Gherkin_Row_2_______________ SFT_T(KC_Z), KC_X, KC_C, LT(gNUM,KC_V), LT(gETC,KC_B), KC_N, LT(gDIR,KC_M), GUI_T(KC_COMM), ALT_T(KC_DOT), CTL_T(KC_BSPC) +#define _______________Gherkin_Row_2_______________ SFT_T(KC_Z), KC_X, KC_C, LT(gNUM,KC_V), LT(gETC,KC_B), LT(_FN,KC_N), LT(gDIR,KC_M), GUI_T(KC_COMM), ALT_T(KC_DOT), CTL_T(KC_BSPC) -/* Directional Keys +/* Gherkin Directional Keys * .-----------------------------------------------------------------------------------------. * | TAB | up | | INS | CTRL | SHIFT | PgUp | HOME | - | = | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| @@ -146,7 +146,7 @@ enum { #define _______________Gherkin_DIR_1_______________ KC_LEFT, KC_DOWN, KC_RGHT, KC_PSCR, KC_LSFT, KC_RCTL, KC_PGDN, KC_END, KC_LBRC, KC_RBRC #define _______________Gherkin_DIR_2_______________ KC_PAUS, _______, _______, _______, _______, _______, _______, KC_RGUI, KC_LALT, KC_SLSH -/* Numbers +/* Gherkin Numbers * .-----------------------------------------------------------------------------------------. * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| @@ -160,16 +160,16 @@ enum { #define _______________Gherkin_NUM_1_______________ KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0 #define _______________Gherkin_NUM_2_______________ KC_F11, KC_F12, _______,_______, _______, KC_ENT, KC_RSFT, KC_RGUI, ALT_T(KC_DOT), CTL_T(KC_BSPC) -/* Et Cetera +/* Gherkin Et Cetera * .-----------------------------------------------------------------------------------------. - * | ` | mUP | | | RESET | SHIFT | mScrDn | mScrUp | | \ | + * | ` | mUP | | ESC | RESET | SHIFT | mScrDn | mScrUp | | \ | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| * | mLeft | mDown | mRight | | SHIFT | mBtn3 | mBtn1 | mBtn2 | ; | ' | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| * | Sft//Cp| CAPS | | | | C-A-D | mScrL | mScrR | ALT | DEL | * '-----------------------------------------------------------------------------------------' */ -#define _______________Gherkin_ETC_0_______________ KC_GRV, KC_MS_U, _______,_______, RESET, KC_RSFT, KC_WH_D, KC_WH_U, _______, KC_BSLS +#define _______________Gherkin_ETC_0_______________ KC_GRV, KC_MS_U, _______,KC_ESC, RESET, KC_RSFT, KC_WH_D, KC_WH_U, _______, KC_BSLS #define _______________Gherkin_ETC_1_______________ KC_MS_L, KC_MS_D, KC_MS_R,_______, KC_LSFT, KC_BTN3, KC_BTN1, KC_BTN2, KC_SCLN, KC_QUOT #define _______________Gherkin_ETC_2_______________ TD(TD_SFT_CAPS),KC_CAPS, _______,_______, _______, LALT(LCTL(KC_DEL)), KC_WH_L, KC_WH_R, KC_LALT, KC_DEL @@ -180,7 +180,7 @@ enum { * | TAB | A | S | D | F | G | H | J | K | L | SPACE | ' | * | | | | | | | | | | |SFThold | | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * |SFT/CAPS| Z | X | C | V/NUM | B/ETC | N | M/DIR | ,/GUI | ./ALT | BSPC | ENT/SFT| + * |SFT/CAPS| Z | X | C | V/NUM | B/ETC | N/Fn | M/DIR | ,/GUI | ./ALT | BSPC | ENT/SFT| * | |SFThold | | | | | | | | |CTRLhold| | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| * | LCTRL | LGUI | ALT | ONEHAND| NUM | ETC | SPACE | DIR | RGUI | ALT | DEL | CTRL | @@ -188,7 +188,7 @@ enum { */ #define _______________GherkinLike_0_______________ KC_ESC, _______________Gherkin_Row_0_______________, KC_BSPC #define _______________GherkinLike_1_______________ KC_TAB, _______________Gherkin_Row_1_______________, KC_QUOT -#define _______________GherkinLike_2_______________ TD(TD_SFT_CAPS), SFT_T(KC_Z), KC_X, KC_C, LT(NUM, KC_V),LT(ETC, KC_B),KC_N, LT(DIR, KC_M), GUI_T(KC_COMM), ALT_T(KC_DOT), CTL_T(KC_BSPC), SFT_T(KC_ENT) +#define _______________GherkinLike_2_______________ TD(TD_SFT_CAPS), SFT_T(KC_Z), KC_X, KC_C, LT(NUM, KC_V),LT(ETC, KC_B),LT(_FN,KC_N), LT(DIR, KC_M), GUI_T(KC_COMM), ALT_T(KC_DOT), CTL_T(KC_BSPC), SFT_T(KC_ENT) #define _______________GherkinLike_3_______________ KC_LCTL, KC_LGUI, KC_LALT, KC_LALT, NUMBER, ETCETERA, KC_SPC,DIRECTION, KC_RGUI, KC_RALT, KC_DEL, KC_RCTL #define _______________GherkinLike_3_OneHand_______ KC_LCTL, KC_LGUI, KC_LALT, ONEHAND, NUMBER, ETCETERA, KC_SPC,DIRECTION, KC_RGUI, KC_RALT, ONEHAND, KC_RCTL @@ -241,7 +241,7 @@ enum { #define _______________SUBTER_Row__2_______________ _______, KC_F11, KC_F12, _______, _______, _______, _______, _______, KC_RGUI,ALT_T(KC_DOT), CTL_T(KC_BSPC), _______ #define _______________SUBTER_Row__3_______________ _______, _______, GHERKIN, _______, _______, _______, KC_ENT, KC_LSFT, _______,_______, _______, _______ -/* Gherkin Numbers +/* Gherkin-Like Numbers * .-----------------------------------------------------------------------------------------------------------. * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | BSPC | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| @@ -259,7 +259,7 @@ enum { #define _______________NUMBERS_Row_3_______________ _______, _______, _______, _______, _______, _______, KC_ENT, KC_RSFT, KC_RGUI, _______, _______, _______ -/* Gherkin Directional Keys +/* Gherkin-Like Directional Keys * .-----------------------------------------------------------------------------------------------------------. * | | TAB | up | | INS | CTRL | SHIFT | PgUp | HOME | - | = | DEL | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| @@ -275,9 +275,9 @@ enum { #define _____________DIRECTIONS_Row__2_____________ _______, _______________Gherkin_DIR_2_______________, _______ #define _____________DIRECTIONS_Row__3_____________ _______, _______, QWERTY, _______, _______, _______, _______, _______, _______, _______, _______, _______ -/* Gherkin Et Cetera +/* Gherkin-Like Et Cetera * .-----------------------------------------------------------------------------------------------------------. - * | | ` | mUP | | | RESET | SHIFT | mScrUp |mScrDown| | \ | DEL | + * | | ` | mUP | | | RESET | SHIFT | mScrDn | mScrUp | | \ | DEL | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| * | | mLeft | mDown | mRight | | SHIFT | mBtn3 | mBtn1 | mBtn2 | ; | ' | | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| @@ -290,7 +290,7 @@ enum { #define ______________ETCETERA_Row__1______________ _______, _______________Gherkin_ETC_1_______________, _______ #define ______________ETCETERA_Row__2______________ _______, _______________Gherkin_ETC_2_______________, _______ #define ______________ETCETERA_Row__3______________ _______, _______, _______, _______, _______, _______, LALT(LCTL(KC_DEL)), _______, _______, _______, _______, _______ - + /* Single 4x4 board only * .-----------------------------------. * | 7 | 8 | 9 | BSPC | @@ -307,3 +307,16 @@ enum { #define _______________NUMPAD_Row__1_______________ KC_KP_4, KC_KP_5, KC_KP_6, KC_SPC #define _______________NUMPAD_Row__2_______________ KC_KP_1, KC_KP_2, KC_KP_3, KC_PENT #define _______________NUMPAD_Row__3_______________ KC_KP_0, TD(LYR_TAP_DANCE), KC_KP_DOT, KC_PMNS + +/* Gherkin FN/Lighting + * .-----------------------------------------------------------------------------------------------------. + * | BL_breathe | BL_brite- | BL_brite+ | BL_toggle | BL_briteCyc | BL_briteMax | | | | | + * |------------+-----------+-----------+-----------+-------------+-------------+-----+-----+-----+------| + * | UG_breathe | UG_brite- | UG_brite+ | UG_toggle | UG_modeCycle| | | | | | + * |------------+-----------+-----------+-----------+-------------+-------------+-----+-----+-----+------| + * | UG_hue- | UG_hue+ | UG_sat- | UG_sat+ | | | | | |QWERTY| + * '-----------------------------------------------------------------------------------------------------' + */ +#define _______________Gherkin_FN_0________________ BL_BRTG, BL_DEC, BL_INC, BL_TOGG, BL_STEP, BL_ON, _______, _______, _______, _______ +#define _______________Gherkin_FN_1________________ RGB_M_B, RGB_VAD, RGB_VAI, RGB_TOG, RGB_MOD, _______, _______, _______, _______, _______ +#define _______________Gherkin_FN_2________________ RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, _______, _______, _______, _______, _______, QWERTY diff --git a/users/xulkal/config.h b/users/xulkal/config.h index 5f56f7a14b..2899017b03 100644 --- a/users/xulkal/config.h +++ b/users/xulkal/config.h @@ -10,4 +10,18 @@ #define LSPO_KEYS KC_LSFT, KC_TRNS, KC_LBRC #define RSPC_KEYS KC_RSFT, KC_TRNS, KC_RBRC #define LCPO_KEYS KC_LCTL, KC_TRNS, KC_MINS -#define RCPO_KEYS KC_RCTL, KC_TRNS, KC_EQL +#define RCPC_KEYS KC_RCTL, KC_TRNS, KC_EQL + +// No need for the single versions when multi performance isn't a problem =D +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#define DISABLE_RGB_MATRIX_SPLASH +#define DISABLE_RGB_MATRIX_SOLID_SPLASH + +// Don't like or feel to identical to other effects +#define DISABLE_RGB_MATRIX_RAINBOW_BEACON +#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +#define DISABLE_RGB_MATRIX_DIGITAL_RAIN +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c index af849a0729..531f99eb06 100644 --- a/users/xulkal/process_records.c +++ b/users/xulkal/process_records.c @@ -11,6 +11,10 @@ qk_tap_dance_action_t tap_dance_actions[] = { }; #endif +#if defined(RGB_MATRIX_ENABLE) +extern void eeconfig_update_rgb_matrix_default(void); +#endif + bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case QWERTY: @@ -56,12 +60,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; break; case RGBRST: - #ifdef RGBLIGHT_ENABLE +#if defined(RGBLIGHT_ENABLE) if (record->event.pressed) { eeconfig_update_rgblight_default(); rgblight_enable(); } - #endif +#elif defined(RGB_MATRIX_ENABLE) + if (record->event.pressed) { + eeconfig_update_rgb_matrix_default(); + } +#endif return false; break; } |