aboutsummaryrefslogtreecommitdiff
path: root/keyboards
diff options
context:
space:
mode:
authorDaniel Shields <dshields@bats.com>2017-12-08 14:33:24 +0000
committerJack Humbert <jack.humb@gmail.com>2018-02-02 00:59:44 -0500
commit4a04c7265e74afc8a83a19942af5e9483aac287d (patch)
tree2960a051327989b31b6e7f428b82e2995e38f48b /keyboards
parent9584db055b73937dfba7b9878a8b61af6aa96710 (diff)
downloadqmk_firmware-4a04c7265e74afc8a83a19942af5e9483aac287d.tar.gz
qmk_firmware-4a04c7265e74afc8a83a19942af5e9483aac287d.zip
Replace custom tap dance keys with mod tap keys in planck/keymaps/dshields
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/planck/keymaps/dshields/config.h21
-rw-r--r--keyboards/planck/keymaps/dshields/keymap.c34
-rw-r--r--keyboards/planck/keymaps/dshields/rules.mk3
3 files changed, 7 insertions, 51 deletions
diff --git a/keyboards/planck/keymaps/dshields/config.h b/keyboards/planck/keymaps/dshields/config.h
index d920d1539..438e007d0 100644
--- a/keyboards/planck/keymaps/dshields/config.h
+++ b/keyboards/planck/keymaps/dshields/config.h
@@ -5,6 +5,7 @@
5 5
6#define _______ KC_TRNS 6#define _______ KC_TRNS
7#define XXXXXXX KC_NO 7#define XXXXXXX KC_NO
8#define PREVENT_STUCK_MODIFIERS
8 9
9#define USB_MAX_POWER_CONSUMPTION 100 10#define USB_MAX_POWER_CONSUMPTION 100
10#define ONESHOT_TAP_TOGGLE 2 11#define ONESHOT_TAP_TOGGLE 2
@@ -31,24 +32,8 @@
31#define OSM_ALT OSM(MOD_LALT) 32#define OSM_ALT OSM(MOD_LALT)
32#define OSM_SFT OSM(MOD_LSFT) 33#define OSM_SFT OSM(MOD_LSFT)
33 34
34// tap dance keys 35// mod-tap keys
35#define TD_SCLN TD(TDK_SCLN) 36#define MT_SPC SFT_T(KC_SPC)
36#define TD_COMM TD(TDK_COMM)
37#define TD_DOT TD(TDK_DOT)
38#define TD_SLSH TD(TDK_SLSH)
39
40// macros
41#define ACTION_TAP_DANCE_FN_KEYCODE(user_fn, kc) { \
42 .fn = { NULL, user_fn, NULL }, \
43 .user_data = (void *)&((qk_tap_dance_pair_t) { kc, 0 }) \
44}
45
46#define ACTION_TAP_DANCE_FN_KEYCODE2(user_fn, kc1, kc2) { \
47 .fn = { NULL, user_fn, NULL }, \
48 .user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }) \
49}
50
51#define TAP(keycode) register_code16(keycode); unregister_code16(keycode)
52 37
53#endif 38#endif
54 39
diff --git a/keyboards/planck/keymaps/dshields/keymap.c b/keyboards/planck/keymaps/dshields/keymap.c
index a13c261ed..a99777917 100644
--- a/keyboards/planck/keymaps/dshields/keymap.c
+++ b/keyboards/planck/keymaps/dshields/keymap.c
@@ -6,7 +6,6 @@ extern keymap_config_t keymap_config;
6 6
7enum planck_layers { DEF, LWR, RSE, FUN }; 7enum planck_layers { DEF, LWR, RSE, FUN };
8enum planck_keycodes { DYNAMIC_MACRO_RANGE = SAFE_RANGE }; 8enum planck_keycodes { DYNAMIC_MACRO_RANGE = SAFE_RANGE };
9enum tap_dance_keys { TDK_SCLN, TDK_COMM, TDK_DOT, TDK_SLSH };
10 9
11#include "dynamic_macro.h" 10#include "dynamic_macro.h"
12 11
@@ -24,9 +23,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
24 */ 23 */
25 [DEF] = { 24 [DEF] = {
26 {KC_Q, KC_W, KC_E, KC_R, KC_T, KC_ESC, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P }, 25 {KC_Q, KC_W, KC_E, KC_R, KC_T, KC_ESC, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P },
27 {KC_A, KC_S, KC_D, KC_F, KC_G, KC_TAB, KC_ENT, KC_H, KC_J, KC_K, KC_L, TD_SCLN}, 26 {KC_A, KC_S, KC_D, KC_F, KC_G, KC_TAB, KC_ENT, KC_H, KC_J, KC_K, KC_L, KC_SCLN},
28 {KC_Z, KC_X, KC_C, KC_V, KC_B, OSM_SFT, DM_PLAY, KC_N, KC_M, TD_COMM, TD_DOT, TD_SLSH}, 27 {KC_Z, KC_X, KC_C, KC_V, KC_B, OSM_SFT, DM_PLAY, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH},
29 {OSM_CTL, KC_LGUI, OSM_ALT, OSL_FUN, OSL_LWR, KC_SPC, KC_SPC, OSL_RSE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} 28 {OSM_CTL, KC_LGUI, OSM_ALT, OSL_FUN, OSL_LWR, MT_SPC, MT_SPC, OSL_RSE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
30 }, 29 },
31 /* Lower 30 /* Lower
32 * ,-----------------------------------------------------------------------------------. 31 * ,-----------------------------------------------------------------------------------.
@@ -81,33 +80,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
81 }, 80 },
82}; 81};
83 82
84void tap_dance_triple(qk_tap_dance_state_t *state, void *user_data) {
85 qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
86 uint16_t keycode = pair->kc1;
87
88 switch(state->count) {
89 case 2:
90 register_code(KC_LSFT);
91 TAP(keycode);
92 unregister_code(KC_LSFT);
93 break;
94 case 3: // fall through
95 if (pair->kc2) {
96 keycode = pair->kc2;
97 }
98 TAP(keycode);
99 default:
100 TAP(keycode);
101 }
102}
103
104qk_tap_dance_action_t tap_dance_actions[] = {
105 [TDK_SCLN] = ACTION_TAP_DANCE_FN_KEYCODE2(tap_dance_triple, KC_SCLN, KC_COLN),
106 [TDK_COMM] = ACTION_TAP_DANCE_FN_KEYCODE2(tap_dance_triple, KC_COMM, KC_LABK),
107 [TDK_DOT] = ACTION_TAP_DANCE_FN_KEYCODE (tap_dance_triple, KC_DOT),
108 [TDK_SLSH] = ACTION_TAP_DANCE_FN_KEYCODE (tap_dance_triple, KC_SLSH)
109};
110
111bool process_record_user(uint16_t keycode, keyrecord_t *record) { 83bool process_record_user(uint16_t keycode, keyrecord_t *record) {
112 if (!process_record_dynamic_macro(keycode, record)) { 84 if (!process_record_dynamic_macro(keycode, record)) {
113 return false; 85 return false;
diff --git a/keyboards/planck/keymaps/dshields/rules.mk b/keyboards/planck/keymaps/dshields/rules.mk
index 57144283e..c266b9393 100644
--- a/keyboards/planck/keymaps/dshields/rules.mk
+++ b/keyboards/planck/keymaps/dshields/rules.mk
@@ -4,10 +4,9 @@ endif
4 4
5MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 5MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
6COMMAND_ENABLE = yes # Commands for debug and configuration 6COMMAND_ENABLE = yes # Commands for debug and configuration
7CONSOLE_ENABLE = yes # Console for debug(+400) 7CONSOLE_ENABLE = no # Console for debug(+400)
8BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 8BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
9# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 9# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
10SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 10SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
11TAP_DANCE_ENABLE = yes
12AUDIO_ENABLE = no 11AUDIO_ENABLE = no
13API_SYSEX_ENABLE = no 12API_SYSEX_ENABLE = no