process_combo.h 839 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef PROCESS_COMBO_H
  2. #define PROCESS_COMBO_H
  3. #include <stdint.h>
  4. #include "progmem.h"
  5. #include "quantum.h"
  6. typedef struct
  7. {
  8. const uint16_t *keys;
  9. uint16_t keycode;
  10. #ifdef EXTRA_EXTRA_LONG_COMBOS
  11. uint32_t state;
  12. #elif EXTRA_LONG_COMBOS
  13. uint16_t state;
  14. #else
  15. uint8_t state;
  16. #endif
  17. uint16_t timer;
  18. #ifdef COMBO_ALLOW_ACTION_KEYS
  19. keyrecord_t prev_record;
  20. #else
  21. uint16_t prev_key;
  22. #endif
  23. } combo_t;
  24. #define COMBO(ck, ca) {.keys = &(ck)[0], .keycode = (ca)}
  25. #define COMBO_ACTION(ck) {.keys = &(ck)[0]}
  26. #define COMBO_END 0
  27. #ifndef COMBO_COUNT
  28. #define COMBO_COUNT 0
  29. #endif
  30. #ifndef COMBO_TERM
  31. #define COMBO_TERM TAPPING_TERM
  32. #endif
  33. bool process_combo(uint16_t keycode, keyrecord_t *record);
  34. void matrix_scan_combo(void);
  35. void process_combo_event(uint8_t combo_index, bool pressed);
  36. #endif