summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Richters <gedankenexperimenter@gmail.com>2021-04-26 09:16:08 -0500
committerMichael Richters <gedankenexperimenter@gmail.com>2021-04-27 09:17:35 -0500
commitc701cd6c25d6428b83b21a120897ef334116c4de (patch)
treec556d7e775792c41c16dc3e21ac524085d6948da
parentf4ff736e4761e58992071418dc585cefc6e2f1e8 (diff)
downloadmodel01-firmware-c701cd6c25d6428b83b21a120897ef334116c4de.tar.gz
model01-firmware-c701cd6c25d6428b83b21a120897ef334116c4de.tar.bz2
model01-firmware-c701cd6c25d6428b83b21a120897ef334116c4de.zip
Update for KeyEvent changes
This updates the default sketch's Macros code to match the changes in PR 1024, using the new version of `macroAction()` that takes a `KeyEvent` reference parameter instead of a key state bitfield. Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
-rw-r--r--Model01-Firmware.ino25
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;