Update example sketches' `macroAction()` functions to KeyEvent

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1024/head
Michael Richters 4 years ago
parent c81fd4a584
commit 0a5fff5005
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -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;

@ -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;
}

@ -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),

@ -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;

@ -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();
}

@ -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();
}

@ -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;
}

@ -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;

@ -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();

@ -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

Loading…
Cancel
Save