summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Model01-Firmware.ino47
1 files changed, 46 insertions, 1 deletions
diff --git a/Model01-Firmware.ino b/Model01-Firmware.ino
index eeef307..bc45ee3 100644
--- a/Model01-Firmware.ino
+++ b/Model01-Firmware.ino
@@ -59,6 +59,11 @@
// Support for host power management (suspend & wakeup)
#include "Kaleidoscope-HostPowerManagement.h"
+// Support for magic combos (key chrods that trigger an action)
+#include "Kaleidoscope-MagicCombo.h"
+
+// Support for USB quirks, like changing the key state report protocol
+#include "Kaleidoscope-USB-Quirks.h"
/** This 'enum' is a list of all the macros used by the Model 01's firmware
* The names aren't particularly important. What is important is that each
@@ -279,6 +284,35 @@ void hostPowerManagementEventHandler(kaleidoscope::HostPowerManagement::Event ev
toggleLedsOnSuspendResume(event);
}
+/** This 'enum' is a list of all the magic combos used by the Model 01's
+ * firmware The names aren't particularly important. What is important is that
+ * each is unique.
+ *
+ * These are the names of your magic combos. They will be used by the
+ * `USE_MAGIC_COMBOS` call below.
+ */
+enum {
+ // Toggle between Boot (6-key rollover; for BIOSes and early boot) and NKRO
+ // mode.
+ COMBO_TOGGLE_NKRO_MODE
+};
+
+/** A tiny wrapper, to be used by MagicCombo.
+ * This simply toggles the keyboard protocol via USBQuirks, and wraps it within
+ * a function with an unused argument, to match what MagicCombo expects.
+ */
+static void toggleKeyboardProtocol(uint8_t combo_index) {
+ USBQuirks.toggleKeyboardProtocol();
+}
+
+/** Magic combo list, a list of key combo and action pairs the firmware should
+ * recognise.
+ */
+USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol,
+ // Left Fn + Esc + Shift
+ .keys = { R3C6, R2C6, R3C7 }
+ });
+
// First, tell Kaleidoscope which plugins you want to use.
// The order can be important. For example, LED effects are
// added in the order they're listed here.
@@ -332,7 +366,18 @@ KALEIDOSCOPE_INIT_PLUGINS(
// The HostPowerManagement plugin allows us to turn LEDs off when then host
// goes to sleep, and resume them when it wakes up.
- HostPowerManagement
+ HostPowerManagement,
+
+ // The MagicCombo plugin lets you use key combinations to trigger custom
+ // actions - a bit like Macros, but triggered by pressing multiple keys at the
+ // same time.
+ MagicCombo,
+
+ // The USBQuirks plugin lets you do some things with USB that we aren't
+ // comfortable - or able - to do automatically, but can be useful
+ // nevertheless. Such as toggling the key report protocol between Boot (used
+ // by BIOSes) and Report (NKRO).
+ USBQuirks
);
/** The 'setup' function is one of the two standard Arduino sketch functions.