Compare commits
No commits in common. "fdf74434ce53cba7b85146a8cea59e1297a032e8" and "fc41b3509dd6dbea00e6553ddd86ad33b712016c" have entirely different histories.
fdf74434ce
...
fc41b3509d
44
keymap.ino
44
keymap.ino
|
@ -58,6 +58,7 @@
|
|||
*/
|
||||
|
||||
enum { MACRO_VERSION_INFO,
|
||||
MACRO_ANY
|
||||
};
|
||||
|
||||
|
||||
|
@ -127,7 +128,7 @@ KEYMAPS(
|
|||
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
|
||||
ShiftToLayer(FUNCTION),
|
||||
|
||||
___, Key_6, Key_7, Key_8, Key_9, Key_0, Key_Equals,
|
||||
M(MACRO_ANY), Key_6, Key_7, Key_8, Key_9, Key_0, Key_Equals,
|
||||
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Backslash,
|
||||
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
|
||||
Key_RightAlt, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
|
||||
|
@ -180,6 +181,27 @@ static void versionInfoMacro(uint8_t keyState) {
|
|||
}
|
||||
}
|
||||
|
||||
/** anyKeyMacro is used to provide the functionality of the 'Any' key.
|
||||
*
|
||||
* When the 'any key' macro is toggled on, a random alphanumeric key is
|
||||
* selected. While the key is held, the function generates a synthetic
|
||||
* keypress event repeating that randomly selected key.
|
||||
*
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (keyIsPressed(keyState))
|
||||
Kaleidoscope.hid().keyboard().pressKey(lastKey, toggledOn);
|
||||
}
|
||||
|
||||
|
||||
/** macroAction dispatches keymap events that are tied to a macro
|
||||
to that macro. It takes two uint8_t parameters.
|
||||
|
||||
|
@ -194,9 +216,14 @@ static void versionInfoMacro(uint8_t keyState) {
|
|||
|
||||
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
|
||||
switch (macroIndex) {
|
||||
|
||||
case MACRO_VERSION_INFO:
|
||||
versionInfoMacro(keyState);
|
||||
break;
|
||||
|
||||
case MACRO_ANY:
|
||||
anyKeyMacro(keyState);
|
||||
break;
|
||||
}
|
||||
return MACRO_NONE;
|
||||
}
|
||||
|
@ -226,6 +253,21 @@ void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::
|
|||
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,
|
||||
// Enter test mode
|
||||
COMBO_ENTER_TEST_MODE
|
||||
};
|
||||
|
||||
// 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.
|
||||
|
|
Loading…
Reference in a new issue