diff options
author | Ofer Plesser <plesserofer@gmail.com> | 2016-12-16 21:50:28 +0200 |
---|---|---|
committer | Ofer Plesser <plesserofer@gmail.com> | 2016-12-16 21:50:28 +0200 |
commit | 6e7cfa83b9424061914793b02757fa4ec75b356b (patch) | |
tree | 8ddb3fd03ce5666ad75ebfd5c4abce7d3b737d86 /quantum/process_keycode/process_combo.h | |
parent | b6bf4e0dce062a535685c4e772f613252d401ed3 (diff) | |
download | qmk_firmware-6e7cfa83b9424061914793b02757fa4ec75b356b.tar.gz qmk_firmware-6e7cfa83b9424061914793b02757fa4ec75b356b.zip |
Refactored as well as added support for action keys in combos
Diffstat (limited to 'quantum/process_keycode/process_combo.h')
-rw-r--r-- | quantum/process_keycode/process_combo.h | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/quantum/process_keycode/process_combo.h b/quantum/process_keycode/process_combo.h index c475acd33..847f2b737 100644 --- a/quantum/process_keycode/process_combo.h +++ b/quantum/process_keycode/process_combo.h | |||
@@ -5,35 +5,39 @@ | |||
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 | ||
11 | |||
12 | typedef struct | 8 | typedef struct |
13 | { | 9 | { |
14 | const uint16_t *keys; | 10 | const uint16_t *keys; |
15 | uint16_t action; | 11 | uint16_t keycode; |
12 | #ifdef EXTRA_EXTRA_LONG_COMBOS | ||
16 | uint32_t state; | 13 | uint32_t state; |
17 | #if COMBO_TERM | 14 | #elif EXTRA_LONG_COMBOS |
15 | uint16_t state; | ||
16 | #else | ||
17 | uint8_t state; | ||
18 | #endif | ||
18 | uint16_t timer; | 19 | uint16_t timer; |
19 | uint16_t key; | 20 | #ifdef COMBO_ALLOW_ACTION_KEYS |
21 | keyrecord_t prev_record; | ||
22 | #else | ||
23 | uint16_t prev_key; | ||
20 | #endif | 24 | #endif |
21 | } combo_t; | 25 | } combo_t; |
22 | 26 | ||
23 | 27 | ||
24 | #if COMBO_TERM | 28 | #define COMBO(ck, ca) {.keys = &(ck)[0], .keycode = (ca)} |
25 | #define COMBO(ck, ca) {.keys = &(ck)[0], .action = (ca), .state = 0, .timer = 0, .key = 0} | 29 | #define COMBO_ACTION(ck) {.keys = &(ck)[0]} |
26 | #else | 30 | |
27 | #define COMBO(ck, ca) {.keys = &(ck)[0], .action = (ca), .state = 0 } | ||
28 | #endif | ||
29 | #define COMBO_END 0 | 31 | #define COMBO_END 0 |
30 | #ifndef COMBO_COUNT | 32 | #ifndef COMBO_COUNT |
31 | #define COMBO_COUNT 0 | 33 | #define COMBO_COUNT 0 |
32 | #endif | 34 | #endif |
33 | 35 | #ifndef COMBO_TERM | |
34 | extern combo_t key_combos[COMBO_COUNT]; | 36 | #define COMBO_TERM TAPPING_TERM |
37 | #endif | ||
35 | 38 | ||
36 | bool process_combo(uint16_t keycode, keyrecord_t *record); | 39 | bool process_combo(uint16_t keycode, keyrecord_t *record); |
37 | void matrix_scan_combo(void); | 40 | void matrix_scan_combo(void); |
41 | void process_combo_event(uint8_t combo_index, bool pressed); | ||
38 | 42 | ||
39 | #endif \ No newline at end of file | 43 | #endif |