aboutsummaryrefslogtreecommitdiff
path: root/quantum/process_keycode/process_combo.h
diff options
context:
space:
mode:
authorOfer Plesser <plesserofer@gmail.com>2016-12-10 16:11:59 +0200
committerOfer Plesser <plesserofer@gmail.com>2016-12-10 16:11:59 +0200
commitb6bf4e0dce062a535685c4e772f613252d401ed3 (patch)
tree26ed7273077f84e33d5cea525f7cc662637212c3 /quantum/process_keycode/process_combo.h
parenteac8fa799909817bfc7cb4043448f85551154c6b (diff)
downloadqmk_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.h20
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
9typedef struct 12typedef 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 34extern combo_t key_combos[COMBO_COUNT];
21extern combo_t key_combos[1];
22 35
23bool process_combo(uint16_t keycode, keyrecord_t *record); 36bool process_combo(uint16_t keycode, keyrecord_t *record);
37void matrix_scan_combo(void);
24 38
25#endif \ No newline at end of file 39#endif \ No newline at end of file