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.

59 lines
1.5 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. #ifndef PROCESS_COMBO_H
  17. #define PROCESS_COMBO_H
  18. #include <stdint.h>
  19. #include "progmem.h"
  20. #include "quantum.h"
  21. typedef struct
  22. {
  23. const uint16_t *keys;
  24. uint16_t keycode;
  25. #ifdef EXTRA_EXTRA_LONG_COMBOS
  26. uint32_t state;
  27. #elif EXTRA_LONG_COMBOS
  28. uint16_t state;
  29. #else
  30. uint8_t state;
  31. #endif
  32. uint16_t timer;
  33. #ifdef COMBO_ALLOW_ACTION_KEYS
  34. keyrecord_t prev_record;
  35. #else
  36. uint16_t prev_key;
  37. #endif
  38. } combo_t;
  39. #define COMBO(ck, ca) {.keys = &(ck)[0], .keycode = (ca)}
  40. #define COMBO_ACTION(ck) {.keys = &(ck)[0]}
  41. #define COMBO_END 0
  42. #ifndef COMBO_COUNT
  43. #define COMBO_COUNT 0
  44. #endif
  45. #ifndef COMBO_TERM
  46. #define COMBO_TERM TAPPING_TERM
  47. #endif
  48. bool process_combo(uint16_t keycode, keyrecord_t *record);
  49. void matrix_scan_combo(void);
  50. void process_combo_event(uint8_t combo_index, bool pressed);
  51. #endif