1
0

A full implementation of the new HardwareTestMode.

Signed-off-by: Jesse Vincent <jesse@keyboard.io>
This commit is contained in:
Jesse Vincent 2019-03-07 18:58:02 -08:00
parent 36e7028be8
commit 4299824b11

View File

@ -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,12 +407,24 @@ 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.
@ -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