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 --- layouts/community/ortho_4x12/drashna/config.h | 9 ++ layouts/community/ortho_4x12/drashna/keymap.c | 195 ++++++++++++++------------ layouts/community/ortho_4x12/drashna/rules.mk | 14 +- 3 files changed, 127 insertions(+), 91 deletions(-) (limited to 'layouts/community/ortho_4x12') diff --git a/layouts/community/ortho_4x12/drashna/config.h b/layouts/community/ortho_4x12/drashna/config.h index 0bb6a4f501..cbd5bb4602 100644 --- a/layouts/community/ortho_4x12/drashna/config.h +++ b/layouts/community/ortho_4x12/drashna/config.h @@ -14,6 +14,15 @@ #define RGBLIGHT_EFFECT_BREATHE_CENTER 1 #endif // RGBLIGHT_ENABLE +#ifdef RGB_MATRIX_ENABLE +#define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) +// #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) +// #define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects +#define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended +// #define RGB_MATRIX_SKIP_FRAMES 1 // number of frames to skip when displaying animations (0 is full effect) if not defined defaults to 1 +// #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 +// #define EECONFIG_RGB_MATRIX (uint32_t *)16 +#endif #if defined(KEYBOARD_lets_split_rev2) #define USE_SERIAL diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index a5443939ca..39f901b14f 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c @@ -17,86 +17,51 @@ #include QMK_KEYBOARD_H #include "drashna.h" - +#ifdef BACKLIGHT_ENABLE enum planck_keycodes { BACKLIT = NEW_SAFE_RANGE, }; +#else + #define BACKLIT OSM(MOD_LSFT) +#endif const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -/* Qwerty - * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ [_QWERTY] = LAYOUT_ortho_4x12_wrapper( - KC_TAB, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC, - KC_ESC, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, - KC_LSFT, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_ENT, - BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC, + KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, + KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_ENT, + BACKLIT, OS_LCTL, OS_LALT, OS_LGUI, SP_LWER, BK_LWER, DL_RAIS, ET_RAIS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT ), -/* Colemak - * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | R | S | T | D | H | N | E | I | O | " | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ [_COLEMAK] = LAYOUT_ortho_4x12_wrapper( - KC_TAB, _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSPC, - KC_ESC, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT, - KC_LSFT, _________________COLEMAK_L3________________, _________________COLEMAK_R3________________, KC_ENT, - BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + KC_ESC, _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSPC, + KC_TAB, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT, + KC_MLSF, _________________COLEMAK_L3________________, _________________COLEMAK_R3________________, KC_ENT, + BACKLIT, OS_LCTL, OS_LALT, OS_LGUI, SP_LWER, BK_LWER, DL_RAIS, ET_RAIS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT ), -/* Dvorak - * ,-----------------------------------------------------------------------------------. - * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | O | E | U | I | D | H | T | N | S | / | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ [_DVORAK] = LAYOUT_ortho_4x12_wrapper( - KC_TAB, _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSPC, - KC_ESC, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_SLSH, - KC_LSFT, _________________DVORAK_L3_________________, _________________DVORAK_R3_________________, KC_ENT, - BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + KC_ESC, _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSPC, + KC_TAB, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_SLSH, + KC_MLSF, _________________DVORAK_L3_________________, _________________DVORAK_R3_________________, KC_ENT, + BACKLIT, OS_LCTL, OS_LALT, OS_LGUI, SP_LWER, BK_LWER, DL_RAIS, ET_RAIS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT ), - [_WORKMAN] = LAYOUT_ortho_4x12_wrapper( KC_TAB, _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, KC_BSPC, KC_ESC, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, KC_QUOT, - KC_LSFT, _________________WORKMAN_L3________________, _________________WORKMAN_R3________________, KC_ENT, - BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + KC_MLSF, _________________WORKMAN_L3________________, _________________WORKMAN_R3________________, KC_ENT, + BACKLIT, OS_LCTL, OS_LALT, OS_LGUI, SP_LWER, BK_LWER, DL_RAIS, ET_RAIS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +[_MODS] = LAYOUT_ortho_4x12_wrapper( + _______, ___________________BLANK___________________, ___________________BLANK___________________, _______, + _______, ___________________BLANK___________________, ___________________BLANK___________________, _______, + KC_LSFT, ___________________BLANK___________________, ___________________BLANK___________________, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), -/* Lower - * ,-----------------------------------------------------------------------------------. - * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | Next | Vol- | Vol+ | Play | - * `-----------------------------------------------------------------------------------' - */ [_LOWER] = LAYOUT_ortho_4x12_wrapper( KC_TILD, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_BSPC, KC_DEL, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE, @@ -104,39 +69,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), -/* Raise - * ,-----------------------------------------------------------------------------------. - * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | Next | Vol- | Vol+ | Play | - * `-----------------------------------------------------------------------------------' - */ [_RAISE] = LAYOUT_ortho_4x12_wrapper( KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, KC_BSPC, KC_DEL, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, _________________RAISE_R3__________________ ), -/* Adjust (Lower + Raise) - * ,-----------------------------------------------------------------------------------. - * | | Reset| | | | | | | | | | Del | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | - * `-----------------------------------------------------------------------------------' - */ [_ADJUST] = LAYOUT_ortho_4x12_wrapper( - _______, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_DEL, - _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, _______, - _______, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, _______, + KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RST, + VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EPRM, + _______, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, TG_MODS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) @@ -147,7 +90,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { switch (keycode) { -#ifdef KEYBOARD_planck +#ifdef BACKLIGHT_ENABLE case BACKLIT: if (record->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<