From e4bbe057f2620ee24c3a78cb758cdfa7c4bd7abf Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 29 Aug 2018 10:42:15 -0700 Subject: Yet another update to drashna keymaps and userspace (#3787) * Make tap function inline * Use better makefile keyboard detection * Remove Copy-Paste macro * Add F11/F12 to Iris * Minor tweaks to userspace config * Set audio clicky randomness to 1.5 * Set NO_DEBUG to only be set if console is not enabled * Move NO_MUSIC_MODE to userspace config.h * Reduce Ergodox Debounce * Add Planck Light config * Use OSM for ortho 4x12 * Music Mode changes for planck light * Cleanup do to shutdown user and other fixes in Master * Add and use 'shutdown_user' fzunction * Remove global NO_MUSIC_MODE define * Add NO_MUSIC_MODE to individual keymaps * Change layer colors * Remove NO_PRINT and NO_DEBUG from userspace config.h Since these are automatically disabled if the console isn't enabled. * Remove backlight code if backlight isn't enabled * Remove Twinkle from Ergodox * Disable RGB twinkling and enable PSM * Clean up RGB matrix code * Clean up planck light indicators * Clean up tap code * Rules cleanup for ortho 4x12 * Fix up userspace template * Revert "Clean up tap code" This reverts commit 09f64d6d67aa021c3b5ac86a9a739a5ca2b9c1ec. * Organize includes * userspace cleanup * Fix modifier spelling error * Fix userspace rules * Disable Permissive Hold again * Minor clean up * Fix Tap stuff * Viterbi Updates for file size --- keyboards/iris/keymaps/drashna/keymap.c | 22 ++- keyboards/iris/keymaps/drashna/rules.mk | 2 +- keyboards/orthodox/keymaps/drashna/config.h | 2 +- keyboards/orthodox/keymaps/drashna/rules.mk | 2 +- keyboards/viterbi/keymaps/drashna/config.h | 8 +- keyboards/viterbi/keymaps/drashna/keymap.c | 2 +- layouts/community/ergodox/drashna/config.h | 3 + layouts/community/ergodox/drashna/keymap.c | 16 +-- layouts/community/ergodox/drashna/rules.mk | 6 +- layouts/community/ortho_4x12/drashna/config.h | 9 ++ layouts/community/ortho_4x12/drashna/keymap.c | 195 ++++++++++++++------------ layouts/community/ortho_4x12/drashna/rules.mk | 14 +- users/drashna/config.h | 16 +-- users/drashna/drashna.c | 75 ++++------ users/drashna/drashna.h | 22 +-- users/drashna/rgb_stuff.c | 6 +- users/drashna/rgb_stuff.h | 1 - users/drashna/template.c | 97 +++++++++---- users/drashna/template.h | 4 +- 19 files changed, 280 insertions(+), 222 deletions(-) diff --git a/keyboards/iris/keymaps/drashna/keymap.c b/keyboards/iris/keymaps/drashna/keymap.c index 70d13cac2..37c3f97f5 100644 --- a/keyboards/iris/keymaps/drashna/keymap.c +++ b/keyboards/iris/keymaps/drashna/keymap.c @@ -2,36 +2,34 @@ #include QMK_KEYBOARD_H #include "drashna.h" -#define KC_ALAP ALT_T(KC_APP) -#define KC_OSLG OSM(MOD_LGUI) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = LAYOUT_wrapper( KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, KC_TAB , _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSLS, - KC_CCCV, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, - KC_MLSF, _________________QWERTY_L3_________________, KC_ALAP, KC_OSLG, _________________QWERTY_R3_________________, KC_MRSF, + KC_C1R3, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, + KC_MLSF, _________________QWERTY_L3_________________, ALT_APP, OS_RGUI, _________________QWERTY_R3_________________, KC_MRSF, LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE ), [_COLEMAK] = LAYOUT_wrapper( KC_ESC , ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, KC_TAB , _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSLS, - KC_CCCV, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT, - KC_MLSF, _________________COLEMAK_L3________________, KC_ALAP, KC_OSLG, _________________COLEMAK_R3________________, KC_MRSF, + KC_C1R3, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT, + KC_MLSF, _________________COLEMAK_L3________________, ALT_APP, OS_RGUI, _________________COLEMAK_R3________________, KC_MRSF, LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE ), [_DVORAK] = LAYOUT_wrapper( KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, KC_TAB , _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSLS, - KC_CCCV, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_QUOT, - KC_MLSF, _________________DVORAK_L3_________________, KC_ALAP, KC_OSLG, _________________DVORAK_R3_________________, KC_MRSF, + KC_C1R3, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_QUOT, + KC_MLSF, _________________DVORAK_L3_________________, ALT_APP, OS_RGUI, _________________DVORAK_R3_________________, KC_MRSF, LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE ), [_WORKMAN] = LAYOUT_wrapper( KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, KC_TAB , _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, KC_BSLS, - KC_CCCV, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, KC_QUOT, - KC_MLSF, _________________WORKMAN_L3________________, KC_ALAP, KC_OSLG, _________________WORKMAN_R3________________, KC_MRSF, + KC_C1R3, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, KC_QUOT, + KC_MLSF, _________________WORKMAN_L3________________, ALT_APP, OS_RGUI, _________________WORKMAN_R3________________, KC_MRSF, LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE ), @@ -53,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_LOWER] = LAYOUT_wrapper( - _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______, + KC_F12, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, KC_TILD, _________________LOWER_L1__________________, _________________LOWER_R1__________________, _______, _______, ___________________BLANK___________________, _________________LOWER_R2__________________, KC_PIPE, _______, ___________________BLANK___________________, _______, _______, _________________LOWER_R3__________________, _______, @@ -61,7 +59,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_RAISE] = LAYOUT_wrapper( - _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______, + KC_F12, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______, _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, _______, _________________RAISE_L3__________________, _______, _______, _________________RAISE_R3__________________, _______, diff --git a/keyboards/iris/keymaps/drashna/rules.mk b/keyboards/iris/keymaps/drashna/rules.mk index ccc33c06f..e8035176e 100644 --- a/keyboards/iris/keymaps/drashna/rules.mk +++ b/keyboards/iris/keymaps/drashna/rules.mk @@ -12,6 +12,6 @@ SWAP_HANDS_ENABLE = no INDICATOR_LIGHTS = yes MACROS_ENABLED = no -RGBLIGHT_TWINKLE = yes +RGBLIGHT_TWINKLE = no BOOTLOADER = qmk-dfu diff --git a/keyboards/orthodox/keymaps/drashna/config.h b/keyboards/orthodox/keymaps/drashna/config.h index d8ff95fcb..2257b62fd 100644 --- a/keyboards/orthodox/keymaps/drashna/config.h +++ b/keyboards/orthodox/keymaps/drashna/config.h @@ -58,7 +58,7 @@ along with this program. If not, see . #define C6_AUDIO #ifdef RGBLIGHT_ENABLE #define NO_MUSIC_MODE -#endif //RGBLIGHT_ENABLE +#endif #endif //AUDIO_ENABLE #undef PRODUCT diff --git a/keyboards/orthodox/keymaps/drashna/rules.mk b/keyboards/orthodox/keymaps/drashna/rules.mk index f870c3a7d..a826c664a 100644 --- a/keyboards/orthodox/keymaps/drashna/rules.mk +++ b/keyboards/orthodox/keymaps/drashna/rules.mk @@ -10,6 +10,6 @@ NKRO_ENABLE = yes INDICATOR_LIGHTS = yes MACROS_ENABLED = no -RGBLIGHT_TWINKLE = yes +RGBLIGHT_TWINKLE = no BOOTLOADER = qmk-dfu diff --git a/keyboards/viterbi/keymaps/drashna/config.h b/keyboards/viterbi/keymaps/drashna/config.h index 5bc5598ee..687f80441 100644 --- a/keyboards/viterbi/keymaps/drashna/config.h +++ b/keyboards/viterbi/keymaps/drashna/config.h @@ -35,12 +35,6 @@ along with this program. If not, see . #undef LOCKING_SUPPORT_ENABLE #undef LOCKING_RESYNC_ENABLE -#ifndef NO_DEBUG -#define NO_DEBUG -#endif // !NO_DEBUG -#ifndef NO_PRINT -#define NO_PRINT -#endif // !NO_PRINT /* disable action features */ //#define NO_ACTION_LAYER @@ -59,6 +53,8 @@ along with this program. If not, see . #define NO_MUSIC_MODE #endif +#undef PREVENT_STUCK_MODIFIERS + #define LAYOUT_ortho_5x7( \ L00, L01, L02, L03, L04, L05, L06, \ L10, L11, L12, L13, L14, L15, L16, \ diff --git a/keyboards/viterbi/keymaps/drashna/keymap.c b/keyboards/viterbi/keymaps/drashna/keymap.c index 68ca593db..acda8a0d2 100644 --- a/keyboards/viterbi/keymaps/drashna/keymap.c +++ b/keyboards/viterbi/keymaps/drashna/keymap.c @@ -13,7 +13,7 @@ extern keymap_config_t keymap_config; #define _______ KC_TRNS #define XXXXXXX KC_NO -#define LMACRO TG(_MACROS) +#define LMACRO OSL(_MACROS) #define DIABLO TG(_DIABLO) #define GAMEPAD TG(_GAMEPAD) #define MEDIA TT(_MEDIA) diff --git a/layouts/community/ergodox/drashna/config.h b/layouts/community/ergodox/drashna/config.h index 9e2bd74f3..3ced18593 100644 --- a/layouts/community/ergodox/drashna/config.h +++ b/layouts/community/ergodox/drashna/config.h @@ -13,3 +13,6 @@ #undef PRODUCT #define PRODUCT DrashnaDox - Hacked ErgoDox EZ Shine + +#undef DEBOUNCE +#define DEBOUNCE 5 diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index 27d20d928..4d7700f19 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c @@ -61,7 +61,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TAB, _________________QWERTY_L1_________________, TG(_DIABLO), TG(_DIABLO), _________________QWERTY_R1_________________, KC_BSLS, KC_C1R3, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, KC_MLSF, _________________QWERTY_L3_________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________QWERTY_R3_________________, KC_MRSF, - KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, KC_CCCV, + KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, KC_NO, __________________ERGODOX_THUMB_CLUSTER_____________________ ), /* Keymap 0: COLEMAK layer @@ -93,7 +93,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TAB, _________________COLEMAK_L1________________, TG(_DIABLO), TG(_DIABLO), _________________COLEMAK_R1________________, KC_BSLS, KC_C1R3, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT, KC_MLSF, _________________COLEMAK_L3________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________COLEMAK_R3________________, KC_MRSF, - KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, KC_CCCV, + KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, KC_NO, __________________ERGODOX_THUMB_CLUSTER_____________________ ), /* Keymap 0: DVORAK Layout @@ -125,7 +125,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TAB, _________________DVORAK_L1_________________, TG(_DIABLO), TG(_DIABLO), _________________DVORAK_R1_________________, KC_SLSH, KC_C1R3, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_MINS, KC_MLSF, _________________DVORAK_L3_________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________DVORAK_R3_________________, KC_MRSF, - KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, KC_CCCV, + KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, KC_NO, __________________ERGODOX_THUMB_CLUSTER_____________________ ), /* Keymap 0: WORKMAN layer @@ -157,7 +157,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TAB, _________________WORKMAN_L1________________, TG(_DIABLO), TG(_DIABLO), _________________WORKMAN_R1________________, KC_BSLS, KC_C1R3, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, KC_QUOT, KC_MLSF, _________________WORKMAN_L3________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________WORKMAN_R3________________, KC_MRSF, - KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, KC_CCCV, + KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, KC_NO, __________________ERGODOX_THUMB_CLUSTER_____________________ ), @@ -294,7 +294,7 @@ void matrix_init_keymap(void) { // Runs boot tasks for keyboard void matrix_scan_keymap(void) { // runs frequently to update info - uint8_t modifiders = get_mods(); + uint8_t modifiers = get_mods(); uint8_t led_usb_state = host_keyboard_leds(); uint8_t one_shot = get_oneshot_mods(); @@ -307,15 +307,15 @@ void matrix_scan_keymap(void) { // runs frequently to update info // Since we're not using the LEDs here for layer indication anymore, // then lets use them for modifier indicators. Shame we don't have 4... // Also, no "else", since we want to know each, independently. - if (modifiders & MODS_SHIFT_MASK || led_usb_state & (1<event.pressed) { register_code(KC_RSFT); @@ -170,8 +113,86 @@ bool music_mask_user(uint16_t keycode) { switch (keycode) { case RAISE: case LOWER: + case BK_LWER: + case SP_LWER: + case DL_RAIS: + case ET_RAIS: return false; default: return true; } } + +#ifdef RGB_MATRIX_ENABLE + + +void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { + rgb_led led; + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + led = g_rgb_leds[i]; + if (led.matrix_co.raw < 0xFF) { + if (led.modifier) { + rgb_matrix_set_color( i, red, green, blue ); + } + } + } +} + +void rgb_matrix_indicators_user(void) { + uint8_t this_mod = get_mods(); + uint8_t this_led = host_keyboard_leds(); + uint8_t this_osm = get_oneshot_mods(); + + switch (biton32(layer_state)) { + case _RAISE: + rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, false); break; + case _LOWER: + rgb_matrix_layer_helper(0x00, 0xFF, 0x00, false); break; + case _ADJUST: + rgb_matrix_layer_helper(0xFF, 0x00, 0x00, false); break; + default: + switch (biton32(default_layer_state)) { + case _QWERTY: + rgb_matrix_layer_helper(0x00, 0xFF, 0xFF, true); break; + case _COLEMAK: + rgb_matrix_layer_helper(0xFF, 0x00, 0xFF, true); break; + case _DVORAK: + rgb_matrix_layer_helper(0x00, 0xFF, 0x00, true); break; + case _WORKMAN: + rgb_matrix_layer_helper(0xD9, 0xA5, 0x21, true); break; + } + } + + switch (biton32(default_layer_state)) { + case _QWERTY: + rgb_matrix_set_color(42, 0x00, 0xFF, 0xFF); break; + case _COLEMAK: + rgb_matrix_set_color(42, 0xFF, 0x00, 0xFF); break; + case _DVORAK: + rgb_matrix_set_color(42, 0x00, 0xFF, 0x00); break; + case _WORKMAN: + rgb_matrix_set_color(42, 0xD9, 0xA5, 0x21); break; + } + + if (this_mod & MODS_SHIFT_MASK || this_led & (1<. */ #include "drashna.h" -#include "version.h" -#include "eeprom.h" #include "tap_dances.h" #include "rgb_stuff.h" - -float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND); -float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND); - -static uint16_t copy_paste_timer; userspace_config_t userspace_config; // Helper Functions @@ -35,8 +28,14 @@ userspace_config_t userspace_config; // 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; + } clear_keyboard(); - tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER); + tap(keycode); wait_ms(50); send_string_with_delay(str, MACRO_TIMER); wait_ms(50); @@ -46,8 +45,6 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) { return false; } -void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); }; - bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed) { static uint16_t this_timer; if(pressed) { @@ -93,6 +90,9 @@ void matrix_init_keymap(void) {} __attribute__ ((weak)) void startup_keymap(void) {} +__attribute__ ((weak)) +void shutdown_keymap(void) {} + __attribute__ ((weak)) void suspend_power_down_keymap(void) {} @@ -127,6 +127,7 @@ __attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) {} + // Call user matrix init, set default RGB colors and then // call the keymap's init function void matrix_init_user(void) { @@ -158,6 +159,24 @@ void startup_user (void) { startup_keymap(); } +void shutdown_user (void) { +#ifdef RGBLIGHT_ENABLE + rgblight_enable_noeeprom(); + rgblight_mode_noeeprom(1); + rgblight_setrgb_red(); +#endif // RGBLIGHT_ENABLE +#ifdef RGB_MATRIX_ENABLE + rgb_led led; + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + led = g_rgb_leds[i]; + if (led.matrix_co.raw < 0xFF) { + rgb_matrix_set_color( i, 0xFF, 0x00, 0x00 ); + } + } +#endif //RGB_MATRIX_ENABLE + shutdown_keymap(); +} + void suspend_power_down_user(void) { suspend_power_down_keymap(); @@ -246,20 +265,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; break; - - case KC_RESET: // Custom RESET code that sets RGBLights to RED - if (!record->event.pressed) { -#ifdef RGBLIGHT_ENABLE - rgblight_enable_noeeprom(); - rgblight_mode_noeeprom(1); - rgblight_setrgb_red(); -#endif // RGBLIGHT_ENABLE - reset_keyboard(); - } - return false; - break; - - case EPRM: // Resets EEPROM if (record->event.pressed) { eeconfig_init(); @@ -333,28 +338,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; 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(KC_C); - unregister_code(KC_LCTL); -#ifdef AUDIO_ENABLE - PLAY_SONG(tone_copy); -#endif - } else { // Tap, paste - register_code(KC_LCTL); - tap(KC_V); - unregister_code(KC_LCTL); -#ifdef AUDIO_ENABLE - PLAY_SONG(tone_paste); -#endif - } - } - return false; - break; case CLICKY_TOGGLE: #ifdef AUDIO_CLICKY userspace_config.clicky_enable = clicky_enable; diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 3efef5704..dd0d1c0d7 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -15,11 +15,13 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef USERSPACE -#define USERSPACE +#pragma once #include "quantum.h" - - +#include "version.h" +#include "eeprom.h" +#ifdef RGB_MATRIX_ENABLE +#include "rgb_matrix.h" +#endif // Define layer names enum userspace_layers { _QWERTY = 0, @@ -53,7 +55,7 @@ extern bool clicky_enable; void rgblight_sethsv_default_helper(uint8_t index); #endif // RGBLIGHT_ENABLE -void tap(uint16_t keycode); +inline void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); }; 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); @@ -90,7 +92,6 @@ enum userspace_custom_keycodes { KC_C9, KC_GGEZ, KC_MAKE, // Run keyboard's customized make command - KC_RESET, // Resets keyboard, with red underglow KC_RGB_T, // Toggles RGB Layer Indication mode KC_SECRET_1, // test1 KC_SECRET_2, // test2 @@ -123,6 +124,7 @@ enum userspace_custom_keycodes { #define COLEMAK KC_COLEMAK #define WORKMAN KC_WORKMAN +#define KC_RESET RESET #define KC_RST KC_RESET #ifdef SWAP_HANDS_ENABLE @@ -131,6 +133,11 @@ enum userspace_custom_keycodes { #define KC_C1R3 KC_BSPC #endif // SWAP_HANDS_ENABLE +#define BK_LWER LT(_LOWER, KC_BSPC) +#define SP_LWER LT(_LOWER, KC_SPC) +#define DL_RAIS LT(_RAISE, KC_DEL) +#define ET_RAIS LT(_RAISE, KC_ENTER) + // OSM keycodes, to keep things clean and easy to change #define KC_MLSF OSM(MOD_LSFT) #define KC_MRSF OSM(MOD_RSFT) @@ -325,7 +332,7 @@ enum { #define _________________ADJUST_L1_________________ RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG -#define _________________ADJUST_L2_________________ _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM +#define _________________ADJUST_L2_________________ MU_TOG , CK_TOGG, AU_ON, AU_OFF, AG_NORM #define _________________ADJUST_L3_________________ RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T #define _________________ADJUST_R1_________________ KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5 @@ -350,4 +357,3 @@ enum { LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER) -#endif // !USERSPACE diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index f2a9a47a9..03c55b132 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -267,7 +267,7 @@ void matrix_init_rgb(void) { case _COLEMAK: rgblight_sethsv_noeeprom_magenta(); break; case _DVORAK: - rgblight_sethsv_noeeprom_green(); break; + rgblight_sethsv_noeeprom_springgreen(); break; case _WORKMAN: rgblight_sethsv_noeeprom_goldenrod(); break; default: @@ -313,7 +313,7 @@ uint32_t layer_state_set_rgb(uint32_t state) { rgblight_mode_noeeprom(5); break; case _LOWER: - rgblight_sethsv_noeeprom_orange(); + rgblight_sethsv_noeeprom_green(); rgblight_mode_noeeprom(5); break; case _ADJUST: @@ -325,7 +325,7 @@ uint32_t layer_state_set_rgb(uint32_t state) { case _COLEMAK: rgblight_sethsv_noeeprom_magenta(); break; case _DVORAK: - rgblight_sethsv_noeeprom_green(); break; + rgblight_sethsv_noeeprom_springgreen(); break; case _WORKMAN: rgblight_sethsv_noeeprom_goldenrod(); break; default: diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h index 6426ea266..50c75c8c3 100644 --- a/users/drashna/rgb_stuff.h +++ b/users/drashna/rgb_stuff.h @@ -13,4 +13,3 @@ void matrix_init_rgb(void); void matrix_scan_rgb(void); uint32_t layer_state_set_rgb(uint32_t state); - diff --git a/users/drashna/template.c b/users/drashna/template.c index 20dbb96d7..e6b50c961 100644 --- a/users/drashna/template.c +++ b/users/drashna/template.c @@ -1,7 +1,5 @@ -#include "drashna.h" -#include "quantum.h" -#include "action.h" -#include "version.h" +#include "template.h" + // Add reconfigurable functions here, for keymap customization // This allows for a global, userspace functions, and continued @@ -10,25 +8,15 @@ __attribute__ ((weak)) void matrix_init_keymap(void) {} -__attribute__ ((weak)) -void matrix_scan_keymap(void) {} - -__attribute__ ((weak)) -bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - return true; -} -__attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { - return state; -} -__attribute__ ((weak)) -void led_set_keymap(uint8_t usb_led) {} - // Call user matrix init, then call the keymap's init function void matrix_init_user(void) { matrix_init_keymap(); } + +__attribute__ ((weak)) +void matrix_scan_keymap(void) {} + // No global matrix scan code, so just run keymap's matix // scan function void matrix_scan_user(void) { @@ -36,11 +24,16 @@ void matrix_scan_user(void) { } +__attribute__ ((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +} + // Defines actions tor my global custom keycodes. Defined in drashna.h file // Then runs the _keymap's recod handier if not processed here, // And use "NEWPLACEHOLDER" for new safe range bool process_record_user(uint16_t keycode, keyrecord_t *record) { - + switch (keycode) { case KC_MAKE: if (!record->event.pressed) { @@ -56,12 +49,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; - case KC_RESET: - if (!record->event.pressed) { - reset_keyboard(); - } - return false; - break; + case EPRM: if (record->event.pressed) { eeconfig_init(); @@ -78,13 +66,66 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return process_record_keymap(keycode, record); } -// Runs state check and changes underglow color and animation -// on layer change, no matter where the change was initiated -// Then runs keymap's layer change check + +__attribute__ ((weak)) +uint32_t layer_state_set_keymap (uint32_t state) { + return state; +} + uint32_t layer_state_set_user (uint32_t state) { return layer_state_set_keymap (state); } + + +__attribute__ ((weak)) +void led_set_keymap(uint8_t usb_led) {} + void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); } + + + +__attribute__ ((weak)) +void suspend_power_down_keymap(void) {} + +void suspend_power_down_user(void) +{ + suspend_power_down_keymap(); +} + + + +__attribute__ ((weak)) +void suspend_wakeup_init_keymap(void) {} + +void suspend_wakeup_init_user(void) +{ + suspend_wakeup_init_keymap(); + #ifdef KEYBOARD_ergodox_ez + wait_ms(10); + #endif +} + + + +__attribute__ ((weak)) +void startup_keymap(void) {} + +void startup_user (void) { + #ifdef RGBLIGHT_ENABLE + matrix_init_rgb(); + #endif //RGBLIGHT_ENABLE + startup_keymap(); +} + + + +__attribute__ ((weak)) +void shutdown_keymap(void) {} + +void shutdown_user (void) { + shutdown_keymap(); +} + diff --git a/users/drashna/template.h b/users/drashna/template.h index d1251462b..5b3a93de5 100644 --- a/users/drashna/template.h +++ b/users/drashna/template.h @@ -2,8 +2,10 @@ #define USERSPACE #include "quantum.h" +#include "version.h" +#include "eeprom.h" -// Define layer names +// Define layer names #define BASE 0 enum custom_keycodes { -- cgit v1.2.3-70-g09d2