process_combo.h 732 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef PROCESS_COMBO_H
  2. #define PROCESS_COMBO_H
  3. #include <stdint.h>
  4. #include "progmem.h"
  5. #include "quantum.h"
  6. #ifndef COMBO_TERM
  7. #define COMBO_TERM TAPPING_TERM
  8. #endif
  9. typedef struct
  10. {
  11. const uint16_t *keys;
  12. uint16_t action;
  13. uint32_t state;
  14. #if COMBO_TERM
  15. uint16_t timer;
  16. uint16_t key;
  17. #endif
  18. } combo_t;
  19. #if COMBO_TERM
  20. #define COMBO(ck, ca) {.keys = &(ck)[0], .action = (ca), .state = 0, .timer = 0, .key = 0}
  21. #else
  22. #define COMBO(ck, ca) {.keys = &(ck)[0], .action = (ca), .state = 0 }
  23. #endif
  24. #define COMBO_END 0
  25. #ifndef COMBO_COUNT
  26. #define COMBO_COUNT 0
  27. #endif
  28. extern combo_t key_combos[COMBO_COUNT];
  29. bool process_combo(uint16_t keycode, keyrecord_t *record);
  30. void matrix_scan_combo(void);
  31. #endif