X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=quantum%2Fprocess_keycode%2Fprocess_tap_dance.h;h=37a27c5366f8099408eb400fc1c6dfd640a573c1;hb=e899cb8940da04fa2610604f0aab417db7fac119;hp=f753cbba665fd316dff284d8a0318a363505af79;hpb=b75cb53c4a67597dd453fb8bb54af1936b422f6b;p=qmk_firmware.git diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index f753cbba6..37a27c536 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h @@ -1,3 +1,18 @@ +/* Copyright 2016 Jack Humbert + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef PROCESS_TAP_DANCE_H #define PROCESS_TAP_DANCE_H @@ -9,6 +24,7 @@ typedef struct { uint8_t count; + uint8_t oneshot_mods; uint16_t keycode; uint16_t timer; bool interrupted; @@ -28,6 +44,7 @@ typedef struct qk_tap_dance_user_fn_t on_reset; } fn; qk_tap_dance_state_t state; + uint16_t custom_tapping_term; void *user_data; } qk_tap_dance_action_t; @@ -37,11 +54,22 @@ typedef struct uint16_t kc2; } qk_tap_dance_pair_t; +typedef struct +{ + uint16_t kc; + uint8_t layer; +} qk_tap_dance_dual_role_t; + #define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) { \ .fn = { NULL, qk_tap_dance_pair_finished, qk_tap_dance_pair_reset }, \ .user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }), \ } +#define ACTION_TAP_DANCE_DUAL_ROLE(kc, layer) { \ + .fn = { NULL, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset }, \ + .user_data = (void *)&((qk_tap_dance_dual_role_t) { kc, layer }), \ + } + #define ACTION_TAP_DANCE_FN(user_fn) { \ .fn = { NULL, user_fn, NULL }, \ .user_data = NULL, \ @@ -52,6 +80,12 @@ typedef struct .user_data = NULL, \ } +#define ACTION_TAP_DANCE_FN_ADVANCED_TIME(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term) { \ + .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \ + .user_data = NULL, \ + .custom_tapping_term = tap_specific_tapping_term, \ + } + extern qk_tap_dance_action_t tap_dance_actions[]; /* To be used internally */ @@ -63,6 +97,9 @@ void reset_tap_dance (qk_tap_dance_state_t *state); void qk_tap_dance_pair_finished (qk_tap_dance_state_t *state, void *user_data); void qk_tap_dance_pair_reset (qk_tap_dance_state_t *state, void *user_data); +void qk_tap_dance_dual_role_finished (qk_tap_dance_state_t *state, void *user_data); +void qk_tap_dance_dual_role_reset (qk_tap_dance_state_t *state, void *user_data); + #else #define TD(n) KC_NO