diff --git a/src/Kaleidoscope-Macros.cpp b/src/Kaleidoscope-Macros.cpp index 128faf5c..15f31adf 100644 --- a/src/Kaleidoscope-Macros.cpp +++ b/src/Kaleidoscope-Macros.cpp @@ -45,6 +45,28 @@ void Macros_::play(const macro_t *macro_p) { handle_key_event(key, 255, 255, WAS_PRESSED | INJECTED); Keyboard.sendReport(); break; + + case MACRO_ACTION_STEP_KEYCODEDOWN: + key.flags = 0; + key.keyCode = pgm_read_byte(macro_p++); + handle_key_event(key, 255, 255, IS_PRESSED | INJECTED); + Keyboard.sendReport(); + break; + case MACRO_ACTION_STEP_KEYCODEUP: + key.flags = 0; + key.keyCode = pgm_read_byte(macro_p++); + handle_key_event(key, 255, 255, WAS_PRESSED | INJECTED); + Keyboard.sendReport(); + break; + case MACRO_ACTION_STEP_TAPCODE: + key.flags = 0; + key.keyCode = pgm_read_byte(macro_p++); + handle_key_event(key, 255, 255, IS_PRESSED | INJECTED); + Keyboard.sendReport(); + handle_key_event(key, 255, 255, WAS_PRESSED | INJECTED); + Keyboard.sendReport(); + break; + case END: default: return; diff --git a/src/MacroSteps.h b/src/MacroSteps.h index 9a0fd379..7b92f526 100644 --- a/src/MacroSteps.h +++ b/src/MacroSteps.h @@ -5,9 +5,14 @@ typedef enum { MACRO_ACTION_STEP_INTERVAL, MACRO_ACTION_STEP_WAIT, + MACRO_ACTION_STEP_KEYDOWN, MACRO_ACTION_STEP_KEYUP, - MACRO_ACTION_STEP_TAP + MACRO_ACTION_STEP_TAP, + + MACRO_ACTION_STEP_KEYCODEDOWN, + MACRO_ACTION_STEP_KEYCODEUP, + MACRO_ACTION_STEP_TAPCODE, } MacroActionStepType; typedef uint8_t macro_t; @@ -18,10 +23,16 @@ typedef uint8_t macro_t; #define I(n) MACRO_ACTION_STEP_INTERVAL, n #define W(n) MACRO_ACTION_STEP_WAIT, n + #define Dr(k) MACRO_ACTION_STEP_KEYDOWN, (k).flags, (k).keyCode #define D(k) Dr(Key_ ## k) #define Ur(k) MACRO_ACTION_STEP_KEYUP, (k).flags, (k).keyCode #define U(k) Ur(Key_ ## k) #define Tr(k) MACRO_ACTION_STEP_TAP, (k).flags, (k).keyCode #define T(k) Tr(Key_ ## k) + +#define Dc(k) MACRO_ACTION_STEP_KEYCODEDOWN, (Key_ ## k).keyCode +#define Uc(k) MACRO_ACTION_STEP_KEYCODEUP, (Key_ ## k).keyCode +#define Tc(k) MACRO_ACTION_STEP_TAPCODE, (Key_ ## k).keyCode + #define END MACRO_ACTION_END