summaryrefslogtreecommitdiffstats
path: root/keyboards/ergodox_ez
diff options
context:
space:
mode:
authordrashna <drashna@live.com>2017-10-10 19:11:05 +0200
committerJack Humbert <jack.humb@gmail.com>2017-10-10 19:11:05 +0200
commite0e80c0dc1be961999617a9eb0e1ae0f7988fae9 (patch)
tree021baf7d1950e4ccbc2d29cbb82d1e399645b2e5 /keyboards/ergodox_ez
parent34084b4ee63458789a3b84a956024291e404275b (diff)
downloadqmk_firmware-e0e80c0dc1be961999617a9eb0e1ae0f7988fae9.tar.gz
qmk_firmware-e0e80c0dc1be961999617a9eb0e1ae0f7988fae9.tar.xz
Cleanup of my keymaps (#1802)
* Add woodpad * Cleanup * Remove misc layouts for woodpad * Move woodpad to handwired * Updated RGB Underglow info * Cleanup macros * Fix odd merge issue * Tweaked RGB lighting stuff * Start to merge orthodox/ergodox keymaps (persistant layers) * Add forced NKRO * Added Colemak and Dvorak layers to default orthodox keymap * Added default layer (qwerty/colemak/dvorak) detection to RGB Underglow
Diffstat (limited to 'keyboards/ergodox_ez')
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna-custom/config.h15
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna-custom/keymap.c127
2 files changed, 101 insertions, 41 deletions
diff --git a/keyboards/ergodox_ez/keymaps/drashna-custom/config.h b/keyboards/ergodox_ez/keymaps/drashna-custom/config.h
index d2878547d..f4775eeac 100644
--- a/keyboards/ergodox_ez/keymaps/drashna-custom/config.h
+++ b/keyboards/ergodox_ez/keymaps/drashna-custom/config.h
@@ -1,4 +1,5 @@
-
+#ifndef CONFIG_USER_H
+#define CONFIG_USER_H
#include "../../config.h"
@@ -7,8 +8,16 @@
#ifdef RGBLIGHT_ENABLE
#undef RGBLIGHT_SAT_STEP
#define RGBLIGHT_SAT_STEP 12
-#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3
-#define RGBLIGHT_EFFECT_SNAKE_LENGTH 3
+#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 7
+#define RGBLIGHT_EFFECT_SNAKE_LENGTH 7
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
#endif // RGBLIGHT_ENABLE
+
#define FORCE_NKRO
+#ifdef FORCE_NKRO
+#define NKRO_EPSIZE 32
+#endif
+
+#define PERMISSIVE_HOLD
+
+#endif \ No newline at end of file
diff --git a/keyboards/ergodox_ez/keymaps/drashna-custom/keymap.c b/keyboards/ergodox_ez/keymaps/drashna-custom/keymap.c
index 2df8cbf22..4223bc2d1 100644
--- a/keyboards/ergodox_ez/keymaps/drashna-custom/keymap.c
+++ b/keyboards/ergodox_ez/keymaps/drashna-custom/keymap.c
@@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "keymap_nordic.h"
// Define layer names
-#define BASE 0
+#define QWERTY 0
#define COLEMAK 1
#define DVORAK 2
#define SYMB 3
@@ -33,6 +33,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DIABLO 5
#define MOUS 6
+
+
//define modifiers
#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
@@ -45,9 +47,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//define layer change stuff for underglow indicator
bool skip_leds = false;
+#define rgblight_set_blue rgblight_sethsv (0xFF, 0xFF, 0xFF);
+#define rgblight_set_red rgblight_sethsv(0x00, 0xFF, 0xFF);
+#define rgblight_set_green rgblight_sethsv (0x78, 0xFF, 0xFF);
+#define rgblight_set_orange rgblight_sethsv (0x1E, 0xFF, 0xFF);
+#define rgblight_set_teal rgblight_sethsv (0xC3, 0xFF, 0xFF);
+#define rgblight_set_magenta rgblight_sethsv (0x12C, 0xFF, 0xFF);
+#define rgblight_set_urine rgblight_sethsv (0x3C, 0xFF, 0xFF);
//This is both for underglow, and Diablo 3 macros
-bool has_layer_changed = false;
-static uint8_t current_layer;
+
+static uint8_t current_layer = 0;
//define diablo macro timer variables
static uint16_t diablo_timer[4];
@@ -70,7 +79,10 @@ enum custom_keycodes {
RGB_FF0000,
RGB_800080,
RGB_00FF90,
- KC_DIABLO_CLEAR
+ KC_DIABLO_CLEAR,
+ KC_QWERTY,
+ KC_COLEMAK,
+ KC_DVORAK
};
#ifdef TAP_DANCE_ENABLE
@@ -206,7 +218,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | End | | PgDn | | |
* `---------------------' `---------------------'
*/
- [BASE] = KEYMAP(
+ [QWERTY] = KEYMAP(
KC_EQUAL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(MOUS),
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(DIABLO),
KC_BSPACE, KC_A, KC_S, KC_D, KC_F, KC_G,
@@ -261,9 +273,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_SPC,KC_BSPC,KC_END,
// right hand
KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
- KC_NO, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS,
+ TG(DVORAK), KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS,
KC_H, KC_N, KC_E, KC_I, LT(MOUS, KC_O), KC_QUOTE,
- KC_TRNS,KC_K,KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLASH),KC_RSHIFT,
+ TG(COLEMAK), KC_K, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLASH),KC_RSHIFT,
KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_FN1,
KC_LALT, CTL_T(KC_ESC),
KC_PGUP,
@@ -304,9 +316,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_SPC,KC_BSPC,KC_END,
// right hand
KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS,
- KC_TRNS, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH,
+ TG(DVORAK), KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH,
KC_D, KC_H, KC_T, KC_N, LT(MOUS, KC_S), KC_MINS,
- KC_NO,KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_RSHIFT,
+ TG(COLEMAK), KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_RSHIFT,
KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_FN1,
KC_LALT, CTL_T(KC_ESC),
KC_PGUP,
@@ -344,10 +356,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
- KC_TRNS, KC_KP_PLUS, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_ASTERISK, KC_F12,
+ KC_QWERTY, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
+ KC_DVORAK, KC_KP_PLUS, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_ASTERISK, KC_F12,
KC_KP_MINUS, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_SLASH,KC_PSCREEN,
- KC_TRNS, KC_NUMLOCK, KC_KP_1, KC_KP_2, KC_KP_3, KC_EQUAL, KC_PAUSE,
+ KC_COLEMAK, KC_NUMLOCK, KC_KP_1, KC_KP_2, KC_KP_3, KC_EQUAL, KC_PAUSE,
KC_KP_0, KC_KP_0, KC_KP_DOT, KC_KP_ENTER, KC_TRNS,
RGB_TOG, RGB_SLD,
KC_NO,
@@ -357,13 +369,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 4: Customized Overwatch Layout
*
* ,--------------------------------------------------. ,--------------------------------------------------.
- * | ESC | SALT | MORE | GG | SYMM | DOOM | HARD | | | F9 | F10 | F11 | F12 | | |
+ * | ESC | | | | | | | | | F9 | F10 | F11 | F12 | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | F1 | K | Q | W | E | R | T | | | | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | TAB | G | A | S | D | F |------| |------| | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
- * | LCTR | LSHFT| Z | X | C | M | | | | | | | | | |
+ * | LCTR | LSHFT| Z | X | C | V | | | | N | M | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | J | U | I | Y | T | | | | | | |
* `----------------------------------' `----------------------------------'
@@ -379,7 +391,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESCAPE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, KC_T,
KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F,
- KC_LCTL, KC_LSHIFT, KC_Z, KC_X, KC_C, KC_M, KC_TRNS,
+ KC_LCTL, KC_LSHIFT, KC_Z, KC_X, KC_C, KC_V, KC_TRNS,
KC_G, KC_U, KC_I, KC_Y, KC_T,
KC_O, KC_P,
KC_LGUI,
@@ -388,11 +400,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_NO, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
- KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
- KC_NO, KC_NO,
+ KC_NO, KC_NO,
KC_NO,
- KC_NO, KC_NO, KC_ENTER
+ KC_PGDOWN, KC_DELETE, KC_ENTER
),
/* Keymap 3:
@@ -508,6 +520,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
return MACRO_NONE;
};
+void persistent_default_layer_set(uint16_t default_layer) {
+ eeconfig_update_default_layer(default_layer);
+ default_layer_set(default_layer);
+}
+
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
@@ -595,7 +612,25 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
-
+ case KC_QWERTY:
+ if (record->event.pressed) {
+ persistent_default_layer_set(1UL << QWERTY);
+ }
+ return false;
+ break;
+ case KC_COLEMAK:
+ if (record->event.pressed) {
+ persistent_default_layer_set(1UL << COLEMAK);
+ }
+ return false;
+ break;
+ case KC_DVORAK:
+ if (record->event.pressed) {
+ persistent_default_layer_set(1UL << DVORAK);
+ }
+ return false;
+ break;
+
}
return true;
}
@@ -636,7 +671,7 @@ void run_diablo_macro_check(void) {
}
void matrix_init_user(void) { // Runs boot tasks for keyboard
- has_layer_changed = true;
+
};
@@ -644,7 +679,11 @@ void matrix_init_user(void) { // Runs boot tasks for keyboard
void matrix_scan_user(void) { // runs frequently to update info
uint8_t modifiders = get_mods();
uint8_t layer = biton32(layer_state);
-
+ bool l_dvorak = false;
+ bool l_colemak = false;
+ static bool has_layer_changed = true;
+
+
if (!skip_leds) {
ergodox_board_led_off();
ergodox_right_led_1_off();
@@ -665,48 +704,60 @@ void matrix_scan_user(void) { // runs frequently to update info
}
}
+ if (layer != current_layer) {
+ has_layer_changed = true;
+ current_layer = layer;
+ }
// Check layer, and apply color if its changed since last check
if (has_layer_changed) {
+ uint8_t default_layer = 0;
+ default_layer = eeconfig_read_default_layer();
+
+ if (default_layer & (1UL << DVORAK)) {
+ l_dvorak = true;
+ }
+ else if (default_layer & (1UL << COLEMAK)) {
+ l_colemak = true;
+ }
switch (layer) {
case SYMB:
- rgblight_sethsv (255,255,255);
- rgblight_mode(23);
+ rgblight_set_blue;
+ rgblight_mode(2);
break;
case OVERWATCH:
- rgblight_sethsv (30,255,255);
+ rgblight_set_orange;
rgblight_mode(17);
break;
case DIABLO:
- rgblight_sethsv (0,255,255);
+ rgblight_set_red;
rgblight_mode(5);
break;
case MOUS:
- rgblight_sethsv (60,255,255);
+ rgblight_set_urine;
break;
case COLEMAK:
- rgblight_sethsv (300,255,255);
+ rgblight_set_magenta;
break;
case DVORAK:
- rgblight_sethsv (120,255,255);
+ rgblight_set_green;
break;
case 7:
rgblight_sethsv (255,255,255);
break;
default:
- rgblight_sethsv (195,255,255);
+ if (l_colemak) {
+ rgblight_set_magenta;
+ }
+ else if (l_dvorak) {
+ rgblight_set_green;
+ }
+ else {
+ rgblight_set_teal;
+ }
rgblight_mode(1);
break;
}
- }
-
- // Update layer status at the end, so this sets the default color
- // rather than relying on the init, which was unreliably...
- // Probably due to a timing issue, but this requires no additional code
- if (current_layer == layer) {
has_layer_changed = false;
- } else {
- has_layer_changed = true;
- current_layer = layer;
}
// Run Diablo 3 macro checking code.