From 3399e392977f91b1993e1ac581ff5a054a45848b Mon Sep 17 00:00:00 2001 From: Stephen Tudor Date: Mon, 20 Mar 2017 07:26:28 -0400 Subject: Fix shift tap-dance (can't use one-shot layer) --- keyboards/satan/keymaps/smt/Makefile | 3 ++- keyboards/satan/keymaps/smt/keymap.c | 43 +++++++++--------------------------- 2 files changed, 12 insertions(+), 34 deletions(-) (limited to 'keyboards/satan') diff --git a/keyboards/satan/keymaps/smt/Makefile b/keyboards/satan/keymaps/smt/Makefile index 2a7ff27793..afcd025e13 100644 --- a/keyboards/satan/keymaps/smt/Makefile +++ b/keyboards/satan/keymaps/smt/Makefile @@ -8,13 +8,14 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +TAP_DANCE_ENABLE = yes # Enable tap dance ifndef QUANTUM_DIR include ../../../../Makefile diff --git a/keyboards/satan/keymaps/smt/keymap.c b/keyboards/satan/keymaps/smt/keymap.c index 4ac016f212..7f9e9c2d50 100644 --- a/keyboards/satan/keymaps/smt/keymap.c +++ b/keyboards/satan/keymaps/smt/keymap.c @@ -20,6 +20,10 @@ enum planck_keycodes { DVORAK }; +enum { + TD_SHIFT_RAISE = 0 +}; + #define _______ KC_TRNS #define XXXXXXX KC_NO @@ -28,7 +32,7 @@ enum planck_keycodes { #define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl #define HPR_TAB ALL_T(KC_TAB) // Tap for Tab, hold for Hyper (Super+Ctrl+Shift+Alt) #define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift -#define SFT_RSE TD(KC_LSFT, OS(_RAISE)) // Double-tap for RAISE one-shot, otherwise Left Shift +#define SFT_RSE TD(TD_SHIFT_RAISE) // Double-tap for RAISE one-shot, otherwise Left Shift const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap _QWERTY: (Base Layer) Default Layer @@ -170,36 +174,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } -enum function_id { - SHIFT_ESC, +// Tap Dance Definitions +qk_tap_dance_action_t tap_dance_actions[] = { + // Tap/hold once for Shift, tap twice for raise layer + [TD_SHIFT_RAISE] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, _RAISE) +// Other declarations would go here, separated by commas, if you have them }; - -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(SHIFT_ESC), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t shift_esc_shift_mask; - switch (id) { - case SHIFT_ESC: - shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; - if (record->event.pressed) { - if (shift_esc_shift_mask) { - add_key(KC_GRV); - send_keyboard_report(); - } else { - add_key(KC_ESC); - send_keyboard_report(); - } - } else { - if (shift_esc_shift_mask) { - del_key(KC_GRV); - send_keyboard_report(); - } else { - del_key(KC_ESC); - send_keyboard_report(); - } - } - break; - } -} -- cgit v1.2.3