From ecd21b44a8efd5c7241ebf48c65fc7b30134865f Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 26 Nov 2018 16:45:24 -0800 Subject: Update to drashna userspace and keymaps (#4459) * Fix reversed bool check in layer_state_set * Add Quefrency 65 for a friend * Add Ergodox EZ Glow keymap * Add RGB Matrix Code * Further changes to rgb matrix ErgoDox EZ * Update bjohnson keymaps * Fix CRKBD display * Overhaul to corne keyboard * Narrow scope for keylogger * Minor layout tweaks to Corne Keyboard * additional CRKBD tweaks * Minor tweaks to CRKBD * Add all characters for keylogger * Ergodox EZ Glow overhaul * Fix Ergodox EZ Glow layer colors * Increase Tapping Term for Corne Keyboard * Fix unicode-ish * Revert some changes * Add layer specific lighting effects * Some minor tweaks to ergodox glow config * revert changes to ergodox files * Update Glow readme * Add more tapping term defines * Fix changes * Fix ergodox keymap * Hopefully fix sleeping * Disable layer indications if rgb matrix is disabled * Add support for sleeping and rgb layer change toggle to ergodox ez glow * Make RGB Layer Indication Great Again * Make Unicode Great Again * Remove placeholder define Co-Authored-By: drashna * Remove placeholder define Co-Authored-By: drashna * Remove old EEPROM Reset keycode --- layouts/community/ergodox/drashna/keymap.c | 120 +++++++++++++++++++++-- layouts/community/ergodox/drashna_glow/README.md | 1 + layouts/community/ergodox/drashna_glow/config.h | 11 +++ layouts/community/ergodox/drashna_glow/keymap.c | 67 +++++++++++++ layouts/community/ergodox/drashna_glow/rules.mk | 9 ++ layouts/community/ortho_4x12/drashna/keymap.c | 2 +- 6 files changed, 201 insertions(+), 9 deletions(-) create mode 100644 layouts/community/ergodox/drashna_glow/README.md create mode 100644 layouts/community/ergodox/drashna_glow/config.h create mode 100644 layouts/community/ergodox/drashna_glow/keymap.c create mode 100644 layouts/community/ergodox/drashna_glow/rules.mk (limited to 'layouts') diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index 360a2d9c6..df9be62b7 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c @@ -20,8 +20,13 @@ along with this program. If not, see . #ifdef UNICODEMAP_ENABLE #include "drashna_unicode.h" #endif // UNICODEMAP_ENABLE +extern uint8_t input_mode; - +#ifdef RGB_MATRIX_ENABLE +extern bool g_suspend_state; +extern rgb_config_t rgb_matrix_config; +#endif +extern userspace_config_t userspace_config; //enum more_custom_keycodes { // KC_P00 = NEW_SAFE_RANGE @@ -40,7 +45,7 @@ bool skip_leds = false; KC_TAB, K01, K02, K03, K04, K05, TG(_DIABLO), TG(_DIABLO), K06, K07, K08, K09, K0A, KC_BSLS, \ KC_C1R3, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, KC_QUOT, \ KC_MLSF, CTL_T(K21), K22, K23, K24, K25, TG(_GAMEPAD), TG(_GAMEPAD), K26, K27, K28, K29, CTL_T(K2A), KC_MRSF, \ - KC_GRV, OSM(MOD_MEH),OSM(MOD_LGUI),KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC_SHRG, \ + KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC(0x2E2E), \ OS_LALT, OS_LGUI, OS_RGUI, CTL_T(KC_ESCAPE), \ KC_HOME, KC_PGUP, \ LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER) \ @@ -198,7 +203,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_GAMEPAD] = LAYOUT_ergodox_pretty_wrapper( KC_ESC, KC_NO, KC_1, KC_2, KC_3, HYPR(KC_Q), HYPR(KC_GRV), KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, - KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, KC_T, UC_SHRG, UC_DISA, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, KC_T, UC_SHRG, UC_DISA, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, KC_I, KC_O, KC_NO, KC_NO, KC_NO, KC_NO, KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_TRNS, TG(_GAMEPAD), KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO, KC_GRV, KC_U, KC_I, KC_Y, KC_T, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, @@ -263,7 +268,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = LAYOUT_ergodox_pretty_wrapper( KC_MAKE, _______, _______, _______, _______, _______, _______, KC_NUKE, _________________ADJUST_R1_________________, KC_RST, - VRSN, _________________ADJUST_L1_________________, _______, _______, _______, _______, _______, _______, _______, EPRM, + VRSN, _________________ADJUST_L1_________________, _______, _______, _______, _______, _______, _______, _______, EEP_RST, _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG(_MODS), _______, _________________ADJUST_L3_________________, _______, _______, _________________ADJUST_R3_________________, KC_MPLY, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -290,10 +295,6 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } -void matrix_init_keymap(void) { // Runs boot tasks for keyboard -}; - - void matrix_scan_keymap(void) { // runs frequently to update info uint8_t modifiers = get_mods(); uint8_t led_usb_state = host_keyboard_leds(); @@ -335,3 +336,106 @@ bool indicator_is_this_led_used_keyboard(uint8_t index) { return false; } } + + +#ifdef RGB_MATRIX_ENABLE + +void suspend_power_down_keymap(void) { + rgb_matrix_set_suspend_state(true); + rgb_matrix_config.enable = false; +} + +void suspend_wakeup_init_keymap(void) { + rgb_matrix_config.enable = true; + rgb_matrix_set_suspend_state(false); +} + +void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue) { + 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) { + if (g_suspend_state || !rgb_matrix_config.enable || !userspace_config.rgb_layer_change) return; + + switch (biton32(layer_state)) { + case _MODS: + rgb_matrix_layer_helper(0xFF, 0xFF, 0x00); break; + case _GAMEPAD: + rgb_matrix_layer_helper(0xFF, 0x80, 0x00); + rgb_matrix_set_color(32, 0x00, 0xFF, 0x00); // Q + rgb_matrix_set_color(31, 0x00, 0xFF, 0xFF); // W + rgb_matrix_set_color(30, 0xFF, 0x00, 0x00); // E + rgb_matrix_set_color(29, 0xFF, 0x80, 0x00); // R + rgb_matrix_set_color(37, 0x00, 0xFF, 0xFF); // A + rgb_matrix_set_color(36, 0x00, 0xFF, 0xFF); // S + rgb_matrix_set_color(35, 0x00, 0xFF, 0xFF); // D + rgb_matrix_set_color(34, 0x7A, 0x00, 0xFF); // F + + rgb_matrix_set_color(27, 0xFF, 0xFF, 0xFF); // 1 + rgb_matrix_set_color(26, 0x00, 0xFF, 0x00); // 2 + rgb_matrix_set_color(25, 0x7A, 0x00, 0xFF); // 3 + + break; + case _DIABLO: + rgb_matrix_layer_helper(0xFF, 0x00, 0x00); break; + case _RAISE: + rgb_matrix_layer_helper(0xFF, 0xFF, 0x00); break; + case _LOWER: + rgb_matrix_layer_helper(0x00, 0xFF, 0x00); break; + case _ADJUST: + rgb_matrix_layer_helper(0xFF, 0x00, 0x00); break; + default: + switch (biton32(default_layer_state)) { + case _QWERTY: + rgb_matrix_layer_helper(0x00, 0xFF, 0xFF); break; + case _COLEMAK: + rgb_matrix_layer_helper(0xFF, 0x00, 0xFF); break; + case _DVORAK: + rgb_matrix_layer_helper(0x00, 0xFF, 0x00); break; + case _WORKMAN: + rgb_matrix_layer_helper(0xD9, 0xA5, 0x21); break; + } + } +#if 0 + if (this_mod & MODS_SHIFT_MASK || this_led & (1<