diff options
Diffstat (limited to 'users/brandonschlack/tap_dances.h')
| -rw-r--r-- | users/brandonschlack/tap_dances.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/users/brandonschlack/tap_dances.h b/users/brandonschlack/tap_dances.h new file mode 100644 index 000000000..3747619a5 --- /dev/null +++ b/users/brandonschlack/tap_dances.h | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | /* Copyright 2020 Brandon Schlack | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #pragma once | ||
| 17 | #include "brandonschlack.h" | ||
| 18 | #ifdef TAP_DANCE_ENABLE | ||
| 19 | # include "process_keycode/process_tap_dance.h" | ||
| 20 | #endif | ||
| 21 | |||
| 22 | enum tap_dance_states { | ||
| 23 | SINGLE_TAP = 1, | ||
| 24 | SINGLE_HOLD = 2, | ||
| 25 | DOUBLE_TAP = 3, | ||
| 26 | DOUBLE_HOLD = 4, | ||
| 27 | DOUBLE_SINGLE_TAP = 5, | ||
| 28 | TRIPLE_TAP = 6, | ||
| 29 | TRIPLE_HOLD = 7 | ||
| 30 | }; | ||
| 31 | |||
| 32 | int cur_dance (qk_tap_dance_state_t *state); | ||
| 33 | void process_tap_dance_keycode (bool reset, uint8_t toggle_layer); | ||
| 34 | |||
| 35 | /* Tap Dance: Trigger Layer | ||
| 36 | * | ||
| 37 | * Toggles Layer based on given trigger (Single Hold, Double Tap, Double Hold, etc). | ||
| 38 | * Uses process_tap_dance_keycode() to allow keycode defines based on layer | ||
| 39 | */ | ||
| 40 | typedef struct { | ||
| 41 | uint8_t trigger; | ||
| 42 | uint8_t layer; | ||
| 43 | uint8_t state; | ||
| 44 | } qk_tap_dance_trigger_layer_t; | ||
| 45 | |||
| 46 | #define ACTION_TAP_DANCE_TRIGGER_LAYER(trigger, layer) { \ | ||
| 47 | .fn = { NULL, td_trigger_layer_finished, td_trigger_layer_reset }, \ | ||
| 48 | .user_data = (void *)&((qk_tap_dance_trigger_layer_t) { trigger, layer, 0 }), \ | ||
| 49 | } | ||
| 50 | |||
| 51 | void td_trigger_layer_finished (qk_tap_dance_state_t *state, void *user_data); | ||
| 52 | void td_trigger_layer_reset (qk_tap_dance_state_t *state, void *user_data); | ||
