summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGergely Nagy <algernon@users.noreply.github.com>2021-05-29 00:15:58 +0200
committerGitHub <noreply@github.com>2021-05-29 00:15:58 +0200
commiteca361d6d03252e66a9659ab259cc4428850d6e8 (patch)
treec556d7e775792c41c16dc3e21ac524085d6948da
parentf4ff736e4761e58992071418dc585cefc6e2f1e8 (diff)
parentc701cd6c25d6428b83b21a120897ef334116c4de (diff)
downloadmodel01-firmware-eca361d6d03252e66a9659ab259cc4428850d6e8.tar.gz
model01-firmware-eca361d6d03252e66a9659ab259cc4428850d6e8.tar.bz2
model01-firmware-eca361d6d03252e66a9659ab259cc4428850d6e8.zip
Merge pull request #108 from gedankenexperimenter/key-event-handlers
Update for `KeyEvent` changes
-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;