Compare commits
2 commits
fc41b3509d
...
fdf74434ce
Author | SHA1 | Date | |
---|---|---|---|
Antoine Martin | fdf74434ce | ||
Antoine Martin | 9f558785f5 |
44
keymap.ino
44
keymap.ino
|
@ -58,7 +58,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum { MACRO_VERSION_INFO,
|
enum { MACRO_VERSION_INFO,
|
||||||
MACRO_ANY
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,7 +127,7 @@ KEYMAPS(
|
||||||
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
|
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
|
||||||
ShiftToLayer(FUNCTION),
|
ShiftToLayer(FUNCTION),
|
||||||
|
|
||||||
M(MACRO_ANY), Key_6, Key_7, Key_8, Key_9, Key_0, Key_Equals,
|
___, 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_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_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,
|
Key_RightAlt, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
|
||||||
|
@ -181,27 +180,6 @@ 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
|
/** macroAction dispatches keymap events that are tied to a macro
|
||||||
to that macro. It takes two uint8_t parameters.
|
to that macro. It takes two uint8_t parameters.
|
||||||
|
|
||||||
|
@ -216,14 +194,9 @@ static void anyKeyMacro(uint8_t keyState) {
|
||||||
|
|
||||||
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
|
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
|
||||||
switch (macroIndex) {
|
switch (macroIndex) {
|
||||||
|
|
||||||
case MACRO_VERSION_INFO:
|
case MACRO_VERSION_INFO:
|
||||||
versionInfoMacro(keyState);
|
versionInfoMacro(keyState);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MACRO_ANY:
|
|
||||||
anyKeyMacro(keyState);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return MACRO_NONE;
|
return MACRO_NONE;
|
||||||
}
|
}
|
||||||
|
@ -253,21 +226,6 @@ void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::
|
||||||
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,
|
|
||||||
// Enter test mode
|
|
||||||
COMBO_ENTER_TEST_MODE
|
|
||||||
};
|
|
||||||
|
|
||||||
// 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.
|
||||||
|
|
Loading…
Reference in a new issue