aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/action_macro.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/action_macro.c')
-rw-r--r--tmk_core/common/action_macro.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/tmk_core/common/action_macro.c b/tmk_core/common/action_macro.c
index 12bef2958..92228c0ba 100644
--- a/tmk_core/common/action_macro.c
+++ b/tmk_core/common/action_macro.c
@@ -20,22 +20,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20#include "wait.h" 20#include "wait.h"
21 21
22#ifdef DEBUG_ACTION 22#ifdef DEBUG_ACTION
23#include "debug.h" 23# include "debug.h"
24#else 24#else
25#include "nodebug.h" 25# include "nodebug.h"
26#endif 26#endif
27 27
28
29#ifndef NO_ACTION_MACRO 28#ifndef NO_ACTION_MACRO
30 29
31#define MACRO_READ() (macro = MACRO_GET(macro_p++)) 30# define MACRO_READ() (macro = MACRO_GET(macro_p++))
32/** \brief Action Macro Play 31/** \brief Action Macro Play
33 * 32 *
34 * FIXME: Needs doc 33 * FIXME: Needs doc
35 */ 34 */
36void action_macro_play(const macro_t *macro_p) 35void action_macro_play(const macro_t *macro_p) {
37{ 36 macro_t macro = END;
38 macro_t macro = END;
39 uint8_t interval = 0; 37 uint8_t interval = 0;
40 38
41 if (!macro_p) return; 39 if (!macro_p) return;
@@ -64,7 +62,10 @@ void action_macro_play(const macro_t *macro_p)
64 case WAIT: 62 case WAIT:
65 MACRO_READ(); 63 MACRO_READ();
66 dprintf("WAIT(%u)\n", macro); 64 dprintf("WAIT(%u)\n", macro);
67 { uint8_t ms = macro; while (ms--) wait_ms(1); } 65 {
66 uint8_t ms = macro;
67 while (ms--) wait_ms(1);
68 }
68 break; 69 break;
69 case INTERVAL: 70 case INTERVAL:
70 interval = MACRO_READ(); 71 interval = MACRO_READ();
@@ -76,14 +77,17 @@ void action_macro_play(const macro_t *macro_p)
76 break; 77 break;
77 case 0x84 ... 0xF3: 78 case 0x84 ... 0xF3:
78 dprintf("UP(%02X)\n", macro); 79 dprintf("UP(%02X)\n", macro);
79 unregister_code(macro&0x7F); 80 unregister_code(macro & 0x7F);
80 break; 81 break;
81 case END: 82 case END:
82 default: 83 default:
83 return; 84 return;
84 } 85 }
85 // interval 86 // interval
86 { uint8_t ms = interval; while (ms--) wait_ms(1); } 87 {
88 uint8_t ms = interval;
89 while (ms--) wait_ms(1);
90 }
87 } 91 }
88} 92}
89#endif 93#endif