diff options
Diffstat (limited to 'keyboards/minidox/keymaps/dustypomerleau/keymap.c')
-rw-r--r-- | keyboards/minidox/keymaps/dustypomerleau/keymap.c | 234 |
1 files changed, 90 insertions, 144 deletions
diff --git a/keyboards/minidox/keymaps/dustypomerleau/keymap.c b/keyboards/minidox/keymaps/dustypomerleau/keymap.c index e8b1ca1b53..e93a09f64a 100644 --- a/keyboards/minidox/keymaps/dustypomerleau/keymap.c +++ b/keyboards/minidox/keymaps/dustypomerleau/keymap.c @@ -5,7 +5,7 @@ extern keymap_config_t keymap_config; -enum custom_layers { +enum my_layers { _CMK_DHM, _QWERTY, _SYS, @@ -15,7 +15,7 @@ enum custom_layers { _SYM }; -enum custom_keycodes { +enum my_keycodes { CMK_DHM = SAFE_RANGE, QWERTY, SYS, @@ -25,34 +25,30 @@ enum custom_keycodes { SYM }; -typedef struct { - bool is_press_action; - int state; -} tap; - -enum { - SINGLE_TAP = 1, - SINGLE_HOLD = 2, - DOUBLE_SINGLE_TAP = 3 -}; - -enum { - ALT_OP = 0, - CTL_CCB, - GUI_CP, - SFT_OCB, +enum td_keycodes { + ALT_LP, + CTL_RCB, + GUI_RP, + SFT_LCB, SFT_PLS }; +typedef enum { + SINGLE_TAP, + SINGLE_HOLD, + DOUBLE_SINGLE_TAP +} td_state_t; + +static td_state_t td_state; int cur_dance (qk_tap_dance_state_t *state); -void altop_finished (qk_tap_dance_state_t *state, void *user_data); -void altop_reset (qk_tap_dance_state_t *state, void *user_data); -void ctlccb_finished (qk_tap_dance_state_t *state, void *user_data); -void ctlccb_reset (qk_tap_dance_state_t *state, void *user_data); -void guicp_finished (qk_tap_dance_state_t *state, void *user_data); -void guicp_reset (qk_tap_dance_state_t *state, void *user_data); -void sftocb_finished (qk_tap_dance_state_t *state, void *user_data); -void sftocb_reset (qk_tap_dance_state_t *state, void *user_data); +void altlp_finished (qk_tap_dance_state_t *state, void *user_data); +void altlp_reset (qk_tap_dance_state_t *state, void *user_data); +void ctlrcb_finished (qk_tap_dance_state_t *state, void *user_data); +void ctlrcb_reset (qk_tap_dance_state_t *state, void *user_data); +void guirp_finished (qk_tap_dance_state_t *state, void *user_data); +void guirp_reset (qk_tap_dance_state_t *state, void *user_data); +void sftlcb_finished (qk_tap_dance_state_t *state, void *user_data); +void sftlcb_reset (qk_tap_dance_state_t *state, void *user_data); void sftpls_finished (qk_tap_dance_state_t *state, void *user_data); void sftpls_reset (qk_tap_dance_state_t *state, void *user_data); @@ -62,7 +58,7 @@ void sftpls_reset (qk_tap_dance_state_t *state, void *user_data); #define ALT_D LALT_T(KC_D) #define ALT_E LALT_T(KC_E) #define ALT_K LALT_T(KC_K) -#define ALT_OB LALT_T(KC_LBRC) +#define ALT_LB LALT_T(KC_LBRC) #define ALT_S LALT_T(KC_S) #define CTRL_2 LCTL_T(KC_2) #define CTRL_4 LCTL_T(KC_4) @@ -77,7 +73,7 @@ void sftpls_reset (qk_tap_dance_state_t *state, void *user_data); #define GUI_1 LGUI_T(KC_1) #define GUI_4 LGUI_T(KC_4) #define GUI_7 LGUI_T(KC_7) -#define GUI_CB LGUI_T(KC_RBRC) +#define GUI_RB LGUI_T(KC_RBRC) #define GUI_F LGUI_T(KC_F) #define GUI_J LGUI_T(KC_J) #define GUI_N LGUI_T(KC_N) @@ -153,7 +149,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * If you use QWERTY + the Vanilla numbers primarily, change NUMLK_E to NUMLK_N here. * * ,----------------------------------. ,----------------------------------. - * | RESET|DEBUG |QWERTY|CMKDHM| | | | VOL--| VOL++| | | + * | RESET|DEBUG |QWERTY|CMKDHM| | | | VOL--| VOL++|BRITE-|BRITE+| * |------+------+------+------+------| |------+------+------+------+------| * | SHIFT| CTRL | ALT | GUI |NAV LK| | POWER| VOL- | VOL+ | MUTE | MPLY | * |------+------+------+------+------| |------+------+------+------+------| @@ -166,10 +162,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `------' `------' */ [_SYS] = LAYOUT( \ - RESET, DEBUG, QWERTY, CMK_DHM, _______, _______, KC__VOLDOWN, KC__VOLUP, _______, _______, \ - KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, NAV_LK, KC_POWER, VOL_DN, VOL_UP, KC__MUTE, KC_MPLY, \ - _______, _______, AU_OFF, AU_ON, _______, _______, NUMLK_E, KC_MRWD, KC_MFFD, _______, \ - _______, _______, _______, _______, _______, _______ \ + RESET, DEBUG, QWERTY, CMK_DHM, _______, _______, KC_VOLD, KC_VOLU, KC_BRID, KC_BRIU, \ + KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, NAV_LK, KC_POWER, VOL_DN, VOL_UP, KC__MUTE, KC_MPLY, \ + _______, _______, AU_OFF, AU_ON, _______, _______, NUMLK_E, KC_MRWD, KC_MFFD, _______, \ + _______, _______, _______, _______, _______, _______ \ ), /* Navigation + mouse keys @@ -201,7 +197,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------| |------+------+------+------+------| * | SFT/7| CTL/5| ALT/3| GUI/1| 9 | | 8 | GUI/0| ALT/2| CTL/4| SFT/6| * |------+------+------+------+------| |------+------+------+------+------| - * | | | F11 | F12 | BSPC | | DEL |NUM LK| | | | + * | F11 | F12 | - | SPACE| BSPC | | DEL |NUM LK| | | / | * `----------------------------------' `----------------------------------' * ,--------------------. ,--------------------. * | | TAB | | | | | | @@ -212,7 +208,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_NUM_E] = LAYOUT( \ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, \ SFT_7, CTRL_5, ALT_3, GUI_1, KC_9, KC_8, GUI_0, ALT_2, CTRL_4, SFT_6, \ - _______, _______, KC_F11, KC_F12, KC_BSPC, KC_DEL, NUMLK_E, _______, _______, _______, \ + KC_F11, KC_F12, KC_MINS, KC_SPC, KC_BSPC, KC_DEL, NUMLK_E, _______, _______, KC_SLSH, \ _______, KC_TAB, KC_ESC, _______, _______, _______ \ ), @@ -223,7 +219,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------| |------+------+------+------+------| * | SFT/1| CTL/2| ALT/3| GUI/4| 5 | | 6 | GUI/7| ALT/8| CTL/9| SFT/0| * |------+------+------+------+------| |------+------+------+------+------| - * | | | F11 | F12 | BSPC | | DEL |NUM LK| | | | + * | F11 | F12 | - | SPACE| BSPC | | DEL |NUM LK| | | / | * `----------------------------------' `----------------------------------' * ,--------------------. ,--------------------. * | | TAB | | | | | | @@ -232,10 +228,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `------' `------' */ [_NUM_N] = LAYOUT( \ - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, \ - SFT_1, CTRL_2, ALT_3, GUI_4, KC_5, KC_6, GUI_7, ALT_8, CTRL_9, SFT_0, \ - _______, _______, KC_F11, KC_F12, KC_BSPC, KC_DEL, NUMLK_N, _______, _______, _______, \ - _______, KC_TAB, KC_ESC, _______, _______, _______ \ + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, \ + SFT_1, CTRL_2, ALT_3, GUI_4, KC_5, KC_6, GUI_7, ALT_8, CTRL_9, SFT_0, \ + KC_F11, KC_F12, KC_MINS, KC_SPC, KC_BSPC, KC_DEL, NUMLK_N, _______, _______, KC_SLSH, \ + _______, KC_TAB, KC_ESC, _______, _______, _______ \ ), @@ -256,7 +252,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_SYM] = LAYOUT( \ KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_QUES, KC_QUOT, \ - TD(SFT_PLS), CTRL_EQ, TD(ALT_OP), TD(GUI_CP), KC_DQT, KC_COLN, GUI_CB, ALT_OB, TD(CTL_CCB), TD(SFT_OCB), \ + TD(SFT_PLS), CTRL_EQ, TD(ALT_LP), TD(GUI_RP), KC_DQT, KC_COLN, GUI_RB, ALT_LB, TD(CTL_RCB), TD(SFT_LCB), \ KC_LT, KC_PIPE, KC_MINS, KC_GT, KC_BSLS, KC_GRV, KC_UNDS, KC_SLSH, KC_TILD, KC_SCLN, \ _______, MAC_EN, _______, _______, MAC_EM, _______ \ ) @@ -286,203 +282,153 @@ int cur_dance (qk_tap_dance_state_t *state) { else return SINGLE_HOLD; } if (state->count == 2) return DOUBLE_SINGLE_TAP; - else return 8; + else return 3; } -static tap altop_tap_state = { - .is_press_action = true, - .state = 0 -}; - -void altop_finished (qk_tap_dance_state_t *state, void *user_data) { - altop_tap_state.state = cur_dance(state); - switch (altop_tap_state.state) { +void altlp_finished (qk_tap_dance_state_t *state, void *user_data) { + td_state = cur_dance(state); + switch (td_state) { case SINGLE_TAP: - register_mods(MOD_BIT(KC_LSFT)); - register_code(KC_9); + register_code16(KC_LPRN); break; case SINGLE_HOLD: register_mods(MOD_BIT(KC_LALT)); break; case DOUBLE_SINGLE_TAP: - register_mods(MOD_BIT(KC_LSFT)); - tap_code(KC_9); - register_code(KC_9); + tap_code16(KC_LPRN); + register_code16(KC_LPRN); } } -void altop_reset (qk_tap_dance_state_t *state, void *user_data) { - switch (altop_tap_state.state) { +void altlp_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (td_state) { case SINGLE_TAP: - unregister_code(KC_9); - unregister_mods(MOD_BIT(KC_LSFT)); + unregister_code16(KC_LPRN); break; case SINGLE_HOLD: unregister_mods(MOD_BIT(KC_LALT)); break; case DOUBLE_SINGLE_TAP: - unregister_code(KC_9); - unregister_mods(MOD_BIT(KC_LSFT)); + unregister_code16(KC_LPRN); } - altop_tap_state.state = 0; } -static tap ctlccb_tap_state = { - .is_press_action = true, - .state = 0 -}; - -void ctlccb_finished (qk_tap_dance_state_t *state, void *user_data) { - ctlccb_tap_state.state = cur_dance(state); - switch (ctlccb_tap_state.state) { +void ctlrcb_finished (qk_tap_dance_state_t *state, void *user_data) { + td_state = cur_dance(state); + switch (td_state) { case SINGLE_TAP: - register_mods(MOD_BIT(KC_LSFT)); - register_code(KC_RBRC); + register_code16(KC_RCBR); break; case SINGLE_HOLD: register_mods(MOD_BIT(KC_LCTL)); break; case DOUBLE_SINGLE_TAP: - register_mods(MOD_BIT(KC_LSFT)); - tap_code(KC_RBRC); - register_code(KC_RBRC); + tap_code16(KC_RCBR); + register_code16(KC_RCBR); } } -void ctlccb_reset (qk_tap_dance_state_t *state, void *user_data) { - switch (ctlccb_tap_state.state) { +void ctlrcb_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (td_state) { case SINGLE_TAP: - unregister_code(KC_RBRC); - unregister_mods(MOD_BIT(KC_LSFT)); + unregister_code16(KC_RCBR); break; case SINGLE_HOLD: unregister_mods(MOD_BIT(KC_LCTL)); break; case DOUBLE_SINGLE_TAP: - unregister_code(KC_RBRC); - unregister_mods(MOD_BIT(KC_LSFT)); + unregister_code16(KC_RCBR); } - ctlccb_tap_state.state = 0; } -static tap guicp_tap_state = { - .is_press_action = true, - .state = 0 -}; - -void guicp_finished (qk_tap_dance_state_t *state, void *user_data) { - guicp_tap_state.state = cur_dance(state); - switch (guicp_tap_state.state) { +void guirp_finished (qk_tap_dance_state_t *state, void *user_data) { + td_state = cur_dance(state); + switch (td_state) { case SINGLE_TAP: - register_mods(MOD_BIT(KC_LSFT)); - register_code(KC_0); + register_code16(KC_RPRN); break; case SINGLE_HOLD: register_mods(MOD_BIT(KC_LGUI)); break; case DOUBLE_SINGLE_TAP: - register_mods(MOD_BIT(KC_LSFT)); - tap_code(KC_0); - register_code(KC_0); + tap_code16(KC_RPRN); + register_code16(KC_RPRN); } } -void guicp_reset (qk_tap_dance_state_t *state, void *user_data) { - switch (guicp_tap_state.state) { +void guirp_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (td_state) { case SINGLE_TAP: - unregister_code(KC_0); - unregister_mods(MOD_BIT(KC_LSFT)); + unregister_code16(KC_RPRN); break; case SINGLE_HOLD: unregister_mods(MOD_BIT(KC_LGUI)); break; case DOUBLE_SINGLE_TAP: - unregister_code(KC_0); - unregister_mods(MOD_BIT(KC_LSFT)); + unregister_code16(KC_RPRN); } - guicp_tap_state.state = 0; } -static tap sftocb_tap_state = { - .is_press_action = true, - .state = 0 -}; - -void sftocb_finished (qk_tap_dance_state_t *state, void *user_data) { - sftocb_tap_state.state = cur_dance(state); - switch (sftocb_tap_state.state) { +void sftlcb_finished (qk_tap_dance_state_t *state, void *user_data) { + td_state = cur_dance(state); + switch (td_state) { case SINGLE_TAP: - register_mods(MOD_BIT(KC_LSFT)); - register_code(KC_LBRC); + register_code16(KC_LCBR); break; case SINGLE_HOLD: register_mods(MOD_BIT(KC_LSFT)); break; case DOUBLE_SINGLE_TAP: - register_mods(MOD_BIT(KC_LSFT)); - tap_code(KC_LBRC); - register_code(KC_LBRC); + tap_code16(KC_LCBR); + register_code16(KC_LCBR); } } -void sftocb_reset (qk_tap_dance_state_t *state, void *user_data) { - switch (sftocb_tap_state.state) { +void sftlcb_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (td_state) { case SINGLE_TAP: - unregister_code(KC_LBRC); - unregister_mods(MOD_BIT(KC_LSFT)); + unregister_code16(KC_LCBR); break; case SINGLE_HOLD: unregister_mods(MOD_BIT(KC_LSFT)); break; case DOUBLE_SINGLE_TAP: - unregister_code(KC_LBRC); - unregister_mods(MOD_BIT(KC_LSFT)); + unregister_code16(KC_LCBR); } - sftocb_tap_state.state = 0; } -static tap sftpls_tap_state = { - .is_press_action = true, - .state = 0 -}; - void sftpls_finished (qk_tap_dance_state_t *state, void *user_data) { - sftpls_tap_state.state = cur_dance(state); - switch (sftpls_tap_state.state) { + td_state = cur_dance(state); + switch (td_state) { case SINGLE_TAP: - register_mods(MOD_BIT(KC_LSFT)); - register_code(KC_EQL); + register_code16(KC_PLUS); break; case SINGLE_HOLD: register_mods(MOD_BIT(KC_LSFT)); break; case DOUBLE_SINGLE_TAP: - register_mods(MOD_BIT(KC_LSFT)); - tap_code(KC_EQL); - register_code(KC_EQL); + tap_code16(KC_PLUS); + register_code16(KC_PLUS); } } void sftpls_reset (qk_tap_dance_state_t *state, void *user_data) { - switch (sftpls_tap_state.state) { + switch (td_state) { case SINGLE_TAP: - unregister_code(KC_EQL); - unregister_mods(MOD_BIT(KC_LSFT)); + unregister_code16(KC_PLUS); break; case SINGLE_HOLD: unregister_mods(MOD_BIT(KC_LSFT)); break; case DOUBLE_SINGLE_TAP: - unregister_code(KC_EQL); - unregister_mods(MOD_BIT(KC_LSFT)); + unregister_code16(KC_PLUS); } - sftpls_tap_state.state = 0; } qk_tap_dance_action_t tap_dance_actions[] = { - [ALT_OP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, altop_finished, altop_reset), - [CTL_CCB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctlccb_finished, ctlccb_reset), - [GUI_CP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, guicp_finished, guicp_reset), - [SFT_OCB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, sftocb_finished, sftocb_reset), + [ALT_LP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, altlp_finished, altlp_reset), + [CTL_RCB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctlrcb_finished, ctlrcb_reset), + [GUI_RP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, guirp_finished, guirp_reset), + [SFT_LCB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, sftlcb_finished, sftlcb_reset), [SFT_PLS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, sftpls_finished, sftpls_reset) }; |