Remove sample random key macro

This commit is contained in:
Antoine Martin 2022-04-06 14:29:58 +02:00
parent 9f558785f5
commit fdf74434ce

View file

@ -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;
} }