aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/planck/keymaps/jimmysjolund/config.h49
-rw-r--r--keyboards/planck/keymaps/jimmysjolund/keymap.c367
-rw-r--r--keyboards/planck/keymaps/jimmysjolund/readme.md2
-rw-r--r--keyboards/planck/keymaps/jimmysjolund/rules.mk1
4 files changed, 419 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/jimmysjolund/config.h b/keyboards/planck/keymaps/jimmysjolund/config.h
new file mode 100644
index 000000000..5606510d4
--- /dev/null
+++ b/keyboards/planck/keymaps/jimmysjolund/config.h
@@ -0,0 +1,49 @@
1/* Copyright 2021 Jimmy Sjölund
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#pragma once
18
19#ifdef AUDIO_ENABLE
20 #define STARTUP_SONG SONG(PLANCK_SOUND)
21 // #define STARTUP_SONG SONG(NO_SOUND)
22
23 #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
24 SONG(COLEMAK_SOUND), \
25 SONG(DVORAK_SOUND) \
26 }
27#endif
28
29/*
30 * MIDI options
31 */
32
33/* enable basic MIDI features:
34 - MIDI notes can be sent when in Music mode is on
35*/
36
37#define MIDI_BASIC
38
39/* enable advanced MIDI features:
40 - MIDI notes can be added to the keymap
41 - Octave shift and transpose
42 - Virtual sustain, portamento, and modulation wheel
43 - etc.
44*/
45//#define MIDI_ADVANCED
46
47// Most tactile encoders have detents every 4 stages
48#define ENCODER_RESOLUTION 4
49
diff --git a/keyboards/planck/keymaps/jimmysjolund/keymap.c b/keyboards/planck/keymaps/jimmysjolund/keymap.c
new file mode 100644
index 000000000..6b89b9954
--- /dev/null
+++ b/keyboards/planck/keymaps/jimmysjolund/keymap.c
@@ -0,0 +1,367 @@
1/* Copyright 2015-2017 Jack Humbert
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#include QMK_KEYBOARD_H
18#include "muse.h"
19
20
21enum planck_layers {
22 _QWERTY,
23 _COLEMAK,
24 _DVORAK,
25 _LOWER,
26 _RAISE,
27 _PLOVER,
28 _ADJUST
29};
30
31enum planck_keycodes {
32 QWERTY = SAFE_RANGE,
33 COLEMAK,
34 DVORAK,
35 PLOVER,
36 BACKLIT,
37 EXT_PLV
38};
39
40#define LOWER MO(_LOWER)
41#define RAISE MO(_RAISE)
42
43const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
44
45/* Qwerty - Original
46 * ,-----------------------------------------------------------------------------------.
47 * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
48 * |------+------+------+------+------+-------------+------+------+------+------+------|
49 * | Esc | A | S | D | F | G | H | J | K | L | ; | " |
50 * |------+------+------+------+------+------|------+------+------+------+------+------|
51 * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
52 * |------+------+------+------+------+------+------+------+------+------+------+------|
53 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
54 * `-----------------------------------------------------------------------------------'
55 */
56/* Qwerty - jimmysjolund 2021-09-22
57 * ,-----------------------------------------------------------------------------------.
58 * | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp |
59 * |------+------+------+------+------+-------------+------+------+------+------+------|
60 * | Tab | A | S | D | F | G | H | J | K | L | ; | " |
61 * |------+------+------+------+------+------|------+------+------+------+------+------|
62 * | Shift| Z | X | C | V | B | N | M | , | . | / |Shift |
63 * |------+------+------+------+------+------+------+------+------+------+------+------|
64 * | Del | Ctrl | GUI | Alt |Lower |Raise |Enter |Space |AltGr | Down | Up |Enter |
65 * `-----------------------------------------------------------------------------------'
66 */
67
68[_QWERTY] = LAYOUT_planck_grid(
69 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
70 KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
71 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
72 KC_DEL, KC_LCTL, KC_LGUI, KC_LALT, LOWER, RAISE, KC_ENT, KC_SPC, KC_ALGR, KC_DOWN, KC_UP, KC_ENT
73),
74
75/* Colemak Original
76 * ,-----------------------------------------------------------------------------------.
77 * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
78 * |------+------+------+------+------+-------------+------+------+------+------+------|
79 * | Esc | A | R | S | T | D | H | N | E | I | O | " |
80 * |------+------+------+------+------+------|------+------+------+------+------+------|
81 * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
82 * |------+------+------+------+------+------+------+------+------+------+------+------|
83 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
84 * `-----------------------------------------------------------------------------------'
85 */
86/* Colemak jimmysjolund
87 * ,-----------------------------------------------------------------------------------.
88 * | Esc | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
89 * |------+------+------+------+------+-------------+------+------+------+------+------|
90 * | Tab | A | R | S | T | D | H | N | E | I | O | " |
91 * |------+------+------+------+------+------|------+------+------+------+------+------|
92 * | Shift| Z | X | C | V | B | K | M | , | . | / |Shift |
93 * |------+------+------+------+------+------+------+------+------+------+------+------|
94 * | Del | Ctrl | GUI | Alt |Lower |Raise |Enter |Space |AltGr | Down | Up |Enter |
95 * `-----------------------------------------------------------------------------------'
96 */
97[_COLEMAK] = LAYOUT_planck_grid(
98 KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
99 KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
100 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
101 KC_DEL, KC_LCTL, KC_LGUI, KC_LALT, LOWER, RAISE, KC_ENT, KC_SPC, KC_ALGR, KC_DOWN, KC_UP, KC_ENT
102),
103
104/* Dvorak
105 * ,-----------------------------------------------------------------------------------.
106 * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
107 * |------+------+------+------+------+-------------+------+------+------+------+------|
108 * | Esc | A | O | E | U | I | D | H | T | N | S | / |
109 * |------+------+------+------+------+------|------+------+------+------+------+------|
110 * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
111 * |------+------+------+------+------+------+------+------+------+------+------+------|
112 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
113 * `-----------------------------------------------------------------------------------'
114 */
115[_DVORAK] = LAYOUT_planck_grid(
116 KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC,
117 KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH,
118 KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT ,
119 BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
120),
121
122/* Lower
123 * ,-----------------------------------------------------------------------------------.
124 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
125 * |------+------+------+------+------+-------------+------+------+------+------+------|
126 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
127 * |------+------+------+------+------+------|------+------+------+------+------+------|
128 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | |
129 * |------+------+------+------+------+------+------+------+------+------+------+------|
130 * | | | | | | | | Left | Down | Up |Right |
131 * `-----------------------------------------------------------------------------------'
132 */
133[_LOWER] = LAYOUT_planck_grid(
134 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
135 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
136 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______,
137 _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
138),
139
140/* Raise
141 * ,-----------------------------------------------------------------------------------.
142 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
143 * |------+------+------+------+------+-------------+------+------+------+------+------|
144 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
145 * |------+------+------+------+------+------|------+------+------+------+------+------|
146 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | |
147 * |------+------+------+------+------+------+------+------+------+------+------+------|
148 * | | | | | | | | Next | Vol- | Vol+ | Play |
149 * `-----------------------------------------------------------------------------------'
150 */
151[_RAISE] = LAYOUT_planck_grid(
152 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
153 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
154 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______,
155 _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
156),
157
158
159/* Plover layer (http://opensteno.org)
160 * ,-----------------------------------------------------------------------------------.
161 * | # | # | # | # | # | # | # | # | # | # | # | # |
162 * |------+------+------+------+------+-------------+------+------+------+------+------|
163 * | | S | T | P | H | * | * | F | P | L | T | D |
164 * |------+------+------+------+------+------|------+------+------+------+------+------|
165 * | | S | K | W | R | * | * | R | B | G | S | Z |
166 * |------+------+------+------+------+------+------+------+------+------+------+------|
167 * | Exit | | | A | O | | E | U | | | |
168 * `-----------------------------------------------------------------------------------'
169 */
170[_PLOVER] = LAYOUT_planck_grid(
171 KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 ,
172 XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,
173 XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
174 EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX
175),
176
177/* Adjust (Lower + Raise)
178 * ,-----------------------------------------------------------------------------------.
179 * | | Reset| | | | | | | | | | Del |
180 * |------+------+------+------+------+-------------+------+------+------+------+------|
181 * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| |
182 * |------+------+------+------+------+------|------+------+------+------+------+------|
183 * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
184 * |------+------+------+------+------+------+------+------+------+------+------+------|
185 * | | | | | | | | | | | |
186 * `-----------------------------------------------------------------------------------'
187 */
188[_ADJUST] = LAYOUT_planck_grid(
189 _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
190 _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______,
191 _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
192 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
193)
194
195};
196
197#ifdef AUDIO_ENABLE
198 float plover_song[][2] = SONG(PLOVER_SOUND);
199 float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
200#endif
201
202layer_state_t layer_state_set_user(layer_state_t state) {
203 return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
204}
205
206bool process_record_user(uint16_t keycode, keyrecord_t *record) {
207 switch (keycode) {
208 case QWERTY:
209 if (record->event.pressed) {
210 print("mode just switched to qwerty and this is a huge string\n");
211 set_single_persistent_default_layer(_QWERTY);
212 }
213 return false;
214 break;
215 case COLEMAK:
216 if (record->event.pressed) {
217 set_single_persistent_default_layer(_COLEMAK);
218 }
219 return false;
220 break;
221 case DVORAK:
222 if (record->event.pressed) {
223 set_single_persistent_default_layer(_DVORAK);
224 }
225 return false;
226 break;
227 case BACKLIT:
228 if (record->event.pressed) {
229 register_code(KC_RSFT);
230 #ifdef BACKLIGHT_ENABLE
231 backlight_step();
232 #endif
233 #ifdef KEYBOARD_planck_rev5
234 PORTE &= ~(1<<6);
235 #endif
236 } else {
237 unregister_code(KC_RSFT);
238 #ifdef KEYBOARD_planck_rev5
239 PORTE |= (1<<6);
240 #endif
241 }
242 return false;
243 break;
244 case PLOVER:
245 if (record->event.pressed) {
246 #ifdef AUDIO_ENABLE
247 stop_all_notes();
248 PLAY_SONG(plover_song);
249 #endif
250 layer_off(_RAISE);
251 layer_off(_LOWER);
252 layer_off(_ADJUST);
253 layer_on(_PLOVER);
254 if (!eeconfig_is_enabled()) {
255 eeconfig_init();
256 }
257 keymap_config.raw = eeconfig_read_keymap();
258 keymap_config.nkro = 1;
259 eeconfig_update_keymap(keymap_config.raw);
260 }
261 return false;
262 break;
263 case EXT_PLV:
264 if (record->event.pressed) {
265 #ifdef AUDIO_ENABLE
266 PLAY_SONG(plover_gb_song);
267 #endif
268 layer_off(_PLOVER);
269 }
270 return false;
271 break;
272 }
273 return true;
274}
275
276bool muse_mode = false;
277uint8_t last_muse_note = 0;
278uint16_t muse_counter = 0;
279uint8_t muse_offset = 70;
280uint16_t muse_tempo = 50;
281
282bool encoder_update_user(uint8_t index, bool clockwise) {
283 if (muse_mode) {
284 if (IS_LAYER_ON(_RAISE)) {
285 if (clockwise) {
286 muse_offset++;
287 } else {
288 muse_offset--;
289 }
290 } else {
291 if (clockwise) {
292 muse_tempo+=1;
293 } else {
294 muse_tempo-=1;
295 }
296 }
297 } else {
298 if (clockwise) {
299 #ifdef MOUSEKEY_ENABLE
300 tap_code(KC_MS_WH_DOWN);
301 #else
302 tap_code(KC_PGDN);
303 #endif
304 } else {
305 #ifdef MOUSEKEY_ENABLE
306 tap_code(KC_MS_WH_UP);
307 #else
308 tap_code(KC_PGUP);
309 #endif
310 }
311 }
312 return false;
313}
314
315bool dip_update_user(uint8_t index, bool active) {
316 switch (index) {
317 case 0:
318 if (active) {
319 #ifdef AUDIO_ENABLE
320 PLAY_SONG(plover_song);
321 #endif
322 layer_on(_ADJUST);
323 } else {
324 #ifdef AUDIO_ENABLE
325 PLAY_SONG(plover_gb_song);
326 #endif
327 layer_off(_ADJUST);
328 }
329 break;
330 case 1:
331 if (active) {
332 muse_mode = true;
333 } else {
334 muse_mode = false;
335 #ifdef AUDIO_ENABLE
336 stop_all_notes();
337 #endif
338 }
339 }
340 return false;
341}
342
343void matrix_scan_user(void) {
344 #ifdef AUDIO_ENABLE
345 if (muse_mode) {
346 if (muse_counter == 0) {
347 uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
348 if (muse_note != last_muse_note) {
349 stop_note(compute_freq_for_midi_note(last_muse_note));
350 play_note(compute_freq_for_midi_note(muse_note), 0xF);
351 last_muse_note = muse_note;
352 }
353 }
354 muse_counter = (muse_counter + 1) % muse_tempo;
355 }
356 #endif
357}
358
359bool music_mask_user(uint16_t keycode) {
360 switch (keycode) {
361 case RAISE:
362 case LOWER:
363 return false;
364 default:
365 return true;
366 }
367}
diff --git a/keyboards/planck/keymaps/jimmysjolund/readme.md b/keyboards/planck/keymaps/jimmysjolund/readme.md
new file mode 100644
index 000000000..de9680b49
--- /dev/null
+++ b/keyboards/planck/keymaps/jimmysjolund/readme.md
@@ -0,0 +1,2 @@
1# The Default Planck Layout
2
diff --git a/keyboards/planck/keymaps/jimmysjolund/rules.mk b/keyboards/planck/keymaps/jimmysjolund/rules.mk
new file mode 100644
index 000000000..dcf16bef3
--- /dev/null
+++ b/keyboards/planck/keymaps/jimmysjolund/rules.mk
@@ -0,0 +1 @@
SRC += muse.c