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.

63 lines
1.6 KiB

  1. /* Copyright 2016 Jack Humbert
  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 "progmem.h"
  18. #include "quantum.h"
  19. #include <stdint.h>
  20. #ifdef EXTRA_EXTRA_LONG_COMBOS
  21. # define MAX_COMBO_LENGTH 32
  22. #elif EXTRA_LONG_COMBOS
  23. # define MAX_COMBO_LENGTH 16
  24. #else
  25. # define MAX_COMBO_LENGTH 8
  26. #endif
  27. typedef struct {
  28. const uint16_t *keys;
  29. uint16_t keycode;
  30. #ifdef EXTRA_EXTRA_LONG_COMBOS
  31. uint32_t state;
  32. #elif EXTRA_LONG_COMBOS
  33. uint16_t state;
  34. #else
  35. uint8_t state;
  36. #endif
  37. } combo_t;
  38. #define COMBO(ck, ca) \
  39. { .keys = &(ck)[0], .keycode = (ca) }
  40. #define COMBO_ACTION(ck) \
  41. { .keys = &(ck)[0] }
  42. #define COMBO_END 0
  43. #ifndef COMBO_COUNT
  44. # define COMBO_COUNT 0
  45. #endif
  46. #ifndef COMBO_TERM
  47. # define COMBO_TERM TAPPING_TERM
  48. #endif
  49. bool process_combo(uint16_t keycode, keyrecord_t *record);
  50. void matrix_scan_combo(void);
  51. void process_combo_event(uint16_t combo_index, bool pressed);
  52. void combo_enable(void);
  53. void combo_disable(void);
  54. void combo_toggle(void);
  55. bool is_combo_enabled(void);