diff options
author | Joel Challis <git@zvecr.com> | 2021-08-18 00:18:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-18 00:18:58 +0100 |
commit | b8e913c8db73ebf890e4604ee41991a34354a600 (patch) | |
tree | 258035f8fda9f83f08a309f6cd608b9c61476678 /tmk_core/common/action_macro.c | |
parent | 96e2b13d1de227cdc2b918fb0292bd832d346a25 (diff) | |
download | qmk_firmware-b8e913c8db73ebf890e4604ee41991a34354a600.tar.gz qmk_firmware-b8e913c8db73ebf890e4604ee41991a34354a600.zip |
Migrate platform independent code from tmk_core -> quantum (#13673)
* Migrate action|keyboard|keycode|eeconfig from tmk_core -> quantum
Diffstat (limited to 'tmk_core/common/action_macro.c')
-rw-r--r-- | tmk_core/common/action_macro.c | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/tmk_core/common/action_macro.c b/tmk_core/common/action_macro.c deleted file mode 100644 index 92228c0ba..000000000 --- a/tmk_core/common/action_macro.c +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | /* | ||
2 | Copyright 2013 Jun Wako <wakojun@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | #include "action.h" | ||
18 | #include "action_util.h" | ||
19 | #include "action_macro.h" | ||
20 | #include "wait.h" | ||
21 | |||
22 | #ifdef DEBUG_ACTION | ||
23 | # include "debug.h" | ||
24 | #else | ||
25 | # include "nodebug.h" | ||
26 | #endif | ||
27 | |||
28 | #ifndef NO_ACTION_MACRO | ||
29 | |||
30 | # define MACRO_READ() (macro = MACRO_GET(macro_p++)) | ||
31 | /** \brief Action Macro Play | ||
32 | * | ||
33 | * FIXME: Needs doc | ||
34 | */ | ||
35 | void action_macro_play(const macro_t *macro_p) { | ||
36 | macro_t macro = END; | ||
37 | uint8_t interval = 0; | ||
38 | |||
39 | if (!macro_p) return; | ||
40 | while (true) { | ||
41 | switch (MACRO_READ()) { | ||
42 | case KEY_DOWN: | ||
43 | MACRO_READ(); | ||
44 | dprintf("KEY_DOWN(%02X)\n", macro); | ||
45 | if (IS_MOD(macro)) { | ||
46 | add_macro_mods(MOD_BIT(macro)); | ||
47 | send_keyboard_report(); | ||
48 | } else { | ||
49 | register_code(macro); | ||
50 | } | ||
51 | break; | ||
52 | case KEY_UP: | ||
53 | MACRO_READ(); | ||
54 | dprintf("KEY_UP(%02X)\n", macro); | ||
55 | if (IS_MOD(macro)) { | ||
56 | del_macro_mods(MOD_BIT(macro)); | ||
57 | send_keyboard_report(); | ||
58 | } else { | ||
59 | unregister_code(macro); | ||
60 | } | ||
61 | break; | ||
62 | case WAIT: | ||
63 | MACRO_READ(); | ||
64 | dprintf("WAIT(%u)\n", macro); | ||
65 | { | ||
66 | uint8_t ms = macro; | ||
67 | while (ms--) wait_ms(1); | ||
68 | } | ||
69 | break; | ||
70 | case INTERVAL: | ||
71 | interval = MACRO_READ(); | ||
72 | dprintf("INTERVAL(%u)\n", interval); | ||
73 | break; | ||
74 | case 0x04 ... 0x73: | ||
75 | dprintf("DOWN(%02X)\n", macro); | ||
76 | register_code(macro); | ||
77 | break; | ||
78 | case 0x84 ... 0xF3: | ||
79 | dprintf("UP(%02X)\n", macro); | ||
80 | unregister_code(macro & 0x7F); | ||
81 | break; | ||
82 | case END: | ||
83 | default: | ||
84 | return; | ||
85 | } | ||
86 | // interval | ||
87 | { | ||
88 | uint8_t ms = interval; | ||
89 | while (ms--) wait_ms(1); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | #endif | ||