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/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 +- 6 files changed, 140 insertions(+), 103 deletions(-) (limited to 'layouts') 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<