From 5d241479f59493bf5e09004d918d34e85a63a194 Mon Sep 17 00:00:00 2001 From: Pavlos Vinieratos Date: Fri, 9 Dec 2016 14:37:07 +0100 Subject: [PATCH 1/5] media keys --- keyboards/ergodox/keymaps/pvinis/keymap.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/keyboards/ergodox/keymaps/pvinis/keymap.c b/keyboards/ergodox/keymaps/pvinis/keymap.c index df906201a..bc2a5380a 100644 --- a/keyboards/ergodox/keymaps/pvinis/keymap.c +++ b/keyboards/ergodox/keymaps/pvinis/keymap.c @@ -52,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | | | | | * `----------------------------------' `----------------------------------' * ,-------------. ,-------------. - * |BEGIN |QWERTY| |SYSCTL| | + * |BEGIN |QWERTY| | | | * ,------|------|------| |------+--------+------. * | | |CARPAL| |Slack | | | * |Backsp|LShift|------| |------| Enter |Space | @@ -218,13 +218,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * a keymap to control my system. * * ,--------------------------------------------------. ,--------------------------------------------------. - * | | | | | | | | | | | | Mute |VolDn |VolUp | | + * | | | | | | | | | | | | | | | | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | | | | | | | | | | |MsUpL | MsUp |MsUpR | | | + * | | | | | | | | | | Mute |MsUpL | MsUp |MsUpR | | | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | | | | | | |------| |------| |MsLeft| MsDn |MsRght| | Lock | + * | | | | | | |------| |------|VolUp |MsLeft| MsDn |MsRght| | Lock | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | | | | | | | | | | |MsDnL | MsDn | | | Sleep | + * | | | | | | | | | |VolDn |MsDnL | MsDn | | | Sleep | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * | | | | | | | | | | | Power| * `----------------------------------' `----------------------------------' @@ -245,13 +245,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ,KC_NO ,KC_NO ,KC_NO - ,KC_NO ,KC_NO ,KC_NO + ,KC_NO ,KC_NO ,KC_TRNS - /*,KC_POP*/,KC_NO ,KC_NO ,KC_NO ,KC_MUTE ,KC_VOLD ,KC_VOLU ,KC_NO - /*,KC_PTRN*/,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO - ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LCTL(LSFT(KC_PWR)) - ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_SLEP - ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_PWR + /*,KC_POP /// */,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO + /* /// ,KC_PTRN*/,KC_NO ,KC_MUTE ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO + ,KC_VOLU ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LCTL(LSFT(KC_PWR)) + ,KC_NO ,KC_VOLD ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_SLEP + ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_PWR ,KC_NO ,KC_NO ,KC_NO From d5914a4dfeb69023a0c4e81cd1bc3696df043777 Mon Sep 17 00:00:00 2001 From: Pavlos Vinieratos Date: Fri, 9 Dec 2016 14:37:22 +0100 Subject: [PATCH 2/5] add alt key --- keyboards/ergodox/keymaps/pvinis/keymap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/ergodox/keymaps/pvinis/keymap.c b/keyboards/ergodox/keymaps/pvinis/keymap.c index bc2a5380a..045d6b543 100644 --- a/keyboards/ergodox/keymaps/pvinis/keymap.c +++ b/keyboards/ergodox/keymaps/pvinis/keymap.c @@ -85,7 +85,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * a beginner's keymap i currently use. * * ,--------------------------------------------------. ,--------------------------------------------------. - * | | 1 | 2 | 3 | 4 | 5 | 6 | | 6 | 7 | 8 | 9 | 0 | - | = | + * | | 1 | 2 | 3 | 4 | 5 | opt | | 6 | 7 | 8 | 9 | 0 | - | = | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| * | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \ | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| @@ -104,7 +104,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------' `----------------------' */ [BEGIN] = KEYMAP( - KC_TRNS ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_6 + KC_TRNS ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_LALT ,KC_TAB ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC ,CTL_T(KC_ESC) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G ,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,KC_LPRN From be2863e56d2464170725cd6740f4d761e5102e48 Mon Sep 17 00:00:00 2001 From: Pavlos Vinieratos Date: Fri, 9 Dec 2016 16:00:10 +0100 Subject: [PATCH 3/5] separate sysctl and mouse layers --- keyboards/ergodox/keymaps/pvinis/keymap.c | 128 +++++++++++----------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/keyboards/ergodox/keymaps/pvinis/keymap.c b/keyboards/ergodox/keymaps/pvinis/keymap.c index 045d6b543..0052a9325 100644 --- a/keyboards/ergodox/keymaps/pvinis/keymap.c +++ b/keyboards/ergodox/keymaps/pvinis/keymap.c @@ -13,18 +13,13 @@ enum { QWERTY, CARPALX, SYSCTL, + MOUSE, }; // extra keys enum { NONE = 0, - // mouse - MS_UL, // up left - MS_UR, // up right - MS_DL, // down left - MS_DR, // down right - // tap dance TD_FLSH, // flash keyboard }; @@ -213,27 +208,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ,KC_TRNS ,KC_TRNS ,KC_TRNS ), - /* SYSCTL * a keymap to control my system. * - * ,--------------------------------------------------. ,--------------------------------------------------. - * | | | | | | | | | | | | | | | | - * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | | | | | | | | | | Mute |MsUpL | MsUp |MsUpR | | | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | | | | | | |------| |------|VolUp |MsLeft| MsDn |MsRght| | Lock | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | | | | | | | | | |VolDn |MsDnL | MsDn | | | Sleep | - * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | | | | | | | | | | | Power| - * `----------------------------------' `----------------------------------' + * ,--------------------------------------------------. ,------------------------------------------------------. + * | ^ | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+----------+------+------+--------| + * | | | | | | | | | | Mute | Home | Up | End | | | + * |--------+------+------+------+------+------| | | |------+------+----------+------+------+--------| + * | | | | | | |------| |------|VolUp | Left | Down |Right | | Lock | + * |--------+------+------+------+------+------| | | |------+------+----------+------+------+--------| + * | | | | | | | | | |VolDn | Prev |Play/Pause| Next | | Sleep | + * `--------+------+------+------+------+-------------' `-------------+------+----------+------+------+--------' + * | | | | | | | | | | | Power| + * `----------------------------------' `--------------------------------------' * ,-------------. ,-------------. - * | | | | |MidClk| + * | | | | | | * ,------|------|------| |------+------+------. - * | | | | | |Left |Right | - * | | |------| |------| Click| Click| * | | | | | | | | + * | | |------| |------| | | + * | | | ^ | | | | | * `--------------------' `--------------------' */ [SYSCTL] = KEYMAP( @@ -247,11 +241,55 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ,KC_NO ,KC_NO ,KC_NO ,KC_TRNS - /*,KC_POP /// */,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO - /* /// ,KC_PTRN*/,KC_NO ,KC_MUTE ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO - ,KC_VOLU ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LCTL(LSFT(KC_PWR)) - ,KC_NO ,KC_VOLD ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_SLEP - ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_PWR + /*,KC_POP /// */,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO + /* /// ,KC_PTRN*/,KC_NO ,KC_MUTE ,KC_HOME ,KC_UP ,KC_END ,KC_NO ,KC_NO + ,KC_VOLU ,KC_LEFT ,KC_DOWN ,KC_RGHT ,KC_NO ,LCTL(LSFT(KC_PWR)) + ,KC_NO ,KC_VOLD ,KC_MPRV ,KC_MPLY ,KC_MNXT ,KC_NO ,KC_SLEP + ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_PWR + + ,KC_NO ,KC_NO + ,KC_NO + ,KC_NO ,KC_NO ,KC_NO +), + +/* MOUSE + * a keymap to control my system. + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ^ | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | | | | | | | | | MsUp | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | |------| |------| |MsLeft| MsDn |MsRght| | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | | | | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | |MidClk| + * ,------|------|------| |------+------+------. + * | | | | | |Left |Right | + * | | |------| |------| Click| Click| + * | | | ^ | | | | | + * `--------------------' `--------------------' + */ +[MOUSE] = KEYMAP( + KC_TRNS ,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_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_TRNS + + ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO + ,KC_NO ,KC_NO ,KC_NO ,KC_MS_U ,KC_NO ,KC_NO ,KC_NO + ,KC_NO ,KC_MS_L ,KC_MS_D ,KC_MS_R ,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 @@ -344,44 +382,6 @@ void matrix_init_user() { // extra keys const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { switch (id) { - - // mouse - case MS_UL: - if (record->event.pressed) { - mousekey_on(KC_MS_UP); - mousekey_on(KC_MS_LEFT); - } else { - mousekey_off(KC_MS_UP); - mousekey_off(KC_MS_LEFT); - } - break; - case MS_UR: - if (record->event.pressed) { - mousekey_on(KC_MS_UP); - mousekey_on(KC_MS_RIGHT); - } else { - mousekey_off(KC_MS_UP); - mousekey_off(KC_MS_RIGHT); - } - break; - case MS_DL: - if (record->event.pressed) { - mousekey_on(KC_MS_DOWN); - mousekey_on(KC_MS_LEFT); - } else { - mousekey_off(KC_MS_DOWN); - mousekey_off(KC_MS_LEFT); - } - break; - case MS_DR: - if (record->event.pressed) { - mousekey_on(KC_MS_DOWN); - mousekey_on(KC_MS_RIGHT); - } else { - mousekey_off(KC_MS_DOWN); - mousekey_off(KC_MS_RIGHT); - } - break; } return MACRO_NONE; } From 063ade6bb5963d21b1f466f3cad33fa72f1f06a8 Mon Sep 17 00:00:00 2001 From: Pavlos Vinieratos Date: Fri, 9 Dec 2016 16:00:46 +0100 Subject: [PATCH 4/5] add light for some layers --- keyboards/ergodox/keymaps/pvinis/keymap.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/keyboards/ergodox/keymaps/pvinis/keymap.c b/keyboards/ergodox/keymaps/pvinis/keymap.c index 0052a9325..52283a51e 100644 --- a/keyboards/ergodox/keymaps/pvinis/keymap.c +++ b/keyboards/ergodox/keymaps/pvinis/keymap.c @@ -379,6 +379,25 @@ void matrix_init_user() { ergodox_led_all_off(); } +// light up leds based on the layer +void matrix_scan_user(void) { + uint8_t layer = biton32(layer_state); + + switch(layer) { + case SYSCTL: + ergodox_right_led_3_on(); + break; + case MOUSE: + ergodox_right_led_2_on(); + break; + default: + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + break; + } +} + // extra keys const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { switch (id) { From 9a59fee6677a51c5a15ecf9807a1e3962f606b50 Mon Sep 17 00:00:00 2001 From: Pavlos Vinieratos Date: Fri, 9 Dec 2016 16:01:11 +0100 Subject: [PATCH 5/5] tap dance for some layers. one tap sysctl, two taps mouse. --- keyboards/ergodox/keymaps/pvinis/keymap.c | 32 ++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/keyboards/ergodox/keymaps/pvinis/keymap.c b/keyboards/ergodox/keymaps/pvinis/keymap.c index 52283a51e..87ad70c91 100644 --- a/keyboards/ergodox/keymaps/pvinis/keymap.c +++ b/keyboards/ergodox/keymaps/pvinis/keymap.c @@ -22,6 +22,7 @@ enum { // tap dance TD_FLSH, // flash keyboard + TD_LAYR, // SYSCTL and MOUSE layer switch }; // application selection @@ -61,9 +62,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO - ,TG(BEGIN) ,TG(QWERTY) - ,TG(CARPALX) - ,KC_BSPC ,KC_LSFT ,TG(SYSCTL) + ,TG(BEGIN) ,TD(TD_LAYR) + ,TG(MOUSE) + ,KC_BSPC ,KC_LSFT ,TD(TD_LAYR) ,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 @@ -444,6 +445,31 @@ void flash_dance_reset(qk_tap_dance_state_t *state, void *user_data) { ergodox_right_led_3_off(); } +// SYSCTL on first tap, MOUSE ON second tap +void layers_dance_finished(qk_tap_dance_state_t *state, void *user_data) { + uint8_t layer = biton32(layer_state); + + switch(state->count) { + case 1: + switch(layer) { + case SYSCTL: + layer_off(SYSCTL); + break; + case MOUSE: + layer_off(MOUSE); + break; + default: + layer_on(SYSCTL); + break; + } + break; + case 2: + layer_on(MOUSE); + break; + } +} + qk_tap_dance_action_t tap_dance_actions[] = { [TD_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED( flash_each_tap, flash_dance_finished, flash_dance_reset ), + [TD_LAYR] = ACTION_TAP_DANCE_FN_ADVANCED( NULL, layers_dance_finished, NULL ), };