summaryrefslogtreecommitdiff
path: root/quantum/process_keycode/process_leader.h
diff options
context:
space:
mode:
authorChris Browne <cbbrowne@hpaq.int.linuxdatabases.info>2016-10-10 17:18:15 -0400
committerChris Browne <cbbrowne@hpaq.int.linuxdatabases.info>2016-10-10 17:18:15 -0400
commit4b682ea63e2b3dd0bc1132917be7985ce0da57a6 (patch)
tree6d79874c5542148c27907511ecdb2e9e5e12b24b /quantum/process_keycode/process_leader.h
parent04759d63ef9b520fc41d76de64bb65198448fc1c (diff)
parenta9df99b81c787862dc3fa11bd854fe39e704da81 (diff)
Merge branch 'master' of github.com:cbbrowne/qmk_firmware
Diffstat (limited to 'quantum/process_keycode/process_leader.h')
-rw-r--r--quantum/process_keycode/process_leader.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/quantum/process_keycode/process_leader.h b/quantum/process_keycode/process_leader.h
new file mode 100644
index 0000000000..c83db8abbd
--- /dev/null
+++ b/quantum/process_keycode/process_leader.h
@@ -0,0 +1,23 @@
+#ifndef PROCESS_LEADER_H
+#define PROCESS_LEADER_H
+
+#include "quantum.h"
+
+bool process_leader(uint16_t keycode, keyrecord_t *record);
+
+void leader_start(void);
+void leader_end(void);
+
+#ifndef LEADER_TIMEOUT
+ #define LEADER_TIMEOUT 200
+#endif
+#define SEQ_ONE_KEY(key) if (leader_sequence[0] == (key) && leader_sequence[1] == 0 && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0)
+#define SEQ_TWO_KEYS(key1, key2) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0)
+#define SEQ_THREE_KEYS(key1, key2, key3) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == 0 && leader_sequence[4] == 0)
+#define SEQ_FOUR_KEYS(key1, key2, key3, key4) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == (key4) && leader_sequence[4] == 0)
+#define SEQ_FIVE_KEYS(key1, key2, key3, key4, key5) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == (key4) && leader_sequence[4] == (key5))
+
+#define LEADER_EXTERNS() extern bool leading; extern uint16_t leader_time; extern uint16_t leader_sequence[5]; extern uint8_t leader_sequence_size
+#define LEADER_DICTIONARY() if (leading && timer_elapsed(leader_time) > LEADER_TIMEOUT)
+
+#endif \ No newline at end of file