diff options
author | Ofer Plesser <plesserofer@gmail.com> | 2016-12-10 16:11:59 +0200 |
---|---|---|
committer | Ofer Plesser <plesserofer@gmail.com> | 2016-12-10 16:11:59 +0200 |
commit | b6bf4e0dce062a535685c4e772f613252d401ed3 (patch) | |
tree | 26ed7273077f84e33d5cea525f7cc662637212c3 /quantum/process_keycode/process_combo.h | |
parent | eac8fa799909817bfc7cb4043448f85551154c6b (diff) | |
download | qmk_firmware-b6bf4e0dce062a535685c4e772f613252d401ed3.tar.gz qmk_firmware-b6bf4e0dce062a535685c4e772f613252d401ed3.zip |
Added support for timing out combos if a key as been pressed for longer than COMBO_TERM
Diffstat (limited to 'quantum/process_keycode/process_combo.h')
-rw-r--r-- | quantum/process_keycode/process_combo.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/quantum/process_keycode/process_combo.h b/quantum/process_keycode/process_combo.h index 68786c0f1..c475acd33 100644 --- a/quantum/process_keycode/process_combo.h +++ b/quantum/process_keycode/process_combo.h | |||
@@ -5,21 +5,35 @@ | |||
5 | #include "progmem.h" | 5 | #include "progmem.h" |
6 | #include "quantum.h" | 6 | #include "quantum.h" |
7 | 7 | ||
8 | #ifndef COMBO_TERM | ||
9 | #define COMBO_TERM TAPPING_TERM | ||
10 | #endif | ||
8 | 11 | ||
9 | typedef struct | 12 | typedef struct |
10 | { | 13 | { |
11 | const uint16_t *keys; | 14 | const uint16_t *keys; |
12 | uint16_t action; | 15 | uint16_t action; |
13 | uint32_t state; | 16 | uint32_t state; |
17 | #if COMBO_TERM | ||
18 | uint16_t timer; | ||
19 | uint16_t key; | ||
20 | #endif | ||
14 | } combo_t; | 21 | } combo_t; |
15 | 22 | ||
16 | 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 | ||
17 | #define COMBO_END 0 | 29 | #define COMBO_END 0 |
18 | #define NUM_ELEMS(a) (sizeof(a)/sizeof 0[a]) | 30 | #ifndef COMBO_COUNT |
31 | #define COMBO_COUNT 0 | ||
32 | #endif | ||
19 | 33 | ||
20 | 34 | extern combo_t key_combos[COMBO_COUNT]; | |
21 | extern combo_t key_combos[1]; | ||
22 | 35 | ||
23 | bool process_combo(uint16_t keycode, keyrecord_t *record); | 36 | bool process_combo(uint16_t keycode, keyrecord_t *record); |
37 | void matrix_scan_combo(void); | ||
24 | 38 | ||
25 | #endif \ No newline at end of file | 39 | #endif \ No newline at end of file |