From 6f386ca6ae82be9212700dbfeb73517d077bef5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 28 Jan 2019 09:04:47 +0100 Subject: [PATCH 01/28] Change how desktop commands work --- keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c | 8 ++++---- keyboards/whitefox/keymaps/konstantin/keymap.c | 4 ++-- users/konstantin/konstantin.c | 12 ++++++++++++ users/konstantin/konstantin.h | 7 +++++++ users/konstantin/tap_dance.c | 2 +- users/konstantin/tap_dance.h | 6 ++---- 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c index fa324be9a11..707515abb47 100644 --- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c +++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c @@ -58,7 +58,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤ * │ │Mut│VoD│VoU│Ply│Prv│Nxt│MW←│MW→│M4 │M5 │ │ │ * └─────┬──┴┬──┴──┬┴───┴───┴───┴───┴───┴───┴──┬┴───┴┬───┬─┴───┘ - * │ │ │ MW↓ │MAcl2│ │ + * │DPR│DstNA│ MW↓ │MAcl2│ │ * └───┴─────┴───────────────────────────┴─────┴───┘ */ [L_FN] = LAYOUT( @@ -66,7 +66,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, _______, _______, _______, KC_BTN1, KC_MS_U, KC_BTN2, KC_BTN3, KC_DEL, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______, _______, _______, KC_WH_U, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_MPRV, KC_MNXT, KC_WH_L, KC_WH_R, KC_BTN4, KC_BTN5, _______, _______, - XXXXXXX, _______, _______, KC_WH_D, KC_ACL2, _______, XXXXXXX + XXXXXXX, DST_P_R, DST_N_A, KC_WH_D, KC_ACL2, _______, XXXXXXX ), /* RCtrl layer @@ -79,7 +79,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤ * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * └─────┬──┴┬──┴──┬┴───┴───┴───┴───┴───┴───┴──┬┴───┴┬───┬─┴───┘ - * │Dst│Dstp←│ │Dstp→│ │ + * │DtR│DstA │ │ │ │ * └───┴─────┴───────────────────────────┴─────┴───┘ */ [L_RCTRL] = LAYOUT( @@ -87,6 +87,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, TOP, MV_UP, BOTTOM, PRV_TAB, _______, _______, _______, _______, _______, _______, _______, _______, CLEAR, _______, MV_LEFT, MV_DOWN, MV_RGHT, NXT_TAB, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - XXXXXXX, DESKTOP, DSKTP_L, _______, DSKTP_R, _______, XXXXXXX + XXXXXXX, DST_RMV, DST_ADD, _______, _______, _______, XXXXXXX ), }; diff --git a/keyboards/whitefox/keymaps/konstantin/keymap.c b/keyboards/whitefox/keymaps/konstantin/keymap.c index e37097361a2..a56d0a43e4f 100644 --- a/keyboards/whitefox/keymaps/konstantin/keymap.c +++ b/keyboards/whitefox/keymaps/konstantin/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ * │ │MA0│MA2│MW←│MW→│ │ │ │VoD│VoU│Mut│ App │PgU│Btm│ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬─┬───┼───┼───┤ - * │ │Dstp│Dst←│ MW↓ │Dst→│ │ │Hom│PgD│End│ + * │ │DtPR│DtNA│ MW↓ │ │ │ │Hom│PgD│End│ * └────┴────┴────┴────────────────────────┴────┴────┘ └───┴───┴───┘ */ [L_FN] = LAYOUT_truefox( \ @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, UC_MOD, _______, KC_MSTP, KC_MPLY, KC_MPRV, KC_MNXT, CLEAR, KC_INS, \ _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, TOP, \ _______, KC_ACL0, KC_ACL2, KC_WH_L, KC_WH_R, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_APP, KC_PGUP, BOTTOM, \ - _______, DESKTOP, DSKTP_L, KC_WH_D, DSKTP_R, _______, KC_HOME, KC_PGDN, KC_END \ + _______, DST_P_R, DST_N_A, KC_WH_D, _______, _______, KC_HOME, KC_PGDN, KC_END \ ), /* Numpad layer diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c index 47596279c36..bf92a503e6e 100644 --- a/users/konstantin/konstantin.c +++ b/users/konstantin/konstantin.c @@ -28,6 +28,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; + case DST_P_R: + (record->event.pressed ? register_code16 : unregister_code16)( + (get_mods() & MOD_MASK_CTRL) ? DST_RMV : DST_PRV + ); + return false; + + case DST_N_A: + (record->event.pressed ? register_code16 : unregister_code16)( + (get_mods() & MOD_MASK_CTRL) ? DST_ADD : DST_NXT + ); + return false; + #ifdef LAYER_FN static bool fn_lock; diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h index f67f9f1b7ef..3ca4f401e01 100644 --- a/users/konstantin/konstantin.h +++ b/users/konstantin/konstantin.h @@ -23,6 +23,11 @@ #define PRV_TAB LCTL(KC_PGUP) #define NXT_TAB LCTL(KC_PGDN) +#define DST_ADD LCTL(LGUI(KC_D)) +#define DST_RMV LCTL(LGUI(KC_F4)) +#define DST_PRV LCTL(LGUI(KC_LEFT)) +#define DST_NXT LCTL(LGUI(KC_RGHT)) + #define LCT_CPS LCTL_T(KC_CAPS) #ifdef SEND_STRING_CLEAN @@ -37,6 +42,8 @@ enum keycodes_user { CLEAR = SAFE_RANGE, + DST_P_R, + DST_N_A, #ifdef LAYER_NUMPAD NUMPAD, #endif diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c index b13f33c024f..e3f1729467f 100644 --- a/users/konstantin/tap_dance.c +++ b/users/konstantin/tap_dance.c @@ -82,7 +82,7 @@ void td_lsft_fn_reset(qk_tap_dance_state_t *state, void *user_data) { } qk_tap_dance_action_t tap_dance_actions[] = { - [TD_DESKTOP] = ACTION_TAP_DANCE_DOUBLE(LCTL(LGUI(KC_D)), LCTL(LGUI(KC_F4))), // Add/close virtual desktop + [TD_DST_A_R] = ACTION_TAP_DANCE_DOUBLE(DST_ADD, DST_RMV), [TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_LALT), [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_RGUI), diff --git a/users/konstantin/tap_dance.h b/users/konstantin/tap_dance.h index 922a6351416..1757e9b1135 100644 --- a/users/konstantin/tap_dance.h +++ b/users/konstantin/tap_dance.h @@ -2,9 +2,7 @@ #include "quantum.h" -#define DESKTOP TD(TD_DESKTOP) -#define DSKTP_L LCTL(LGUI(KC_LEFT)) -#define DSKTP_R LCTL(LGUI(KC_RGHT)) +#define DST_A_R TD(TD_DST_A_R) #define RAL_LAL TD(TD_RAL_LAL) #define RAL_RGU TD(TD_RAL_RGU) @@ -14,7 +12,7 @@ #define LSFT_FN TD(TD_LSFT_FN) enum tap_dance { - TD_DESKTOP, + TD_DST_A_R, TD_RAL_LAL, TD_RAL_RGU, From 6695c874fb8660989a129691bbffc6225be67362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 28 Jan 2019 09:05:35 +0100 Subject: [PATCH 02/28] Add DST_MOD_MASK as a config option --- users/konstantin/konstantin.c | 4 ++-- users/konstantin/konstantin.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c index bf92a503e6e..5861574cba7 100644 --- a/users/konstantin/konstantin.c +++ b/users/konstantin/konstantin.c @@ -30,13 +30,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case DST_P_R: (record->event.pressed ? register_code16 : unregister_code16)( - (get_mods() & MOD_MASK_CTRL) ? DST_RMV : DST_PRV + (get_mods() & DST_MOD_MASK) ? DST_RMV : DST_PRV ); return false; case DST_N_A: (record->event.pressed ? register_code16 : unregister_code16)( - (get_mods() & MOD_MASK_CTRL) ? DST_ADD : DST_NXT + (get_mods() & DST_MOD_MASK) ? DST_ADD : DST_NXT ); return false; diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h index 3ca4f401e01..a649e4f79d8 100644 --- a/users/konstantin/konstantin.h +++ b/users/konstantin/konstantin.h @@ -27,6 +27,9 @@ #define DST_RMV LCTL(LGUI(KC_F4)) #define DST_PRV LCTL(LGUI(KC_LEFT)) #define DST_NXT LCTL(LGUI(KC_RGHT)) +#ifndef DST_MOD_MASK + #define DST_MOD_MASK MOD_MASK_CTRL +#endif #define LCT_CPS LCTL_T(KC_CAPS) From f2543c3b9b63433f8f5f7aec9531f7ebddcce4fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Tue, 29 Jan 2019 00:37:10 +0100 Subject: [PATCH 03/28] =?UTF-8?q?DST=5FRMV=20=E2=86=92=20DST=5FREM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c | 2 +- users/konstantin/konstantin.c | 2 +- users/konstantin/konstantin.h | 2 +- users/konstantin/tap_dance.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c index 707515abb47..b1e8bf05819 100644 --- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c +++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c @@ -87,6 +87,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, TOP, MV_UP, BOTTOM, PRV_TAB, _______, _______, _______, _______, _______, _______, _______, _______, CLEAR, _______, MV_LEFT, MV_DOWN, MV_RGHT, NXT_TAB, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - XXXXXXX, DST_RMV, DST_ADD, _______, _______, _______, XXXXXXX + XXXXXXX, DST_REM, DST_ADD, _______, _______, _______, XXXXXXX ), }; diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c index 5861574cba7..686ff32ecc2 100644 --- a/users/konstantin/konstantin.c +++ b/users/konstantin/konstantin.c @@ -30,7 +30,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case DST_P_R: (record->event.pressed ? register_code16 : unregister_code16)( - (get_mods() & DST_MOD_MASK) ? DST_RMV : DST_PRV + (get_mods() & DST_MOD_MASK) ? DST_REM : DST_PRV ); return false; diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h index a649e4f79d8..48bd26cd595 100644 --- a/users/konstantin/konstantin.h +++ b/users/konstantin/konstantin.h @@ -24,7 +24,7 @@ #define NXT_TAB LCTL(KC_PGDN) #define DST_ADD LCTL(LGUI(KC_D)) -#define DST_RMV LCTL(LGUI(KC_F4)) +#define DST_REM LCTL(LGUI(KC_F4)) #define DST_PRV LCTL(LGUI(KC_LEFT)) #define DST_NXT LCTL(LGUI(KC_RGHT)) #ifndef DST_MOD_MASK diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c index e3f1729467f..81f2d42e1fb 100644 --- a/users/konstantin/tap_dance.c +++ b/users/konstantin/tap_dance.c @@ -82,7 +82,7 @@ void td_lsft_fn_reset(qk_tap_dance_state_t *state, void *user_data) { } qk_tap_dance_action_t tap_dance_actions[] = { - [TD_DST_A_R] = ACTION_TAP_DANCE_DOUBLE(DST_ADD, DST_RMV), + [TD_DST_A_R] = ACTION_TAP_DANCE_DOUBLE(DST_ADD, DST_REM), [TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_LALT), [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_RGUI), From 012c5ef9bdccc8d752481c3c1d35a0ef47b075c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Thu, 31 Jan 2019 16:02:24 +0100 Subject: [PATCH 04/28] Update custom SEND_STRING --- users/konstantin/konstantin.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h index 48bd26cd595..989854c2e68 100644 --- a/users/konstantin/konstantin.h +++ b/users/konstantin/konstantin.h @@ -35,11 +35,11 @@ #ifdef SEND_STRING_CLEAN #undef SEND_STRING - #define SEND_STRING(...) { \ - uint8_t ss_mods = get_mods(); \ - clear_mods(); \ - send_string_P(PSTR(__VA_ARGS__)); \ - set_mods(ss_mods); \ + #define SEND_STRING(string) { \ + uint8_t ss_mods = get_mods(); \ + clear_mods(); \ + send_string_P(PSTR(string)); \ + set_mods(ss_mods); \ } #endif From db1ace5426ab08842cec23e0da190ab222de6088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Fri, 11 Jan 2019 07:55:47 +0100 Subject: [PATCH 05/28] Add melody96:konstantin keymap --- .../melody96/keymaps/konstantin/config.h | 3 ++ .../melody96/keymaps/konstantin/keymap.c | 52 +++++++++++++++++++ .../melody96/keymaps/konstantin/rules.mk | 1 + 3 files changed, 56 insertions(+) create mode 100644 keyboards/melody96/keymaps/konstantin/config.h create mode 100644 keyboards/melody96/keymaps/konstantin/keymap.c create mode 100644 keyboards/melody96/keymaps/konstantin/rules.mk diff --git a/keyboards/melody96/keymaps/konstantin/config.h b/keyboards/melody96/keymaps/konstantin/config.h new file mode 100644 index 00000000000..4b511eb8484 --- /dev/null +++ b/keyboards/melody96/keymaps/konstantin/config.h @@ -0,0 +1,3 @@ +#pragma once + +#define LAYER_FN diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c new file mode 100644 index 00000000000..df93cd702bc --- /dev/null +++ b/keyboards/melody96/keymaps/konstantin/keymap.c @@ -0,0 +1,52 @@ +#include QMK_KEYBOARD_H +#include "konstantin.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base layer + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ + * │Esc│F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│PSc│Ins│Hom│End│PgU│PgD│ + * ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ \ │Del│NLk│P/ │P* │P- │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┼───┼───┼───┼───┤ + * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │Bspc │P7 │P8 │P9 │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┼───┼───┤P+ │ + * │FnCaps│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │P4 │P5 │P6 │ │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┼───┼───┼───┤ + * │LSft│RAG│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │RShift│ ↑ │P1 │P2 │P3 │ │ + * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┴┬──┴──┬───┼───┼───┼───┼───┤PEn│ + * │LCtl│LGui│LAlt│ Space │RAlGu│RCtrl│ ← │ ↓ │ → │P0 │P. │ │ + * └────┴────┴────┴────────────────────────┴─────┴─────┴───┴───┴───┴───┴───┴───┘ + */ + [L_BASE] = LAYOUT( \ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_INS, KC_HOME, KC_END, KC_PGUP, KC_PGDN, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_DEL, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_P7, KC_P8, KC_P9, XXXXXXX, + FN_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_LSFT, RAL_RGU, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXXX, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, RAL_RGU, XXXXXXX, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT + ), + + /* Function layer + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┼───┼───┼───┼───┤ + * │ M4 │M2 │M↑ │M1 │M3 │M5 │ │ │ │ │ │ │ │Clear│ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┼───┼───┤ │ + * │ │M← │M↓ │M→ │MW↑│ │ │ │ │ │ │ │ │ │ │ │ │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┼───┼───┼───┤ + * │ │ │MA0│MA2│MW←│MW→│ │ │ │VoD│VoU│Mut│ │PgU│ │ │ │ │ + * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┴┬──┴──┬───┼───┼───┼───┼───┤ │ + * │ │DtPR│DtNA│ MW↓ │ │ App │Hom│PgD│End│ │ │ │ + * └────┴────┴────┴────────────────────────┴─────┴─────┴───┴───┴───┴───┴───┴───┘ + */ + [L_FN] = LAYOUT( \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, _______, _______, _______, _______, _______, _______, CLEAR, _______, _______, _______, XXXXXXX, + _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_ACL0, KC_ACL2, KC_WH_L, KC_WH_R, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, KC_PGUP, _______, _______, _______, XXXXXXX, + _______, DST_P_R, DST_N_A, KC_WH_D, _______, XXXXXXX, KC_APP, KC_HOME, KC_PGDN, KC_END, _______, _______, _______ + ), +}; diff --git a/keyboards/melody96/keymaps/konstantin/rules.mk b/keyboards/melody96/keymaps/konstantin/rules.mk new file mode 100644 index 00000000000..7b30c0beff2 --- /dev/null +++ b/keyboards/melody96/keymaps/konstantin/rules.mk @@ -0,0 +1 @@ +BACKLIGHT_ENABLE = no From ef189da2439d8f0cf20a83756400a38310c1caeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Sat, 9 Feb 2019 21:45:25 +0100 Subject: [PATCH 06/28] Move feature flags from userspace into keyboard rules --- keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk | 9 +++++++++ keyboards/melody96/keymaps/konstantin/rules.mk | 9 +++++++++ keyboards/whitefox/keymaps/konstantin/rules.mk | 9 +++++++++ users/konstantin/rules.mk | 9 --------- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk b/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk index a45a631dc04..38ccda621a2 100644 --- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk +++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk @@ -1,2 +1,11 @@ +BOOTMAGIC_ENABLE = no +COMMAND_ENABLE = yes +CONSOLE_ENABLE = yes +EXTRAKEY_ENABLE = yes +MOUSEKEY_ENABLE = yes +NKRO_ENABLE = yes +TAP_DANCE_ENABLE = yes +UNICODE_ENABLE = yes + BACKLIGHT_ENABLE = no RGBLIGHT_ENABLE = no diff --git a/keyboards/melody96/keymaps/konstantin/rules.mk b/keyboards/melody96/keymaps/konstantin/rules.mk index 7b30c0beff2..c1d4c9a0373 100644 --- a/keyboards/melody96/keymaps/konstantin/rules.mk +++ b/keyboards/melody96/keymaps/konstantin/rules.mk @@ -1 +1,10 @@ +BOOTMAGIC_ENABLE = no +COMMAND_ENABLE = yes +CONSOLE_ENABLE = no +EXTRAKEY_ENABLE = yes +MOUSEKEY_ENABLE = yes +NKRO_ENABLE = yes +TAP_DANCE_ENABLE = yes +UNICODE_ENABLE = yes + BACKLIGHT_ENABLE = no diff --git a/keyboards/whitefox/keymaps/konstantin/rules.mk b/keyboards/whitefox/keymaps/konstantin/rules.mk index 1302f14ca84..14a29380ce3 100644 --- a/keyboards/whitefox/keymaps/konstantin/rules.mk +++ b/keyboards/whitefox/keymaps/konstantin/rules.mk @@ -1,2 +1,11 @@ +BOOTMAGIC_ENABLE = no +COMMAND_ENABLE = yes +CONSOLE_ENABLE = yes +EXTRAKEY_ENABLE = yes +MOUSEKEY_ENABLE = yes +NKRO_ENABLE = yes +TAP_DANCE_ENABLE = yes +UNICODE_ENABLE = yes + BACKLIGHT_ENABLE = no VISUALIZER_ENABLE = no diff --git a/users/konstantin/rules.mk b/users/konstantin/rules.mk index d2522b95238..4af256e1eb5 100644 --- a/users/konstantin/rules.mk +++ b/users/konstantin/rules.mk @@ -1,12 +1,3 @@ -BOOTMAGIC_ENABLE = no -COMMAND_ENABLE = yes -CONSOLE_ENABLE = yes -EXTRAKEY_ENABLE = yes -MOUSEKEY_ENABLE = yes -NKRO_ENABLE = yes -TAP_DANCE_ENABLE = yes -UNICODE_ENABLE = yes - SRC += konstantin.c ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) SRC += tap_dance.c From ea23035c53162ee88ca02533d49cb931fdce3bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 11 Feb 2019 22:03:14 +0100 Subject: [PATCH 07/28] Use "Vo-", "Vo+" instead of "VoD", "VoU" in keymap comments --- keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c | 2 +- keyboards/melody96/keymaps/konstantin/keymap.c | 2 +- keyboards/whitefox/keymaps/konstantin/keymap.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c index b1e8bf05819..3404cc4e491 100644 --- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c +++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c @@ -56,7 +56,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ * │ │ ← │ ↓ │ → │PgD│ │ │ │MW↑│M← │M↓ │M→ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤ - * │ │Mut│VoD│VoU│Ply│Prv│Nxt│MW←│MW→│M4 │M5 │ │ │ + * │ │Mut│Vo-│Vo+│Ply│Prv│Nxt│MW←│MW→│M4 │M5 │ │ │ * └─────┬──┴┬──┴──┬┴───┴───┴───┴───┴───┴───┴──┬┴───┴┬───┬─┴───┘ * │DPR│DstNA│ MW↓ │MAcl2│ │ * └───┴─────┴───────────────────────────┴─────┴───┘ diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c index df93cd702bc..2f05e288b06 100644 --- a/keyboards/melody96/keymaps/konstantin/keymap.c +++ b/keyboards/melody96/keymaps/konstantin/keymap.c @@ -36,7 +36,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┼───┼───┤ │ * │ │M← │M↓ │M→ │MW↑│ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┼───┼───┼───┤ - * │ │ │MA0│MA2│MW←│MW→│ │ │ │VoD│VoU│Mut│ │PgU│ │ │ │ │ + * │ │ │MA0│MA2│MW←│MW→│ │ │ │Vo-│Vo+│Mut│ │PgU│ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┴┬──┴──┬───┼───┼───┼───┼───┤ │ * │ │DtPR│DtNA│ MW↓ │ │ App │Hom│PgD│End│ │ │ │ * └────┴────┴────┴────────────────────────┴─────┴─────┴───┴───┴───┴───┴───┴───┘ diff --git a/keyboards/whitefox/keymaps/konstantin/keymap.c b/keyboards/whitefox/keymaps/konstantin/keymap.c index a56d0a43e4f..494300f2d62 100644 --- a/keyboards/whitefox/keymaps/konstantin/keymap.c +++ b/keyboards/whitefox/keymaps/konstantin/keymap.c @@ -31,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤ * │ │M← │M↓ │M→ │MW↑│ │ │ │ │ │ │ │ │Top│ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ - * │ │MA0│MA2│MW←│MW→│ │ │ │VoD│VoU│Mut│ App │PgU│Btm│ + * │ │MA0│MA2│MW←│MW→│ │ │ │Vo-│Vo+│Mut│ App │PgU│Btm│ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬─┬───┼───┼───┤ * │ │DtPR│DtNA│ MW↓ │ │ │ │Hom│PgD│End│ * └────┴────┴────┴────────────────────────┴────┴────┘ └───┴───┴───┘ From d163b22dfbb4a9092e3b7fc2b18a679e03080a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 11 Feb 2019 22:04:59 +0100 Subject: [PATCH 08/28] Add RGB controls and numpad Unicode to Melody96 keymap --- .../melody96/keymaps/konstantin/keymap.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c index 2f05e288b06..11b687b55e3 100644 --- a/keyboards/melody96/keymaps/konstantin/keymap.c +++ b/keyboards/melody96/keymaps/konstantin/keymap.c @@ -30,23 +30,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │RTg│ ÷ │ × │ − │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┼───┼───┼───┼───┤ - * │ M4 │M2 │M↑ │M1 │M3 │M5 │ │ │ │ │ │ │ │Clear│ │ │ │ │ + * │ M4 │M2 │M↑ │M1 │M3 │M5 │ │ │ │ │ │ │ │Clear│RH+│RS+│RV+│ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┼───┼───┤ │ - * │ │M← │M↓ │M→ │MW↑│ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │M← │M↓ │M→ │MW↑│ │ │ │ │ │ │ │ │RH-│RS-│RV-│ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┼───┼───┼───┤ - * │ │ │MA0│MA2│MW←│MW→│ │ │ │Vo-│Vo+│Mut│ │PgU│ │ │ │ │ - * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┴┬──┴──┬───┼───┼───┼───┼───┤ │ - * │ │DtPR│DtNA│ MW↓ │ │ App │Hom│PgD│End│ │ │ │ + * │ │ │MA0│MA2│MW←│MW→│ │ │ │Vo-│Vo+│Mut│ │PgU│RMB│RMK│RMG│ │ + * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┴┬──┴──┬───┼───┼───┼───┼───┤RMP│ + * │ │DtPR│DtNA│ MW↓ │ │ App │Hom│PgD│End│RMR│RMF│ │ * └────┴────┴────┴────────────────────────┴─────┴─────┴───┴───┴───┴───┴───┴───┘ */ [L_FN] = LAYOUT( \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, _______, _______, _______, _______, _______, _______, CLEAR, _______, _______, _______, XXXXXXX, - _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, KC_ACL0, KC_ACL2, KC_WH_L, KC_WH_R, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, KC_PGUP, _______, _______, _______, XXXXXXX, - _______, DST_P_R, DST_N_A, KC_WH_D, _______, XXXXXXX, KC_APP, KC_HOME, KC_PGDN, KC_END, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, DIVIDE, TIMES, MINUS, + KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, _______, _______, _______, _______, _______, _______, CLEAR, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, + _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, _______, + _______, _______, KC_ACL0, KC_ACL2, KC_WH_L, KC_WH_R, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, KC_PGUP, RGB_M_B, RGB_M_K, RGB_M_G, XXXXXXX, + _______, DST_P_R, DST_N_A, KC_WH_D, _______, XXXXXXX, KC_APP, KC_HOME, KC_PGDN, KC_END, RGB_RMOD,RGB_MOD, RGB_M_P ), }; From 2f07627a5dd38ab1370804f4feb1972250928803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 11 Feb 2019 22:41:51 +0100 Subject: [PATCH 09/28] Add RGB_SET keycode to Melody96 and RGB files to userspace --- .../melody96/keymaps/konstantin/keymap.c | 23 +++++++++++++++---- users/konstantin/konstantin.h | 3 +++ users/konstantin/rgb.c | 3 +++ users/konstantin/rgb.h | 17 ++++++++++++++ users/konstantin/rules.mk | 3 +++ 5 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 users/konstantin/rgb.c create mode 100644 users/konstantin/rgb.h diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c index 11b687b55e3..4df856f8fbf 100644 --- a/keyboards/melody96/keymaps/konstantin/keymap.c +++ b/keyboards/melody96/keymaps/konstantin/keymap.c @@ -1,6 +1,21 @@ #include QMK_KEYBOARD_H #include "konstantin.h" +enum keycodes_keymap { + RGB_SET = RANGE_KEYMAP, +}; + +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case RGB_SET: + rgblight_sethsv(GODSPEED_BLUE.h, GODSPEED_BLUE.s, GODSPEED_BLUE.v); + return false; + + default: + return true; + } +} + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Base layer * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ @@ -32,8 +47,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤ * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │RTg│ ÷ │ × │ − │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┼───┼───┼───┼───┤ - * │ M4 │M2 │M↑ │M1 │M3 │M5 │ │ │ │ │ │ │ │Clear│RH+│RS+│RV+│ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┼───┼───┤ │ + * │ M4 │M2 │M↑ │M1 │M3 │M5 │ │UCM│ │ │ │ │ │Clear│RH+│RS+│RV+│ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┼───┼───┤RSt│ * │ │M← │M↓ │M→ │MW↑│ │ │ │ │ │ │ │ │RH-│RS-│RV-│ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┼───┼───┼───┤ * │ │ │MA0│MA2│MW←│MW→│ │ │ │Vo-│Vo+│Mut│ │PgU│RMB│RMK│RMG│ │ @@ -44,8 +59,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [L_FN] = LAYOUT( \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, DIVIDE, TIMES, MINUS, - KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, _______, _______, _______, _______, _______, _______, CLEAR, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, - _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, _______, + KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, UC_MOD, _______, _______, _______, _______, _______, CLEAR, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, + _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SET, _______, _______, KC_ACL0, KC_ACL2, KC_WH_L, KC_WH_R, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, KC_PGUP, RGB_M_B, RGB_M_K, RGB_M_G, XXXXXXX, _______, DST_P_R, DST_N_A, KC_WH_D, _______, XXXXXXX, KC_APP, KC_HOME, KC_PGDN, KC_END, RGB_RMOD,RGB_MOD, RGB_M_P ), diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h index 989854c2e68..d8b00c4c89d 100644 --- a/users/konstantin/konstantin.h +++ b/users/konstantin/konstantin.h @@ -1,6 +1,9 @@ #pragma once #include "quantum.h" +#if defined(RGBLIGHT_ENABLE) || defined(RGBMATRIX_ENABLE) + #include "rgb.h" +#endif #ifdef TAP_DANCE_ENABLE #include "tap_dance.h" #endif diff --git a/users/konstantin/rgb.c b/users/konstantin/rgb.c new file mode 100644 index 00000000000..a09057d282d --- /dev/null +++ b/users/konstantin/rgb.c @@ -0,0 +1,3 @@ +#include "rgb.h" + +const hsv_t GODSPEED_BLUE = { .h = 214, .s = 17, .v = 73 }; diff --git a/users/konstantin/rgb.h b/users/konstantin/rgb.h new file mode 100644 index 00000000000..2ea10c67a7a --- /dev/null +++ b/users/konstantin/rgb.h @@ -0,0 +1,17 @@ +#pragma once + +#include "quantum.h" + +typedef struct { + uint16_t h; + uint8_t s; + uint8_t v; +} hsv_t; + +typedef struct { + uint8_t r; + uint8_t g; + uint8_t b; +} rgb_t; + +extern const hsv_t GODSPEED_BLUE; diff --git a/users/konstantin/rules.mk b/users/konstantin/rules.mk index 4af256e1eb5..8913e575586 100644 --- a/users/konstantin/rules.mk +++ b/users/konstantin/rules.mk @@ -1,4 +1,7 @@ SRC += konstantin.c +ifneq (,$(filter yes,$(RGBLIGHT_ENABLE) $(RGB_MATRIX_ENABLE))) # if either is yes + SRC += rgb.c +endif ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) SRC += tap_dance.c endif From ddb0f39ebf317c7a23c69ed45efb1882746a01b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 11 Feb 2019 23:21:41 +0100 Subject: [PATCH 10/28] Generate UNICODE and UNICODEMAP constants using macros --- users/konstantin/konstantin.h | 2 +- users/konstantin/rules.mk | 3 +++ users/konstantin/unicode.c | 7 +++++++ users/konstantin/unicode.h | 37 ++++++++++++++++++++++++++++------- 4 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 users/konstantin/unicode.c diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h index d8b00c4c89d..c32d674e8c7 100644 --- a/users/konstantin/konstantin.h +++ b/users/konstantin/konstantin.h @@ -7,7 +7,7 @@ #ifdef TAP_DANCE_ENABLE #include "tap_dance.h" #endif -#ifdef UNICODE_ENABLE +#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) #include "unicode.h" #endif diff --git a/users/konstantin/rules.mk b/users/konstantin/rules.mk index 8913e575586..6bda030fb0b 100644 --- a/users/konstantin/rules.mk +++ b/users/konstantin/rules.mk @@ -5,5 +5,8 @@ endif ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) SRC += tap_dance.c endif +ifneq (,$(filter yes,$(UNICODE_ENABLE) $(UNICODEMAP_ENABLE))) # if either is yes + SRC += unicode.c +endif EXTRAFLAGS += -flto diff --git a/users/konstantin/unicode.c b/users/konstantin/unicode.c new file mode 100644 index 00000000000..3b6164bc513 --- /dev/null +++ b/users/konstantin/unicode.c @@ -0,0 +1,7 @@ +#include "unicode.h" + +#ifdef UNICODEMAP_ENABLE + const uint32_t PROGMEM unicode_map[] = { + FOREACH_UNICODE(X_ENTRY) + }; +#endif diff --git a/users/konstantin/unicode.h b/users/konstantin/unicode.h index 09af7e1c7f6..d76f2a17004 100644 --- a/users/konstantin/unicode.h +++ b/users/konstantin/unicode.h @@ -2,10 +2,33 @@ #include "quantum.h" -#define COMMA UC(0x002C) -#define L_PAREN UC(0x0028) -#define R_PAREN UC(0x0029) -#define EQUALS UC(0x003D) -#define TIMES UC(0x00D7) -#define DIVIDE UC(0x00F7) -#define MINUS UC(0x2212) +#define FOREACH_UNICODE(M) \ + M(COMMA, 0x002C) \ + M(L_PAREN, 0x0028) \ + M(R_PAREN, 0x0029) \ + M(EQUALS, 0x003D) \ + M(TIMES, 0x00D7) \ + M(DIVIDE, 0x00F7) \ + M(MINUS, 0x2212) + +#define UC_KEYCODE(name, code) name = UC(code), + +#define X_NAME(name, code) X_ ## name, +#define X_ENTRY(name, code) [X_ ## name] = code, +#define X_KEYCODE(name, code) name = X(X_ ## name), + +#if defined(UNICODE_ENABLE) + enum unicode_keycodes { + FOREACH_UNICODE(UC_KEYCODE) + }; +#elif defined(UNICODEMAP_ENABLE) + enum unicode_names { + FOREACH_UNICODE(X_NAME) + }; + + extern const uint32_t PROGMEM unicode_map[]; + + enum unicode_keycodes { + FOREACH_UNICODE(X_KEYCODE) + }; +#endif From 7b11d740eaad1aade1a8d1914aab54f2720ab7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Tue, 12 Feb 2019 00:18:52 +0100 Subject: [PATCH 11/28] Avoid collisions with X_* send string constants --- users/konstantin/unicode.c | 2 +- users/konstantin/unicode.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/users/konstantin/unicode.c b/users/konstantin/unicode.c index 3b6164bc513..44b5be6c918 100644 --- a/users/konstantin/unicode.c +++ b/users/konstantin/unicode.c @@ -2,6 +2,6 @@ #ifdef UNICODEMAP_ENABLE const uint32_t PROGMEM unicode_map[] = { - FOREACH_UNICODE(X_ENTRY) + FOREACH_UNICODE(UCM_ENTRY) }; #endif diff --git a/users/konstantin/unicode.h b/users/konstantin/unicode.h index d76f2a17004..6bb908e0e26 100644 --- a/users/konstantin/unicode.h +++ b/users/konstantin/unicode.h @@ -13,9 +13,9 @@ #define UC_KEYCODE(name, code) name = UC(code), -#define X_NAME(name, code) X_ ## name, -#define X_ENTRY(name, code) [X_ ## name] = code, -#define X_KEYCODE(name, code) name = X(X_ ## name), +#define UCM_NAME(name, code) UCM_ ## name, +#define UCM_ENTRY(name, code) [UCM_ ## name] = code, +#define UCM_KEYCODE(name, code) name = X(UCM_ ## name), #if defined(UNICODE_ENABLE) enum unicode_keycodes { @@ -23,12 +23,12 @@ }; #elif defined(UNICODEMAP_ENABLE) enum unicode_names { - FOREACH_UNICODE(X_NAME) + FOREACH_UNICODE(UCM_NAME) }; extern const uint32_t PROGMEM unicode_map[]; enum unicode_keycodes { - FOREACH_UNICODE(X_KEYCODE) + FOREACH_UNICODE(UCM_KEYCODE) }; #endif From 5a41c06cd7dcf04f5a27ac9b2fa95399c65367d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 18 Feb 2019 05:01:24 +0100 Subject: [PATCH 12/28] Switch to UNICODEMAP in keyboard rules --- .../kbdfans/kbd6x/keymaps/konstantin/rules.mk | 16 ++++++++-------- keyboards/melody96/keymaps/konstantin/rules.mk | 16 ++++++++-------- keyboards/whitefox/keymaps/konstantin/rules.mk | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk b/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk index 38ccda621a2..4e485bf7667 100644 --- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk +++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk @@ -1,11 +1,11 @@ -BOOTMAGIC_ENABLE = no -COMMAND_ENABLE = yes -CONSOLE_ENABLE = yes -EXTRAKEY_ENABLE = yes -MOUSEKEY_ENABLE = yes -NKRO_ENABLE = yes -TAP_DANCE_ENABLE = yes -UNICODE_ENABLE = yes +BOOTMAGIC_ENABLE = no +COMMAND_ENABLE = yes +CONSOLE_ENABLE = yes +EXTRAKEY_ENABLE = yes +MOUSEKEY_ENABLE = yes +NKRO_ENABLE = yes +TAP_DANCE_ENABLE = yes +UNICODEMAP_ENABLE = yes BACKLIGHT_ENABLE = no RGBLIGHT_ENABLE = no diff --git a/keyboards/melody96/keymaps/konstantin/rules.mk b/keyboards/melody96/keymaps/konstantin/rules.mk index c1d4c9a0373..47a859d0891 100644 --- a/keyboards/melody96/keymaps/konstantin/rules.mk +++ b/keyboards/melody96/keymaps/konstantin/rules.mk @@ -1,10 +1,10 @@ -BOOTMAGIC_ENABLE = no -COMMAND_ENABLE = yes -CONSOLE_ENABLE = no -EXTRAKEY_ENABLE = yes -MOUSEKEY_ENABLE = yes -NKRO_ENABLE = yes -TAP_DANCE_ENABLE = yes -UNICODE_ENABLE = yes +BOOTMAGIC_ENABLE = no +COMMAND_ENABLE = yes +CONSOLE_ENABLE = no +EXTRAKEY_ENABLE = yes +MOUSEKEY_ENABLE = yes +NKRO_ENABLE = yes +TAP_DANCE_ENABLE = yes +UNICODEMAP_ENABLE = yes BACKLIGHT_ENABLE = no diff --git a/keyboards/whitefox/keymaps/konstantin/rules.mk b/keyboards/whitefox/keymaps/konstantin/rules.mk index 14a29380ce3..625ef346c8d 100644 --- a/keyboards/whitefox/keymaps/konstantin/rules.mk +++ b/keyboards/whitefox/keymaps/konstantin/rules.mk @@ -1,11 +1,11 @@ -BOOTMAGIC_ENABLE = no -COMMAND_ENABLE = yes -CONSOLE_ENABLE = yes -EXTRAKEY_ENABLE = yes -MOUSEKEY_ENABLE = yes -NKRO_ENABLE = yes -TAP_DANCE_ENABLE = yes -UNICODE_ENABLE = yes +BOOTMAGIC_ENABLE = no +COMMAND_ENABLE = yes +CONSOLE_ENABLE = yes +EXTRAKEY_ENABLE = yes +MOUSEKEY_ENABLE = yes +NKRO_ENABLE = yes +TAP_DANCE_ENABLE = yes +UNICODEMAP_ENABLE = yes BACKLIGHT_ENABLE = no VISUALIZER_ENABLE = no From bd43df53bdf0009a152251582a05046bbefb0858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Sat, 16 Feb 2019 15:26:14 +0100 Subject: [PATCH 13/28] Use two spaces before inline comments --- users/konstantin/konstantin.c | 4 ++-- users/konstantin/rgb.h | 12 ++++++------ users/konstantin/tap_dance.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c index 686ff32ecc2..239252d9c1d 100644 --- a/users/konstantin/konstantin.c +++ b/users/konstantin/konstantin.c @@ -6,7 +6,7 @@ static void toggle_numpad(void) { bool numpad_on = IS_LAYER_ON(L_NUMPAD); bool num_lock_on = IS_HOST_LED_ON(USB_LED_NUM_LOCK); if (num_lock_on != numpad_on) { - tap_code(KC_NLCK); // Toggle Num Lock to match layer state + tap_code(KC_NLCK); // Toggle Num Lock to match layer state } } #endif @@ -45,7 +45,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case FN_FNLK: if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) { - fn_lock = !IS_LAYER_ON(L_FN); // Fn layer will be toggled after this + fn_lock = !IS_LAYER_ON(L_FN); // Fn layer will be toggled after this } return true; #endif diff --git a/users/konstantin/rgb.h b/users/konstantin/rgb.h index 2ea10c67a7a..e296cf12e7c 100644 --- a/users/konstantin/rgb.h +++ b/users/konstantin/rgb.h @@ -3,15 +3,15 @@ #include "quantum.h" typedef struct { - uint16_t h; - uint8_t s; - uint8_t v; + uint16_t h; // 0–360 + uint8_t s; // 0–255 + uint8_t v; // 0–255 } hsv_t; typedef struct { - uint8_t r; - uint8_t g; - uint8_t b; + uint8_t r; // 0–255 + uint8_t g; // 0–255 + uint8_t b; // 0–255 } rgb_t; extern const hsv_t GODSPEED_BLUE; diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c index 81f2d42e1fb..dffaeb20663 100644 --- a/users/konstantin/tap_dance.c +++ b/users/konstantin/tap_dance.c @@ -30,7 +30,7 @@ void td_double_mods_reset(qk_tap_dance_state_t *state, void *user_data) { } struct { - bool fn_on; // Layer state when tap dance started + bool fn_on; // Layer state when tap dance started bool started; } td_fn_rctrl_data; From be65a0cc7921a0f6a6397bd7682720b5bd7d9128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Sat, 16 Feb 2019 18:03:59 +0100 Subject: [PATCH 14/28] Add _keymap versions of other custom Quantum functions Not added: eeconfig_update_keymap, eeconfig_read_keymap --- users/konstantin/konstantin.c | 80 ++++++++++++++++++++++++++++++++--- users/konstantin/konstantin.h | 12 ++++++ 2 files changed, 87 insertions(+), 5 deletions(-) diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c index 239252d9c1d..f5c59f9eb12 100644 --- a/users/konstantin/konstantin.c +++ b/users/konstantin/konstantin.c @@ -1,5 +1,45 @@ #include "konstantin.h" +__attribute__((weak)) +void keyboard_pre_init_keymap(void) {} + +void keyboard_pre_init_user(void) { + keyboard_pre_init_keymap(); +} + +__attribute__((weak)) +void eeconfig_init_keymap(void) {} + +void eeconfig_init_user(void) { + eeconfig_init_keymap(); +} + +__attribute__((weak)) +void matrix_init_keymap(void) {} + +void matrix_init_user(void) { + matrix_init_keymap(); +} + +__attribute__((weak)) +void keyboard_post_init_keymap(void) {} + +void keyboard_post_init_user(void) { + keyboard_post_init_keymap(); +} + +__attribute__((weak)) +void matrix_scan_keymap(void) {} + +void matrix_scan_user(void) { + matrix_scan_keymap(); +} + +__attribute__((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +} + #ifdef LAYER_NUMPAD static void toggle_numpad(void) { layer_invert(L_NUMPAD); @@ -11,11 +51,6 @@ static void toggle_numpad(void) { } #endif -__attribute__((weak)) -bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - return true; -} - bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keymap(keycode, record)) { return false; @@ -88,3 +123,38 @@ uint32_t layer_state_set_keymap(uint32_t state) { uint32_t layer_state_set_user(uint32_t state) { return layer_state_set_keymap(state); } + +__attribute__((weak)) +void led_set_keymap(uint8_t usb_led) {} + +void led_set_user(uint8_t usb_led) { + led_set_keymap(usb_led); +} + +__attribute__((weak)) +void suspend_power_down_keymap(void) {} + +void suspend_power_down_user(void) { + suspend_power_down_keymap(); +} + +__attribute__((weak)) +void suspend_wakeup_init_keymap(void) {} + +void suspend_wakeup_init_user(void) { + suspend_wakeup_init_keymap(); +} + +__attribute__((weak)) +void startup_keymap(void) {} + +void startup_user(void) { // Currently not called anywhere + startup_keymap(); +} + +__attribute__((weak)) +void shutdown_keymap(void) {} + +void shutdown_user(void) { + shutdown_keymap(); +} diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h index c32d674e8c7..db90c4ef69e 100644 --- a/users/konstantin/konstantin.h +++ b/users/konstantin/konstantin.h @@ -69,5 +69,17 @@ enum layers_user { L_RANGE_KEYMAP, }; +void keyboard_pre_init_keymap(void); +void eeconfig_init_keymap(void); +void matrix_init_keymap(void); +void keyboard_post_init_keymap(void); + +void matrix_scan_keymap(void); bool process_record_keymap(uint16_t keycode, keyrecord_t *record); uint32_t layer_state_set_keymap(uint32_t state); +void led_set_keymap(uint8_t usb_led); + +void suspend_power_down_keymap(void); +void suspend_wakeup_init_keymap(void); +void startup_keymap(void); +void shutdown_keymap(void); From 784e2af062a9ef0c6d1a4ef7fcc20df79ad4fab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Sat, 16 Feb 2019 18:05:01 +0100 Subject: [PATCH 15/28] Make toggle_numpad a nested function in process_record_user --- users/konstantin/konstantin.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c index f5c59f9eb12..a567d9166fd 100644 --- a/users/konstantin/konstantin.c +++ b/users/konstantin/konstantin.c @@ -40,22 +40,21 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } -#ifdef LAYER_NUMPAD -static void toggle_numpad(void) { - layer_invert(L_NUMPAD); - bool numpad_on = IS_LAYER_ON(L_NUMPAD); - bool num_lock_on = IS_HOST_LED_ON(USB_LED_NUM_LOCK); - if (num_lock_on != numpad_on) { - tap_code(KC_NLCK); // Toggle Num Lock to match layer state - } -} -#endif - bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keymap(keycode, record)) { return false; } +#ifdef LAYER_NUMPAD + void toggle_numpad(void) { + layer_invert(L_NUMPAD); + bool numpad = IS_LAYER_ON(L_NUMPAD), num_lock = IS_HOST_LED_ON(USB_LED_NUM_LOCK); + if (num_lock != numpad) { + tap_code(KC_NLCK); // Toggle Num Lock to match layer state + } + } +#endif + switch (keycode) { case CLEAR: if (record->event.pressed) { From f09a237a07f2a3a341f6c6972d2f87eec3235254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 18 Feb 2019 00:44:31 +0100 Subject: [PATCH 16/28] Remove most _keymap and _user definitions in userspace Some keyboards misuse _user functions by defining them in the base files instead of the corresponding _kb functions (especially led_set_user and matrix_init_user). Until this is fixed (#5148), I've removed definitions in my userspace that could cause linking collisions. --- users/konstantin/konstantin.c | 49 ----------------------------------- users/konstantin/konstantin.h | 8 ------ 2 files changed, 57 deletions(-) diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c index a567d9166fd..a8f2a5f2c95 100644 --- a/users/konstantin/konstantin.c +++ b/users/konstantin/konstantin.c @@ -14,13 +14,6 @@ void eeconfig_init_user(void) { eeconfig_init_keymap(); } -__attribute__((weak)) -void matrix_init_keymap(void) {} - -void matrix_init_user(void) { - matrix_init_keymap(); -} - __attribute__((weak)) void keyboard_post_init_keymap(void) {} @@ -28,13 +21,6 @@ void keyboard_post_init_user(void) { keyboard_post_init_keymap(); } -__attribute__((weak)) -void matrix_scan_keymap(void) {} - -void matrix_scan_user(void) { - matrix_scan_keymap(); -} - __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; @@ -122,38 +108,3 @@ uint32_t layer_state_set_keymap(uint32_t state) { uint32_t layer_state_set_user(uint32_t state) { return layer_state_set_keymap(state); } - -__attribute__((weak)) -void led_set_keymap(uint8_t usb_led) {} - -void led_set_user(uint8_t usb_led) { - led_set_keymap(usb_led); -} - -__attribute__((weak)) -void suspend_power_down_keymap(void) {} - -void suspend_power_down_user(void) { - suspend_power_down_keymap(); -} - -__attribute__((weak)) -void suspend_wakeup_init_keymap(void) {} - -void suspend_wakeup_init_user(void) { - suspend_wakeup_init_keymap(); -} - -__attribute__((weak)) -void startup_keymap(void) {} - -void startup_user(void) { // Currently not called anywhere - startup_keymap(); -} - -__attribute__((weak)) -void shutdown_keymap(void) {} - -void shutdown_user(void) { - shutdown_keymap(); -} diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h index db90c4ef69e..d4e0e189910 100644 --- a/users/konstantin/konstantin.h +++ b/users/konstantin/konstantin.h @@ -71,15 +71,7 @@ enum layers_user { void keyboard_pre_init_keymap(void); void eeconfig_init_keymap(void); -void matrix_init_keymap(void); void keyboard_post_init_keymap(void); -void matrix_scan_keymap(void); bool process_record_keymap(uint16_t keycode, keyrecord_t *record); uint32_t layer_state_set_keymap(uint32_t state); -void led_set_keymap(uint8_t usb_led); - -void suspend_power_down_keymap(void); -void suspend_wakeup_init_keymap(void); -void startup_keymap(void); -void shutdown_keymap(void); From 8e0dfdfb5307e8b0abb2f6030c9147cfd12964c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Sat, 16 Feb 2019 18:26:27 +0100 Subject: [PATCH 17/28] Set Melody96 underglow color to Godspeed blue on EEPROM reset --- keyboards/melody96/keymaps/konstantin/keymap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c index 4df856f8fbf..ab876f2f2f7 100644 --- a/keyboards/melody96/keymaps/konstantin/keymap.c +++ b/keyboards/melody96/keymaps/konstantin/keymap.c @@ -1,6 +1,10 @@ #include QMK_KEYBOARD_H #include "konstantin.h" +void eeconfig_init_keymap(void) { + rgblight_sethsv(GODSPEED_BLUE.h, GODSPEED_BLUE.s, GODSPEED_BLUE.v); +} + enum keycodes_keymap { RGB_SET = RANGE_KEYMAP, }; From de2e03650bd4d6056513991d4481679e246667bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Sat, 16 Feb 2019 17:26:39 +0100 Subject: [PATCH 18/28] Update GODSPEED_BLUE values and RGB mode keys --- keyboards/melody96/keymaps/konstantin/keymap.c | 6 +++--- users/konstantin/rgb.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c index ab876f2f2f7..02d84d693a9 100644 --- a/keyboards/melody96/keymaps/konstantin/keymap.c +++ b/keyboards/melody96/keymaps/konstantin/keymap.c @@ -55,9 +55,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┼───┼───┤RSt│ * │ │M← │M↓ │M→ │MW↑│ │ │ │ │ │ │ │ │RH-│RS-│RV-│ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┼───┼───┼───┤ - * │ │ │MA0│MA2│MW←│MW→│ │ │ │Vo-│Vo+│Mut│ │PgU│RMB│RMK│RMG│ │ + * │ │ │MA0│MA2│MW←│MW→│ │ │ │Vo-│Vo+│Mut│ │PgU│RMR│RMS│RMB│ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┴┬──┴──┬───┼───┼───┼───┼───┤RMP│ - * │ │DtPR│DtNA│ MW↓ │ │ App │Hom│PgD│End│RMR│RMF│ │ + * │ │DtPR│DtNA│ MW↓ │ │ App │Hom│PgD│End│RM-│RM+│ │ * └────┴────┴────┴────────────────────────┴─────┴─────┴───┴───┴───┴───┴───┴───┘ */ [L_FN] = LAYOUT( \ @@ -65,7 +65,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, DIVIDE, TIMES, MINUS, KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, UC_MOD, _______, _______, _______, _______, _______, CLEAR, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SET, - _______, _______, KC_ACL0, KC_ACL2, KC_WH_L, KC_WH_R, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, KC_PGUP, RGB_M_B, RGB_M_K, RGB_M_G, XXXXXXX, + _______, _______, KC_ACL0, KC_ACL2, KC_WH_L, KC_WH_R, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, KC_PGUP, RGB_M_R, RGB_M_SN,RGB_M_B, XXXXXXX, _______, DST_P_R, DST_N_A, KC_WH_D, _______, XXXXXXX, KC_APP, KC_HOME, KC_PGDN, KC_END, RGB_RMOD,RGB_MOD, RGB_M_P ), }; diff --git a/users/konstantin/rgb.c b/users/konstantin/rgb.c index a09057d282d..b69123be056 100644 --- a/users/konstantin/rgb.c +++ b/users/konstantin/rgb.c @@ -1,3 +1,3 @@ #include "rgb.h" -const hsv_t GODSPEED_BLUE = { .h = 214, .s = 17, .v = 73 }; +const hsv_t GODSPEED_BLUE = { .h = 300, .s = 68, .v = RGBLIGHT_LIMIT_VAL }; From fbe2eba4729a1d7b00b76243e146b5324d65976b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 18 Feb 2019 03:16:21 +0100 Subject: [PATCH 19/28] Add GODSPEED_YELLOW color --- keyboards/melody96/keymaps/konstantin/keymap.c | 11 +++++++++-- users/konstantin/konstantin.c | 2 +- users/konstantin/rgb.c | 3 ++- users/konstantin/rgb.h | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c index 02d84d693a9..c8b6edb3d6b 100644 --- a/keyboards/melody96/keymaps/konstantin/keymap.c +++ b/keyboards/melody96/keymaps/konstantin/keymap.c @@ -1,8 +1,12 @@ #include QMK_KEYBOARD_H #include "konstantin.h" +static const hsv_t *colors[] = { &GODSPEED_BLUE, &GODSPEED_YELLOW }; +static size_t cnum = sizeof colors / sizeof *colors; +static size_t cidx; + void eeconfig_init_keymap(void) { - rgblight_sethsv(GODSPEED_BLUE.h, GODSPEED_BLUE.s, GODSPEED_BLUE.v); + rgblight_sethsv(colors[cidx]->h, colors[cidx]->s, colors[cidx]->v); } enum keycodes_keymap { @@ -12,7 +16,10 @@ enum keycodes_keymap { bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case RGB_SET: - rgblight_sethsv(GODSPEED_BLUE.h, GODSPEED_BLUE.s, GODSPEED_BLUE.v); + if (record->event.pressed) { + cidx = (cidx + 1) % cnum; + rgblight_sethsv(colors[cidx]->h, colors[cidx]->s, colors[cidx]->v); + } return false; default: diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c index a8f2a5f2c95..753742fa781 100644 --- a/users/konstantin/konstantin.c +++ b/users/konstantin/konstantin.c @@ -61,7 +61,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; #ifdef LAYER_FN - static bool fn_lock; + static bool fn_lock; case FN_FNLK: if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) { diff --git a/users/konstantin/rgb.c b/users/konstantin/rgb.c index b69123be056..37b1ab3d579 100644 --- a/users/konstantin/rgb.c +++ b/users/konstantin/rgb.c @@ -1,3 +1,4 @@ #include "rgb.h" -const hsv_t GODSPEED_BLUE = { .h = 300, .s = 68, .v = RGBLIGHT_LIMIT_VAL }; +const hsv_t GODSPEED_BLUE = { .h = 300, .s = 68, .v = RGBLIGHT_LIMIT_VAL }; +const hsv_t GODSPEED_YELLOW = { .h = 35, .s = 165, .v = RGBLIGHT_LIMIT_VAL }; diff --git a/users/konstantin/rgb.h b/users/konstantin/rgb.h index e296cf12e7c..53b5821b0ee 100644 --- a/users/konstantin/rgb.h +++ b/users/konstantin/rgb.h @@ -15,3 +15,4 @@ typedef struct { } rgb_t; extern const hsv_t GODSPEED_BLUE; +extern const hsv_t GODSPEED_YELLOW; From 45dddfa6c27123ec6b598d561d3c3859882ccbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 18 Feb 2019 04:34:55 +0100 Subject: [PATCH 20/28] Set preferred intervals for rgblight effects --- users/konstantin/rgb.c | 20 ++++++++++++++++++++ users/konstantin/unicode.c | 6 +++--- users/konstantin/unicode.h | 20 ++++++++++---------- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/users/konstantin/rgb.c b/users/konstantin/rgb.c index 37b1ab3d579..ed6efe87a46 100644 --- a/users/konstantin/rgb.c +++ b/users/konstantin/rgb.c @@ -1,4 +1,24 @@ #include "rgb.h" +#ifdef RGBLIGHT_EFFECT_BREATHING +const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {20, 30, 5, 10}; +#endif + +#ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD +const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {20, 50, 100}; +#endif + +#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL +const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {20, 50, 100}; +#endif + +#ifdef RGBLIGHT_EFFECT_SNAKE +const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {20, 50, 100}; +#endif + +#ifdef RGBLIGHT_EFFECT_KNIGHT +const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {20, 50, 100}; +#endif + const hsv_t GODSPEED_BLUE = { .h = 300, .s = 68, .v = RGBLIGHT_LIMIT_VAL }; const hsv_t GODSPEED_YELLOW = { .h = 35, .s = 165, .v = RGBLIGHT_LIMIT_VAL }; diff --git a/users/konstantin/unicode.c b/users/konstantin/unicode.c index 44b5be6c918..144c0aaf75f 100644 --- a/users/konstantin/unicode.c +++ b/users/konstantin/unicode.c @@ -1,7 +1,7 @@ #include "unicode.h" #ifdef UNICODEMAP_ENABLE - const uint32_t PROGMEM unicode_map[] = { - FOREACH_UNICODE(UCM_ENTRY) - }; +const uint32_t PROGMEM unicode_map[] = { + FOREACH_UNICODE(UCM_ENTRY) +}; #endif diff --git a/users/konstantin/unicode.h b/users/konstantin/unicode.h index 6bb908e0e26..c8eddabb713 100644 --- a/users/konstantin/unicode.h +++ b/users/konstantin/unicode.h @@ -18,17 +18,17 @@ #define UCM_KEYCODE(name, code) name = X(UCM_ ## name), #if defined(UNICODE_ENABLE) - enum unicode_keycodes { - FOREACH_UNICODE(UC_KEYCODE) - }; +enum unicode_keycodes { + FOREACH_UNICODE(UC_KEYCODE) +}; #elif defined(UNICODEMAP_ENABLE) - enum unicode_names { - FOREACH_UNICODE(UCM_NAME) - }; +enum unicode_names { + FOREACH_UNICODE(UCM_NAME) +}; - extern const uint32_t PROGMEM unicode_map[]; +extern const uint32_t PROGMEM unicode_map[]; - enum unicode_keycodes { - FOREACH_UNICODE(UCM_KEYCODE) - }; +enum unicode_keycodes { + FOREACH_UNICODE(UCM_KEYCODE) +}; #endif From 1b3b9414b75e78db14daf61475c54007e8e5e0b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 18 Feb 2019 05:26:54 +0100 Subject: [PATCH 21/28] Update tap dance function names --- users/konstantin/tap_dance.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c index dffaeb20663..cdf7b731c57 100644 --- a/users/konstantin/tap_dance.c +++ b/users/konstantin/tap_dance.c @@ -60,7 +60,7 @@ void td_fn_rctrl_reset(qk_tap_dance_state_t *state, void *user_data) { td_fn_rctrl_data.started = false; } -void td_lsft_fn_each(qk_tap_dance_state_t *state, void *user_data) { +void td_lshift_fn_each(qk_tap_dance_state_t *state, void *user_data) { // Single tap → LShift, double tap → Fn, triple tap etc. → Fn+LShift if (state->count == 1 || state->count == 3) { register_code(KC_LSFT); @@ -72,7 +72,7 @@ void td_lsft_fn_each(qk_tap_dance_state_t *state, void *user_data) { } } -void td_lsft_fn_reset(qk_tap_dance_state_t *state, void *user_data) { +void td_lshift_fn_reset(qk_tap_dance_state_t *state, void *user_data) { if (state->count == 1 || state->count >= 3) { unregister_code(KC_LSFT); } @@ -88,6 +88,6 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_RGUI), [TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RCTL, KC_RSFT), - [TD_FN_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(td_fn_rctrl_each, NULL, td_fn_rctrl_reset), - [TD_LSFT_FN] = ACTION_TAP_DANCE_FN_ADVANCED(td_lsft_fn_each, NULL, td_lsft_fn_reset), + [TD_FN_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(td_fn_rctrl_each, NULL, td_fn_rctrl_reset), + [TD_LSFT_FN] = ACTION_TAP_DANCE_FN_ADVANCED(td_lshift_fn_each, NULL, td_lshift_fn_reset), }; From b05a4b1a4be36e00095eac3188b3b748c5fe1362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 18 Feb 2019 05:41:03 +0100 Subject: [PATCH 22/28] Replace td_lshift_fn with generic td_mod_layer, add TD_RCTL_FN Move TD_FN_RCTL after TD_RCTL_FN --- users/konstantin/tap_dance.c | 78 ++++++++++++++++++++---------------- users/konstantin/tap_dance.h | 6 ++- 2 files changed, 47 insertions(+), 37 deletions(-) diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c index cdf7b731c57..166bb10a696 100644 --- a/users/konstantin/tap_dance.c +++ b/users/konstantin/tap_dance.c @@ -1,31 +1,59 @@ #include "tap_dance.h" #include "konstantin.h" -#define ACTION_TAP_DANCE_DOUBLE_MODS(mod1, mod2) { \ - .fn = { td_double_mods_each, NULL, td_double_mods_reset }, \ - .user_data = &(qk_tap_dance_pair_t){ mod1, mod2 }, \ +#define ACTION_TAP_DANCE_DOUBLE_MODS(mod1, mod2) { \ + .fn = { td_double_mods_each, NULL, td_double_mods_reset }, \ + .user_data = &(qk_tap_dance_pair_t){ mod1, mod2 }, \ } void td_double_mods_each(qk_tap_dance_state_t *state, void *user_data) { - qk_tap_dance_pair_t *mods = (qk_tap_dance_pair_t *)user_data; + qk_tap_dance_pair_t *data = (qk_tap_dance_pair_t *)user_data; // Single tap → mod1, double tap → mod2, triple tap etc. → mod1+mod2 if (state->count == 1 || state->count == 3) { - register_code(mods->kc1); + register_code(data->kc1); } else if (state->count == 2) { - unregister_code(mods->kc1); - register_code(mods->kc2); + unregister_code(data->kc1); + register_code(data->kc2); } - // Prevent tap dance from sending kc1 and kc2 as weak mods - state->weak_mods &= ~(MOD_BIT(mods->kc1) | MOD_BIT(mods->kc2)); + // Prevent tap dance from sending the mods as weak mods + state->weak_mods &= ~(MOD_BIT(data->kc1) | MOD_BIT(data->kc2)); } void td_double_mods_reset(qk_tap_dance_state_t *state, void *user_data) { - qk_tap_dance_pair_t *mods = (qk_tap_dance_pair_t *)user_data; + qk_tap_dance_pair_t *data = (qk_tap_dance_pair_t *)user_data; if (state->count == 1 || state->count >= 3) { - unregister_code(mods->kc1); + unregister_code(data->kc1); } if (state->count >= 2) { - unregister_code(mods->kc2); + unregister_code(data->kc2); + } +} + +#define ACTION_TAP_DANCE_MOD_LAYER(mod, layer) { \ + .fn = { td_mod_layer_each, NULL, td_mod_layer_reset }, \ + .user_data = &(qk_tap_dance_dual_role_t){ mod, layer }, \ + } + +void td_mod_layer_each(qk_tap_dance_state_t *state, void *user_data) { + qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data; + // Single tap → mod, double tap → layer, triple tap etc. → mod+layer + if (state->count == 1 || state->count == 3) { + register_code(data->kc); + } else if (state->count == 2) { + unregister_code(data->kc); + // Prevent tap dance from sending the mod as a weak mod + state->weak_mods &= ~MOD_BIT(data->kc); + layer_on(data->layer); + } +} + +void td_mod_layer_reset(qk_tap_dance_state_t *state, void *user_data) { + qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data; + if (state->count == 1 || state->count >= 3) { + unregister_code(data->kc); + } + if (state->count >= 2) { + layer_off(data->layer); } } @@ -60,27 +88,6 @@ void td_fn_rctrl_reset(qk_tap_dance_state_t *state, void *user_data) { td_fn_rctrl_data.started = false; } -void td_lshift_fn_each(qk_tap_dance_state_t *state, void *user_data) { - // Single tap → LShift, double tap → Fn, triple tap etc. → Fn+LShift - if (state->count == 1 || state->count == 3) { - register_code(KC_LSFT); - } else if (state->count == 2) { - unregister_code(KC_LSFT); - // Prevent tap dance from sending LShift as a weak mod - state->weak_mods &= ~MOD_BIT(KC_LSFT); - layer_on(L_FN); - } -} - -void td_lshift_fn_reset(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1 || state->count >= 3) { - unregister_code(KC_LSFT); - } - if (state->count >= 2) { - layer_off(L_FN); - } -} - qk_tap_dance_action_t tap_dance_actions[] = { [TD_DST_A_R] = ACTION_TAP_DANCE_DOUBLE(DST_ADD, DST_REM), @@ -88,6 +95,7 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_RGUI), [TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RCTL, KC_RSFT), - [TD_FN_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(td_fn_rctrl_each, NULL, td_fn_rctrl_reset), - [TD_LSFT_FN] = ACTION_TAP_DANCE_FN_ADVANCED(td_lshift_fn_each, NULL, td_lshift_fn_reset), + [TD_LSFT_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_LSFT, L_FN), + [TD_RCTL_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_RCTL, L_FN), + [TD_FN_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(td_fn_rctrl_each, NULL, td_fn_rctrl_reset), }; diff --git a/users/konstantin/tap_dance.h b/users/konstantin/tap_dance.h index 1757e9b1135..ad7c04cb7f1 100644 --- a/users/konstantin/tap_dance.h +++ b/users/konstantin/tap_dance.h @@ -8,8 +8,9 @@ #define RAL_RGU TD(TD_RAL_RGU) #define RCT_RSF TD(TD_RCT_RSF) -#define FN_RCTL TD(TD_FN_RCTL) #define LSFT_FN TD(TD_LSFT_FN) +#define RCTL_FN TD(TD_RCTL_FN) +#define FN_RCTL TD(TD_FN_RCTL) enum tap_dance { TD_DST_A_R, @@ -18,6 +19,7 @@ enum tap_dance { TD_RAL_RGU, TD_RCT_RSF, - TD_FN_RCTL, TD_LSFT_FN, + TD_RCTL_FN, + TD_FN_RCTL, }; From 14908f86fb97bb7ddc269515a48e681799baccf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 18 Feb 2019 06:00:05 +0100 Subject: [PATCH 23/28] Replace td_fn_rctrl with generic td_layer_mod --- users/konstantin/tap_dance.c | 47 +++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c index 166bb10a696..377a0889feb 100644 --- a/users/konstantin/tap_dance.c +++ b/users/konstantin/tap_dance.c @@ -57,35 +57,44 @@ void td_mod_layer_reset(qk_tap_dance_state_t *state, void *user_data) { } } -struct { - bool fn_on; // Layer state when tap dance started - bool started; -} td_fn_rctrl_data; +#define ACTION_TAP_DANCE_LAYER_MOD(layer, mod) { \ + .fn = { td_layer_mod_each, NULL, td_layer_mod_reset }, \ + .user_data = &(qk_tap_dance_layer_mod_t){ layer, mod }, \ + } + +typedef struct { + uint8_t layer; + uint16_t kc; + bool layer_on; // Layer state when tap dance started + bool started; +} qk_tap_dance_layer_mod_t; -void td_fn_rctrl_each(qk_tap_dance_state_t *state, void *user_data) { - if (!td_fn_rctrl_data.started) { - td_fn_rctrl_data.fn_on = IS_LAYER_ON(L_FN); - td_fn_rctrl_data.started = true; +void td_layer_mod_each(qk_tap_dance_state_t *state, void *user_data) { + qk_tap_dance_layer_mod_t *data = (qk_tap_dance_layer_mod_t *)user_data; + if (!data->started) { + data->layer_on = IS_LAYER_ON(data->layer); + data->started = true; } - // Single tap → Fn, double tap → RCtrl, triple tap etc. → Fn+RCtrl + // Single tap → layer, double tap → mod, triple tap etc. → layer+mod if (state->count == 1 || state->count == 3) { - layer_on(L_FN); + layer_on(data->layer); } else if (state->count == 2) { - if (!td_fn_rctrl_data.fn_on) { - layer_off(L_FN); + if (!data->layer_on) { + layer_off(data->layer); } - register_code(KC_RCTL); + register_code(data->kc); } } -void td_fn_rctrl_reset(qk_tap_dance_state_t *state, void *user_data) { - if ((state->count == 1 || state->count >= 3) && !td_fn_rctrl_data.fn_on) { - layer_off(L_FN); +void td_layer_mod_reset(qk_tap_dance_state_t *state, void *user_data) { + qk_tap_dance_layer_mod_t *data = (qk_tap_dance_layer_mod_t *)user_data; + if ((state->count == 1 || state->count >= 3) && !data->layer_on) { + layer_off(data->layer); } if (state->count >= 2) { - unregister_code(KC_RCTL); + unregister_code(data->kc); } - td_fn_rctrl_data.started = false; + data->started = false; } qk_tap_dance_action_t tap_dance_actions[] = { @@ -97,5 +106,5 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_LSFT_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_LSFT, L_FN), [TD_RCTL_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_RCTL, L_FN), - [TD_FN_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(td_fn_rctrl_each, NULL, td_fn_rctrl_reset), + [TD_FN_RCTL] = ACTION_TAP_DANCE_LAYER_MOD(L_FN, KC_RCTL), }; From 6a088f7ff6b6e001fdac46252d75863b7611fd0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 18 Feb 2019 06:08:52 +0100 Subject: [PATCH 24/28] Add blank lines, prefer explicit initialization --- keyboards/melody96/keymaps/konstantin/keymap.c | 2 +- users/konstantin/tap_dance.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c index c8b6edb3d6b..de1b67e98b7 100644 --- a/keyboards/melody96/keymaps/konstantin/keymap.c +++ b/keyboards/melody96/keymaps/konstantin/keymap.c @@ -3,7 +3,7 @@ static const hsv_t *colors[] = { &GODSPEED_BLUE, &GODSPEED_YELLOW }; static size_t cnum = sizeof colors / sizeof *colors; -static size_t cidx; +static size_t cidx = 0; void eeconfig_init_keymap(void) { rgblight_sethsv(colors[cidx]->h, colors[cidx]->s, colors[cidx]->v); diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c index 377a0889feb..c01b29bd534 100644 --- a/users/konstantin/tap_dance.c +++ b/users/konstantin/tap_dance.c @@ -8,6 +8,7 @@ void td_double_mods_each(qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_pair_t *data = (qk_tap_dance_pair_t *)user_data; + // Single tap → mod1, double tap → mod2, triple tap etc. → mod1+mod2 if (state->count == 1 || state->count == 3) { register_code(data->kc1); @@ -21,6 +22,7 @@ void td_double_mods_each(qk_tap_dance_state_t *state, void *user_data) { void td_double_mods_reset(qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_pair_t *data = (qk_tap_dance_pair_t *)user_data; + if (state->count == 1 || state->count >= 3) { unregister_code(data->kc1); } @@ -36,6 +38,7 @@ void td_double_mods_reset(qk_tap_dance_state_t *state, void *user_data) { void td_mod_layer_each(qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data; + // Single tap → mod, double tap → layer, triple tap etc. → mod+layer if (state->count == 1 || state->count == 3) { register_code(data->kc); @@ -49,6 +52,7 @@ void td_mod_layer_each(qk_tap_dance_state_t *state, void *user_data) { void td_mod_layer_reset(qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data; + if (state->count == 1 || state->count >= 3) { unregister_code(data->kc); } @@ -59,7 +63,7 @@ void td_mod_layer_reset(qk_tap_dance_state_t *state, void *user_data) { #define ACTION_TAP_DANCE_LAYER_MOD(layer, mod) { \ .fn = { td_layer_mod_each, NULL, td_layer_mod_reset }, \ - .user_data = &(qk_tap_dance_layer_mod_t){ layer, mod }, \ + .user_data = &(qk_tap_dance_layer_mod_t){ layer, mod, 0, 0 }, \ } typedef struct { @@ -75,6 +79,7 @@ void td_layer_mod_each(qk_tap_dance_state_t *state, void *user_data) { data->layer_on = IS_LAYER_ON(data->layer); data->started = true; } + // Single tap → layer, double tap → mod, triple tap etc. → layer+mod if (state->count == 1 || state->count == 3) { layer_on(data->layer); @@ -88,12 +93,14 @@ void td_layer_mod_each(qk_tap_dance_state_t *state, void *user_data) { void td_layer_mod_reset(qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_layer_mod_t *data = (qk_tap_dance_layer_mod_t *)user_data; + if ((state->count == 1 || state->count >= 3) && !data->layer_on) { layer_off(data->layer); } if (state->count >= 2) { unregister_code(data->kc); } + data->started = false; } From 9baee84b36fbb9c506e593a2a9bca851ed67b8e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 18 Feb 2019 12:11:37 +0100 Subject: [PATCH 25/28] =?UTF-8?q?ACTION=5FTAP=5FDANCE=5FDOUBLE=5FMODS=20?= =?UTF-8?q?=E2=86=92=20ACTION=5FTAP=5FDANCE=5FDOUBLE=5FMOD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/konstantin/tap_dance.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c index c01b29bd534..0b405939b34 100644 --- a/users/konstantin/tap_dance.c +++ b/users/konstantin/tap_dance.c @@ -1,12 +1,12 @@ #include "tap_dance.h" #include "konstantin.h" -#define ACTION_TAP_DANCE_DOUBLE_MODS(mod1, mod2) { \ - .fn = { td_double_mods_each, NULL, td_double_mods_reset }, \ - .user_data = &(qk_tap_dance_pair_t){ mod1, mod2 }, \ +#define ACTION_TAP_DANCE_DOUBLE_MOD(mod1, mod2) { \ + .fn = { td_double_mod_each, NULL, td_double_mod_reset }, \ + .user_data = &(qk_tap_dance_pair_t){ mod1, mod2 }, \ } -void td_double_mods_each(qk_tap_dance_state_t *state, void *user_data) { +void td_double_mod_each(qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_pair_t *data = (qk_tap_dance_pair_t *)user_data; // Single tap → mod1, double tap → mod2, triple tap etc. → mod1+mod2 @@ -20,7 +20,7 @@ void td_double_mods_each(qk_tap_dance_state_t *state, void *user_data) { state->weak_mods &= ~(MOD_BIT(data->kc1) | MOD_BIT(data->kc2)); } -void td_double_mods_reset(qk_tap_dance_state_t *state, void *user_data) { +void td_double_mod_reset(qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_pair_t *data = (qk_tap_dance_pair_t *)user_data; if (state->count == 1 || state->count >= 3) { @@ -107,9 +107,9 @@ void td_layer_mod_reset(qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_action_t tap_dance_actions[] = { [TD_DST_A_R] = ACTION_TAP_DANCE_DOUBLE(DST_ADD, DST_REM), - [TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_LALT), - [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_RGUI), - [TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RCTL, KC_RSFT), + [TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RALT, KC_LALT), + [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RALT, KC_RGUI), + [TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RCTL, KC_RSFT), [TD_LSFT_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_LSFT, L_FN), [TD_RCTL_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_RCTL, L_FN), From f9c070e1a492b60f1c475302e82b17d9bcfc298c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Tue, 19 Feb 2019 15:20:11 +0100 Subject: [PATCH 26/28] Update Godspeed colors --- users/konstantin/rgb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/users/konstantin/rgb.c b/users/konstantin/rgb.c index ed6efe87a46..0f0c73c49eb 100644 --- a/users/konstantin/rgb.c +++ b/users/konstantin/rgb.c @@ -20,5 +20,5 @@ const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {20, 50, 100}; const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {20, 50, 100}; #endif -const hsv_t GODSPEED_BLUE = { .h = 300, .s = 68, .v = RGBLIGHT_LIMIT_VAL }; -const hsv_t GODSPEED_YELLOW = { .h = 35, .s = 165, .v = RGBLIGHT_LIMIT_VAL }; +const hsv_t GODSPEED_BLUE = { .h = 280, .s = 68, .v = RGBLIGHT_LIMIT_VAL }; +const hsv_t GODSPEED_YELLOW = { .h = 38, .s = 153, .v = RGBLIGHT_LIMIT_VAL }; From 51182a4f03f2d0c6eef6a0bdd87529c7626e8eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Wed, 20 Feb 2019 00:28:34 +0100 Subject: [PATCH 27/28] Add media controls to Melody96 keymap --- keyboards/melody96/keymaps/konstantin/keymap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c index de1b67e98b7..46dbc9ae7c3 100644 --- a/keyboards/melody96/keymaps/konstantin/keymap.c +++ b/keyboards/melody96/keymaps/konstantin/keymap.c @@ -58,7 +58,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤ * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │RTg│ ÷ │ × │ − │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┼───┼───┼───┼───┤ - * │ M4 │M2 │M↑ │M1 │M3 │M5 │ │UCM│ │ │ │ │ │Clear│RH+│RS+│RV+│ │ + * │ M4 │M2 │M↑ │M1 │M3 │M5 │ │UCM│ │Stp│Ply│Prv│Nxt│Clear│RH+│RS+│RV+│ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┼───┼───┤RSt│ * │ │M← │M↓ │M→ │MW↑│ │ │ │ │ │ │ │ │RH-│RS-│RV-│ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┼───┼───┼───┤ @@ -70,7 +70,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [L_FN] = LAYOUT( \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, DIVIDE, TIMES, MINUS, - KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, UC_MOD, _______, _______, _______, _______, _______, CLEAR, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, + KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, UC_MOD, _______, KC_MSTP, KC_MPLY, KC_MPRV, KC_MNXT, CLEAR, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SET, _______, _______, KC_ACL0, KC_ACL2, KC_WH_L, KC_WH_R, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, KC_PGUP, RGB_M_R, RGB_M_SN,RGB_M_B, XXXXXXX, _______, DST_P_R, DST_N_A, KC_WH_D, _______, XXXXXXX, KC_APP, KC_HOME, KC_PGDN, KC_END, RGB_RMOD,RGB_MOD, RGB_M_P From be1d5c66093faa8885855a2d133ef20a408233bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Sat, 23 Feb 2019 00:47:42 +0100 Subject: [PATCH 28/28] Add SysRq, Break combos and other keys to Melody96 keymap --- keyboards/melody96/keymaps/konstantin/keymap.c | 4 ++-- keyboards/whitefox/keymaps/konstantin/keymap.c | 2 +- users/konstantin/konstantin.h | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c index 46dbc9ae7c3..1150e5dc796 100644 --- a/keyboards/melody96/keymaps/konstantin/keymap.c +++ b/keyboards/melody96/keymaps/konstantin/keymap.c @@ -54,7 +54,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Function layer * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │Sys│SLk│Pau│Brk│Top│Btm│ * ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤ * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │RTg│ ÷ │ × │ − │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┼───┼───┼───┼───┤ @@ -68,7 +68,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * └────┴────┴────┴────────────────────────┴─────┴─────┴───┴───┴───┴───┴───┴───┘ */ [L_FN] = LAYOUT( \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_SYSR, KC_SLCK, KC_PAUS, KC_BRK, TOP, BOTTOM, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, DIVIDE, TIMES, MINUS, KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, UC_MOD, _______, KC_MSTP, KC_MPLY, KC_MPRV, KC_MNXT, CLEAR, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SET, diff --git a/keyboards/whitefox/keymaps/konstantin/keymap.c b/keyboards/whitefox/keymaps/konstantin/keymap.c index 494300f2d62..dddfb274e7f 100644 --- a/keyboards/whitefox/keymaps/konstantin/keymap.c +++ b/keyboards/whitefox/keymaps/konstantin/keymap.c @@ -25,7 +25,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Function layer * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ - * │ │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│Num│Scr│Pau│ + * │ │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│Num│SLk│Pau│ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┼───┤ * │ M4 │M2 │M↑ │M1 │M3 │M5 │ │UCM│ │Stp│Ply│Prv│Nxt│Clear│Ins│ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤ diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h index d4e0e189910..0639b93a6de 100644 --- a/users/konstantin/konstantin.h +++ b/users/konstantin/konstantin.h @@ -17,6 +17,10 @@ #define FN_FNLK TT(L_FN) #endif +#define KC_SYSR LALT(KC_PSCR) +#undef KC_BRK +#define KC_BRK LCTL(KC_PAUS) + #define MV_UP LCTL(KC_UP) #define MV_DOWN LCTL(KC_DOWN) #define MV_LEFT LCTL(KC_LEFT)