You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.7 KiB

  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. enum tap_dance_states {
  22. SINGLE_TAP = 1,
  23. SINGLE_HOLD = 2,
  24. DOUBLE_TAP = 3,
  25. DOUBLE_HOLD = 4,
  26. DOUBLE_SINGLE_TAP = 5,
  27. TRIPLE_TAP = 6,
  28. TRIPLE_HOLD = 7
  29. };
  30. int cur_dance (qk_tap_dance_state_t *state);
  31. void process_tap_dance_keycode (bool reset, uint8_t toggle_layer);
  32. /* Tap Dance: Trigger Layer
  33. *
  34. * Toggles Layer based on given trigger (Single Hold, Double Tap, Double Hold, etc).
  35. * Uses process_tap_dance_keycode() to allow keycode defines based on layer
  36. */
  37. typedef struct {
  38. uint8_t trigger;
  39. uint8_t layer;
  40. uint8_t state;
  41. } qk_tap_dance_trigger_layer_t;
  42. #define ACTION_TAP_DANCE_TRIGGER_LAYER(trigger, layer) { \
  43. .fn = { NULL, td_trigger_layer_finished, td_trigger_layer_reset }, \
  44. .user_data = (void *)&((qk_tap_dance_trigger_layer_t) { trigger, layer, 0 }), \
  45. }
  46. void td_trigger_layer_finished (qk_tap_dance_state_t *state, void *user_data);
  47. void td_trigger_layer_reset (qk_tap_dance_state_t *state, void *user_data);