aboutsummaryrefslogtreecommitdiff
path: root/common/action_macro.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/action_macro.h')
-rw-r--r--common/action_macro.h96
1 files changed, 42 insertions, 54 deletions
diff --git a/common/action_macro.h b/common/action_macro.h
index eea8ef57d..621826308 100644
--- a/common/action_macro.h
+++ b/common/action_macro.h
@@ -35,80 +35,68 @@ void action_macro_play(const macro_t *macro_p);
35 35
36 36
37 37
38/* TODO: NOT FINISHED 38/* Macro commands
39normal mode command: 39 * code(0x04-73) // key down(1byte)
40 key(down): 0x04-7f/73(F24) 40 * code(0x04-73) | 0x80 // key up(1byte)
41 key(up): 0x84-ff 41 * { KEY_DOWN, code(0x04-0xff) } // key down(2bytes)
42command: 0x00-03, 0x80-83(0x74-7f, 0xf4-ff) 42 * { KEY_UP, code(0x04-0xff) } // key up(2bytes)
43 mods down 0x00 43 * WAIT // wait milli-seconds
44 mods up 0x01 44 * INTERVAL // set interval between macro commands
45 wait 0x02 45 * END // stop macro execution
46 interval 0x03 46 *
47 extkey down 0x80 47 * Ideas(Not implemented):
48 extkey up 0x81 48 * modifiers
49 ext commad 0x82 49 * system usage
50 ext mode 0x83 50 * consumer usage
51 end 0xff 51 * unicode usage
52 52 * function call
53extension mode command: NOT IMPLEMENTED 53 * conditionals
54 key down 0x00 54 * loop
55 key up 0x01 55 */
56 key down + wait
57 key up + wait
58 mods push
59 mods pop
60 wait
61 interval
62 if
63 loop
64 push
65 pop
66 all up
67 end
68*/
69enum macro_command_id{ 56enum macro_command_id{
70 /* 0x00 - 0x03 */ 57 /* 0x00 - 0x03 */
71 END = 0x00, 58 END = 0x00,
72 MODS_DOWN = 0x01, 59 KEY_DOWN,
73 MODS_UP = 0x02, 60 KEY_UP,
74 MODS_SET, 61
75 MODS_PUSH, 62 /* 0x04 - 0x73 (reserved for keycode down) */
76 MODS_POP,
77 63
64 /* 0x74 - 0x83 */
78 WAIT = 0x74, 65 WAIT = 0x74,
79 INTERVAL, 66 INTERVAL,
80 /* 0x74 - 0x7f */
81 /* 0x80 - 0x84 */
82 67
83 EXT_DOWN, 68 /* 0x84 - 0xf3 (reserved for keycode up) */
84 EXT_UP,
85 EXT_WAIT,
86 EXT_INTERVAL,
87 COMPRESSION_MODE,
88 69
89 EXTENSION_MODE = 0xff, 70 /* 0xf4 - 0xff */
90}; 71};
91 72
92 73
93/* normal mode */ 74/* TODO: keycode:0x04-0x73 can be handled by 1byte command else 2bytes are needed
94#define DOWN(key) (key) 75 * if keycode between 0x04 and 0x73
95#define UP(key) ((key) | 0x80) 76 * keycode / (keycode|0x80)
96#define TYPE(key) (key), (key | 0x80) 77 * else
97#define MODS_DOWN(mods) MODS_DOWN, (mods) 78 * {KEY_DOWN, keycode} / {KEY_UP, keycode}
98#define MODS_UP(mods) MODS_UP, (mods) 79*/
80#define DOWN(key) KEY_DOWN, (key)
81#define UP(key) KEY_UP, (key)
82#define TYPE(key) DOWN(key), UP(key)
99#define WAIT(ms) WAIT, (ms) 83#define WAIT(ms) WAIT, (ms)
100#define INTERVAL(ms) INTERVAL, (ms) 84#define INTERVAL(ms) INTERVAL, (ms)
101 85
86/* key down */
102#define D(key) DOWN(KC_##key) 87#define D(key) DOWN(KC_##key)
88/* key up */
103#define U(key) UP(KC_##key) 89#define U(key) UP(KC_##key)
90/* key type */
104#define T(key) TYPE(KC_##key) 91#define T(key) TYPE(KC_##key)
105#define MD(key) MODS_DOWN(MOD_BIT(KC_##key)) 92/* wait */
106#define MU(key) MODS_UP(MOD_BIT(KC_##key))
107#define W(ms) WAIT(ms) 93#define W(ms) WAIT(ms)
94/* interval */
108#define I(ms) INTERVAL(ms) 95#define I(ms) INTERVAL(ms)
109 96
110 97/* for backward comaptibility */
111/* extension mode */ 98#define MD(key) DOWN(KC_##key)
99#define MU(key) UP(KC_##key)
112 100
113 101
114#endif /* ACTION_MACRO_H */ 102#endif /* ACTION_MACRO_H */