]> git.donarmstrong.com Git - qmk_firmware.git/blob - quantum/process_keycode/process_combo.h
Added support for timing out combos if a key as been pressed for longer than COMBO_TERM
[qmk_firmware.git] / quantum / process_keycode / process_combo.h
1 #ifndef PROCESS_COMBO_H
2 #define PROCESS_COMBO_H
3
4 #include <stdint.h>
5 #include "progmem.h"
6 #include "quantum.h"
7
8 #ifndef COMBO_TERM
9 #define COMBO_TERM TAPPING_TERM
10 #endif
11
12 typedef struct
13 {
14     const uint16_t *keys;
15     uint16_t action;        
16     uint32_t state;
17 #if COMBO_TERM
18     uint16_t timer;
19     uint16_t key;
20 #endif
21 } combo_t;
22
23
24 #if COMBO_TERM
25 #define COMBO(ck, ca) {.keys = &(ck)[0], .action = (ca), .state = 0, .timer = 0, .key = 0}
26 #else
27 #define COMBO(ck, ca) {.keys = &(ck)[0], .action = (ca), .state = 0 }
28 #endif
29 #define COMBO_END 0
30 #ifndef COMBO_COUNT
31 #define COMBO_COUNT 0
32 #endif
33
34 extern combo_t key_combos[COMBO_COUNT];
35
36 bool process_combo(uint16_t keycode, keyrecord_t *record);
37 void matrix_scan_combo(void);
38
39 #endif