summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Vincent <jesse@keyboard.io>2019-03-07 18:58:02 -0800
committerJesse Vincent <jesse@keyboard.io>2019-07-29 20:39:47 -0700
commit4299824b114a001fd74ae790669ff0d39563d62d (patch)
treef906524c86691acd27c7c0686c400f50d98b40da
parent36e7028be8dbe5c977a137d0cb0fab0163013a7d (diff)
downloadmodel01-firmware-4299824b114a001fd74ae790669ff0d39563d62d.tar.gz
model01-firmware-4299824b114a001fd74ae790669ff0d39563d62d.tar.bz2
model01-firmware-4299824b114a001fd74ae790669ff0d39563d62d.zip
A full implementation of the new HardwareTestMode.
Signed-off-by: Jesse Vincent <jesse@keyboard.io>
-rw-r--r--Model01-Firmware.ino40
1 files changed, 36 insertions, 4 deletions
diff --git a/Model01-Firmware.ino b/Model01-Firmware.ino
index 17c99e9..f30171d 100644
--- a/Model01-Firmware.ino
+++ b/Model01-Firmware.ino
@@ -64,7 +64,7 @@
#include "Kaleidoscope-Colormap.h"
// Support for Keyboardio's internal keyboard testing mode
-#include "Kaleidoscope-Model01-TestMode.h"
+#include "Kaleidoscope-HardwareTestMode.h"
// Support for host power management (suspend & wakeup)
#include "Kaleidoscope-HostPowerManagement.h"
@@ -382,7 +382,24 @@ void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::
toggleLedsOnSuspendResume(event);
}
-/** A tiny wrapper, to be used by MagicCombo.
+/** 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,
+ // Enter test mode
+ COMBO_ENTER_TEST_MODE
+};
+
+/** Wrappers, 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.
*/
@@ -390,13 +407,25 @@ static void toggleKeyboardProtocol(uint8_t combo_index) {
USBQuirks.toggleKeyboardProtocol();
}
+/**
+ * This enters the hardware test mode
+ */
+static void enterHardwareTestMode(uint8_t combo_index) {
+ HardwareTestMode.runTests();
+}
+
+
/** 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 }
- });
+}, {
+ .action = enterHardwareTestMode,
+ // Left Fn + Prog + LED
+ .keys = { R3C6, R0C0, R0C6 }
+});
// First, tell Kaleidoscope which plugins you want to use.
// The order can be important. For example, LED effects are
@@ -426,7 +455,7 @@ KALEIDOSCOPE_INIT_PLUGINS(
// The hardware test mode, which can be invoked by tapping Prog, LED and the
// left Fn button at the same time.
- TestMode,
+ HardwareTestMode,
// LEDControl provides support for other LED modes
LEDControl,
@@ -512,6 +541,9 @@ void setup() {
LEDRainbowEffect.brightness(150);
LEDRainbowWaveEffect.brightness(150);
+ // Set the action key the test mode should listen for to Left Fn
+ HardwareTestMode.setActionKey(R3C6);
+
// The LED Stalker mode has a few effects. The one we like is called
// 'BlazingTrail'. For details on other options, see
// https://github.com/keyboardio/Kaleidoscope/blob/master/doc/plugin/LED-Stalker.md