diff options
| author | Louis Orleans <louis@orleans.io> | 2019-10-04 20:32:52 -0700 |
|---|---|---|
| committer | noroadsleft <18669334+noroadsleft@users.noreply.github.com> | 2019-10-04 20:32:52 -0700 |
| commit | c5ffd182c8daeaa0b50c45f4f959b5615ae2a6e6 (patch) | |
| tree | 3ddc7c6341e935caa5068891d918395c94b55a6a /keyboards/ergodox_infinity | |
| parent | 93bce832555f0f34b2b9a681a7d5d0dbe4462a26 (diff) | |
| download | qmk_firmware-c5ffd182c8daeaa0b50c45f4f959b5615ae2a6e6.tar.gz qmk_firmware-c5ffd182c8daeaa0b50c45f4f959b5615ae2a6e6.zip | |
[Keymap] update my keymap for Infinity Ergodox (#6864)
* 🎉 Building simple flasher
* 🎉 Flashing works
* 🎨 Cleaning up
* 🐛 Being more specific with board identity
* 🐛 Flashing correct keymap
* 🎉 Adding keymap
* ✨ Updating keymap
* 🚨 RGB
* ⏪ Revert "🚨 RGB"
This reverts commit 9ceabfb267f8daedaad929231229c703abc12ec4.
* ✨ Improvements to flasher
* ✨ Layout tweaks
* 💄 Messing around with LCD
* 💄 Enabling LCD backlight matching
* 🔧 Updating layout
* 🐛 Fixing console logging
* 🎨 Cleaning up indentation
* 🔧 Adding editorconfig
* ✨ Adding game layer
* 💄 Changing numpad layout
* ✨🔥 redoing entire layout
It's now more similar to the Planck default layout
* ✨ add workman and dvorak layouts
* 🐛 fix numpad
* 🐛 fix layer orders
* 🐛 fix layer toggling
* 🐛 fix tri-layer switching
* 🐛 fix LCD colors for adjustment layers
* 🔥 remove old flasher project
* 🔥 remove simple_visualizer
* 💄 update LCD colors
* 📝 fix layout comments
* 💄 swapping 2u buttons
* 🔥🔧 removing editorconfig
* 🚨 using 2 spaces
* 📝 add README
* ⏪ Revert "💄 Enabling LCD backlight matching"
This reverts commit 51577903dfdc9fea5d33e9ab8cfa9b854e7ae19e.
* ⏪ Revert "💄 Messing around with LCD"
This reverts commit fdd9acdae514a3e0e4a7153225053680744980e5.
* 🐛 fix thumb inconsistency in QWERTY
* 🐛 fix media keys
* ✨ add F# shortcuts to vertical 1.5u buttons
* ✨ hold enter for RShift
* ✨ hold for numpad
* 🎨 remove unnecessary breaks
* 🎨 reoganizing layers
* ✨ add Colmak layer
* 🚧🔧 add basic config
* ✨ use more standard numpad layout
* 💄 change layer orders
* ✨ add caps lock on adjust layer
* 🔥 disable space cadet
* 📝 update README
* 🔨 use userspace config
* 🎨 clean up a bit
* 🐛 undefine tapping toggle from base config
* 🔨 rename LED functions
* 💩 someone commited Windows line endings
* ✨ left hand thumb is space
* ♻️ extract layers def to new file
* 🔥 remove unnecessary hooks
* ✨💄 set LCD text and color by layer
* 💄 update keymap
removing layer buttons that I don't really use
* ✨ set backlight to full brightness on boot
* 🔥 remove unnecessary includes
Diffstat (limited to 'keyboards/ergodox_infinity')
4 files changed, 263 insertions, 432 deletions
diff --git a/keyboards/ergodox_infinity/keymaps/dudeofawesome/keymap.c b/keyboards/ergodox_infinity/keymaps/dudeofawesome/keymap.c index cf0b452bd..26de392f9 100644 --- a/keyboards/ergodox_infinity/keymaps/dudeofawesome/keymap.c +++ b/keyboards/ergodox_infinity/keymaps/dudeofawesome/keymap.c | |||
| @@ -1,20 +1,6 @@ | |||
| 1 | #include QMK_KEYBOARD_H | 1 | #include QMK_KEYBOARD_H |
| 2 | #include "debug.h" | ||
| 3 | #include "action_layer.h" | ||
| 4 | #include "version.h" | 2 | #include "version.h" |
| 5 | 3 | #include "layers.h" | |
| 6 | enum custom_layers { | ||
| 7 | _QWERTY, | ||
| 8 | _WORKMAN, | ||
| 9 | _DVORAK, | ||
| 10 | _COLEMAK, | ||
| 11 | _LOWER, | ||
| 12 | _RAISE, | ||
| 13 | _ADJUST, | ||
| 14 | _GAME, | ||
| 15 | _MOUSE, | ||
| 16 | _NUM, | ||
| 17 | }; | ||
| 18 | 4 | ||
| 19 | enum custom_keycodes { | 5 | enum custom_keycodes { |
| 20 | QWERTY = SAFE_RANGE, | 6 | QWERTY = SAFE_RANGE, |
| @@ -39,41 +25,41 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 39 | * | Tab | Q | W | E | R | T | [{ | | ]} | Y | U | I | O | P | BSPC | | 25 | * | Tab | Q | W | E | R | T | [{ | | ]} | Y | U | I | O | P | BSPC | |
| 40 | * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------| | 26 | * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------| |
| 41 | * | ESC | A | S | D | F | G |------| |------| H | J | K | L | ; | ' | | 27 | * | ESC | A | S | D | F | G |------| |------| H | J | K | L | ; | ' | |
| 42 | * |--------+-----+-----+-----+-----+-----| L1 | | L1 |-----+-----+-----+-----+-----+--------| | 28 | * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------| |
| 43 | * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | Enter | | 29 | * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | Enter | |
| 44 | * `--------+-----+-----+-----+-----+------------' `------------+-----+-----+-----+-----+--------' | 30 | * `--------+-----+-----+-----+-----+------------' `------------+-----+-----+-----+-----+--------' |
| 45 | * | Num |Ctrl | Alt |LGUI |Lower| |Raise|Left |Down | Up |Right | | 31 | * | Num |Ctrl | Alt |LGUI |Lower| |Raise|Left |Down | Up |Right | |
| 46 | * `------------------------------' `------------------------------' | 32 | * `------------------------------' `------------------------------' |
| 47 | * ,------------. ,------------. | 33 | * ,------------. ,------------. |
| 48 | * |Play |Mouse | | Num |Mouse| | 34 | * |Play | | | |Play | |
| 49 | * ,----|-----|------| |------+-----+-----. | 35 | * ,-----|-----|------| |------+-----+-----. |
| 50 | * | | | Alt | | Alt | | | | 36 | * | | | Alt | | Alt | | | |
| 51 | * |BSPC|LOWER|------| |------|RAISE|Space| | 37 | * |Space|LOWER|------| |------|RAISE|Space| |
| 52 | * | | | LGUI | | LGUI | | | | 38 | * | | | LGUI | | LGUI | | | |
| 53 | * `-----------------' `------------------' | 39 | * `------------------' `------------------' |
| 54 | */ | 40 | */ |
| 55 | [_QWERTY] = LAYOUT_ergodox( | 41 | [_QWERTY] = LAYOUT_ergodox( |
| 56 | // left hand | 42 | // left hand |
| 57 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, | 43 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, |
| 58 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRACKET, | 44 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRACKET, |
| 59 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, | 45 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, |
| 60 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_FN1, | 46 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, _______, |
| 61 | TT(_NUM), KC_LCTL, KC_LALT, KC_LGUI, LOWER, | 47 | TT(_NUM), KC_LCTL, KC_LALT, KC_LGUI, LOWER, |
| 62 | 48 | ||
| 63 | KC_MPLY, TG(_MOUSE), | 49 | KC_MPLY, _______, |
| 64 | KC_LALT, | 50 | KC_LALT, |
| 65 | KC_BSPACE, LOWER, KC_LGUI, | 51 | KC_SPACE, LOWER, KC_LGUI, |
| 66 | 52 | ||
| 67 | // right hand | 53 | // right hand |
| 68 | KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, | 54 | KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, |
| 69 | KC_RBRACKET, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPACE, | 55 | KC_RBRACKET, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPACE, |
| 70 | KC_H, KC_J, KC_K, KC_L, KC_SCOLON, KC_QUOTE, | 56 | KC_H, KC_J, KC_K, KC_L, KC_SCOLON, KC_QUOTE, |
| 71 | KC_FN1, KC_N, KC_M, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), RSFT_T(KC_ENT), | 57 | _______, KC_N, KC_M, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), RSFT_T(KC_ENT), |
| 72 | RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, | 58 | RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, |
| 73 | 59 | ||
| 74 | TT(_NUM), TG(_MOUSE), | 60 | _______, KC_MPLY, |
| 75 | KC_LALT, | 61 | KC_LALT, |
| 76 | KC_LGUI, RAISE, KC_SPACE | 62 | KC_LGUI, RAISE, KC_SPACE |
| 77 | ), | 63 | ), |
| 78 | 64 | ||
| 79 | /* Keymap 0: Basic Workman layer | 65 | /* Keymap 0: Basic Workman layer |
| @@ -84,41 +70,41 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 84 | * | Tab | Q | D | R | W | B | [{ | | ]} | J | F | U | P | ; | BSPC | | 70 | * | Tab | Q | D | R | W | B | [{ | | ]} | J | F | U | P | ; | BSPC | |
| 85 | * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------| | 71 | * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------| |
| 86 | * | ESC | A | S | H | T | G |------| |------| Y | N | E | O | I | ' | | 72 | * | ESC | A | S | H | T | G |------| |------| Y | N | E | O | I | ' | |
| 87 | * |--------+-----+-----+-----+-----+-----| L1 | | L1 |-----+-----+-----+-----+-----+--------| | 73 | * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------| |
| 88 | * | LShift | Z | X | M | C | V | | | | K | L | , | . | / | Enter | | 74 | * | LShift | Z | X | M | C | V | | | | K | L | , | . | / | Enter | |
| 89 | * `--------+-----+-----+-----+-----+------------' `------------+-----+-----+-----+-----+--------' | 75 | * `--------+-----+-----+-----+-----+------------' `------------+-----+-----+-----+-----+--------' |
| 90 | * | Num |Ctrl | Alt |LGUI |Lower| |Raise|Left |Down | Up |Right | | 76 | * | Num |Ctrl | Alt |LGUI |Lower| |Raise|Left |Down | Up |Right | |
| 91 | * `------------------------------' `------------------------------' | 77 | * `------------------------------' `------------------------------' |
| 92 | * ,------------. ,------------. | 78 | * ,------------. ,------------. |
| 93 | * |Play |Mouse | | Num |Mouse| | 79 | * |Play | | | |Play | |
| 94 | * ,----|-----|------| |------+-----+-----. | 80 | * ,-----|-----|------| |------+-----+-----. |
| 95 | * | | | Alt | | Alt | | | | 81 | * | | | Alt | | Alt | | | |
| 96 | * |BSPC|LOWER|------| |------|RAISE|Space| | 82 | * |Space|LOWER|------| |------|RAISE|Space| |
| 97 | * | | | LGUI | | LGUI | | | | 83 | * | | | LGUI | | LGUI | | | |
| 98 | * `-----------------' `------------------' | 84 | * `------------------' `------------------' |
| 99 | */ | 85 | */ |
| 100 | [_WORKMAN] = LAYOUT_ergodox( | 86 | [_WORKMAN] = LAYOUT_ergodox( |
| 101 | // left hand | 87 | // left hand |
| 102 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, | 88 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, |
| 103 | KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_LBRACKET, | 89 | KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_LBRACKET, |
| 104 | KC_ESC, KC_A, KC_S, KC_H, KC_T, KC_G, | 90 | KC_ESC, KC_A, KC_S, KC_H, KC_T, KC_G, |
| 105 | KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_FN1, | 91 | KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, _______, |
| 106 | TT(_NUM), KC_LCTL, KC_LALT, KC_LGUI, LOWER, | 92 | TT(_NUM), KC_LCTL, KC_LALT, KC_LGUI, LOWER, |
| 107 | 93 | ||
| 108 | KC_MPLY, TG(_MOUSE), | 94 | KC_MPLY, _______, |
| 109 | KC_LALT, | 95 | KC_LALT, |
| 110 | KC_BSPACE, LOWER, KC_LGUI, | 96 | KC_SPACE, LOWER, KC_LGUI, |
| 111 | 97 | ||
| 112 | // right hand | 98 | // right hand |
| 113 | KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, | 99 | KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, |
| 114 | KC_RBRACKET, KC_J, KC_F, KC_U, KC_P, KC_SCOLON, KC_BSPACE, | 100 | KC_RBRACKET, KC_J, KC_F, KC_U, KC_P, KC_SCOLON, KC_BSPACE, |
| 115 | KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOTE, | 101 | KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOTE, |
| 116 | KC_FN1, KC_K, KC_L, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), RSFT_T(KC_ENT), | 102 | _______, KC_K, KC_L, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), RSFT_T(KC_ENT), |
| 117 | RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, | 103 | RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, |
| 118 | 104 | ||
| 119 | TT(_NUM), TG(_MOUSE), | 105 | _______, KC_MPLY, |
| 120 | KC_LALT, | 106 | KC_LALT, |
| 121 | KC_LGUI, RAISE, KC_SPACE | 107 | KC_LGUI, RAISE, KC_SPACE |
| 122 | ), | 108 | ), |
| 123 | 109 | ||
| 124 | /* Keymap 0: Basic Dvorak layer | 110 | /* Keymap 0: Basic Dvorak layer |
| @@ -129,41 +115,41 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 129 | * | Tab | ' | , | . | P | Y | [{ | | ]} | F | G | C | R | L | BSPC | | 115 | * | Tab | ' | , | . | P | Y | [{ | | ]} | F | G | C | R | L | BSPC | |
| 130 | * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------| | 116 | * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------| |
| 131 | * | ESC | A | O | E | U | I |------| |------| D | H | T | N | S | / | | 117 | * | ESC | A | O | E | U | I |------| |------| D | H | T | N | S | / | |
| 132 | * |--------+-----+-----+-----+-----+-----| L1 | | L1 |-----+-----+-----+-----+-----+--------| | 118 | * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------| |
| 133 | * | LShift | ; | Q | J | K | X | | | | B | M | W | V | Z | Enter | | 119 | * | LShift | ; | Q | J | K | X | | | | B | M | W | V | Z | Enter | |
| 134 | * `--------+-----+-----+-----+-----+------------' `------------+-----+-----+-----+-----+--------' | 120 | * `--------+-----+-----+-----+-----+------------' `------------+-----+-----+-----+-----+--------' |
| 135 | * | Num |Ctrl | Alt |LGUI |Lower| |Raise|Left |Down | Up |Right | | 121 | * | Num |Ctrl | Alt |LGUI |Lower| |Raise|Left |Down | Up |Right | |
| 136 | * `------------------------------' `------------------------------' | 122 | * `------------------------------' `------------------------------' |
| 137 | * ,------------. ,------------. | 123 | * ,------------. ,------------. |
| 138 | * |Play |Mouse | | Num |Mouse| | 124 | * |Play | | | |Play | |
| 139 | * ,----|-----|------| |------+-----+-----. | 125 | * ,-----|-----|------| |------+-----+-----. |
| 140 | * | | | Alt | | Alt | | | | 126 | * | | | Alt | | Alt | | | |
| 141 | * |BSPC|LOWER|------| |------|RAISE|Space| | 127 | * |Space|LOWER|------| |------|RAISE|Space| |
| 142 | * | | | LGUI | | LGUI | | | | 128 | * | | | LGUI | | LGUI | | | |
| 143 | * `-----------------' `------------------' | 129 | * `------------------' `------------------' |
| 144 | */ | 130 | */ |
| 145 | [_DVORAK] = LAYOUT_ergodox( | 131 | [_DVORAK] = LAYOUT_ergodox( |
| 146 | // left hand | 132 | // left hand |
| 147 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, | 133 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, |
| 148 | KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_LBRACKET, | 134 | KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_LBRACKET, |
| 149 | KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, | 135 | KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, |
| 150 | KC_LSFT, KC_SCOLON, KC_Q, KC_J, KC_K, KC_X, KC_FN1, | 136 | KC_LSFT, KC_SCOLON, KC_Q, KC_J, KC_K, KC_X, _______, |
| 151 | TT(_NUM), KC_LCTL, KC_LALT, KC_LGUI, LOWER, | 137 | TT(_NUM), KC_LCTL, KC_LALT, KC_LGUI, LOWER, |
| 152 | 138 | ||
| 153 | KC_MPLY, TG(_MOUSE), | 139 | KC_MPLY, _______, |
| 154 | KC_LALT, | 140 | KC_LALT, |
| 155 | KC_BSPACE, LOWER, KC_LGUI, | 141 | KC_SPACE, LOWER, KC_LGUI, |
| 156 | 142 | ||
| 157 | // right hand | 143 | // right hand |
| 158 | KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, | 144 | KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, |
| 159 | KC_RBRACKET, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPACE, | 145 | KC_RBRACKET, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPACE, |
| 160 | KC_D, KC_H, KC_T, KC_N, KC_S, LT(MOUSE, KC_SLSH), | 146 | KC_D, KC_H, KC_T, KC_N, KC_S, LT(MOUSE, KC_SLSH), |
| 161 | KC_FN1, KC_B, KC_M, KC_W, KC_V, KC_Z, RSFT_T(KC_ENT), | 147 | _______, KC_B, KC_M, KC_W, KC_V, KC_Z, RSFT_T(KC_ENT), |
| 162 | RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, | 148 | RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, |
| 163 | 149 | ||
| 164 | TT(_NUM), TG(_MOUSE), | 150 | _______, KC_MPLY, |
| 165 | KC_LALT, | 151 | KC_LALT, |
| 166 | KC_LGUI, RAISE, KC_SPACE | 152 | KC_LGUI, RAISE, KC_SPACE |
| 167 | ), | 153 | ), |
| 168 | 154 | ||
| 169 | /* Keymap 0: Basic Colemak layer | 155 | /* Keymap 0: Basic Colemak layer |
| @@ -174,41 +160,41 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 174 | * | Tab | Q | W | F | P | G | [{ | | ]} | J | L | U | Y | ; | BSPC | | 160 | * | Tab | Q | W | F | P | G | [{ | | ]} | J | L | U | Y | ; | BSPC | |
| 175 | * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------| | 161 | * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------| |
| 176 | * | ESC | A | R | S | T | D |------| |------| H | N | E | I | O | ' | | 162 | * | ESC | A | R | S | T | D |------| |------| H | N | E | I | O | ' | |
| 177 | * |--------+-----+-----+-----+-----+-----| L1 | | L1 |-----+-----+-----+-----+-----+--------| | 163 | * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------| |
| 178 | * | LShift | Z | X | C | V | B | | | | K | M | , | . | / | Enter | | 164 | * | LShift | Z | X | C | V | B | | | | K | M | , | . | / | Enter | |
| 179 | * `--------+-----+-----+-----+-----+------------' `------------+-----+-----+-----+-----+--------' | 165 | * `--------+-----+-----+-----+-----+------------' `------------+-----+-----+-----+-----+--------' |
| 180 | * | Num |Ctrl | Alt |LGUI |Lower| |Raise|Left |Down | Up |Right | | 166 | * | Num |Ctrl | Alt |LGUI |Lower| |Raise|Left |Down | Up |Right | |
| 181 | * `------------------------------' `------------------------------' | 167 | * `------------------------------' `------------------------------' |
| 182 | * ,------------. ,------------. | 168 | * ,------------. ,------------. |
| 183 | * |Play |Mouse | | Num |Mouse| | 169 | * |Play | | | |Play | |
| 184 | * ,----|-----|------| |------+-----+-----. | 170 | * ,-----|-----|------| |------+-----+-----. |
| 185 | * | | | Alt | | Alt | | | | 171 | * | | | Alt | | Alt | | | |
| 186 | * |BSPC|LOWER|------| |------|RAISE|Space| | 172 | * |Space|LOWER|------| |------|RAISE|Space| |
| 187 | * | | | LGUI | | LGUI | | | | 173 | * | | | LGUI | | LGUI | | | |
| 188 | * `-----------------' `------------------' | 174 | * `------------------' `------------------' |
| 189 | */ | 175 | */ |
| 190 | [_COLEMAK] = LAYOUT_ergodox( | 176 | [_COLEMAK] = LAYOUT_ergodox( |
| 191 | // left hand | 177 | // left hand |
| 192 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, | 178 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, |
| 193 | KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_LBRACKET, | 179 | KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_LBRACKET, |
| 194 | KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, | 180 | KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, |
| 195 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_FN1, | 181 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, _______, |
| 196 | TT(_NUM), KC_LCTL, KC_LALT, KC_LGUI, LOWER, | 182 | TT(_NUM), KC_LCTL, KC_LALT, KC_LGUI, LOWER, |
| 197 | 183 | ||
| 198 | KC_MPLY, TG(_MOUSE), | 184 | KC_MPLY, _______, |
| 199 | KC_LALT, | 185 | KC_LALT, |
| 200 | KC_BSPACE, LOWER, KC_LGUI, | 186 | KC_SPACE, LOWER, KC_LGUI, |
| 201 | 187 | ||
| 202 | // right hand | 188 | // right hand |
| 203 | KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, | 189 | KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, |
| 204 | KC_RBRACKET, KC_J, KC_L, KC_U, KC_Y, KC_SCOLON, KC_BSPACE, | 190 | KC_RBRACKET, KC_J, KC_L, KC_U, KC_Y, KC_SCOLON, KC_BSPACE, |
| 205 | KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOTE, | 191 | KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOTE, |
| 206 | KC_FN1, KC_K, KC_M, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), RSFT_T(KC_ENT), | 192 | _______, KC_K, KC_M, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), RSFT_T(KC_ENT), |
| 207 | RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, | 193 | RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, |
| 208 | 194 | ||
| 209 | TT(_NUM), TG(_MOUSE), | 195 | _______, KC_MPLY, |
| 210 | KC_LALT, | 196 | KC_LALT, |
| 211 | KC_LGUI, RAISE, KC_SPACE | 197 | KC_LGUI, RAISE, KC_SPACE |
| 212 | ), | 198 | ), |
| 213 | 199 | ||
| 214 | /* Lower | 200 | /* Lower |
| @@ -216,19 +202,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 216 | * ,---------------------------------------------------. ,--------------------------------------------------. | 202 | * ,---------------------------------------------------. ,--------------------------------------------------. |
| 217 | * | Version | F1 | F2 | F3 | F4 | F5 | F11 | | F12 | F6 | F7 | F8 | F9 | F10 | | | 203 | * | Version | F1 | F2 | F3 | F4 | F5 | F11 | | F12 | F6 | F7 | F8 | F9 | F10 | | |
| 218 | * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| | 204 | * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| |
| 219 | * | ~ | ! | @ | # | $ | % | | | | ^ | & | * | ( | ) | | | 205 | * | ~ | ! | @ | # | $ | % | F6 | | F5 | ^ | & | * | ( | ) | | |
| 220 | * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| | 206 | * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| |
| 221 | * | Del | F1 | F2 | F3 | F4 | F5 |------| |------| F6 | _ | + | { | } | | | | 207 | * | Del | F1 | F2 | F3 | F4 | F5 |------| |------| F6 | _ | + | { | } | | | |
| 222 | * |---------+------+------+------+------+------| L2 | | L2 |------+------+------+------+------+--------| | 208 | * |---------+------+------+------+------+------| F12 | | F11 |------+------+------+------+------+--------| |
| 223 | * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO ~ |ISO | | Home | End | | | 209 | * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO ~ |ISO | | Home | End | | |
| 224 | * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | 210 | * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' |
| 225 | * | | | | | | | | Play | Vol- | Vol+ | Next | | 211 | * | | | | | | | | Play | Vol- | Vol+ | Next | |
| 226 | * `-----------------------------------' `----------------------------------' | 212 | * `-----------------------------------' `----------------------------------' |
| 227 | * ,-------------. ,-------------. | 213 | * ,-------------. ,-------------. |
| 228 | * |Animat| | |Toggle|Solid | | 214 | * | | | | | | |
| 229 | * ,------|------|------| |------+------+------. | 215 | * ,------|------|------| |------+------+------. |
| 230 | * |Bright|Bright| | | |Hue- |Hue+ | | 216 | * | | | | | | | | |
| 231 | * |ness- |ness+ |------| |------| | | | 217 | * | | |------| |------| | | |
| 232 | * | | | | | | | | | 218 | * | | | | | | | | |
| 233 | * `--------------------' `--------------------' | 219 | * `--------------------' `--------------------' |
| 234 | */ | 220 | */ |
| @@ -261,10 +247,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 261 | * ,---------------------------------------------------. ,--------------------------------------------------. | 247 | * ,---------------------------------------------------. ,--------------------------------------------------. |
| 262 | * | Version | F1 | F2 | F3 | F4 | F5 | F11 | | F12 | F6 | F7 | F8 | F9 | F10 | F11 | | 248 | * | Version | F1 | F2 | F3 | F4 | F5 | F11 | | F12 | F6 | F7 | F8 | F9 | F10 | F11 | |
| 263 | * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| | 249 | * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| |
| 264 | * | ` | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | | | 250 | * | ` | 1 | 2 | 3 | 4 | 5 | F6 | | F5 | 6 | 7 | 8 | 9 | 0 | | |
| 265 | * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| | 251 | * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| |
| 266 | * | Del | F1 | F2 | F3 | F4 | F5 |------| |------| F6 | - | = | [ | ] | \ | | 252 | * | Del | F1 | F2 | F3 | F4 | F5 |------| |------| F6 | - | = | [ | ] | \ | |
| 267 | * |---------+------+------+------+------+------| L2 | | L2 |------+------+------+------+------+--------| | 253 | * |---------+------+------+------+------+------| F12 | | F11 |------+------+------+------+------+--------| |
| 268 | * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO # |ISO / |Pg Up |Pg Dn | | | 254 | * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO # |ISO / |Pg Up |Pg Dn | | |
| 269 | * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | 255 | * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' |
| 270 | * | | | | | | | | Play | Vol- | Vol+ | Next | | 256 | * | | | | | | | | Play | Vol- | Vol+ | Next | |
| @@ -308,7 +294,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 308 | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| | 294 | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| |
| 309 | * | |Reset |Debug | | | | | | | |TRM on|TRMoff| | | Del | | 295 | * | |Reset |Debug | | | | | | | |TRM on|TRMoff| | | Del | |
| 310 | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | 296 | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| |
| 311 | * | CPSLCK | | | | |AG Nrm|------| |------|AG Swp|QWERTY|Wrkman|Dvorak| | | | 297 | * | CPSLCK | | | | |AG Nrm|------| |------|AG Swp|QWERTY|Wrkman|Dvorak|Colmak| | |
| 312 | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | 298 | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| |
| 313 | * | | | | | | | | | | | | Prev | Next | | | | 299 | * | | | | | | | | | | | | Prev | Next | | | |
| 314 | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | 300 | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' |
| @@ -325,7 +311,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 325 | [_ADJUST] = LAYOUT_ergodox( | 311 | [_ADJUST] = LAYOUT_ergodox( |
| 326 | // left hand | 312 | // left hand |
| 327 | VRSN, _______, _______, _______, _______, _______, _______, | 313 | VRSN, _______, _______, _______, _______, _______, _______, |
| 328 | _______, RESET, DEBUG, _______, _______, _______, _______, | 314 | _______, RESET, DEBUG, BL_TOGG, BL_STEP, _______, _______, |
| 329 | KC_CAPS, _______, _______, _______, _______, AG_NORM, | 315 | KC_CAPS, _______, _______, _______, _______, AG_NORM, |
| 330 | _______, _______, _______, _______, _______, _______, _______, | 316 | _______, _______, _______, _______, _______, _______, _______, |
| 331 | _______, _______, _______, _______, _______, | 317 | _______, _______, _______, _______, _______, |
| @@ -502,6 +488,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | |||
| 502 | return MACRO_NONE; | 488 | return MACRO_NONE; |
| 503 | }; | 489 | }; |
| 504 | 490 | ||
| 491 | void matrix_init_user() { | ||
| 492 | backlight_enable(); | ||
| 493 | backlight_level(BACKLIGHT_LEVELS); | ||
| 494 | } | ||
| 495 | |||
| 505 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 496 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 506 | switch (keycode) { | 497 | switch (keycode) { |
| 507 | case QWERTY: | 498 | case QWERTY: |
| @@ -576,34 +567,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 576 | } | 567 | } |
| 577 | return true; | 568 | return true; |
| 578 | } | 569 | } |
| 579 | |||
| 580 | /** | ||
| 581 | * Runs just one time when the keyboard initializes. | ||
| 582 | */ | ||
| 583 | void matrix_init_user(void) { | ||
| 584 | |||
| 585 | }; | ||
| 586 | |||
| 587 | /** | ||
| 588 | * Runs constantly in the background, in a loop. | ||
| 589 | */ | ||
| 590 | void matrix_scan_user(void) { | ||
| 591 | uint8_t layer = biton32(layer_state); | ||
| 592 | |||
| 593 | ergodox_board_led_off(); | ||
| 594 | ergodox_led_lower_off(); | ||
| 595 | ergodox_led_raise_off(); | ||
| 596 | ergodox_led_adjust_off(); | ||
| 597 | |||
| 598 | switch (layer) { | ||
| 599 | case _LOWER: | ||
| 600 | ergodox_led_lower_on(); | ||
| 601 | break; | ||
| 602 | case _RAISE: | ||
| 603 | ergodox_led_raise_on(); | ||
| 604 | break; | ||
| 605 | case _ADJUST: | ||
| 606 | ergodox_led_adjust_on(); | ||
| 607 | break; | ||
| 608 | } | ||
| 609 | }; | ||
diff --git a/keyboards/ergodox_infinity/keymaps/dudeofawesome/layers.h b/keyboards/ergodox_infinity/keymaps/dudeofawesome/layers.h new file mode 100644 index 000000000..d852fe980 --- /dev/null +++ b/keyboards/ergodox_infinity/keymaps/dudeofawesome/layers.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #include QMK_KEYBOARD_H | ||
| 2 | |||
| 3 | enum custom_layers { | ||
| 4 | _QWERTY, | ||
| 5 | _WORKMAN, | ||
| 6 | _DVORAK, | ||
| 7 | _COLEMAK, | ||
| 8 | _LOWER, | ||
| 9 | _RAISE, | ||
| 10 | _ADJUST, | ||
| 11 | _GAME, | ||
| 12 | _MOUSE, | ||
| 13 | _NUM, | ||
| 14 | }; | ||
diff --git a/keyboards/ergodox_infinity/keymaps/dudeofawesome/simple_visualizer.h b/keyboards/ergodox_infinity/keymaps/dudeofawesome/simple_visualizer.h new file mode 100644 index 000000000..9213e99f4 --- /dev/null +++ b/keyboards/ergodox_infinity/keymaps/dudeofawesome/simple_visualizer.h | |||
| @@ -0,0 +1,123 @@ | |||
| 1 | /* Copyright 2017 Fred Sundvik | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_ | ||
| 18 | #define KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_ | ||
| 19 | |||
| 20 | // Currently we are assuming that both the backlight and LCD are enabled | ||
| 21 | // But it's entirely possible to write a custom visualizer that use only | ||
| 22 | // one of them | ||
| 23 | #ifndef LCD_BACKLIGHT_ENABLE | ||
| 24 | #error This visualizer needs that LCD backlight is enabled | ||
| 25 | #endif | ||
| 26 | |||
| 27 | #ifndef LCD_ENABLE | ||
| 28 | #error This visualizer needs that LCD is enabled | ||
| 29 | #endif | ||
| 30 | |||
| 31 | #include "visualizer.h" | ||
| 32 | #include "visualizer_keyframes.h" | ||
| 33 | #include "lcd_keyframes.h" | ||
| 34 | #include "lcd_backlight_keyframes.h" | ||
| 35 | #include "system/serial_link.h" | ||
| 36 | #include "led.h" | ||
| 37 | #include "default_animations.h" | ||
| 38 | |||
| 39 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); | ||
| 40 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); | ||
| 41 | |||
| 42 | static bool initial_update = true; | ||
| 43 | |||
| 44 | // Feel free to modify the animations below, or even add new ones if needed | ||
| 45 | |||
| 46 | static keyframe_animation_t lcd_layer_display = { | ||
| 47 | .num_frames = 1, | ||
| 48 | .loop = false, | ||
| 49 | .frame_lengths = {gfxMillisecondsToTicks(0)}, | ||
| 50 | .frame_functions = {lcd_keyframe_display_layer_and_led_states} | ||
| 51 | }; | ||
| 52 | |||
| 53 | // The color animation animates the LCD color when you change layers | ||
| 54 | static keyframe_animation_t color_animation = { | ||
| 55 | .num_frames = 2, | ||
| 56 | .loop = false, | ||
| 57 | // Note that there's a 200 ms no-operation frame, | ||
| 58 | // this prevents the color from changing when activating the layer | ||
| 59 | // momentarily | ||
| 60 | .frame_lengths = {gfxMillisecondsToTicks(1), gfxMillisecondsToTicks(5)}, | ||
| 61 | .frame_functions = {keyframe_no_operation, lcd_backlight_keyframe_animate_color}, | ||
| 62 | }; | ||
| 63 | |||
| 64 | void initialize_user_visualizer(visualizer_state_t* state) { | ||
| 65 | // The brightness will be dynamically adjustable in the future | ||
| 66 | // But for now, change it here. | ||
| 67 | lcd_backlight_brightness(130); | ||
| 68 | state->current_lcd_color = initial_color; | ||
| 69 | state->target_lcd_color = logo_background_color; | ||
| 70 | initial_update = true; | ||
| 71 | start_keyframe_animation(&default_startup_animation); | ||
| 72 | } | ||
| 73 | |||
| 74 | |||
| 75 | // This function should be implemented by the keymap visualizer | ||
| 76 | // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing | ||
| 77 | // that the simple_visualizer assumes that you are updating | ||
| 78 | // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is | ||
| 79 | // stopped. This can be done by either double buffering it or by using constant strings | ||
| 80 | static void get_visualizer_layer_and_color(visualizer_state_t* state); | ||
| 81 | |||
| 82 | void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { | ||
| 83 | // Add more tests, change the colors and layer texts here | ||
| 84 | // Usually you want to check the high bits (higher layers first) | ||
| 85 | // because that's the order layers are processed for keypresses | ||
| 86 | // You can for check for example: | ||
| 87 | // state->status.layer | ||
| 88 | // state->status.default_layer | ||
| 89 | // state->status.leds (see led.h for available statuses) | ||
| 90 | |||
| 91 | uint32_t prev_color = state->target_lcd_color; | ||
| 92 | const char* prev_layer_text = state->layer_text; | ||
| 93 | |||
| 94 | get_visualizer_layer_and_color(state); | ||
| 95 | |||
| 96 | if (initial_update || prev_color != state->target_lcd_color) { | ||
| 97 | start_keyframe_animation(&color_animation); | ||
| 98 | } | ||
| 99 | |||
| 100 | if (initial_update || prev_layer_text != state->layer_text) { | ||
| 101 | start_keyframe_animation(&lcd_layer_display); | ||
| 102 | } | ||
| 103 | // You can also stop existing animations, and start your custom ones here | ||
| 104 | // remember that you should normally have only one animation for the LCD | ||
| 105 | // and one for the background. But you can also combine them if you want. | ||
| 106 | } | ||
| 107 | |||
| 108 | void user_visualizer_suspend(visualizer_state_t* state) { | ||
| 109 | state->layer_text = "Suspending..."; | ||
| 110 | uint8_t hue = LCD_HUE(state->current_lcd_color); | ||
| 111 | uint8_t sat = LCD_SAT(state->current_lcd_color); | ||
| 112 | state->target_lcd_color = LCD_COLOR(hue, sat, 0); | ||
| 113 | start_keyframe_animation(&default_suspend_animation); | ||
| 114 | } | ||
| 115 | |||
| 116 | void user_visualizer_resume(visualizer_state_t* state) { | ||
| 117 | state->current_lcd_color = initial_color; | ||
| 118 | state->target_lcd_color = logo_background_color; | ||
| 119 | initial_update = true; | ||
| 120 | start_keyframe_animation(&default_startup_animation); | ||
| 121 | } | ||
| 122 | |||
| 123 | #endif /* KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_ */ | ||
diff --git a/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.c b/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.c index d339ecc97..54fc2363c 100644 --- a/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.c +++ b/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright 2016 Fred Sundvik <fsundvik@gmail.com> | 2 | Copyright 2017 Fred Sundvik |
| 3 | 3 | ||
| 4 | This program is free software: you can redistribute it and/or modify | 4 | This program is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
| @@ -15,331 +15,65 @@ You should have received a copy of the GNU General Public License | |||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | /** | 18 | #include "./simple_visualizer.h" |
| 19 | * Currently we are assuming that both the backlight and LCD are enabled | 19 | #include "util.h" |
| 20 | * But it's entirely possible to write a custom visualizer that use only | 20 | #include "layers.h" |
| 21 | * one of them | 21 | |
| 22 | */ | 22 | // This function should be implemented by the keymap visualizer |
| 23 | #ifndef LCD_BACKLIGHT_ENABLE | 23 | // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing |
| 24 | #error This visualizer needs that LCD backlight is enabled | 24 | // that the simple_visualizer assumes that you are updating |
| 25 | #endif | 25 | // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is |
| 26 | 26 | // stopped. This can be done by either double buffering it or by using constant strings | |
| 27 | #ifndef LCD_ENABLE | 27 | static void get_visualizer_layer_and_color(visualizer_state_t* state) { |
| 28 | #error This visualizer needs that LCD is enabled | 28 | switch(biton32(default_layer_state)) { |
| 29 | #endif | 29 | case _QWERTY: |
| 30 | 30 | state->layer_text = "QWERTY"; | |
| 31 | #include "./visualizer.h" | 31 | state->target_lcd_color = LCD_COLOR(0, 255, 128); |
| 32 | #include "visualizer_keyframes.h" | 32 | break; |
| 33 | #include "lcd_keyframes.h" | 33 | case _WORKMAN: |
| 34 | #include "lcd_backlight_keyframes.h" | 34 | state->layer_text = "Workman"; |
| 35 | #include "system/serial_link.h" | 35 | state->target_lcd_color = LCD_COLOR(80, 255, 128); |
| 36 | #include "default_animations.h" | 36 | break; |
| 37 | 37 | case _DVORAK: | |
| 38 | static const uint32_t logo_background_color = LCD_COLOR(0, 0, 255); | 38 | state->layer_text = "Dvorak"; |
| 39 | static const uint32_t initial_color = LCD_COLOR(84, 255, 255); | 39 | state->target_lcd_color = LCD_COLOR(194, 255, 128); |
| 40 | 40 | break; | |
| 41 | static const uint32_t led_emulation_colors[4] = { | 41 | case _COLEMAK: |
| 42 | LCD_COLOR(0, 0, 255), | 42 | state->layer_text = "Colemak"; |
| 43 | LCD_COLOR(141, 255, 255), | 43 | state->target_lcd_color = LCD_COLOR(18, 255, 128); |
| 44 | LCD_COLOR(18, 255, 255), | 44 | break; |
| 45 | LCD_COLOR(194, 255, 255), | ||
| 46 | }; | ||
| 47 | |||
| 48 | static uint32_t next_led_target_color = 0; | ||
| 49 | |||
| 50 | typedef enum { | ||
| 51 | LCD_STATE_INITIAL, | ||
| 52 | LCD_STATE_LAYER_BITMAP, | ||
| 53 | LCD_STATE_BITMAP_AND_LEDS, | ||
| 54 | } lcd_state_t; | ||
| 55 | |||
| 56 | static lcd_state_t lcd_state = LCD_STATE_INITIAL; | ||
| 57 | |||
| 58 | typedef struct { | ||
| 59 | uint8_t led_on; | ||
| 60 | uint8_t led1; | ||
| 61 | uint8_t led2; | ||
| 62 | uint8_t led3; | ||
| 63 | } visualizer_user_data_t; | ||
| 64 | |||
| 65 | /** | ||
| 66 | * Don't access from visualization function, use the visualizer state instead | ||
| 67 | */ | ||
| 68 | static visualizer_user_data_t user_data_keyboard = { | ||
| 69 | .led_on = 0, | ||
| 70 | .led1 = LED_BRIGHTNESS_HI, | ||
| 71 | .led2 = LED_BRIGHTNESS_HI, | ||
| 72 | .led3 = LED_BRIGHTNESS_HI, | ||
| 73 | }; | ||
| 74 | |||
| 75 | _Static_assert(sizeof(visualizer_user_data_t) <= VISUALIZER_USER_DATA_SIZE, | ||
| 76 | "Please increase the VISUALIZER_USER_DATA_SIZE"); | ||
| 77 | |||
| 78 | // Feel free to modify the animations below, or even add new ones if needed | ||
| 79 | |||
| 80 | // The color animation animates the LCD color when you change layers | ||
| 81 | static keyframe_animation_t one_led_color = { | ||
| 82 | .num_frames = 1, | ||
| 83 | .loop = false, | ||
| 84 | .frame_lengths = {gfxMillisecondsToTicks(0)}, | ||
| 85 | .frame_functions = {lcd_backlight_keyframe_set_color}, | ||
| 86 | }; | ||
| 87 | |||
| 88 | bool swap_led_target_color(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 89 | uint32_t temp = next_led_target_color; | ||
| 90 | next_led_target_color = state->target_lcd_color; | ||
| 91 | state->target_lcd_color = temp; | ||
| 92 | return false; | ||
| 93 | } | ||
| 94 | |||
| 95 | // The color animation animates the LCD color when you change layers | ||
| 96 | static keyframe_animation_t two_led_colors = { | ||
| 97 | .num_frames = 2, | ||
| 98 | .loop = true, | ||
| 99 | .frame_lengths = {gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(0)}, | ||
| 100 | .frame_functions = {lcd_backlight_keyframe_set_color, swap_led_target_color}, | ||
| 101 | }; | ||
| 102 | |||
| 103 | /** | ||
| 104 | * The LCD animation alternates between the layer name display and a | ||
| 105 | * bitmap that displays all active layers | ||
| 106 | */ | ||
| 107 | static keyframe_animation_t lcd_bitmap_animation = { | ||
| 108 | .num_frames = 1, | ||
| 109 | .loop = false, | ||
| 110 | .frame_lengths = {gfxMillisecondsToTicks(0)}, | ||
| 111 | .frame_functions = {lcd_keyframe_display_layer_bitmap}, | ||
| 112 | }; | ||
| 113 | |||
| 114 | static keyframe_animation_t lcd_bitmap_leds_animation = { | ||
| 115 | .num_frames = 2, | ||
| 116 | .loop = true, | ||
| 117 | .frame_lengths = {gfxMillisecondsToTicks(2000), gfxMillisecondsToTicks(2000)}, | ||
| 118 | .frame_functions = {lcd_keyframe_display_layer_bitmap, lcd_keyframe_display_led_states}, | ||
| 119 | }; | ||
| 120 | |||
| 121 | void initialize_user_visualizer(visualizer_state_t* state) { | ||
| 122 | /** | ||
| 123 | * The brightness will be dynamically adjustable in the future | ||
| 124 | * But for now, change it here. | ||
| 125 | */ | ||
| 126 | lcd_backlight_brightness(180); | ||
| 127 | state->current_lcd_color = initial_color; | ||
| 128 | state->target_lcd_color = logo_background_color; | ||
| 129 | lcd_state = LCD_STATE_INITIAL; | ||
| 130 | start_keyframe_animation(&default_startup_animation); | ||
| 131 | } | ||
| 132 | |||
| 133 | static inline bool is_led_on(visualizer_user_data_t* user_data, uint8_t num) { | ||
| 134 | return user_data->led_on & (1u << num); | ||
| 135 | } | ||
| 136 | |||
| 137 | static uint8_t get_led_index_master(visualizer_user_data_t* user_data) { | ||
| 138 | for (int i=0; i < 4; i++) { | ||
| 139 | if (is_led_on(user_data, i)) { | ||
| 140 | return i + 1; | ||
| 141 | } | ||
| 142 | } | ||
| 143 | return 0; | ||
| 144 | } | ||
| 145 | |||
| 146 | static uint8_t get_led_index_slave(visualizer_user_data_t* user_data) { | ||
| 147 | uint8_t master_index = get_led_index_master(user_data); | ||
| 148 | if (master_index!=0) { | ||
| 149 | for (int i=master_index; i < 4; i++) { | ||
| 150 | if (is_led_on(user_data, i)) { | ||
| 151 | return i + 1; | ||
| 152 | } | ||
| 153 | } | ||
| 154 | } | ||
| 155 | |||
| 156 | return 0; | ||
| 157 | } | ||
| 158 | |||
| 159 | static uint8_t get_secondary_led_index(visualizer_user_data_t* user_data) { | ||
| 160 | if ( | ||
| 161 | is_led_on(user_data, 0) && | ||
| 162 | is_led_on(user_data, 1) && | ||
| 163 | is_led_on(user_data, 2) | ||
| 164 | ) { | ||
| 165 | return 3; | ||
| 166 | } | ||
| 167 | return 0; | ||
| 168 | } | ||
| 169 | |||
| 170 | static uint8_t get_brightness(visualizer_user_data_t* user_data, uint8_t index) { | ||
| 171 | switch (index) { | ||
| 172 | case 1: | ||
| 173 | return user_data->led1; | ||
| 174 | case 2: | ||
| 175 | return user_data->led2; | ||
| 176 | case 3: | ||
| 177 | return user_data->led3; | ||
| 178 | } | ||
| 179 | return 0; | ||
| 180 | } | ||
| 181 | |||
| 182 | static void update_emulated_leds(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { | ||
| 183 | visualizer_user_data_t* user_data_new = (visualizer_user_data_t*)state->status.user_data; | ||
| 184 | visualizer_user_data_t* user_data_old = (visualizer_user_data_t*)prev_status->user_data; | ||
| 185 | |||
| 186 | uint8_t new_index; | ||
| 187 | uint8_t old_index; | ||
| 188 | |||
| 189 | if (true || is_serial_link_master()) { | ||
| 190 | new_index = get_led_index_master(user_data_new); | ||
| 191 | old_index = get_led_index_master(user_data_old); | ||
| 192 | } else { | ||
| 193 | new_index = get_led_index_slave(user_data_new); | ||
| 194 | old_index = get_led_index_slave(user_data_old); | ||
| 195 | } | ||
| 196 | |||
| 197 | uint8_t new_secondary_index = get_secondary_led_index(user_data_new); | ||
| 198 | uint8_t old_secondary_index = get_secondary_led_index(user_data_old); | ||
| 199 | |||
| 200 | uint8_t new_brightness = get_brightness(user_data_new, new_index); | ||
| 201 | uint8_t old_brightness = get_brightness(user_data_old, old_index); | ||
| 202 | |||
| 203 | uint8_t new_secondary_brightness = get_brightness(user_data_new, new_secondary_index); | ||
| 204 | uint8_t old_secondary_brightness = get_brightness(user_data_old, old_secondary_index); | ||
| 205 | |||
| 206 | if ( | ||
| 207 | lcd_state == LCD_STATE_INITIAL || | ||
| 208 | new_index != old_index || | ||
| 209 | new_secondary_index != old_secondary_index || | ||
| 210 | new_brightness != old_brightness || | ||
| 211 | new_secondary_brightness != old_secondary_brightness | ||
| 212 | ) { | ||
| 213 | if (new_secondary_index != 0) { | ||
| 214 | state->target_lcd_color = change_lcd_color_intensity( | ||
| 215 | led_emulation_colors[new_index], new_brightness); | ||
| 216 | next_led_target_color = change_lcd_color_intensity( | ||
| 217 | led_emulation_colors[new_secondary_index], new_secondary_brightness); | ||
| 218 | |||
| 219 | stop_keyframe_animation(&one_led_color); | ||
| 220 | start_keyframe_animation(&two_led_colors); | ||
| 221 | } else { | ||
| 222 | state->target_lcd_color = change_lcd_color_intensity( | ||
| 223 | led_emulation_colors[new_index], new_brightness); | ||
| 224 | |||
| 225 | stop_keyframe_animation(&two_led_colors); | ||
| 226 | start_keyframe_animation(&one_led_color); | ||
| 227 | } | ||
| 228 | } | 45 | } |
| 229 | } | ||
| 230 | |||
| 231 | static void update_lcd_text(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { | ||
| 232 | if (state->status.leds) { | ||
| 233 | if ( | ||
| 234 | lcd_state != LCD_STATE_BITMAP_AND_LEDS || | ||
| 235 | state->status.leds != prev_status->leds || | ||
| 236 | state->status.layer != prev_status->layer || | ||
| 237 | state->status.default_layer != prev_status->default_layer | ||
| 238 | ) { | ||
| 239 | // NOTE: that it doesn't matter if the animation isn't playing, stop will do nothing in that case | ||
| 240 | stop_keyframe_animation(&lcd_bitmap_animation); | ||
| 241 | 46 | ||
| 242 | lcd_state = LCD_STATE_BITMAP_AND_LEDS; | 47 | switch(biton32(state->status.layer)) { |
| 243 | /** | 48 | case _LOWER: |
| 244 | * For information: | 49 | state->layer_text = "Lower"; |
| 245 | * The logic in this function makes sure that this doesn't happen, but if you call start on an | 50 | state->target_lcd_color = LCD_COLOR(141, 255, 255); |
| 246 | * animation that is already playing it will be restarted. | 51 | break; |
| 247 | */ | 52 | case _RAISE: |
| 248 | start_keyframe_animation(&lcd_bitmap_leds_animation); | 53 | state->layer_text = "Raise"; |
| 249 | } | 54 | state->target_lcd_color = LCD_COLOR(18, 255, 255); |
| 250 | } else { | 55 | break; |
| 251 | if ( | 56 | case _ADJUST: |
| 252 | lcd_state != LCD_STATE_LAYER_BITMAP || | 57 | state->layer_text = "Adjust"; |
| 253 | state->status.layer != prev_status->layer || | 58 | state->target_lcd_color = LCD_COLOR(194, 255, 255); |
| 254 | state->status.default_layer != prev_status->default_layer | 59 | break; |
| 255 | ) { | 60 | case _NUM: |
| 256 | stop_keyframe_animation(&lcd_bitmap_leds_animation); | 61 | state->layer_text = "Numpad"; |
| 257 | 62 | state->target_lcd_color = LCD_COLOR(80, 255, 255); | |
| 258 | lcd_state = LCD_STATE_LAYER_BITMAP; | 63 | break; |
| 259 | start_keyframe_animation(&lcd_bitmap_animation); | 64 | case _MOUSE: |
| 260 | } | 65 | state->layer_text = "Mouse"; |
| 66 | state->target_lcd_color = LCD_COLOR(300, 255, 255); | ||
| 67 | break; | ||
| 68 | case _GAME: | ||
| 69 | state->layer_text = "Game"; | ||
| 70 | state->target_lcd_color = LCD_COLOR(300, 255, 255); | ||
| 71 | break; | ||
| 72 | case _QWERTY: case _WORKMAN: case _DVORAK: case _COLEMAK: | ||
| 73 | break; | ||
| 74 | default: | ||
| 75 | state->layer_text = "NONE"; | ||
| 76 | state->target_lcd_color = LCD_COLOR(0, 255, 255); | ||
| 77 | break; | ||
| 261 | } | 78 | } |
| 262 | } | 79 | } |
| 263 | |||
| 264 | void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { | ||
| 265 | /** | ||
| 266 | * Check the status here to start and stop animations | ||
| 267 | * You might have to save some state, like the current animation here so that you can start the right | ||
| 268 | * This function is called every time the status changes | ||
| 269 | * | ||
| 270 | * NOTE that this is called from the visualizer thread, so don't access anything else outside the status | ||
| 271 | * This is also important because the slave won't have access to the active layer for example outside the | ||
| 272 | * status. | ||
| 273 | */ | ||
| 274 | |||
| 275 | update_emulated_leds(state, prev_status); | ||
| 276 | update_lcd_text(state, prev_status); | ||
| 277 | } | ||
| 278 | |||
| 279 | void user_visualizer_suspend(visualizer_state_t* state) { | ||
| 280 | state->layer_text = "Suspending..."; | ||
| 281 | uint8_t hue = LCD_HUE(state->current_lcd_color); | ||
| 282 | uint8_t sat = LCD_SAT(state->current_lcd_color); | ||
| 283 | state->target_lcd_color = LCD_COLOR(hue, sat, 0); | ||
| 284 | start_keyframe_animation(&default_suspend_animation); | ||
| 285 | } | ||
| 286 | |||
| 287 | void user_visualizer_resume(visualizer_state_t* state) { | ||
| 288 | state->current_lcd_color = initial_color; | ||
| 289 | state->target_lcd_color = logo_background_color; | ||
| 290 | lcd_state = LCD_STATE_INITIAL; | ||
| 291 | start_keyframe_animation(&default_startup_animation); | ||
| 292 | } | ||
| 293 | |||
| 294 | void ergodox_board_led_on(void){ | ||
| 295 | // No board led support | ||
| 296 | } | ||
| 297 | |||
| 298 | void ergodox_led_lower_on(void){ | ||
| 299 | user_data_keyboard.led_on |= (1u << 0); | ||
| 300 | visualizer_set_user_data(&user_data_keyboard); | ||
| 301 | } | ||
| 302 | |||
| 303 | void ergodox_led_raise_on(void){ | ||
| 304 | user_data_keyboard.led_on |= (1u << 1); | ||
| 305 | visualizer_set_user_data(&user_data_keyboard); | ||
| 306 | } | ||
| 307 | |||
| 308 | void ergodox_led_adjust_on(void){ | ||
| 309 | user_data_keyboard.led_on |= (1u << 2); | ||
| 310 | visualizer_set_user_data(&user_data_keyboard); | ||
| 311 | } | ||
| 312 | |||
| 313 | void ergodox_board_led_off(void){ | ||
| 314 | // No board led support | ||
| 315 | } | ||
| 316 | |||
| 317 | void ergodox_led_lower_off(void){ | ||
| 318 | user_data_keyboard.led_on &= ~(1u << 0); | ||
| 319 | visualizer_set_user_data(&user_data_keyboard); | ||
| 320 | } | ||
| 321 | |||
| 322 | void ergodox_led_raise_off(void){ | ||
| 323 | user_data_keyboard.led_on &= ~(1u << 1); | ||
| 324 | visualizer_set_user_data(&user_data_keyboard); | ||
| 325 | } | ||
| 326 | |||
| 327 | void ergodox_led_adjust_off(void){ | ||
| 328 | user_data_keyboard.led_on &= ~(1u << 2); | ||
| 329 | visualizer_set_user_data(&user_data_keyboard); | ||
| 330 | } | ||
| 331 | |||
| 332 | void ergodox_led_lower_set(uint8_t n) { | ||
| 333 | user_data_keyboard.led1 = n; | ||
| 334 | visualizer_set_user_data(&user_data_keyboard); | ||
| 335 | } | ||
| 336 | |||
| 337 | void ergodox_led_raise_set(uint8_t n) { | ||
| 338 | user_data_keyboard.led2 = n; | ||
| 339 | visualizer_set_user_data(&user_data_keyboard); | ||
| 340 | } | ||
| 341 | |||
| 342 | void ergodox_led_adjust_set(uint8_t n) { | ||
| 343 | user_data_keyboard.led3 = n; | ||
| 344 | visualizer_set_user_data(&user_data_keyboard); | ||
| 345 | } | ||
