diff options
-rw-r--r-- | Model01-Firmware.ino | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/Model01-Firmware.ino b/Model01-Firmware.ino index da36cf8..daf597c 100644 --- a/Model01-Firmware.ino +++ b/Model01-Firmware.ino @@ -286,8 +286,8 @@ KEYMAPS( * prints out the firmware build information as virtual keystrokes */ -static void versionInfoMacro(uint8_t keyState) { - if (keyToggledOn(keyState)) { +static void versionInfoMacro(uint8_t key_state) { + if (keyToggledOn(key_state)) { Macros.type(PSTR("Keyboardio Model 01 - Kaleidoscope ")); Macros.type(PSTR(BUILD_INFORMATION)); } @@ -301,16 +301,11 @@ static void versionInfoMacro(uint8_t keyState) { * */ -static void anyKeyMacro(uint8_t keyState) { - static Key lastKey; - bool toggledOn = false; - if (keyToggledOn(keyState)) { - lastKey.setKeyCode(Key_A.getKeyCode() + (uint8_t)(millis() % 36)); - toggledOn = true; +static void anyKeyMacro(KeyEvent &event) { + if (keyToggledOn(event.state)) { + event.key.setKeyCode(Key_A.getKeyCode() + (uint8_t)(millis() % 36)); + event.key.setFlags(0); } - - if (keyIsPressed(keyState)) - Kaleidoscope.hid().keyboard().pressKey(lastKey, toggledOn); } @@ -326,15 +321,15 @@ static void anyKeyMacro(uint8_t keyState) { */ -const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { - switch (macroIndex) { +const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { + switch (macro_id) { case MACRO_VERSION_INFO: - versionInfoMacro(keyState); + versionInfoMacro(event.state); break; case MACRO_ANY: - anyKeyMacro(keyState); + anyKeyMacro(event); break; } return MACRO_NONE; |