diff options
author | Brian Cully <bjc@kublai.com> | 2022-09-16 14:50:35 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2022-09-16 14:50:35 -0400 |
commit | a19ed5da7ee8d276b2570f62e19e70528f502efa (patch) | |
tree | aa773b7e0961eaf534b90e235145cb6f07eebb0b | |
parent | d5457762c53d753b16ef90951a8a229589b5ad2e (diff) | |
download | Model01-Firmware-master.tar.gz Model01-Firmware-master.zip |
-rw-r--r-- | Model01-Firmware.ino | 136 |
1 files changed, 91 insertions, 45 deletions
diff --git a/Model01-Firmware.ino b/Model01-Firmware.ino index 95282da..f22a713 100644 --- a/Model01-Firmware.ino +++ b/Model01-Firmware.ino @@ -24,6 +24,7 @@ #include <Kaleidoscope-LayerHighlighter.h> #include <Kaleidoscope-SpaceCadet.h> #include <Kaleidoscope-Heatmap.h> +#include <Kaleidoscope-Leader.h> enum { MACRO_VERSION_INFO, @@ -38,7 +39,7 @@ enum { GASM }; -enum { DVORAK, WORKMAN, QWERTY, FUNCTION, NUMPAD, EMOTES }; // layers +enum { ENGRAM, WORKMAN, DVORAK, QWERTY, FUNCTION, NUMPAD, MACROS }; typedef struct { uint8_t index; @@ -54,7 +55,7 @@ const char takeNRG[] PROGMEM = "TakeNRG"; const char seemsGood[] PROGMEM = "SeemsGood"; const char gasm[] PROGMEM = "kdubGasm"; -static const emote emotes[] = { +static const emote macros[] = { { WOW, wow }, { SAUCY, saucy }, { LUL, lul }, @@ -66,48 +67,94 @@ static const emote emotes[] = { { 255, NULL } }; -// *INDENT-OFF* +void leaderMacro(uint8_t i) { + // auto event = kaleidoscope::KeyEvent(KeyAddr::none(), IS_PRESSED, ShiftToLayer(MACROS)); + // OneShot.setPending(event); + Layer.activate(MACROS); +} -KEYMAPS( - [DVORAK] = KEYMAP_STACKED - (Key_Escape, Key_1, Key_2, Key_3, Key_4, Key_5, Key_ScrollLock, - Key_Backtick, Key_Quote, Key_Comma, Key_Period, Key_P, Key_Y, Key_Tab, - MoveToLayer(WORKMAN), Key_A, Key_O, Key_E, Key_U, Key_I, - Key_RightGui, Key_Semicolon, Key_Q, Key_J, Key_K, Key_X, Key_LeftGui, +void leaderNumpad(uint8_t i) { + Layer.activate(NUMPAD); +} + +void leaderWorkmanLayout(uint8_t i) { + Layer.move(WORKMAN); +} + +void leaderEngramLayout(uint8_t i) { + Layer.move(ENGRAM); +} + +void leaderDvorakLayout(uint8_t i) { + Layer.move(DVORAK); +} + +void leaderQwertyLayout(uint8_t i) { + Layer.move(QWERTY); +} + +constexpr kaleidoscope::plugin::Leader::dictionary_t leaderDictionary[] = + LEADER_DICT({LEADER_SEQ(LEAD(0), Key_M), leaderMacro}, + {LEADER_SEQ(LEAD(0), Key_N), leaderNumpad}, + {LEADER_SEQ(LEAD(0), Key_L, Key_1), leaderWorkmanLayout}, + {LEADER_SEQ(LEAD(0), Key_L, Key_2), leaderEngramLayout}, + {LEADER_SEQ(LEAD(0), Key_L, Key_3), leaderDvorakLayout}, + {LEADER_SEQ(LEAD(0), Key_L, Key_4), leaderQwertyLayout}); + +KEYMAPS([ENGRAM] = KEYMAP_STACKED + (Key_Escape, Key_1, Key_2, Key_3, Key_4, Key_5, XXX, + Key_Backtick, Key_B, Key_Y, Key_O, Key_U, Key_Quote, Key_Tab, + XXX, Key_C, Key_I, Key_E, Key_A, Key_Comma, + Key_RightGui, Key_G, Key_X, Key_J, Key_K, Key_Minus, Key_LeftGui, Key_LeftBracket, Key_Backspace, LSHIFT(Key_LeftBracket), LSHIFT(Key_9), ShiftToLayer(FUNCTION), - LockLayer(EMOTES), Key_6, Key_7, Key_8, Key_9, Key_0, LockLayer(NUMPAD), - Key_Enter, Key_F, Key_G, Key_C, Key_R, Key_L, Key_Slash, - Key_D, Key_H, Key_T, Key_N, Key_S, Key_Minus, - Key_PcApplication, Key_B, Key_M, Key_W, Key_V, Key_Z, Key_Equals, + XXX, Key_6, Key_7, Key_8, Key_9, Key_0, LEAD(0), + Key_Enter, Key_Semicolon, Key_L, Key_D, Key_W, Key_V, Key_Z, + Key_Period, Key_H, Key_T, Key_S, Key_N, Key_Q, + Key_PcApplication, Key_Slash, Key_R, Key_M, Key_F, Key_P, Key_Equals, LSHIFT(Key_0), LSHIFT(Key_RightBracket), Key_Spacebar, Key_RightBracket, ShiftToLayer(FUNCTION)), [WORKMAN] = KEYMAP_STACKED - (Key_Escape, Key_1, Key_2, Key_3, Key_4, Key_5, Key_ScrollLock, - Key_Backtick, Key_Q, Key_D, Key_R, Key_W, Key_B, Key_Tab, - MoveToLayer(DVORAK), Key_A, Key_S, Key_H, Key_T, Key_G, - Key_RightGui, Key_Z, Key_X, Key_M, Key_C, Key_V, Key_LeftGui, + (Key_Escape, Key_1, Key_2, Key_3, Key_4, Key_5, XXX, + Key_Backtick, Key_Q, Key_D, Key_R, Key_W, Key_B, Key_Tab, + XXX, Key_A, Key_S, Key_H, Key_T, Key_G, + Key_RightGui, Key_Z, Key_X, Key_M, Key_C, Key_V, Key_LeftGui, Key_LeftBracket, Key_Backspace, LSHIFT(Key_LeftBracket), LSHIFT(Key_9), ShiftToLayer(FUNCTION), - LockLayer(EMOTES), Key_6, Key_7, Key_8, Key_9, Key_0, LockLayer(NUMPAD), - Key_Enter, Key_J, Key_F, Key_U, Key_P, Key_Semicolon, Key_Slash, + XXX, Key_6, Key_7, Key_8, Key_9, Key_0, LEAD(0), + Key_Enter, Key_J, Key_F, Key_U, Key_P, Key_Semicolon, Key_Minus, Key_Y, Key_N, Key_E, Key_O, Key_I, Key_Quote, Key_PcApplication, Key_K, Key_L, Key_Comma, Key_Period, Key_Slash, Key_Equals, LSHIFT(Key_0), LSHIFT(Key_RightBracket), Key_Spacebar, Key_RightBracket, ShiftToLayer(FUNCTION)), + [DVORAK] = KEYMAP_STACKED + (Key_Escape, Key_1, Key_2, Key_3, Key_4, Key_5, XXX, + Key_Backtick, Key_Quote, Key_Comma, Key_Period, Key_P, Key_Y, Key_Tab, + XXX, Key_A, Key_O, Key_E, Key_U, Key_I, + Key_RightGui, Key_Semicolon, Key_Q, Key_J, Key_K, Key_X, Key_LeftGui, + Key_LeftBracket, Key_Backspace, LSHIFT(Key_LeftBracket), LSHIFT(Key_9), + ShiftToLayer(FUNCTION), + + XXX, Key_6, Key_7, Key_8, Key_9, Key_0, LEAD(0), + Key_Enter, Key_F, Key_G, Key_C, Key_R, Key_L, Key_Slash, + Key_D, Key_H, Key_T, Key_N, Key_S, Key_Minus, + Key_PcApplication, Key_B, Key_M, Key_W, Key_V, Key_Z, Key_Equals, + LSHIFT(Key_0), LSHIFT(Key_RightBracket), Key_Spacebar, Key_RightBracket, + ShiftToLayer(FUNCTION)), + [QWERTY] = KEYMAP_STACKED - (Key_Escape, Key_1, Key_2, Key_3, Key_4, Key_5, Key_ScrollLock, - Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab, - MoveToLayer(DVORAK), Key_A, Key_S, Key_D, Key_F, Key_G, - Key_RightGui, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_LeftGui, + (Key_Escape, Key_1, Key_2, Key_3, Key_4, Key_5, XXX, + Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab, + XXX, Key_A, Key_S, Key_D, Key_F, Key_G, + Key_RightGui, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_LeftGui, Key_LeftBracket, Key_Backspace, LSHIFT(Key_LeftBracket), LSHIFT(Key_9), ShiftToLayer(FUNCTION), - LockLayer(EMOTES), Key_6, Key_7, Key_8, Key_9, Key_0, LockLayer(NUMPAD), + XXX, Key_6, Key_7, Key_8, Key_9, Key_0, LEAD(0), Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote, Key_PcApplication, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus, @@ -116,16 +163,16 @@ KEYMAPS( [FUNCTION] = KEYMAP_STACKED (Key_LEDEffectNext, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, LCTRL(Key_ScrollLock), - ___, ___, Key_PageUp, Key_UpArrow, Key_PageDown, Key_Home, Key_CapsLock, - Key_Copy, ___, Key_LeftArrow, Key_DownArrow, Key_RightArrow, Key_End, + ___, ___, ___, ___, ___, ___, Key_CapsLock, + Key_Copy, ___, ___, ___, ___, ___, Key_Paste, Key_PrintScreen, Key_Insert, Consumer_ScanPreviousTrack, Consumer_ScanNextTrack, Consumer_PlaySlashPause, ___, ___, Key_Delete, ___, ___, ___, - Key_CapsLock, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_F11, - ___, Key_Home, Key_PageUp, Key_UpArrow, Key_PageDown, ___, Key_F12, - Key_End, Key_LeftArrow, Key_DownArrow, Key_RightArrow, ___, ___, - ___, Consumer_Mute, Consumer_VolumeDecrement, Consumer_VolumeIncrement, ___, Key_Backslash, Key_Pipe, + Key_CapsLock, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_F11, + ___, Key_PageUp, LCTRL(Key_LeftArrow), Key_UpArrow, LCTRL(Key_RightArrow), Key_End, Key_F12, + Key_PageDown, Key_LeftArrow, Key_DownArrow, Key_RightArrow, Key_Home, ___, + ___, Consumer_Mute, Consumer_VolumeDecrement, Consumer_VolumeIncrement, ___, Key_Backslash, Key_Pipe, ___, ___, ___, ___, ___), @@ -137,14 +184,14 @@ KEYMAPS( ___, ___, ___, ___, ___, - M(MACRO_VERSION_INFO), ___, Key_7, Key_8, Key_9, Key_KeypadSubtract, ___, - ___, ___, Key_4, Key_5, Key_6, Key_KeypadAdd, ___, - ___, Key_1, Key_2, Key_3, Key_Equals, ___, - ___, ___, Key_0, Key_Period, Key_KeypadMultiply, Key_KeypadDivide, Key_Enter, + ___, ___, Key_7, Key_8, Key_9, Key_KeypadSubtract, UnlockLayer(NUMPAD), + ___, ___, Key_4, Key_5, Key_6, Key_KeypadAdd, ___, + ___, Key_1, Key_2, Key_3, Key_Equals, ___, + ___, ___, Key_0, Key_Period, Key_KeypadMultiply, Key_KeypadDivide, Key_Enter, ___, ___, ___, ___, ___), - [EMOTES] = KEYMAP_STACKED + [MACROS] = KEYMAP_STACKED (___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, M(SEEMS_GOOD), @@ -152,16 +199,14 @@ KEYMAPS( ___, ___, ___, ___, ___, - ___, ___, ___, ___, ___, ___, ___, - ___, ___, ___, ___, ___, M(WOW), ___, - ___, ___, ___, M(LUL), M(SAUCY), ___, - ___, ___, ___, M(GIVE_PLZ), M(TAKE_NRG), ___, ___, + M(MACRO_VERSION_INFO), ___, ___, ___, ___, ___, UnlockLayer(MACROS), + ___, ___, ___, ___, ___, M(WOW), ___, + ___, ___, ___, M(LUL), M(SAUCY), ___, + ___, ___, ___, M(GIVE_PLZ), M(TAKE_NRG), ___, ___, ___, ___, ___, ___, ___) ) -// *INDENT-ON* - /** versionInfoMacro handles the 'firmware version info' macro * When a key bound to the macro is pressed, this macro * prints out the firmware build information as virtual keystrokes @@ -191,9 +236,9 @@ static void anyKeyMacro(KeyEvent &event) { static void emoteMacro(uint8_t macroID, KeyEvent &event) { if (keyToggledOn(event.state)) { - for (int i = 0; emotes[i].index != 255; i++) { - if (emotes[i].index == macroID) { - Macros.type(emotes[i].string); + for (int i = 0; macros[i].index != 255; i++) { + if (macros[i].index == macroID) { + Macros.type(macros[i].string); return; } } @@ -295,7 +340,7 @@ USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol, // Left Fn + Prog + LED .keys = { R3C6, R0C0, R0C6 }}); -static kaleidoscope::plugin::LayerHighlighter emoteHighlighter(EMOTES); +static kaleidoscope::plugin::LayerHighlighter emoteHighlighter(MACROS); // First, tell Kaleidoscope which plugins you want to use. // The order can be important. For example, LED effects are @@ -304,6 +349,7 @@ KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, //HostOS, Unicode, Qukeys, + Leader, //SpaceCadet, //MacrosOnTheFly, //Syster, |