Replace custom tap dance keys with mod tap keys in planck/keymaps/dshields

planck_rev6
Daniel Shields 7 years ago committed by Jack Humbert
parent 9584db055b
commit 4a04c7265e

@ -5,6 +5,7 @@
#define _______ KC_TRNS #define _______ KC_TRNS
#define XXXXXXX KC_NO #define XXXXXXX KC_NO
#define PREVENT_STUCK_MODIFIERS
#define USB_MAX_POWER_CONSUMPTION 100 #define USB_MAX_POWER_CONSUMPTION 100
#define ONESHOT_TAP_TOGGLE 2 #define ONESHOT_TAP_TOGGLE 2
@ -31,24 +32,8 @@
#define OSM_ALT OSM(MOD_LALT) #define OSM_ALT OSM(MOD_LALT)
#define OSM_SFT OSM(MOD_LSFT) #define OSM_SFT OSM(MOD_LSFT)
// tap dance keys // mod-tap keys
#define TD_SCLN TD(TDK_SCLN) #define MT_SPC SFT_T(KC_SPC)
#define TD_COMM TD(TDK_COMM)
#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 }) \
}
#define ACTION_TAP_DANCE_FN_KEYCODE2(user_fn, kc1, kc2) { \
.fn = { NULL, user_fn, NULL }, \
.user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }) \
}
#define TAP(keycode) register_code16(keycode); unregister_code16(keycode)
#endif #endif

@ -6,7 +6,6 @@ extern keymap_config_t keymap_config;
enum planck_layers { DEF, LWR, RSE, FUN }; enum planck_layers { DEF, LWR, RSE, FUN };
enum planck_keycodes { DYNAMIC_MACRO_RANGE = SAFE_RANGE }; enum planck_keycodes { DYNAMIC_MACRO_RANGE = SAFE_RANGE };
enum tap_dance_keys { TDK_SCLN, TDK_COMM, TDK_DOT, TDK_SLSH };
#include "dynamic_macro.h" #include "dynamic_macro.h"
@ -24,9 +23,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/ */
[DEF] = { [DEF] = {
{KC_Q, KC_W, KC_E, KC_R, KC_T, KC_ESC, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P }, {KC_Q, KC_W, KC_E, KC_R, KC_T, KC_ESC, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P },
{KC_A, KC_S, KC_D, KC_F, KC_G, KC_TAB, KC_ENT, KC_H, KC_J, KC_K, KC_L, TD_SCLN}, {KC_A, KC_S, KC_D, KC_F, KC_G, KC_TAB, KC_ENT, KC_H, KC_J, KC_K, KC_L, KC_SCLN},
{KC_Z, KC_X, KC_C, KC_V, KC_B, OSM_SFT, DM_PLAY, KC_N, KC_M, TD_COMM, TD_DOT, TD_SLSH}, {KC_Z, KC_X, KC_C, KC_V, KC_B, OSM_SFT, DM_PLAY, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH},
{OSM_CTL, KC_LGUI, OSM_ALT, OSL_FUN, OSL_LWR, KC_SPC, KC_SPC, OSL_RSE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} {OSM_CTL, KC_LGUI, OSM_ALT, OSL_FUN, OSL_LWR, MT_SPC, MT_SPC, OSL_RSE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
}, },
/* Lower /* Lower
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -81,33 +80,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}, },
}; };
void tap_dance_triple(qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
uint16_t keycode = pair->kc1;
switch(state->count) {
case 2:
register_code(KC_LSFT);
TAP(keycode);
unregister_code(KC_LSFT);
break;
case 3: // fall through
if (pair->kc2) {
keycode = pair->kc2;
}
TAP(keycode);
default:
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_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)
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!process_record_dynamic_macro(keycode, record)) { if (!process_record_dynamic_macro(keycode, record)) {
return false; return false;

@ -4,10 +4,9 @@ endif
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
COMMAND_ENABLE = yes # Commands for debug and configuration COMMAND_ENABLE = yes # Commands for debug and configuration
CONSOLE_ENABLE = yes # Console for debug(+400) CONSOLE_ENABLE = no # Console for debug(+400)
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
TAP_DANCE_ENABLE = yes
AUDIO_ENABLE = no AUDIO_ENABLE = no
API_SYSEX_ENABLE = no API_SYSEX_ENABLE = no

Loading…
Cancel
Save