diff options
author | Joel Elkins <joel@elkins.co> | 2021-06-02 15:59:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-03 06:59:52 +1000 |
commit | 35dbe8ba035c8eefc1051226aa8e3dd7cd63a912 (patch) | |
tree | f152e98a0953238771853d1462a26e10d3540633 /keyboards/planck | |
parent | 93496c8364369f72e2db90c3c59dfa3ecc8657b4 (diff) | |
download | qmk_firmware-35dbe8ba035c8eefc1051226aa8e3dd7cd63a912.tar.gz qmk_firmware-35dbe8ba035c8eefc1051226aa8e3dd7cd63a912.zip |
[Keymap] merge jdelkins userspace and associated keymaps (#11276)
* [Keymap] merge jdelkins userspace and associated keymaps
* Add copyright & license info
* Change rgblight_config.enable to rgblight_is_enabled()
* Update keyboards/dz60/keymaps/jdelkins/keymap.c
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Update keyboards/dz60/keymaps/jdelkins/keymap.c
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Update keyboards/dz60/keymaps/jdelkins/keymap.c
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Remove superfluous includes
* Change EXTRAFLAGS+=-flto to LTO_ENABLE=yes
* Remove unnecessary jdelkins_ss symlink in users
* Add copyright and license notices
* Use preferred way to determine capslock / numlock state
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Add #pragma once to a header
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Include QMK_KEYBOARD_H only once, in userspace header
* Remove unnecessary initialization in matrix_init_keymap
* Do process_record_keymap before cases handled in process_record_user
* Reorganize & simplify secrets feature enablement
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove superfluous break
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove copyright from rules.mk
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove copyright from rules.mk
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* include "print.h" instead of <print.h>
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_cod16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove copyright from rules.mk
Co-authored-by: Ryan <fauxpark@gmail.com>
* add #pragma once to a header
Co-authored-by: Ryan <fauxpark@gmail.com>
* include "print.h" instead of <print.h>
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove copyright from rules.mk
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove copyright from rules.mk
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove copyright from rules.mk
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use :flash target where possible
* Remove special case flash target and use PROGRAM_CMD
* dz60/jdelkins_ss: use tap_code16
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/planck')
-rw-r--r-- | keyboards/planck/keymaps/jdelkins/config.h | 58 | ||||
-rw-r--r-- | keyboards/planck/keymaps/jdelkins/keymap.c | 423 | ||||
-rw-r--r-- | keyboards/planck/keymaps/jdelkins/readme.md | 13 | ||||
-rw-r--r-- | keyboards/planck/keymaps/jdelkins/rules.mk | 4 |
4 files changed, 498 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/jdelkins/config.h b/keyboards/planck/keymaps/jdelkins/config.h new file mode 100644 index 000000000..e09fafc66 --- /dev/null +++ b/keyboards/planck/keymaps/jdelkins/config.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* Copyright 2020 Joel Elkins | ||
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 | /* Prevent use of disabled MIDI features in the keymap */ | ||
34 | //#define MIDI_ENABLE_STRICT 1 | ||
35 | |||
36 | /* enable basic MIDI features: | ||
37 | - MIDI notes can be sent when in Music mode is on | ||
38 | */ | ||
39 | |||
40 | #define MIDI_BASIC | ||
41 | |||
42 | /* enable advanced MIDI features: | ||
43 | - MIDI notes can be added to the keymap | ||
44 | - Octave shift and transpose | ||
45 | - Virtual sustain, portamento, and modulation wheel | ||
46 | - etc. | ||
47 | */ | ||
48 | //#define MIDI_ADVANCED | ||
49 | |||
50 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
51 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
52 | |||
53 | // Most tactile encoders have detents every 4 stages | ||
54 | #define ENCODER_RESOLUTION 4 | ||
55 | |||
56 | #define AUTO_SHIFT_TIMEOUT 165 | ||
57 | #define LEADER_TIMEOUT 400 | ||
58 | #define LEADER_PER_KEY_TIMING | ||
diff --git a/keyboards/planck/keymaps/jdelkins/keymap.c b/keyboards/planck/keymaps/jdelkins/keymap.c new file mode 100644 index 000000000..3d109e9e8 --- /dev/null +++ b/keyboards/planck/keymaps/jdelkins/keymap.c | |||
@@ -0,0 +1,423 @@ | |||
1 | /* Copyright 2015-2017 Jack Humbert | ||
2 | * Portions Copyright 2020 Joel Elkins | ||
3 | * | ||
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 | ||
6 | * the Free Software Foundation, either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * 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/>. | ||
16 | */ | ||
17 | |||
18 | #include "jdelkins.h" | ||
19 | #include "muse.h" | ||
20 | |||
21 | #ifdef LAYOUT | ||
22 | #undef LAYOUT | ||
23 | #endif | ||
24 | #define LAYOUT LAYOUT_planck_2x2u | ||
25 | |||
26 | uint16_t bspc_timer; | ||
27 | |||
28 | enum { | ||
29 | MY_BSPC = USER_SAFE_RANGE, | ||
30 | BACKLIT, | ||
31 | }; | ||
32 | |||
33 | // recycle unused layers defined in my userspace | ||
34 | #define _RAISE _FUNC | ||
35 | #define _LOWER _SECRETS | ||
36 | |||
37 | #define KP MO(_KP) | ||
38 | #define LOWER MO(_LOWER) | ||
39 | #define RAISE MO(_RAISE) | ||
40 | |||
41 | int ctl_state = 0; | ||
42 | |||
43 | void ctl_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
44 | ctl_state = cur_dance(state); | ||
45 | switch (ctl_state) { | ||
46 | case SINGLE_TAP: qk_leader_start(); break; | ||
47 | case SINGLE_HOLD: register_code(KC_LCTL); break; | ||
48 | case DOUBLE_TAP: tap_code(KC_RCTL); break; | ||
49 | case DOUBLE_HOLD: register_code(KC_RCTL); break; | ||
50 | case TRIPLE_TAP: tap_code(KC_RCTL); tap_code(KC_RCTL); break; | ||
51 | case TRIPLE_HOLD: tap_code(KC_RCTL); register_code(KC_RCTL); break; | ||
52 | } | ||
53 | } | ||
54 | |||
55 | void ctl_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
56 | switch (ctl_state) { | ||
57 | case SINGLE_HOLD: unregister_code(KC_LCTL); break; | ||
58 | case DOUBLE_HOLD: | ||
59 | case TRIPLE_HOLD: unregister_code(KC_RCTL); break; | ||
60 | } | ||
61 | ctl_state = 0; | ||
62 | } | ||
63 | |||
64 | void g_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
65 | switch (cur_dance(state)) { | ||
66 | case SINGLE_TAP: | ||
67 | tap_code16(C(KC_END)); | ||
68 | break; | ||
69 | case DOUBLE_TAP: | ||
70 | tap_code16(C(KC_HOME)); | ||
71 | break; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | int kp_state = 0; | ||
76 | |||
77 | void kp_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
78 | kp_state = hold_cur_dance(state); | ||
79 | switch (kp_state) { | ||
80 | case SINGLE_HOLD: layer_on(_KP); break; | ||
81 | case DOUBLE_HOLD: layer_on(_RPT); break; | ||
82 | } | ||
83 | } | ||
84 | |||
85 | void kp_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
86 | switch (kp_state) { | ||
87 | case SINGLE_HOLD: layer_off(_KP); break; | ||
88 | case DOUBLE_HOLD: layer_off(_RPT); break; | ||
89 | } | ||
90 | kp_state = 0; | ||
91 | } | ||
92 | |||
93 | enum { | ||
94 | TD_LDCTL, | ||
95 | TD_G, | ||
96 | TD_KP | ||
97 | }; | ||
98 | |||
99 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
100 | [TD_LDCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctl_finished, ctl_reset), | ||
101 | [TD_G] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, g_finished, NULL), | ||
102 | [TD_KP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, kp_finished, kp_reset), | ||
103 | }; | ||
104 | |||
105 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
106 | |||
107 | /* Qwerty | ||
108 | * ,-----------------------------------------------------------------------------------. | ||
109 | * | Tab | Q | W | E | R | T | Y | U | I | O | P | ` | | ||
110 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
111 | * | Ctrl | A | S | D | F | G | H | J | K | L | ; | " | | ||
112 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
113 | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | | ||
114 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
115 | * | Ctrl | Gui | Alt |Keypad| Bksp | Space | Left | Down | Up |Right | | ||
116 | * `-----------------------------------------------------------------------------------' | ||
117 | */ | ||
118 | [_QWERTY] = LAYOUT( | ||
119 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_GRV, | ||
120 | KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | ||
121 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, | ||
122 | TD(TD_LDCTL), MO(_ADJUST), MY_GUI, MY_ALT, MY_BSPC, MY_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT | ||
123 | ), | ||
124 | |||
125 | [_GAME] = LAYOUT( | ||
126 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
127 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
128 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
129 | _______, KC_NO, KC_LALT, RAISE, KC_SPC, KC_SPC, _______, _______, _______, _______ | ||
130 | ), | ||
131 | |||
132 | [_RAISE] = LAYOUT( | ||
133 | KC_ESC, _______, FW_WRD, KB_EOL, _______, _______, KB_COPY, KC_PGUP, _______, KC_LPRN, KC_RPRN, KC_MINS, | ||
134 | _______, KB_BOL, _______, KC_PGDN, _______, TD(TD_G), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, KC_BSLS, | ||
135 | _______, _______, KC_DEL, _______, KB_PASTE, BK_WRD, _______, _______, _______, _______, _______, KC_CALC, | ||
136 | _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END | ||
137 | ), | ||
138 | |||
139 | /* Same as _QWERTY but disable autoshift */ | ||
140 | [_RPT] = LAYOUT( | ||
141 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
142 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
143 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
144 | _______, _______, _______, _______, KC_BSPC, KC_SPC, _______, _______, _______, _______ | ||
145 | ), | ||
146 | |||
147 | [_KP] = LAYOUT( | ||
148 | KC_NUMLOCK, KC_F9, KC_F10, KC_F11, KC_F12, KC_F13, KC_F14, KC_7, KC_8, KC_9, KC_MINS, KC_EQL, | ||
149 | _______, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX, XXXXXXX, KC_4, KC_5, KC_6, KC_ASTR, _______, | ||
150 | _______, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, KC_1, KC_2, KC_3, KC_SLSH, _______, | ||
151 | _______, _______, _______, _______, _______, _______, KC_0, KC_DOT, KC_PLUS, KC_END | ||
152 | ), | ||
153 | |||
154 | [_LOWER] = LAYOUT( | ||
155 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LBRC, KC_RBRC, KC_EQL, | ||
156 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LCBR, KC_RCBR, KC_PIPE, | ||
157 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_END, KC_MPLY, | ||
158 | _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT | ||
159 | ), | ||
160 | |||
161 | [_ADJUST] = LAYOUT( | ||
162 | _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL, | ||
163 | _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______, | ||
164 | _______, RGB_TOG, KB_MAKE, KB_FLSH, KB_VRSN, KB_BOOT, _______, TG_SYS, _______, _______, _______, _______, | ||
165 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
166 | ) | ||
167 | |||
168 | /* [_ADJUST] = LAYOUT( */ | ||
169 | /* _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , */ | ||
170 | /* _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, */ | ||
171 | /* _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, */ | ||
172 | /* _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ */ | ||
173 | /* ) */ | ||
174 | |||
175 | }; | ||
176 | |||
177 | #ifdef AUDIO_ENABLE | ||
178 | float plover_song[][2] = SONG(PLOVER_SOUND); | ||
179 | float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); | ||
180 | #endif | ||
181 | |||
182 | layer_state_t layer_state_set_keymap(layer_state_t state) { | ||
183 | if (layer_state_cmp(state, _GAME) || layer_state_cmp(state, _RPT)) | ||
184 | autoshift_disable(); | ||
185 | else | ||
186 | autoshift_enable(); | ||
187 | return update_tri_layer_state(state, _KP, _RAISE, _LOWER); | ||
188 | } | ||
189 | |||
190 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
191 | bool rc = true; | ||
192 | static bool bspc_del = false; | ||
193 | static bool bspc_initiated_func = false; | ||
194 | |||
195 | switch (keycode) { | ||
196 | case MY_BSPC: | ||
197 | if (record->event.pressed) { | ||
198 | if (IS_LAYER_ON(_KP)) { | ||
199 | // special case: if _KP was turned on by another key, | ||
200 | // treat this as KC_DEL and don't do anything else | ||
201 | bspc_del = true; | ||
202 | register_code(KC_DEL); | ||
203 | return false; | ||
204 | } else { | ||
205 | bspc_timer = timer_read(); | ||
206 | bspc_initiated_func = true; | ||
207 | layer_on(_KP); | ||
208 | } | ||
209 | } else { | ||
210 | if (bspc_del) { | ||
211 | // special case: if _KP was turned on by another key, | ||
212 | // treat this as KC_DEL and don't do anything else | ||
213 | unregister_code(KC_DEL); | ||
214 | bspc_del = false; | ||
215 | return false; | ||
216 | } | ||
217 | |||
218 | if (bspc_initiated_func) { | ||
219 | layer_off(_KP); | ||
220 | bspc_initiated_func = false; | ||
221 | } | ||
222 | |||
223 | if (bspc_timer > 0) { | ||
224 | // here the key was pressed and released before the timer | ||
225 | // expired, so treat as a backspace tap and pretend we | ||
226 | // never activated _KP | ||
227 | bspc_timer = 0; | ||
228 | tap_code(KC_BSPC); | ||
229 | } else { | ||
230 | // the timer went off, so KC_BSPC was registered in | ||
231 | // matrix_scan_keymap. unregister it now | ||
232 | unregister_code(KC_BSPC); | ||
233 | } | ||
234 | } | ||
235 | return false; // special case, return now without resetting timer | ||
236 | // other paths should set rc and break | ||
237 | break; | ||
238 | |||
239 | case BACKLIT: | ||
240 | if (record->event.pressed) { | ||
241 | register_code(KC_RSFT); | ||
242 | #ifdef BACKLIGHT_ENABLE | ||
243 | backlight_step(); | ||
244 | #endif | ||
245 | } else { | ||
246 | unregister_code(KC_RSFT); | ||
247 | } | ||
248 | rc = false; | ||
249 | break; | ||
250 | } | ||
251 | |||
252 | bspc_timer = 0; | ||
253 | return rc; | ||
254 | } | ||
255 | |||
256 | bool muse_mode = false; | ||
257 | uint8_t last_muse_note = 0; | ||
258 | uint16_t muse_counter = 0; | ||
259 | uint8_t muse_offset = 70; | ||
260 | uint16_t muse_tempo = 50; | ||
261 | |||
262 | void encoder_update(bool clockwise) { | ||
263 | if (muse_mode) { | ||
264 | if (IS_LAYER_ON(_RAISE)) { | ||
265 | if (clockwise) { | ||
266 | muse_offset++; | ||
267 | } else { | ||
268 | muse_offset--; | ||
269 | } | ||
270 | } else { | ||
271 | if (clockwise) { | ||
272 | muse_tempo+=1; | ||
273 | } else { | ||
274 | muse_tempo-=1; | ||
275 | } | ||
276 | } | ||
277 | } else { | ||
278 | if (clockwise) { | ||
279 | #ifdef MOUSEKEY_ENABLE | ||
280 | tap_code(KC_MS_WH_DOWN); | ||
281 | #else | ||
282 | tap_code(KC_PGDN); | ||
283 | #endif | ||
284 | } else { | ||
285 | #ifdef MOUSEKEY_ENABLE | ||
286 | tap_code(KC_MS_WH_UP); | ||
287 | #else | ||
288 | tap_code(KC_PGUP); | ||
289 | #endif | ||
290 | } | ||
291 | } | ||
292 | } | ||
293 | |||
294 | void dip_switch_update_user(uint8_t index, bool active) { | ||
295 | switch (index) { | ||
296 | case 0: { | ||
297 | #ifdef AUDIO_ENABLE | ||
298 | static bool play_sound = false; | ||
299 | #endif | ||
300 | if (active) { | ||
301 | #ifdef AUDIO_ENABLE | ||
302 | if (play_sound) { PLAY_SONG(plover_song); } | ||
303 | #endif | ||
304 | layer_on(_ADJUST); | ||
305 | } else { | ||
306 | #ifdef AUDIO_ENABLE | ||
307 | if (play_sound) { PLAY_SONG(plover_gb_song); } | ||
308 | #endif | ||
309 | layer_off(_ADJUST); | ||
310 | } | ||
311 | #ifdef AUDIO_ENABLE | ||
312 | play_sound = true; | ||
313 | #endif | ||
314 | break; | ||
315 | } | ||
316 | case 1: | ||
317 | if (active) { | ||
318 | muse_mode = true; | ||
319 | } else { | ||
320 | muse_mode = false; | ||
321 | } | ||
322 | } | ||
323 | } | ||
324 | |||
325 | void keyboard_post_init_keymap(void) { | ||
326 | bspc_timer = 0; | ||
327 | } | ||
328 | |||
329 | LEADER_EXTERNS(); | ||
330 | |||
331 | void matrix_scan_keymap(void) { | ||
332 | #ifdef AUDIO_ENABLE | ||
333 | if (muse_mode) { | ||
334 | if (muse_counter == 0) { | ||
335 | uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; | ||
336 | if (muse_note != last_muse_note) { | ||
337 | stop_note(compute_freq_for_midi_note(last_muse_note)); | ||
338 | play_note(compute_freq_for_midi_note(muse_note), 0xF); | ||
339 | last_muse_note = muse_note; | ||
340 | } | ||
341 | } | ||
342 | muse_counter = (muse_counter + 1) % muse_tempo; | ||
343 | } else { | ||
344 | if (muse_counter) { | ||
345 | stop_all_notes(); | ||
346 | muse_counter = 0; | ||
347 | } | ||
348 | } | ||
349 | #endif | ||
350 | // if MY_BSPC is held down too long, pretend like it wasn't and start | ||
351 | // pressing backspace | ||
352 | if (bspc_timer > 0 && timer_elapsed(bspc_timer) > LEADER_TIMEOUT) { | ||
353 | layer_off(_KP); | ||
354 | bspc_timer = 0; | ||
355 | register_code(KC_BSPC); | ||
356 | } | ||
357 | LEADER_DICTIONARY() { | ||
358 | leading = false; | ||
359 | leader_end(); | ||
360 | |||
361 | SEQ_ONE_KEY(KC_K) { | ||
362 | layer_invert(_KP); | ||
363 | } | ||
364 | SEQ_ONE_KEY(KC_G) { | ||
365 | layer_invert(_GAME); | ||
366 | } | ||
367 | SEQ_ONE_KEY(KC_KP_5) { | ||
368 | layer_invert(_KP); | ||
369 | } | ||
370 | SEQ_ONE_KEY(KC_5) { | ||
371 | layer_invert(_KP); | ||
372 | } | ||
373 | SEQ_TWO_KEYS(KC_SCLN, KC_1) { | ||
374 | send_secret_string(0); | ||
375 | } | ||
376 | SEQ_TWO_KEYS(KC_SCLN, KC_2) { | ||
377 | send_secret_string(1); | ||
378 | } | ||
379 | SEQ_TWO_KEYS(KC_SCLN, KC_3) { | ||
380 | send_secret_string(2); | ||
381 | } | ||
382 | SEQ_TWO_KEYS(KC_SCLN, KC_4) { | ||
383 | send_secret_string(3); | ||
384 | } | ||
385 | SEQ_TWO_KEYS(KC_SCLN, KC_5) { | ||
386 | send_secret_string(4); | ||
387 | } | ||
388 | SEQ_TWO_KEYS(KC_SCLN, KC_6) { | ||
389 | send_secret_string(5); | ||
390 | } | ||
391 | SEQ_TWO_KEYS(KC_SCLN, KC_M) { | ||
392 | send_secret_string(0); | ||
393 | } | ||
394 | SEQ_TWO_KEYS(KC_SCLN, KC_COMM) { | ||
395 | send_secret_string(1); | ||
396 | } | ||
397 | SEQ_TWO_KEYS(KC_SCLN, KC_DOT) { | ||
398 | send_secret_string(2); | ||
399 | } | ||
400 | SEQ_TWO_KEYS(KC_SCLN, KC_J) { | ||
401 | send_secret_string(3); | ||
402 | } | ||
403 | SEQ_TWO_KEYS(KC_SCLN, KC_K) { | ||
404 | send_secret_string(4); | ||
405 | } | ||
406 | SEQ_TWO_KEYS(KC_SCLN, KC_L) { | ||
407 | send_secret_string(5); | ||
408 | } | ||
409 | SEQ_ONE_KEY(KC_C) { | ||
410 | tap_code16(C(KC_C)); | ||
411 | } | ||
412 | } | ||
413 | } | ||
414 | |||
415 | bool music_mask_user(uint16_t keycode) { | ||
416 | switch (keycode) { | ||
417 | case RAISE: | ||
418 | case LOWER: | ||
419 | return false; | ||
420 | default: | ||
421 | return true; | ||
422 | } | ||
423 | } | ||
diff --git a/keyboards/planck/keymaps/jdelkins/readme.md b/keyboards/planck/keymaps/jdelkins/readme.md new file mode 100644 index 000000000..5149c7668 --- /dev/null +++ b/keyboards/planck/keymaps/jdelkins/readme.md | |||
@@ -0,0 +1,13 @@ | |||
1 | # jdelkins layout | ||
2 | |||
3 | Features: | ||
4 | |||
5 | - 2x2u layout with the split spaces both operating as layer keys | ||
6 | - No top row numbers; rely on a keypad layer | ||
7 | - My typical leader setup for toggling modes, accessing secrets, etc. | ||
8 | |||
9 | |||
10 | # TODO | ||
11 | |||
12 | - Add/improve audio features | ||
13 | - Fix \_ADJUST layer - there's a bunch of junk on there that needs cleanng up. | ||
diff --git a/keyboards/planck/keymaps/jdelkins/rules.mk b/keyboards/planck/keymaps/jdelkins/rules.mk new file mode 100644 index 000000000..f17e67c23 --- /dev/null +++ b/keyboards/planck/keymaps/jdelkins/rules.mk | |||
@@ -0,0 +1,4 @@ | |||
1 | SRC += muse.c | ||
2 | LEADER_ENABLE = yes | ||
3 | TAP_DANCE_ENABLE = yes | ||
4 | AUTO_SHIFT_ENABLE = yes | ||