diff options
Diffstat (limited to 'users')
-rw-r--r-- | users/kuchosauronad0/config.h | 80 | ||||
-rw-r--r-- | users/kuchosauronad0/kuchosauronad0.c | 13 | ||||
-rw-r--r-- | users/kuchosauronad0/kuchosauronad0.h | 74 | ||||
-rw-r--r-- | users/kuchosauronad0/leader.c | 97 | ||||
-rw-r--r-- | users/kuchosauronad0/process_records.c | 4 | ||||
-rw-r--r-- | users/kuchosauronad0/process_records.h | 89 | ||||
-rw-r--r-- | users/kuchosauronad0/rgblight_user.c | 156 | ||||
-rw-r--r-- | users/kuchosauronad0/rgblight_user.h | 23 | ||||
-rw-r--r-- | users/kuchosauronad0/rules.mk | 8 | ||||
-rw-r--r-- | users/kuchosauronad0/wrappers.h | 152 |
10 files changed, 459 insertions, 237 deletions
diff --git a/users/kuchosauronad0/config.h b/users/kuchosauronad0/config.h index b2c63c1e0c..b06c9e2c56 100644 --- a/users/kuchosauronad0/config.h +++ b/users/kuchosauronad0/config.h @@ -1,61 +1,62 @@ #pragma once #ifdef AUDIO_ENABLE - #define AUDIO_CLICKY - #define STARTUP_SONG SONG(RICK_ROLL) - #define GOODBYE_SONG SONG(SONIC_RING) - #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ - SONG(COLEMAK_SOUND), \ - SONG(DVORAK_SOUND), \ - SONG(OVERWATCH_THEME) \ - } - #define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f - // #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 DEFAULT_LAYER_SONGS \ + { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(PLOVER_SOUND) } +# define AUDIO_CLICKY +# define STARTUP_SONG SONG(RICK_ROLL) +# define GOODBYE_SONG SONG(SONIC_RING) +# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f +# 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) #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_HUE_STEP 16 +# define RGBLIGHT_SAT_STEP 16 +# define RGBLIGHT_VAL_STEP 16 +# define RGBLIGHT_LIMIT_VAL 255 +# define RGBLIGHT_EFFECT_BREATHING +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +//# define RGBLIGHT_EFFECT_KNIGHT +//# define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2 +//# define RGBLIGHT_EFFECT_SNAKE +//# define RGBLIGHT_EFFECT_SNAKE_LENGTH 2 #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 #if defined(LEADER_ENABLE) - #define LEADER_PER_KEY_TIMING - #define LEADER_TIMEOUT 250 +# define LEADER_PER_KEY_TIMING +# define LEADER_TIMEOUT 250 #endif // !LEADER_ENABLE #if defined(COMBO_ENABLE) - #define COMBO_COUNT 4 - #define COMBO_TERM 150 +# define COMBO_COUNT 4 +# define COMBO_TERM 150 #endif // !COMBO_ENABLE #if defined(NKRO_ENABLE) - #define FORCE_NKRO +# define FORCE_NKRO #endif // !NKRO_ENABLE // this makes it possible to do rolling combos (zx) with keys that @@ -68,18 +69,18 @@ //#define RETRO_TAPPING #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_handwired_kuchosauronad0_planckenstein) - #define TAPPING_TERM 185 +# define TAPPING_TERM 185 #elif defined(KEYBOARD_c39) - #define TAPPING_TERM 200 +# define TAPPING_TERM 200 #else - #define TAPPING_TERM 180 +# define TAPPING_TERM 180 #endif @@ -87,4 +88,3 @@ #define MACRO_TIMER 5 - diff --git a/users/kuchosauronad0/kuchosauronad0.c b/users/kuchosauronad0/kuchosauronad0.c index 21e74a0fae..6c38d0f106 100644 --- a/users/kuchosauronad0/kuchosauronad0.c +++ b/users/kuchosauronad0/kuchosauronad0.c @@ -19,10 +19,9 @@ 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 KUCHOSAURONAD0_UNICODE_MODE UC_WINC +# define KUCHOSAURONAD0_UNICODE_MODE UC_WINC #else - // set to 2 for UC_WIN, set to 4 for UC_WINC - #define KUCHOSAURONAD0_UNICODE_MODE 2 +# define KUCHOSAURONAD0_UNICODE_MODE 2 // set to 2 for UC_WIN, set to 4 for UC_WINC #endif @@ -70,7 +69,7 @@ void shutdown_user (void) { #ifdef RGBLIGHT_ENABLE rgblight_enable_noeeprom(); rgblight_mode_noeeprom(1); - rgblight_setrgb_red(); + rgblight_setrgb_teal(); #endif // RGBLIGHT_ENABLE #ifdef RGB_MATRIX_ENABLE // uint16_t timer_start = timer_read(); @@ -108,11 +107,11 @@ void matrix_scan_user(void){ #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. // run_diablo_macro_check(); -#endif // TAP_DANCE_ENABLE +#endif // !TAP_DANCE_ENABLE #ifdef RGBLIGHT_ENABLE matrix_scan_rgb(); -#endif // RGBLIGHT_ENABLE +#endif // !RGBLIGHT_ENABLE matrix_scan_keymap(); } @@ -171,6 +170,8 @@ void eeconfig_init_user(void) { #else eeprom_update_byte(EECONFIG_UNICODEMODE, KUCHOSAURONAD0_UNICODE_MODE); #endif + eeconfig_init_keymap(); + keyboard_init(); } // TMUX stuff diff --git a/users/kuchosauronad0/kuchosauronad0.h b/users/kuchosauronad0/kuchosauronad0.h index 9ea2673dab..da996457c6 100644 --- a/users/kuchosauronad0/kuchosauronad0.h +++ b/users/kuchosauronad0/kuchosauronad0.h @@ -1,7 +1,4 @@ -#ifndef USERSPACE -#define USERSPACE - -//#pragma once +#pragma once #include "quantum.h" @@ -11,23 +8,25 @@ #include "process_records.h" #ifdef TAP_DANCE_ENABLE - #include "tap_dances.h" - #define KC_TMX TD(TD_TMX) // tap1: 't' tap2: <CTL>+b - #define KC_EOL TD(TD_EOL) // tap1: 'e' tap2: <CTL>+e - #define KC_BOL TD(TD_BOL) // tap1: 'a' tap2: <CTL>+a - #define KC_NW TD(TD_NW) // tap1: 'f' tap2: <ALT>+f - #define KC_PW TD(TD_PW) // tap1: 'b' tap2: <ALT>+b - #define KC_DW TD(TD_DW) // tap1: 'w' tap2: <CTL>+w +# include "tap_dances.h" +# define KC_TMX TD(TD_TMX) // tap1: 't' tap2: <CTL>+b +# define KC_EOL TD(TD_EOL) // tap1: 'e' tap2: <CTL>+e +# define KC_BOL TD(TD_BOL) // tap1: 'a' tap2: <CTL>+a +# define KC_NW TD(TD_NW) // tap1: 'f' tap2: <ALT>+f +# define KC_PW TD(TD_PW) // tap1: 'b' tap2: <ALT>+b +# define KC_DW TD(TD_DW) // tap1: 'w' tap2: <CTL>+w #endif //!TAP_DANCE_ENABLE + #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) - #include "rgb_stuff.h" +# include "rgblight_user.h" #endif + #if defined(UNICODEMAP_ENABLE) || defined(UNICODE_ENABLE) - #include "unicode.h" +# include "unicode.h" #endif //!UNICODE_ENABLE // Keycode aliases -#define TM_X LCTL(KC_B) // Tmux control sequence +#define TM_X LCTL(KC_B) // Tmux leader key // Unix QoL macros #define MC_BOL LCTL(KC_A) // jump to beginning of line #define MC_EOL LCTL(KC_E) // jump to end of line @@ -42,10 +41,11 @@ enum userspace_layers { _COLEMAK, _DVORAK, _WORKMAN, - _NORMAN, +/* _NORMAN, _MALTRON, _EUCALYN, - _CARPLAX, + _CARPLAX, */ + _PLOVER, _UNICODE, _MODS, /* layer 8 now 9*/ _GAMEPAD, @@ -57,18 +57,18 @@ enum userspace_layers { _ADJUST, }; -bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed); -bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); -bool send_game_macro(const char *str, keyrecord_t *record, bool override); -void matrix_init_keymap(void); -void shutdown_keymap(void); -void suspend_power_down_keymap(void); -void suspend_wakeup_init_keymap(void); -void matrix_scan_keymap(void); +bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed); +bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); +bool send_game_macro(const char *str, keyrecord_t *record, bool override); +void matrix_init_keymap(void); +void shutdown_keymap(void); +void suspend_power_down_keymap(void); +void suspend_wakeup_init_keymap(void); +void matrix_scan_keymap(void); uint32_t layer_state_set_keymap (uint32_t state); uint32_t default_layer_state_set_keymap (uint32_t state); -void led_set_keymap(uint8_t usb_led); -void eeconfig_init_keymap(void); +void led_set_keymap(uint8_t usb_led); +void eeconfig_init_keymap(void); void tmux_prefix(void); void tmux_pane_zoom(void); @@ -95,17 +95,15 @@ But since TD() doesn't work when tap dance is disabled We use custom codes here, so we can substitute the right stuff */ #ifdef TAP_DANCE_ENABLE -#define KC_D3_1 TD(TD_D3_1) -#define KC_D3_2 TD(TD_D3_2) -#define KC_D3_3 TD(TD_D3_3) -#define KC_D3_4 TD(TD_D3_4) -#else // TAP_DANCE_ENABLE -#define KC_D3_1 KC_1 -#define KC_D3_2 KC_2 -#define KC_D3_3 KC_3 -#define KC_D3_4 KC_4 -#endif // TAP_DANCE_ENABLE - -#endif // !USERSPACE +# 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 +# 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 /* vi: ft=c:tw=80:sw=2:ts=2:sts=2:et */ diff --git a/users/kuchosauronad0/leader.c b/users/kuchosauronad0/leader.c index 58935abb3c..22674eef05 100644 --- a/users/kuchosauronad0/leader.c +++ b/users/kuchosauronad0/leader.c @@ -1,77 +1,116 @@ #include "leader.h" +#ifdef RGBLIGHT_ENABLE +extern rgblight_config_t rgblight_config; +#endif +bool leader_succeed; LEADER_EXTERNS(); -void matrix_scan_user(void){ +void matrix_scan_user(void) { static bool has_ran_yet; if (!has_ran_yet) { has_ran_yet = true; startup_user(); } - #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. // run_diablo_macro_check(); -#endif // TAP_DANCE_ENABLE - +#endif #ifdef RGBLIGHT_ENABLE matrix_scan_rgb(); -#endif // RGBLIGHT_ENABLE - +#endif LEADER_DICTIONARY() { - leading = false; - leader_end(); + leader_succeed = leading = false; SEQ_ONE_KEY(KC_W) { // vim/tmux: Use in command mode in vim: write to file, switch tmux pane in the current session window and repeat the last command SEND_STRING(":w" SS_TAP(X_ENTER)); tmux_pane_switch_repeat(); - } - + leader_succeed = true; + } else SEQ_ONE_KEY(KC_T) { // Send the Tmux Prefix tmux_prefix(); - } - + leader_succeed = true; + } else SEQ_ONE_KEY(KC_A) { // tmux: Send the prefix and press 'right' arrow tmux_prefix(); tap_code(KC_RIGHT); - } - + leader_succeed = true; + } else SEQ_TWO_KEYS(KC_T, KC_T) { // tmux: Send the prefix to a nested session tmux_prefix(); tmux_prefix(); - } + leader_succeed = true; + } else SEQ_TWO_KEYS(KC_T, KC_R) { // tmux: Switch pane and repeat last action tmux_pane_switch_repeat(); - } - + leader_succeed = true; + } else SEQ_TWO_KEYS(KC_V, KC_Z){ // vim: Zoom pane tap_code16(LCTL(KC_W)); tap_code16(LSFT(KC_BSLS)); - } - + leader_succeed = true; + } else SEQ_TWO_KEYS(KC_V, KC_R) { // vim: Substitute and place cursor SEND_STRING(":%s///g" SS_TAP(X_LEFT)); tap_code(KC_LEFT); tap_code(KC_LEFT); - } - + leader_succeed = true; + } else SEQ_TWO_KEYS(KC_V, KC_T) { - // vim: move current pane to new tab - tap_code16(LCTL(KC_W)); - tap_code16(LSFT(KC_T)); - } - + // vim: move current pane to new tab + tap_code16(LCTL(KC_W)); + tap_code16(LSFT(KC_T)); + leader_succeed = true; + } else + SEQ_ONE_KEY(KC_R){ + // Toggle RGB Layer indicator + tap_code16(KC_RGB_T); + leader_succeed = true; + } else + SEQ_ONE_KEY(KC_SPC){ + // One Shot Unicode layer +//TODO tap_code16(OS_UNI); + leader_succeed = true; + } else + SEQ_TWO_KEYS(KC_SPC, KC_SPC){ + // Toggle _MODS + tap_code16(TG_MODS); + leader_succeed = true; + } else SEQ_THREE_KEYS(KC_BSPC, KC_BSPC, KC_BSPC){ - // Reset the keyboard - reset_keyboard(); + // Reset the keyboard + reset_keyboard(); + leader_succeed = true; } + leader_end(); } +// matrix_scan_keymap(); +} + +void leader_start(void) { +#ifdef RGBLIGHT_ENABLE + rgblight_savebase(); + rgblight_mode_noeeprom(1); + rgblight_sethsv_noeeprom_goldenrod(); +#endif +} - matrix_scan_keymap(); +void leader_end(void) { +// pick color depending of success /fail +// fade leader_start from 100 to 0 +// fade new color from 0 to 100 to 0 +// fade old color from 0 to 100 +#ifdef RGBLIGHT_ENABLE + if (leader_succeed) { + fadeflash_leds(HSV_GREEN); + } else { + fadeflash_leds(HSV_RED); + } +#endif } diff --git a/users/kuchosauronad0/process_records.c b/users/kuchosauronad0/process_records.c index 1eb3043b1c..bec6fa5ad0 100644 --- a/users/kuchosauronad0/process_records.c +++ b/users/kuchosauronad0/process_records.c @@ -25,7 +25,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #endif //KEYLOGGER_ENABLE switch (keycode) { - case KC_QWERTY ... KC_UNICODE: + case KC_QWERTY ... KC_PLOVER: if (record->event.pressed) { set_single_persistent_default_layer(keycode - KC_QWERTY); } @@ -168,7 +168,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { 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: diff --git a/users/kuchosauronad0/process_records.h b/users/kuchosauronad0/process_records.h index 1a66beaa77..d3d4c4fe83 100644 --- a/users/kuchosauronad0/process_records.h +++ b/users/kuchosauronad0/process_records.h @@ -2,9 +2,9 @@ #include "kuchosauronad0.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{ @@ -13,11 +13,7 @@ enum userspace_custom_keycodes{ 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_UNICODE, // Sets default layer to UNICODE + KC_PLOVER, // Sets default layer to PLOVER KC_MAKE, // Run keyboard's customized make command KC_RGB_T, // Toggles RGB Layer Indication mode @@ -33,36 +29,37 @@ enum userspace_custom_keycodes{ UC_SHRG, // ¯\_(ツ)_/¯ UC_DISA, // ಠ_ಠ - MC_QT1, // "" - MC_QT2, // '' - MC_QT3, // `' - MC_PAR, // Parenthesis - MC_CUR, // Curly bracket - MC_SQR, // Square bracket - MC_ABR, // Angle bracket - MCT_NEW, // New Tmux Session - MCT_SH, // Tmux horizontal split - MCT_SV, // Tmux vertical split - MCT_ZM, // Tmux zoom - MCT_SCR, // Tmux scroll mode - MCT_UP, // Tmux up - MCT_DW, // Tmux down - MCT_LFT, // Tmux left - MCT_RGT, // Tmux right - MCV_B, // Vim begin of line - MCV_E, // Vim end of line - MCT_F, // Vim for loop - MCG_A, // Git add - MCG_C, // Git commit - MCG_P, // Git push - MCG_R, // Git revert - MCG_L, // Git log - MCG_S, // Git status + MC_QT1, // "" + MC_QT2, // '' + MC_QT3, // `' + MC_PAR, // Parenthesis + MC_CUR, // Curly bracket + MC_SQR, // Square bracket + MC_ABR, // Angle bracket + MCT_NEW, // New Tmux Session + MCT_SH, // Tmux horizontal split + MCT_SV, // Tmux vertical split + MCT_ZM, // Tmux zoom + MCT_SCR, // Tmux scroll mode + MCT_UP, // Tmux up + MCT_DW, // Tmux down + MCT_LFT, // Tmux left + MCT_RGT, // Tmux right + MCV_B, // Vim begin of line + MCV_E, // Vim end of line + MCT_F, // Vim for loop + MCG_A, // Git add + MCG_C, // Git commit + MCG_P, // Git push + MCG_R, // Git revert + MCG_L, // Git log + MCG_S, // Git status NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes }; bool process_record_secrets(uint16_t keycode, keyrecord_t *record); +bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record); bool process_record_keymap(uint16_t keycode, keyrecord_t *record); #define LOWER MO(_LOWER) @@ -74,21 +71,21 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record); #define OS_RSE OSL(_RAISE) #define OS_UNI OSL(_UNICODE) -#define KC_SEC1 KC_SECRET_1 -#define KC_SEC2 KC_SECRET_2 -#define KC_SEC3 KC_SECRET_3 -#define KC_SEC4 KC_SECRET_4 -#define KC_SEC5 KC_SECRET_5 -#define KC_SEC6 KC_SECRET_6 +#define SEC1 KC_SECRET_1 +#define SEC2 KC_SECRET_2 +#define SEC3 KC_SECRET_3 +#define SEC4 KC_SECRET_4 +#define SEC5 KC_SECRET_5 +#define SEC6 KC_SECRET_6 -#define QWERTY KC_QWERTY -#define DVORAK KC_DVORAK -#define COLEMAK KC_COLEMAK -#define WORKMAN KC_WORKMAN -#define UNICODE KC_UNICODE +#define QWERTY KC_QWERTY +#define DVORAK KC_DVORAK +#define COLEMAK KC_COLEMAK +#define WORKMAN KC_WORKMAN +#define PLOVER KC_PLOVER #define KC_RESET RESET -#define KC_RST KC_RESET +#define KC_RST KC_RESET -#define UC_IRNY UC(0x2E2E) -#define UC_CLUE UC(0x203D) +#define UC_IRNY UC(0x2E2E) +#define UC_CLUE UC(0x203D) diff --git a/users/kuchosauronad0/rgblight_user.c b/users/kuchosauronad0/rgblight_user.c new file mode 100644 index 0000000000..63e412c557 --- /dev/null +++ b/users/kuchosauronad0/rgblight_user.c @@ -0,0 +1,156 @@ +#include "rgblight_user.h" +extern rgblight_config_t rgblight_config; +bool has_initialized; +uint8_t base_hue; // Hue value of base state +uint8_t base_sat; // Saturation value of base state +uint8_t base_val; // Brightness value of base state +uint8_t base_mod; // Animation mode of the base state + +void rgblight_savebase(void) { // Save the current settings to ram + base_hue = rgblight_config.hue; + base_sat = rgblight_config.sat; + base_val = rgblight_config.val; + base_mod = rgblight_config.mode; +} +void rgblight_loadbase(void) { // Load settings from ram to eeprom + rgblight_mode( base_mod ); + rgblight_sethsv_eeprom_helper(base_hue, base_sat, base_val, true); +} + + + +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) { + case KC_RGB_T: // Switch between underglow layer indication and normal qmk behaviour +#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); // Immediately set the layer color (looks better) + } + } +#endif // RGBLIGHT_ENABLE + 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; +#endif // RGBLIGHT_ENABLE + } + return true; +} + +void keyboard_post_init_rgb(void) { +# if defined(RGBLIGHT_ENABLE) || defined(RGBLIGHT_STARTUP_ANIMATION) + bool is_enabled = rgblight_config.enable; + 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); + wait_ms(5); + } + } + if (!is_enabled) { + rgblight_disable_noeeprom(); + } +# endif // !RGBLIGHT_ENABLE || RGBLIGHT_STARTUP_ANIMATION + layer_state_set_user(layer_state); +} + +void matrix_scan_rgb(void) { +# ifdef INDICATOR_LIGHTS + matrix_scan_indicator(); +# endif +} + +layer_state_t layer_state_set_rgb(layer_state_t state) { +# ifdef RGBLIGHT_ENABLE + if (userspace_config.rgb_layer_change) { + switch (biton32(state)) { // _RAISE, _LOWER and _ADJUST use a custom color and the breathing effect + case _RAISE: + rgblight_sethsv_noeeprom_green(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); + break; + case _LOWER: + rgblight_sethsv_noeeprom_red(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); + break; + case _ADJUST: + rgblight_sethsv_noeeprom_white(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 2); + break; + default: // Use a solid color for normal layers + switch (biton32(default_layer_state)) { + case _QWERTY: + rgblight_sethsv_noeeprom_magenta(); + break; + case _COLEMAK: + rgblight_sethsv_noeeprom_green(); + break; + case _DVORAK: + rgblight_sethsv_noeeprom_blue(); + break; + case _WORKMAN: + rgblight_sethsv_noeeprom_goldenrod(); + break; + case _PLOVER: + rgblight_sethsv_noeeprom_pink(); + break; + default: + rgblight_sethsv_noeeprom_white(); + 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; + } + } +# endif // !RGBLIGHT_ENABLE + return state; +} + +#ifdef INDICATOR_LIGHTS +void matrix_scan_indicator(void) { + if (has_initialized) { + set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); + } +} +#endif // !INDICATOR_LIGHTS + +void rgblight_fade_helper(bool direction){ + // true: increase val = fade in + // false: decrease val = fade out + for (uint8_t index = 0; index < RGBLIGHT_VAL_STEP ; index++) { + direction ? rgblight_increase_val() : rgblight_decrease_val(); + wait_ms(5); + } +} +void fadeflash_leds(uint8_t hue, uint8_t sat, uint8_t val){ + // indicate success / fail of a leader sequence + // fade out, set new hue and saturation, fade in, fade out, set old color, fade in + // this is used in leader.c + // TODO: come up with a better name maybe + rgblight_fade_helper(false); + rgblight_sethsv_noeeprom(hue, sat, 0); + rgblight_fade_helper(true); + rgblight_fade_helper(false); + rgblight_sethsv_noeeprom(base_hue, base_sat, 0); + rgblight_fade_helper(true); +} diff --git a/users/kuchosauronad0/rgblight_user.h b/users/kuchosauronad0/rgblight_user.h new file mode 100644 index 0000000000..eab15b8325 --- /dev/null +++ b/users/kuchosauronad0/rgblight_user.h @@ -0,0 +1,23 @@ +#pragma once +#include "kuchosauronad0.h" + +typedef struct { + bool enabled; + uint8_t hue; + uint16_t timer; + uint8_t life; +} rgblight_fadeout; +const uint8_t RGBLIGHT_FADE_SPEED[6] PROGMEM; + +layer_state_t layer_state_set_rgb(layer_state_t state); +layer_state_t default_layer_state_set_rgb(layer_state_t state); + +bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record); +void scan_rgblight_fadeout(void); +void keyboard_post_init_rgb(void); +void matrix_scan_rgb(void); +void rgblight_sethsv_default_helper(uint8_t index); +void rgblight_savebase(void); +void rgblight_loadbase(void); +void rgblight_fade_helper(bool direction); +void fadeflash_leds(uint8_t hue, uint8_t sat, uint8_t val); diff --git a/users/kuchosauronad0/rules.mk b/users/kuchosauronad0/rules.mk index ad13083732..b844d12c92 100644 --- a/users/kuchosauronad0/rules.mk +++ b/users/kuchosauronad0/rules.mk @@ -2,10 +2,11 @@ SRC += kuchosauronad0.c \ process_records.c LINK_TIME_OPTIMIZATION_ENABLE = yes +SPACE_CADET_ENABLE = no -#ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") -# SRC += secrets.c -#endif +ifneq ($(strip $(RGBLIGHT_ENABLE)),yes ) + SRC += rgblight_user.c +endif ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) SRC += tap_dances.c @@ -14,6 +15,7 @@ endif ifeq ($(strip $(ENCODER_ENABLE)), yes) SRC += encoder.c endif + ifeq ($(strip $(COMBO_ENABLE)), yes) SRC += combo.c endif diff --git a/users/kuchosauronad0/wrappers.h b/users/kuchosauronad0/wrappers.h index 3172c8a6d3..6dc19d935e 100644 --- a/users/kuchosauronad0/wrappers.h +++ b/users/kuchosauronad0/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__) @@ -16,6 +16,8 @@ expanded before being used as arguments to the LAYOUT_xxx macro. #define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__) #define LAYOUT_ortho_5x12_wrapper(...) LAYOUT_ortho_5x12(__VA_ARGS__) +#define LAYOUT_collide39_base_wrapper(...) LAYOUT_collide39_base(__VA_ARGS__) + /* Blocks for each of the four major keyboard layouts Organized so we can quickly adapt and modify all of them @@ -26,20 +28,30 @@ NOTE: These are all the same length. If you do a search/replace then you need to add/remove underscores to keep the lengths consistent. */ + +#define ___________________BLANK___________________ _______, _______, _______, _______, _______ + #ifdef TAP_DANCE_ENABLE - #define _________________QWERTY_L1_________________ KC_Q, KC_DW, KC_EOL, KC_R, KC_TMX - #define _________________QWERTY_L2_________________ KC_BOL, KC_S, KC_D, KC_NW, KC_G - #define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_PW +# define _________________QWERTY_L1_________________ KC_Q, KC_DW, KC_EOL, KC_R, KC_TMX +# define _________________QWERTY_L2_________________ KC_BOL, KC_S, KC_D, KC_NW, KC_G +# define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_PW #else - #define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T - #define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G - #define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B +# define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T +# define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G +# define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B #endif -#define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P -#define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN -#define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLASH +#define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P +#define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN +#define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLASH + +#define _________________PLOVER_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T +#define _________________PLOVER_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G +#define _________________PLOVER_L3_________________ KC_NO, KC_NO, KC_C, KC_V, KC_NO +#define _________________PLOVER_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P +#define _________________PLOVER_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN +#define _________________PLOVER_R3_________________ KC_NO, KC_NO, KC_N, KC_M, KC_NO #define _________________COLEMAK_L1________________ KC_Q, KC_W, KC_F, KC_P, KC_G #define _________________COLEMAK_L2________________ KC_A, KC_R, KC_S, KC_T, KC_D @@ -57,23 +69,21 @@ NOTE: These are all the same length. If you do a search/replace #define ______________COLEMAK_MOD_DH_R2____________ KC_M, KC_N, KC_E, KC_I, KC_O #define ______________COLEMAK_MOD_DH_R3____________ KC_K, KC_H, KC_COMM, KC_DOT, KC_SLASH +#define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y +#define _________________DVORAK_L2_________________ KC_A, KC_O, KC_E, KC_U, KC_I +#define _________________DVORAK_L3_________________ KC_SCLN, KC_Q, KC_J, KC_K, KC_X -#define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y -#define _________________DVORAK_L2_________________ KC_A, KC_O, KC_E, KC_U, KC_I -#define _________________DVORAK_L3_________________ KC_SCLN, KC_Q, KC_J, KC_K, KC_X +#define _________________DVORAK_R1_________________ KC_F, KC_G, KC_C, KC_R, KC_L +#define _________________DVORAK_R2_________________ KC_D, KC_H, KC_T, KC_N, KC_S +#define _________________DVORAK_R3_________________ KC_B, KC_M, KC_W, KC_V, KC_Z -#define _________________DVORAK_R1_________________ KC_F, KC_G, KC_C, KC_R, KC_L -#define _________________DVORAK_R2_________________ KC_D, KC_H, KC_T, KC_N, KC_S -#define _________________DVORAK_R3_________________ KC_B, KC_M, KC_W, KC_V, KC_Z - -#define ________________DVORAK_AU_L1_______________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y -#define ________________DVORAK_AU_L2_______________ KC_O, KC_A, KC_E, KC_I, KC_U -#define ________________DVORAK_AU_L3_______________ KC_SCLN, KC_Q, KC_J, KC_K, KC_X - -#define ________________DVORAK_AU_R1_______________ KC_F, KC_G, KC_C, KC_R, KC_L -#define ________________DVORAK_AU_R2_______________ KC_D, KC_H, KC_T, KC_N, KC_S -#define ________________DVORAK_AU_R3_______________ KC_B, KC_M, KC_W, KC_V, KC_Z +#define ________________DVORAK_AU_L1_______________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y +#define ________________DVORAK_AU_L2_______________ KC_O, KC_A, KC_E, KC_I, KC_U +#define ________________DVORAK_AU_L3_______________ KC_SCLN, KC_Q, KC_J, KC_K, KC_X +#define ________________DVORAK_AU_R1_______________ KC_F, KC_G, KC_C, KC_R, KC_L +#define ________________DVORAK_AU_R2_______________ KC_D, KC_H, KC_T, KC_N, KC_S +#define ________________DVORAK_AU_R3_______________ KC_B, KC_M, KC_W, KC_V, KC_Z #define _________________WORKMAN_L1________________ KC_Q, KC_D, KC_R, KC_W, KC_B #define _________________WORKMAN_L2________________ KC_A, KC_S, KC_H, KC_T, KC_G @@ -83,7 +93,6 @@ NOTE: These are all the same length. If you do a search/replace #define _________________WORKMAN_R2________________ KC_Y, KC_N, KC_E, KC_O, KC_I #define _________________WORKMAN_R3________________ KC_K, KC_L, KC_COMM, KC_DOT, KC_SLASH - #define _________________NORMAN_L1_________________ KC_Q, KC_W, KC_D, KC_F, KC_K #define _________________NORMAN_L2_________________ KC_A, KC_S, KC_E, KC_T, KC_G #define _________________NORMAN_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B @@ -92,7 +101,6 @@ NOTE: These are all the same length. If you do a search/replace #define _________________NORMAN_R2_________________ KC_Y, KC_N, KC_I, KC_O, KC_U #define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, KC_SLASH - #define _______________ |