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,9 +75,10 @@ KEYMAPS(
KALEIDOSCOPE_INIT_PLUGINS(Macros); KALEIDOSCOPE_INIT_PLUGINS(Macros);
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
switch (macroIndex) { switch (macro_id) {
case RESET: case RESET:
if (keyToggledOn(event.state))
Kaleidoscope.rebootBootloader(); Kaleidoscope.rebootBootloader();
break; break;
default: default:

@ -113,8 +113,9 @@ KALEIDOSCOPE_INIT_PLUGINS(
MouseKeys MouseKeys
); );
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
switch (macroIndex) { if (keyToggledOn(event.state)) {
switch (macro_id) {
case MACRO_QWERTY: case MACRO_QWERTY:
// This macro is currently unused, but is kept around for compatibility // This macro is currently unused, but is kept around for compatibility
// reasons. We used to use it in place of `MoveToLayer(QWERTY)`, but no // reasons. We used to use it in place of `MoveToLayer(QWERTY)`, but no
@ -123,15 +124,13 @@ const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
Layer.move(QWERTY); Layer.move(QWERTY);
break; break;
case MACRO_VERSION_INFO: case MACRO_VERSION_INFO:
if (keyToggledOn(keyState)) {
Macros.type(PSTR("Keyboardio Atreus - Kaleidoscope ")); Macros.type(PSTR("Keyboardio Atreus - Kaleidoscope "));
Macros.type(PSTR(BUILD_INFORMATION)); Macros.type(PSTR(BUILD_INFORMATION));
}
break; break;
default: default:
break; break;
} }
}
return MACRO_NONE; 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 solidIndigo(0, 0, 100);
static kaleidoscope::plugin::LEDSolidColor solidViolet(70, 0, 60); static kaleidoscope::plugin::LEDSolidColor solidViolet(70, 0, 60);
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (macroIndex == 1 && keyToggledOn(keyState)) { if (macro_id == 1 && keyToggledOn(event.state)) {
Kaleidoscope.serialPort().print("Keyboard.IO keyboard driver v0.00"); Kaleidoscope.serialPort().print("Keyboard.IO keyboard driver v0.00");
return MACRO(I(25), return MACRO(I(25),
D(LeftShift), T(M), U(LeftShift), T(O), T(D), T(E), T(L), D(LeftShift), T(M), U(LeftShift), T(O), T(D), T(E), T(L),

@ -82,9 +82,10 @@ KEYMAPS(
KALEIDOSCOPE_INIT_PLUGINS(Macros); KALEIDOSCOPE_INIT_PLUGINS(Macros);
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
switch (macroIndex) { switch (macro_id) {
case QWERTY: case QWERTY:
if (keyToggledOn(event.state))
Layer.move(QWERTY); Layer.move(QWERTY);
break; break;
default: default:

@ -42,8 +42,8 @@ KEYMAPS(
) )
// *INDENT-ON* // *INDENT-ON*
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (macroIndex == 0 && keyToggledOff(keyState)) { if (macro_id == 0 && keyToggledOff(event.state)) {
EEPROMKeymapProgrammer.activate(); EEPROMKeymapProgrammer.activate();
} }

@ -68,8 +68,8 @@ void macroToggleOneShot() {
OneShot.toggleAutoOneShot(); OneShot.toggleAutoOneShot();
} }
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (macroIndex == TOGGLE_ONESHOT) { if (macro_id == TOGGLE_ONESHOT) {
macroToggleOneShot(); macroToggleOneShot();
} }

@ -49,10 +49,10 @@ KEYMAPS(
// *INDENT-ON* // *INDENT-ON*
// Defining a macro (on the "any" key: see above) to toggle Qukeys on and off // 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) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
switch (macro_index) { switch (macro_id) {
case MACRO_TOGGLE_QUKEYS: case MACRO_TOGGLE_QUKEYS:
if (keyToggledOn(key_state)) if (keyToggledOn(event.state))
Qukeys.toggle(); Qukeys.toggle();
break; break;
} }

@ -52,10 +52,10 @@ static void unicode(uint32_t character, uint8_t keyState) {
} }
} }
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
switch (macroIndex) { switch (macro_id) {
case MACRO_KEYBOARD_EMOJI: case MACRO_KEYBOARD_EMOJI:
unicode(0x2328, keyState); unicode(0x2328, event.state);
break; break;
} }
return MACRO_NONE; return MACRO_NONE;

@ -42,11 +42,11 @@ KEYMAPS(
) )
// *INDENT-ON* // *INDENT-ON*
const macro_t *macroAction(uint8_t macro_index, uint8_t key_state) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (!keyToggledOn(key_state)) if (!keyToggledOn(event.state))
return MACRO_NONE; return MACRO_NONE;
if (macro_index == 0) { if (macro_id == 0) {
for (uint8_t i = Key_A.getKeyCode(); i <= Key_0.getKeyCode(); i++) { for (uint8_t i = Key_A.getKeyCode(); i <= Key_0.getKeyCode(); i++) {
LEDControl.set_all_leds_to(0, 0, 0); LEDControl.set_all_leds_to(0, 0, 0);
LEDControl.syncLeds(); LEDControl.syncLeds();

@ -45,16 +45,16 @@ KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
Macros, Macros,
LEDRainbowWaveEffect); LEDRainbowWaveEffect);
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (keyToggledOn(keyState)) { if (keyToggledOn(event.state)) {
uint8_t brightness = LEDControl.getBrightness(); uint8_t brightness = LEDControl.getBrightness();
if (macroIndex == 0) { if (macro_id == 0) {
if (brightness > 10) if (brightness > 10)
brightness -= 10; brightness -= 10;
else else
brightness = 0; brightness = 0;
} else if (macroIndex == 1) { } else if (macro_id == 1) {
if (brightness < 245) if (brightness < 245)
brightness += 10; brightness += 10;
else else

Loading…
Cancel
Save