diff --git a/examples/Devices/KBDFans/KBD4x/KBD4x.ino b/examples/Devices/KBDFans/KBD4x/KBD4x.ino index 91af5f75..3dddaa1e 100644 --- a/examples/Devices/KBDFans/KBD4x/KBD4x.ino +++ b/examples/Devices/KBDFans/KBD4x/KBD4x.ino @@ -75,10 +75,11 @@ KEYMAPS( KALEIDOSCOPE_INIT_PLUGINS(Macros); -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 RESET: - Kaleidoscope.rebootBootloader(); + if (keyToggledOn(event.state)) + Kaleidoscope.rebootBootloader(); break; default: break; diff --git a/examples/Devices/Keyboardio/Atreus/Atreus.ino b/examples/Devices/Keyboardio/Atreus/Atreus.ino index f0f00296..fbdb2fc9 100644 --- a/examples/Devices/Keyboardio/Atreus/Atreus.ino +++ b/examples/Devices/Keyboardio/Atreus/Atreus.ino @@ -113,25 +113,24 @@ KALEIDOSCOPE_INIT_PLUGINS( MouseKeys ); -const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { - switch (macroIndex) { - case MACRO_QWERTY: - // This macro is currently unused, but is kept around for compatibility - // reasons. We used to use it in place of `MoveToLayer(QWERTY)`, but no - // longer do. We keep it so that if someone still has the old layout with - // the macro in EEPROM, it will keep working after a firmware update. - Layer.move(QWERTY); - break; - case MACRO_VERSION_INFO: - if (keyToggledOn(keyState)) { +const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { + if (keyToggledOn(event.state)) { + switch (macro_id) { + case MACRO_QWERTY: + // This macro is currently unused, but is kept around for compatibility + // reasons. We used to use it in place of `MoveToLayer(QWERTY)`, but no + // longer do. We keep it so that if someone still has the old layout with + // the macro in EEPROM, it will keep working after a firmware update. + Layer.move(QWERTY); + break; + case MACRO_VERSION_INFO: Macros.type(PSTR("Keyboardio Atreus - Kaleidoscope ")); Macros.type(PSTR(BUILD_INFORMATION)); + break; + default: + break; } - break; - default: - break; } - return MACRO_NONE; } diff --git a/examples/Devices/Keyboardio/Model01/Model01.ino b/examples/Devices/Keyboardio/Model01/Model01.ino index 28625508..823f04d0 100644 --- a/examples/Devices/Keyboardio/Model01/Model01.ino +++ b/examples/Devices/Keyboardio/Model01/Model01.ino @@ -85,8 +85,8 @@ static kaleidoscope::plugin::LEDSolidColor solidBlue(0, 15, 100); static kaleidoscope::plugin::LEDSolidColor solidIndigo(0, 0, 100); static kaleidoscope::plugin::LEDSolidColor solidViolet(70, 0, 60); -const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { - if (macroIndex == 1 && keyToggledOn(keyState)) { +const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { + if (macro_id == 1 && keyToggledOn(event.state)) { Kaleidoscope.serialPort().print("Keyboard.IO keyboard driver v0.00"); return MACRO(I(25), D(LeftShift), T(M), U(LeftShift), T(O), T(D), T(E), T(L), diff --git a/examples/Devices/Technomancy/Atreus/Atreus.ino b/examples/Devices/Technomancy/Atreus/Atreus.ino index 3ee131d1..b5760783 100644 --- a/examples/Devices/Technomancy/Atreus/Atreus.ino +++ b/examples/Devices/Technomancy/Atreus/Atreus.ino @@ -82,10 +82,11 @@ KEYMAPS( KALEIDOSCOPE_INIT_PLUGINS(Macros); -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 QWERTY: - Layer.move(QWERTY); + if (keyToggledOn(event.state)) + Layer.move(QWERTY); break; default: break; diff --git a/examples/Features/EEPROM/EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino b/examples/Features/EEPROM/EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino index 10345d12..a3ddd53d 100644 --- a/examples/Features/EEPROM/EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino +++ b/examples/Features/EEPROM/EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino @@ -42,8 +42,8 @@ KEYMAPS( ) // *INDENT-ON* -const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { - if (macroIndex == 0 && keyToggledOff(keyState)) { +const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { + if (macro_id == 0 && keyToggledOff(event.state)) { EEPROMKeymapProgrammer.activate(); } diff --git a/examples/Keystrokes/OneShot/OneShot.ino b/examples/Keystrokes/OneShot/OneShot.ino index 483d2c46..82ef7092 100644 --- a/examples/Keystrokes/OneShot/OneShot.ino +++ b/examples/Keystrokes/OneShot/OneShot.ino @@ -68,8 +68,8 @@ void macroToggleOneShot() { OneShot.toggleAutoOneShot(); } -const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { - if (macroIndex == TOGGLE_ONESHOT) { +const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { + if (macro_id == TOGGLE_ONESHOT) { macroToggleOneShot(); } diff --git a/examples/Keystrokes/Qukeys/Qukeys.ino b/examples/Keystrokes/Qukeys/Qukeys.ino index c2cad0d3..da74acdd 100644 --- a/examples/Keystrokes/Qukeys/Qukeys.ino +++ b/examples/Keystrokes/Qukeys/Qukeys.ino @@ -49,10 +49,10 @@ KEYMAPS( // *INDENT-ON* // Defining a macro (on the "any" key: see above) to toggle Qukeys on and off -const macro_t *macroAction(uint8_t macro_index, uint8_t key_state) { - switch (macro_index) { +const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { + switch (macro_id) { case MACRO_TOGGLE_QUKEYS: - if (keyToggledOn(key_state)) + if (keyToggledOn(event.state)) Qukeys.toggle(); break; } diff --git a/examples/Keystrokes/Unicode/Unicode.ino b/examples/Keystrokes/Unicode/Unicode.ino index a47aea6a..34c00e7c 100644 --- a/examples/Keystrokes/Unicode/Unicode.ino +++ b/examples/Keystrokes/Unicode/Unicode.ino @@ -52,10 +52,10 @@ static void unicode(uint32_t character, 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_KEYBOARD_EMOJI: - unicode(0x2328, keyState); + unicode(0x2328, event.state); break; } return MACRO_NONE; diff --git a/examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino b/examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino index 0f8e6615..f3ef2d7a 100644 --- a/examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino +++ b/examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino @@ -42,11 +42,11 @@ KEYMAPS( ) // *INDENT-ON* -const macro_t *macroAction(uint8_t macro_index, uint8_t key_state) { - if (!keyToggledOn(key_state)) +const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { + if (!keyToggledOn(event.state)) return MACRO_NONE; - if (macro_index == 0) { + if (macro_id == 0) { for (uint8_t i = Key_A.getKeyCode(); i <= Key_0.getKeyCode(); i++) { LEDControl.set_all_leds_to(0, 0, 0); LEDControl.syncLeds(); diff --git a/examples/LEDs/LED-Brightness/LED-Brightness.ino b/examples/LEDs/LED-Brightness/LED-Brightness.ino index 5f184150..194358c0 100644 --- a/examples/LEDs/LED-Brightness/LED-Brightness.ino +++ b/examples/LEDs/LED-Brightness/LED-Brightness.ino @@ -45,16 +45,16 @@ KALEIDOSCOPE_INIT_PLUGINS(LEDControl, Macros, LEDRainbowWaveEffect); -const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { - if (keyToggledOn(keyState)) { +const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { + if (keyToggledOn(event.state)) { uint8_t brightness = LEDControl.getBrightness(); - if (macroIndex == 0) { + if (macro_id == 0) { if (brightness > 10) brightness -= 10; else brightness = 0; - } else if (macroIndex == 1) { + } else if (macro_id == 1) { if (brightness < 245) brightness += 10; else