Merge pull request #55 from keyboardio/f/usb-quirks
Add a way to toggle between Boot and NKRO mode manually
This commit is contained in:
commit
11676727a1
@ -59,6 +59,11 @@
|
|||||||
// Support for host power management (suspend & wakeup)
|
// Support for host power management (suspend & wakeup)
|
||||||
#include "Kaleidoscope-HostPowerManagement.h"
|
#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
|
/** 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
|
* The names aren't particularly important. What is important is that each
|
||||||
@ -279,6 +284,35 @@ void hostPowerManagementEventHandler(kaleidoscope::HostPowerManagement::Event ev
|
|||||||
toggleLedsOnSuspendResume(event);
|
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.
|
// First, tell Kaleidoscope which plugins you want to use.
|
||||||
// The order can be important. For example, LED effects are
|
// The order can be important. For example, LED effects are
|
||||||
// added in the order they're listed here.
|
// 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
|
// The HostPowerManagement plugin allows us to turn LEDs off when then host
|
||||||
// goes to sleep, and resume them when it wakes up.
|
// 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.
|
/** The 'setup' function is one of the two standard Arduino sketch functions.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user