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
daktil_thumb_popravljen
drashna 2017-10-10 10:11:05 -07:00 committed by Jack Humbert
parent 34084b4ee6
commit e0e80c0dc1
6 changed files with 215 additions and 41 deletions

View File

@ -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

View File

@ -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.

View File

@ -369,6 +369,10 @@ void matrix_init_user(void) {
// set Numlock LED to output and low
DDRF |= (1<<7);
PORTF &= ~(1<<7);
if (!(host_keyboard_leds() & (1 << USB_LED_NUM_LOCK)) ){
register_code(KC_NUMLOCK);
unregister_code(KC_NUMLOCK);
}
}
void matrix_scan_user(void) {

View File

@ -59,6 +59,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, LOWER, KC_BSPC, KC_ENT, KC_RALT, LS__SPC, RAISE, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LGUI \
),
[_COLEMAK] = KEYMAP(\
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_UP, XXXXXXX, KC_DOWN, KC_LEFT, XXXXXXX, KC_RIGHT, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLASH, KC_LGUI \
),
[_DVORAK] = KEYMAP(\
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \
KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_UP, XXXXXXX, KC_DOWN, KC_LEFT, XXXXXXX, KC_RIGHT, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \
KC_LCTL, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_LGUI \
),
[_LOWER] = KEYMAP( \
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LCTL, XXXXXXX, _______, _______, XXXXXXX, KC_RCTL, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \

View File

@ -39,4 +39,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define TAPPING_TERM 200
#endif
#ifdef RGBLIGHT_ENABLE
#define RGB_DI_PIN D3
#define RGBLED_NUM 12 // Number of LEDs
#define RGBLIGHT_ANIMATIONS
#define RGBLIGHT_HUE_STEP 12
#define RGBLIGHT_SAT_STEP 12
#define RGBLIGHT_VAL_STEP 12
#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2
#define RGBLIGHT_EFFECT_SNAKE_LENGTH 2
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
#endif // RGBLIGHT_ENABLE
#define FORCE_NKRO
#ifdef FORCE_NKRO
#define NKRO_EPSIZE 32
#endif
#define PERMISSIVE_HOLD
#endif

View File

@ -49,6 +49,20 @@ enum custom_keycodes {
#define _______ KC_TRNS
#define XXXXXXX KC_NO
#ifdef RGBLIGHT_ENABLE
//define layer change stuff for underglow indicator
#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 = true;
static uint8_t current_layer = 10;
#endif
#ifdef TAP_DANCE_ENABLE
enum {
@ -194,4 +208,68 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
}
#ifdef RGBLIGHT_ENABLE
void matrix_scan_user(void) { // runs frequently to update info
uint8_t layer = biton32(layer_state);
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 _QWERTY:
if (l_colemak) {
rgblight_set_magenta;
}
else if (l_dvorak) {
rgblight_set_green;
}
else {
rgblight_set_teal;
}
rgblight_mode(1);
break;
case _COLEMAK:
rgblight_set_magenta;
rgblight_mode(1);
break;
case _DVORAK:
rgblight_set_green;
rgblight_mode(1);
break;
case _RAISE:
rgblight_set_blue;
rgblight_mode(2);
break;
case _LOWER:
rgblight_set_orange;
rgblight_mode(3);
break;
case _ADJUST:
rgblight_set_red;
rgblight_mode(17);
break;
case 6:
rgblight_set_urine;
break;
}
has_layer_changed = false;
}
};
#endif