aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Orleans <louis@orleans.io>2017-10-31 08:14:43 -0700
committerJack Humbert <jack.humb@gmail.com>2017-10-31 11:14:43 -0400
commitb2bbbc2dfcf21783bd84cb4db9fd96016c2951af (patch)
treec0c49113129711d9b0c2b284f2adbc3a02c83f1a
parent6169cd52ba031f56268a32c636e9af35941e27a2 (diff)
downloadqmk_firmware-b2bbbc2dfcf21783bd84cb4db9fd96016c2951af.tar.gz
qmk_firmware-b2bbbc2dfcf21783bd84cb4db9fd96016c2951af.zip
layout(infinity ergodox): dudeofawesome's layout (#1932)
* 🎉 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.
-rw-r--r--keyboards/ergodox_infinity/keymaps/dudeofawesome/README.md25
-rw-r--r--keyboards/ergodox_infinity/keymaps/dudeofawesome/keymap.c568
-rw-r--r--keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.c345
3 files changed, 938 insertions, 0 deletions
diff --git a/keyboards/ergodox_infinity/keymaps/dudeofawesome/README.md b/keyboards/ergodox_infinity/keymaps/dudeofawesome/README.md
new file mode 100644
index 000000000..98eb7abb2
--- /dev/null
+++ b/keyboards/ergodox_infinity/keymaps/dudeofawesome/README.md
@@ -0,0 +1,25 @@
1# DudeOfAwesome's ErgoDox Infinity Layout
2
3A basic ErgoDox layout with Planck-like tri-layer support.
4
5![ErgoDox Layout](https://i.imgur.com/9zfKPV7.png)
6
7## Features
8
9- Planck-like tri-layer
10- Workman layout
11- In-progress gaming layer
12- Numpad
13- LCD colors are linked together, like the default KLL firmware
14
15## Building and flashing
16
171. Put your board in DFU mode with either the button on the bottom, or with a software key in your current firmware
181. Flash left half:
19 ```bash
20 $ make ergodox_infinity:dudeofawesome:dfu-util
21 ```
221. Flash right half:
23 ```bash
24 $ make ergodox_infinity:dudeofawesome:dfu-util MASTER=right
25 ```
diff --git a/keyboards/ergodox_infinity/keymaps/dudeofawesome/keymap.c b/keyboards/ergodox_infinity/keymaps/dudeofawesome/keymap.c
new file mode 100644
index 000000000..7d76b25a4
--- /dev/null
+++ b/keyboards/ergodox_infinity/keymaps/dudeofawesome/keymap.c
@@ -0,0 +1,568 @@
1#include QMK_KEYBOARD_H
2#include "debug.h"
3#include "action_layer.h"
4#include "version.h"
5
6enum custom_layers {
7 _QWERTY,
8 _DVORAK,
9 _WORKMAN,
10 _GAME,
11 _MOUSE,
12 _NUM,
13 _LOWER,
14 _RAISE,
15 _ADJUST,
16};
17
18enum custom_keycodes {
19 QWERTY = SAFE_RANGE,
20 DVORAK,
21 WORKMAN,
22 LOWER,
23 RAISE,
24 GAME,
25 MOUSE,
26 NUM,
27 EPRM,
28 VRSN,
29 RGB_SLD
30};
31
32const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
33/* Keymap 0: Basic QWERTY layer
34 *
35 * ,---------------------------------------------. ,---------------------------------------------.
36 * | - | 1 | 2 | 3 | 4 | 5 | Esc | | Esc | 6 | 7 | 8 | 9 | 0 | = |
37 * |--------+-----+-----+-----+-----+------------| |------+-----+-----+-----+-----+-----+--------|
38 * | Tab | Q | W | E | R | T | [{ | | ]} | Y | U | I | O | P | BSPC |
39 * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------|
40 * | ESC | A | S | D | F | G |------| |------| H | J | K | L | ; | '" |
41 * |--------+-----+-----+-----+-----+-----| L1 | | L1 |-----+-----+-----+-----+-----+--------|
42 * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | Enter |
43 * `--------+-----+-----+-----+-----+------------' `------------+-----+-----+-----+-----+--------'
44 * | Num |Ctrl | Alt |LGUI |Lower| |Raise|Left |Down | Up |Right |
45 * `------------------------------' `------------------------------'
46 * ,------------. ,------------.
47 * |Play |Mouse | | Num |Mouse|
48 * ,----|-----|------| |------+-----+-----.
49 * | | | Alt | | Alt | | |
50 * |BSPC|LOWER|------| |------|RAISE|Space|
51 * | | | LGUI | | LGUI | | |
52 * `-----------------' `------------------'
53 */
54[_QWERTY] = LAYOUT_ergodox(
55 // left hand
56 KC_MINUS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC,
57 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRACKET,
58 KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G,
59 KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_FN1,
60 TG(_NUM), KC_LCTL, KC_LALT, KC_LGUI, LOWER,
61
62 KC_MPLY, TG(_MOUSE),
63 KC_LALT,
64 LOWER, KC_BSPACE, KC_LGUI,
65
66 // right hand
67 KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQUAL,
68 KC_RBRACKET, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPACE,
69 KC_H, KC_J, KC_K, KC_L, KC_SCOLON, KC_QUOTE,
70 KC_FN1, KC_N, KC_M, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), KC_ENTER,
71 RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,
72
73 TG(_NUM), TG(_MOUSE),
74 KC_LALT,
75 KC_LGUI, KC_SPACE, RAISE
76),
77
78/* Keymap 0: Basic Dvorak layer
79 *
80 * ,---------------------------------------------. ,--------------------------------------------.
81 * | - | 1 | 2 | 3 | 4 | 5 | Esc | | Esc | 6 | 7 | 8 | 9 | 0 | = |
82 * |--------+-----+-----+-----+-----+------------| |------+-----+-----+-----+-----+-----+--------|
83 * | Tab | ' | , | . | P | Y | [{ | | ]} | F | G | C | R | L | BSPC |
84 * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------|
85 * | ESC | A | O | E | U | I |------| |------| D | H | T | N | S | / |
86 * |--------+-----+-----+-----+-----+-----| L1 | | L1 |-----+-----+-----+-----+-----+--------|
87 * | LShift | ; | Q | J | K | X | | | | B | M | W | V | Z | Enter |
88 * `--------+-----+-----+-----+-----+------------' `------------+-----+-----+-----+-----+--------'
89 * | Num |Ctrl | Alt |LGUI |Lower| |Raise|Left |Down | Up |Right |
90 * `------------------------------' `------------------------------'
91 * ,------------. ,------------.
92 * |Play |Mouse | | Num |Mouse|
93 * ,----|-----|------| |------+-----+-----.
94 * | | | Alt | | Alt | | |
95 * |BSPC|LOWER|------| |------|RAISE|Space|
96 * | | | LGUI | | LGUI | | |
97 * `-----------------' `------------------'
98 */
99[_DVORAK] = LAYOUT_ergodox(
100 // left hand
101 KC_MINUS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC,
102 KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_LBRACKET,
103 KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I,
104 KC_LSPO, KC_SCOLON, KC_Q, KC_J, KC_K, KC_X, KC_FN1,
105 TG(_NUM), KC_LCTL, KC_LALT, KC_LGUI, LOWER,
106
107 KC_MPLY, TG(_MOUSE),
108 KC_LALT,
109 KC_BSPACE, LOWER, KC_LGUI,
110
111 // right hand
112 KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQUAL,
113 KC_RBRACKET, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPACE,
114 KC_D, KC_H, KC_T, KC_N, KC_S, LT(MOUSE, KC_SLSH),
115 KC_FN1, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENTER,
116 RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,
117
118 TG(_NUM), TG(_MOUSE),
119 KC_LALT,
120 KC_LGUI, RAISE, KC_SPACE
121),
122
123/* Keymap 0: Basic Workman layer
124 *
125 * ,---------------------------------------------. ,--------------------------------------------.
126 * | - | 1 | 2 | 3 | 4 | 5 | Esc | | Esc | 6 | 7 | 8 | 9 | 0 | = |
127 * |--------+-----+-----+-----+-----+------------| |------+-----+-----+-----+-----+-----+--------|
128 * | Tab | Q | D | R | W | B | [{ | | ]} | J | F | U | P | ; | BSPC |
129 * |--------+-----+-----+-----+-----+-----| | | |-----+-----+-----+-----+-----+--------|
130 * | ESC | A | S | H | T | G |------| |------| Y | N | E | O | I | '" |
131 * |--------+-----+-----+-----+-----+-----| L1 | | L1 |-----+-----+-----+-----+-----+--------|
132 * | LShift | Z | X | M | C | V | | | | K | L | , | . | / | Enter |
133 * `--------+-----+-----+-----+-----+------------' `------------+-----+-----+-----+-----+--------'
134 * | Num |Ctrl | Alt |LGUI |Lower| |Raise|Left |Down | Up |Right |
135 * `------------------------------' `------------------------------'
136 * ,------------. ,------------.
137 * |Play |Mouse | | Num |Mouse|
138 * ,----|-----|------| |------+-----+-----.
139 * | | | Alt | | Alt | | |
140 * |BSPC|LOWER|------| |------|RAISE|Space|
141 * | | | LGUI | | LGUI | | |
142 * `-----------------' `------------------'
143 */
144[_WORKMAN] = LAYOUT_ergodox(
145 // left hand
146 KC_MINUS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC,
147 KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_LBRACKET,
148 KC_ESC, KC_A, KC_S, KC_H, KC_T, KC_G,
149 KC_LSPO, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_FN1,
150 TG(_NUM), KC_LCTL, KC_LALT, KC_LGUI, LOWER,
151
152 KC_MPLY, TG(_MOUSE),
153 KC_LALT,
154 KC_BSPACE, LOWER, KC_LGUI,
155
156 // right hand
157 KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQUAL,
158 KC_RBRACKET, KC_J, KC_F, KC_U, KC_P, KC_SCOLON, KC_BSPACE,
159 KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOTE,
160 KC_FN1, KC_K, KC_L, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), KC_ENTER,
161 RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,
162
163 NUM, TG(_MOUSE),
164 KC_LALT,
165 KC_LGUI, RAISE, KC_SPACE
166),
167
168/* Lower
169 *
170 * ,---------------------------------------------------. ,--------------------------------------------------.
171 * | Version | F1 | F2 | F3 | F4 | F5 | F11 | | F12 | F6 | F7 | F8 | F9 | F10 | |
172 * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------|
173 * | ~ | ! | @ | # | $ | % | | | | ^ | & | * | ( | ) | |
174 * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------|
175 * | Del | F1 | F2 | F3 | F4 | F5 |------| |------| F6 | _ | + | { | } | | |
176 * |---------+------+------+------+------+------| L2 | | L2 |------+------+------+------+------+--------|
177 * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO ~ |ISO | | Home | End | |
178 * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
179 * | | | | | | | | Next | Vol- | Vol+ | Play |
180 * `-----------------------------------' `----------------------------------'
181 * ,-------------. ,-------------.
182 * |Animat| | |Toggle|Solid |
183 * ,------|------|------| |------+------+------.
184 * |Bright|Bright| | | |Hue- |Hue+ |
185 * |ness- |ness+ |------| |------| | |
186 * | | | | | | | |
187 * `--------------------' `--------------------'
188 */
189[_LOWER] = LAYOUT_ergodox(
190 // left hand
191 VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11,
192 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______,
193 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5,
194 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______,
195 _______, _______, _______, _______, _______,
196
197 _______, _______,
198 _______,
199 _______, _______, _______,
200
201 // right hand
202 KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
203 _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,
204 KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
205 _______, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______,
206 _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY,
207
208 _______, _______,
209 _______,
210 _______, _______, _______
211),
212
213/* Raise
214 *
215 * ,---------------------------------------------------. ,--------------------------------------------------.
216 * | Version | F1 | F2 | F3 | F4 | F5 | F11 | | F12 | F6 | F7 | F8 | F9 | F10 | F11 |
217 * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------|
218 * | ` | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | |
219 * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------|
220 * | Del | F1 | F2 | F3 | F4 | F5 |------| |------| F6 | - | = | [ | ] | \ |
221 * |---------+------+------+------+------+------| L2 | | L2 |------+------+------+------+------+--------|
222 * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO # |ISO / |Pg Up |Pg Dn | |
223 * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
224 * | | | | | | | | Next | Vol- | Vol+ | Play |
225 * `-----------------------------------' `----------------------------------'
226 * ,-------------. ,-------------.
227 * |Animat| | |Toggle|Solid |
228 * ,------|------|------| |------+------+------.
229 * |Bright|Bright| | | |Hue- |Hue+ |
230 * |ness- |ness+ |------| |------| | |
231 * | | | | | | | |
232 * `--------------------' `--------------------'
233 */
234[_RAISE] = LAYOUT_ergodox(
235 // left hand
236 VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11,
237 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, _______,
238 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5,
239 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______,
240 _______, _______, _______, _______, _______,
241
242 _______, _______,
243 _______,
244 _______, _______, _______,
245
246 // right hand
247 KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
248 _______, KC_6, KC_7, KC_8, KC_9, KC_0, _______,
249 KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
250 _______, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______,
251 _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY,
252
253 _______, _______,
254 _______,
255 _______, _______, _______
256),
257
258/* Adjust
259 *
260 * ,--------------------------------------------------. ,--------------------------------------------------.
261 * |Version | | | | | | | | | | | | | | |
262 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
263 * | |Reset |Debug | | | | | | | |TRM on|TRMoff| | | Del |
264 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
265 * | | | | | |AG Nrm|------| |------|AG Swp|QWERTY|Wrkman|Dvorak| | |
266 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
267 * | | | | | | | | | | | | Prev | Next | | |
268 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
269 * | | | | | | |VolUp |VolDn | Mute | | |
270 * `----------------------------------' `----------------------------------'
271 * ,-------------. ,-------------.
272 * | | | | | |
273 * ,------|------|------| |------+------+------.
274 * | | | | | | | |
275 * | | |------| |------| | |
276 * | | | | | | | |
277 * `--------------------' `--------------------'
278 */
279[_ADJUST] = LAYOUT_ergodox(
280 // left hand
281 VRSN, _______, _______, _______, _______, _______, _______,
282 _______, RESET, DEBUG, _______, _______, _______, _______,
283 _______, _______, _______, _______, _______, AG_NORM,
284 _______, _______, _______, _______, _______, _______, _______,
285 _______, _______, _______, _______, _______,
286
287 _______, _______,
288 _______,
289 _______, _______, _______,
290
291 // right hand
292 _______, _______, _______, _______, _______, _______, _______,
293 _______, _______, TERM_ON, TERM_OFF, _______, _______, KC_DEL,
294 AG_SWAP, QWERTY, WORKMAN, DVORAK, _______, _______,
295 _______, _______, _______, _______, _______, _______, _______,
296 _______, _______, _______, _______, _______,
297
298 _______, _______,
299 _______,
300 _______, _______, _______
301),
302
303/* Keymap 2: Media and mouse keys
304 *
305 * ,--------------------------------------------------. ,--------------------------------------------------.
306 * | | | | | | | | | | | | | | | |
307 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
308 * | | | Lclk | MsUp | Rclk |Wh Up | | | | | | | | | |
309 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
310 * | | |MsLeft|MsDown|MsRght|Wh Dn |------| |------| | | | | | Play |
311 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
312 * | | | | | | | | | | | | Prev | Next | | |
313 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
314 * | | | | | | |VolUp |VolDn | Mute | | |
315 * `----------------------------------' `----------------------------------'
316 * ,-------------. ,-------------.
317 * | | | | | |
318 * ,------|------|------| |------+------+------.
319 * | | | | | |Brwser|Brwser|
320 * | Lclk | Rclk |------| |------|Back |Fwd |
321 * | | | | | | | |
322 * `--------------------' `--------------------'
323 */
324// MOUSE
325[_MOUSE] = LAYOUT_ergodox(
326 // left hand
327 _______, _______, _______, _______, _______, _______, _______,
328 _______, _______, KC_BTN2, KC_MS_U, KC_BTN1, KC_WH_D, _______,
329 _______, _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U,
330 _______, _______, KC_WH_L, KC_BTN3, KC_WH_R, _______, TO(_GAME),
331 _______, _______, _______, _______, _______,
332
333 _______, _______,
334 KC_WH_D,
335 KC_BTN1, KC_BTN2, KC_WH_U,
336
337 // right hand
338 _______, _______, _______, _______, _______, _______, _______,
339 _______, _______, _______, _______, _______, _______, _______,
340 _______, _______, _______, _______, _______, KC_MPLY,
341 TO(_GAME), _______, _______, KC_MPRV, KC_MNXT, _______, _______,
342 KC_VOLU, KC_VOLD, KC_MUTE, _______, _______,
343
344 _______, _______,
345 _______,
346 _______, KC_WBAK, KC_WFWD
347),
348
349/* Keymap 2: GAME
350 *
351 * ,--------------------------------------------------. ,--------------------------------------------------.
352 * | | | | | | | | | | | | | | | |
353 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
354 * | | | Lclk | MsUp | Rclk | | | | | | | | | | |
355 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
356 * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
357 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
358 * | | | | | | | | | | | | Prev | Next | | |
359 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
360 * | | | | | | |VolUp |VolDn | Mute | | |
361 * `----------------------------------' `----------------------------------'
362 * ,-------------. ,-------------.
363 * | | | | | |
364 * ,------|------|------| |------+------+------.
365 * | | | | | |Brwser|Brwser|
366 * | Lclk | Rclk |------| |------|Back |Fwd |
367 * | | | | | | | |
368 * `--------------------' `--------------------'
369 */
370[_GAME] = LAYOUT_ergodox(
371 // left hand
372 _______, _______, _______, _______, _______, _______, _______,
373 _______, _______, _______, _______, _______, _______, _______,
374 _______, _______, _______, _______, _______, _______,
375 _______, _______, _______, _______, _______, _______, _______,
376 _______, _______, _______, _______, _______,
377
378 _______, _______,
379 _______,
380 KC_SPACE, KC_LGUI, KC_LALT,
381
382 // right hand
383 _______, _______, _______, _______, _______, _______, _______,
384 _______, _______, _______, _______, _______, _______, _______,
385 _______, _______, _______, _______, _______, _______,
386 _______, _______, _______, _______, _______, _______, _______,
387 _______, _______, _______, _______, _______,
388
389 TG(_MOUSE), TG(_NUM),
390 _______,
391 _______, _______, _______
392),
393
394
395/* Keymap 2: NUMPAD
396 *
397 * ,--------------------------------------------------. ,--------------------------------------------------.
398 * | | F1 | F2 | F3 | F4 | F5 | F11 | | F12 | F6 | F7 | F8 | F9 | F10 | |
399 * |--------+------+------+------+------+------+------| |------+------+------+------+------+------+--------|
400 * | | ! | @ | { | } | | | | | | | 7 | 8 | 9 | * | |
401 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
402 * | | # | $ | ( | ) | ` |------| |------| | 4 | 5 | 6 | + | |
403 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
404 * | | % | ^ | [ | ] | ~ | | | | | 1 | 2 | 3 | \ | |
405 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
406 * | | | | | | | . | 0 | 0 | = | |
407 * `----------------------------------' `----------------------------------'
408 * ,-------------. ,-------------.
409 * | | | | | |
410 * ,------|------|------| |------+------+------.
411 * | | | | | | | |
412 * | | |------| |------| | |
413 * | | | | | | | |
414 * `--------------------' `--------------------'
415 */
416[_NUM] = LAYOUT_ergodox(
417 // left hand
418 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11,
419 _______, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, _______,
420 _______, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRV,
421 _______, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, _______,
422 _______, _______, _______, _______, _______,
423
424 _______, _______,
425 _______,
426 _______, _______, _______,
427
428 // right hand
429 KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
430 _______, _______, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_ASTERISK, _______,
431 _______, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_PLUS, _______,
432 _______, _______, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_SLASH, _______,
433 KC_KP_DOT, KC_KP_0, KC_KP_0, KC_KP_EQUAL, _______,
434
435 _______, _______,
436 _______,
437 _______, _______, _______
438),
439
440};
441
442const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
443{
444 // MACRODOWN only works in this function
445 switch(id) {
446 case 0:
447 if (record->event.pressed) {
448 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
449 }
450 break;
451 case 1:
452 if (record->event.pressed) { // For resetting EEPROM
453 eeconfig_init();
454 }
455 break;
456 }
457 return MACRO_NONE;
458};
459
460bool process_record_user(uint16_t keycode, keyrecord_t *record) {
461 switch (keycode) {
462 case QWERTY:
463 if (record->event.pressed) {
464 print("mode just switched to qwerty and this is a huge string\n");
465 set_single_persistent_default_layer(_QWERTY);
466 }
467 return false;
468 break;
469 case WORKMAN:
470 if (record->event.pressed) {
471 set_single_persistent_default_layer(_WORKMAN);
472 }
473 return false;
474 break;
475 case DVORAK:
476 if (record->event.pressed) {
477 set_single_persistent_default_layer(_DVORAK);
478 }
479 return false;
480 break;
481 case LOWER:
482 if (record->event.pressed) {
483 layer_on(_LOWER);
484 update_tri_layer(_LOWER, _RAISE, _ADJUST);
485 if (IS_LAYER_ON(_ADJUST)) {
486 layer_off(_LOWER);
487 layer_off(_RAISE);
488 }
489 } else {
490 layer_off(_LOWER);
491 if (IS_LAYER_ON(_ADJUST)) {
492 layer_off(_ADJUST);
493 layer_on(_RAISE);
494 }
495 }
496 return false;
497 break;
498 case RAISE:
499 if (record->event.pressed) {
500 layer_on(_RAISE);
501 update_tri_layer(_LOWER, _RAISE, _ADJUST);
502 if (IS_LAYER_ON(_ADJUST)) {
503 layer_off(_RAISE);
504 layer_off(_LOWER);
505 }
506 } else {
507 layer_off(_RAISE);
508 if (IS_LAYER_ON(_ADJUST)) {
509 layer_off(_ADJUST);
510 layer_on(_LOWER);
511 }
512 }
513 return false;
514 break;
515 case EPRM:
516 if (record->event.pressed) {
517 eeconfig_init();
518 }
519 return false;
520 break;
521 case VRSN:
522 if (record->event.pressed) {
523 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
524 }
525 return false;
526 break;
527 case RGB_SLD:
528 if (record->event.pressed) {
529 #ifdef RGBLIGHT_ENABLE
530 rgblight_mode(1);
531 #endif
532 }
533 return false;
534 break;
535 }
536 return true;
537}
538
539/**
540 * Runs just one time when the keyboard initializes.
541 */
542void matrix_init_user(void) {
543
544};
545
546/**
547 * Runs constantly in the background, in a loop.
548 */
549void matrix_scan_user(void) {
550 uint8_t layer = biton32(layer_state);
551
552 ergodox_board_led_off();
553 ergodox_right_led_1_off();
554 ergodox_right_led_2_off();
555 ergodox_right_led_3_off();
556
557 switch (layer) {
558 case _LOWER:
559 ergodox_right_led_1_on();
560 break;
561 case _RAISE:
562 ergodox_right_led_2_on();
563 break;
564 case _ADJUST:
565 ergodox_right_led_3_on();
566 break;
567 }
568};
diff --git a/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.c b/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.c
new file mode 100644
index 000000000..034f15270
--- /dev/null
+++ b/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.c
@@ -0,0 +1,345 @@
1/*
2Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18/**
19 * Currently we are assuming that both the backlight and LCD are enabled
20 * But it's entirely possible to write a custom visualizer that use only
21 * one of them
22 */
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 "default_animations.h"
37
38static const uint32_t logo_background_color = LCD_COLOR(0, 0, 255);
39static const uint32_t initial_color = LCD_COLOR(84, 255, 255);
40
41static const uint32_t led_emulation_colors[4] = {
42 LCD_COLOR(0, 0, 255),
43 LCD_COLOR(141, 255, 255),
44 LCD_COLOR(18, 255, 255),
45 LCD_COLOR(194, 255, 255),
46};
47
48static uint32_t next_led_target_color = 0;
49
50typedef enum {
51 LCD_STATE_INITIAL,
52 LCD_STATE_LAYER_BITMAP,
53 LCD_STATE_BITMAP_AND_LEDS,
54} lcd_state_t;
55
56static lcd_state_t lcd_state = LCD_STATE_INITIAL;
57
58typedef 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 */
68static 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
81static 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
88bool 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
96static 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 */
107static 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
114static 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
121void 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
133static inline bool is_led_on(visualizer_user_data_t* user_data, uint8_t num) {
134 return user_data->led_on & (1u << num);
135}
136
137static 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
146static 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
159static 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
170static 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
182static 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 }
229}
230
231static 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
242 lcd_state = LCD_STATE_BITMAP_AND_LEDS;
243 /**
244 * For information:
245 * The logic in this function makes sure that this doesn't happen, but if you call start on an
246 * animation that is already playing it will be restarted.
247 */
248 start_keyframe_animation(&lcd_bitmap_leds_animation);
249 }
250 } else {
251 if (
252 lcd_state != LCD_STATE_LAYER_BITMAP ||
253 state->status.layer != prev_status->layer ||
254 state->status.default_layer != prev_status->default_layer
255 ) {
256 stop_keyframe_animation(&lcd_bitmap_leds_animation);
257
258 lcd_state = LCD_STATE_LAYER_BITMAP;
259 start_keyframe_animation(&lcd_bitmap_animation);
260 }
261 }
262}
263
264void 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
279void 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
287void 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
294void ergodox_board_led_on(void){
295 // No board led support
296}
297
298void ergodox_right_led_1_on(void){
299 user_data_keyboard.led_on |= (1u << 0);
300 visualizer_set_user_data(&user_data_keyboard);
301}
302
303void ergodox_right_led_2_on(void){
304 user_data_keyboard.led_on |= (1u << 1);
305 visualizer_set_user_data(&user_data_keyboard);
306}
307
308void ergodox_right_led_3_on(void){
309 user_data_keyboard.led_on |= (1u << 2);
310 visualizer_set_user_data(&user_data_keyboard);
311}
312
313void ergodox_board_led_off(void){
314 // No board led support
315}
316
317void ergodox_right_led_1_off(void){
318 user_data_keyboard.led_on &= ~(1u << 0);
319 visualizer_set_user_data(&user_data_keyboard);
320}
321
322void ergodox_right_led_2_off(void){
323 user_data_keyboard.led_on &= ~(1u << 1);
324 visualizer_set_user_data(&user_data_keyboard);
325}
326
327void ergodox_right_led_3_off(void){
328 user_data_keyboard.led_on &= ~(1u << 2);
329 visualizer_set_user_data(&user_data_keyboard);
330}
331
332void ergodox_right_led_1_set(uint8_t n) {
333 user_data_keyboard.led1 = n;
334 visualizer_set_user_data(&user_data_keyboard);
335}
336
337void ergodox_right_led_2_set(uint8_t n) {
338 user_data_keyboard.led2 = n;
339 visualizer_set_user_data(&user_data_keyboard);
340}
341
342void ergodox_right_led_3_set(uint8_t n) {
343 user_data_keyboard.led3 = n;
344 visualizer_set_user_data(&user_data_keyboard);
345}