]> git.donarmstrong.com Git - qmk_firmware.git/blob - quantum/process_keycode/process_combo.h
Merge branch 'master' into feature/combos
[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 typedef struct
9 {
10     const uint16_t *keys;
11     uint16_t keycode;        
12 #ifdef EXTRA_EXTRA_LONG_COMBOS
13     uint32_t state;
14 #elif EXTRA_LONG_COMBOS
15     uint16_t state;
16 #else
17     uint8_t state;
18 #endif
19     uint16_t timer;
20 #ifdef COMBO_ALLOW_ACTION_KEYS
21     keyrecord_t prev_record;
22 #else
23     uint16_t prev_key;
24 #endif
25 } combo_t;
26
27
28 #define COMBO(ck, ca)       {.keys = &(ck)[0], .keycode = (ca)}
29 #define COMBO_ACTION(ck)    {.keys = &(ck)[0]}
30
31 #define COMBO_END 0
32 #ifndef COMBO_COUNT
33 #define COMBO_COUNT 0
34 #endif
35 #ifndef COMBO_TERM
36 #define COMBO_TERM TAPPING_TERM
37 #endif
38
39 bool process_combo(uint16_t keycode, keyrecord_t *record);
40 void matrix_scan_combo(void);
41 void process_combo_event(uint8_t combo_index, bool pressed);
42
43 #endif