Minor updates to planck/keymaps/dshields
* tweaks to tap dance keys * tidy up code * save a few bytesmaster
parent
49cfdb544d
commit
cc158d90ae
|
@ -37,6 +37,7 @@
|
|||
#define TD_DOT TD(TDK_DOT)
|
||||
#define TD_SLSH TD(TDK_SLSH)
|
||||
|
||||
// macros
|
||||
#define ACTION_TAP_DANCE_FN_KEYCODE(user_fn, kc) { \
|
||||
.fn = { NULL, user_fn, NULL }, \
|
||||
.user_data = (void *)&((qk_tap_dance_pair_t) { kc, 0 }) \
|
||||
|
@ -47,6 +48,7 @@
|
|||
.user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }) \
|
||||
}
|
||||
|
||||
#define TAP(keycode) register_code16(keycode); unregister_code16(keycode)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -81,12 +81,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
{BL_TOGG, BL_STEP, _______, _______, _______, DM_STRT, DM_STOP, _______, _______, KC_BTN1, KC_BTN2, KC_BTN3},
|
||||
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R}
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
void tap(uint16_t keycode) {
|
||||
register_code16(keycode);
|
||||
unregister_code16(keycode);
|
||||
};
|
||||
|
||||
void tap_dance_triple(qk_tap_dance_state_t *state, void *user_data) {
|
||||
|
@ -96,25 +90,22 @@ void tap_dance_triple(qk_tap_dance_state_t *state, void *user_data) {
|
|||
switch(state->count) {
|
||||
case 2:
|
||||
register_code(KC_LSFT);
|
||||
tap(keycode);
|
||||
TAP(keycode);
|
||||
unregister_code(KC_LSFT);
|
||||
break;
|
||||
case 3:
|
||||
case 3: // fall through
|
||||
if (pair->kc2) {
|
||||
keycode = pair->kc2;
|
||||
}
|
||||
tap(keycode);
|
||||
tap(keycode);
|
||||
break;
|
||||
TAP(keycode);
|
||||
default:
|
||||
tap(keycode);
|
||||
break;
|
||||
TAP(keycode);
|
||||
}
|
||||
}
|
||||
|
||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
[TDK_SCLN] = ACTION_TAP_DANCE_FN_KEYCODE2(tap_dance_triple, KC_SCLN, KC_COLN),
|
||||
[TDK_COMM] = ACTION_TAP_DANCE_FN_KEYCODE (tap_dance_triple, KC_COMM),
|
||||
[TDK_COMM] = ACTION_TAP_DANCE_FN_KEYCODE2(tap_dance_triple, KC_COMM, KC_LABK),
|
||||
[TDK_DOT] = ACTION_TAP_DANCE_FN_KEYCODE (tap_dance_triple, KC_DOT),
|
||||
[TDK_SLSH] = ACTION_TAP_DANCE_FN_KEYCODE (tap_dance_triple, KC_SLSH)
|
||||
};
|
||||
|
@ -126,6 +117,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void matrix_init_user(void) {
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue