aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/planck/keymaps/tom/config.h39
-rw-r--r--keyboards/planck/keymaps/tom/keymap.c297
-rw-r--r--keyboards/planck/keymaps/tom/readme.md31
-rw-r--r--keyboards/planck/keymaps/tom/rules.mk1
4 files changed, 368 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/tom/config.h b/keyboards/planck/keymaps/tom/config.h
new file mode 100644
index 000000000..6fa31cc8a
--- /dev/null
+++ b/keyboards/planck/keymaps/tom/config.h
@@ -0,0 +1,39 @@
1#pragma once
2
3#ifdef AUDIO_ENABLE
4 #define STARTUP_SONG SONG(PLANCK_SOUND)
5 // #define STARTUP_SONG SONG(NO_SOUND)
6
7 #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
8 SONG(COLEMAK_SOUND), \
9 SONG(DVORAK_SOUND) \
10 }
11#endif
12
13/*
14 * MIDI options
15 */
16
17/* Prevent use of disabled MIDI features in the keymap */
18//#define MIDI_ENABLE_STRICT 1
19
20/* enable basic MIDI features:
21 - MIDI notes can be sent when in Music mode is on
22*/
23
24#define MIDI_BASIC
25
26/* enable advanced MIDI features:
27 - MIDI notes can be added to the keymap
28 - Octave shift and transpose
29 - Virtual sustain, portamento, and modulation wheel
30 - etc.
31*/
32//#define MIDI_ADVANCED
33
34/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
35//#define MIDI_TONE_KEYCODE_OCTAVES 2
36
37// Most tactile encoders have detents every 4 stages
38#define ENCODER_RESOLUTION 4
39
diff --git a/keyboards/planck/keymaps/tom/keymap.c b/keyboards/planck/keymaps/tom/keymap.c
new file mode 100644
index 000000000..abd7c8ada
--- /dev/null
+++ b/keyboards/planck/keymaps/tom/keymap.c
@@ -0,0 +1,297 @@
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
20extern keymap_config_t keymap_config;
21
22enum planck_layers {
23 _QWERTY,
24 _COLEMAK,
25 _DVORAK,
26 _LOWER,
27 _RAISE,
28 _PLOVER,
29 _ADJUST
30};
31
32enum planck_keycodes {
33 QWERTY = SAFE_RANGE,
34 COLEMAK,
35 DVORAK,
36 PLOVER,
37 BACKLIT,
38 EXT_PLV
39};
40
41#define LOWER MO(_LOWER)
42#define RAISE MO(_RAISE)
43
44const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
45
46/* Qwerty
47 * ,-----------------------------------------------------------------------------------.
48 * | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp |
49 * |------+------+------+------+------+-------------+------+------+------+------+------|
50 * | Tab | A | S | D | F | G | H | J | K | L | ; |Enter |
51 * |------+------+------+------+------+------|------+------+------+------+------+------|
52 * | Shift| Z | X | C | V | B | N | M | , | . | Up |Shift |
53 * |------+------+------+------+------+------+------+------+------+------+------+------|
54 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | / | Left | Down |Right |
55 * `-----------------------------------------------------------------------------------'
56 */
57[_QWERTY] = LAYOUT_planck_grid(
58 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
59 KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
60 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_RSFT,
61 BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT
62),
63
64
65/* Lower
66 * ,-----------------------------------------------------------------------------------.
67 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | | |
68 * |------+------+------+------+------+-------------+------+------+------+------+------|
69 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | ' |
70 * |------+------+------+------+------+------|------+------+------+------+------+------|
71 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | |
72 * |------+------+------+------+------+------+------+------+------+------+------+------|
73 * | | | | | | | | Vol- | Vol+ |Brite-|Brite+|
74 * `-----------------------------------------------------------------------------------'
75 */
76[_LOWER] = LAYOUT_planck_grid(
77 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PIPE,
78 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_QUOT,
79 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______,
80 _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLD, KC_VOLU, KC_BRMD, KC_BRMU
81),
82
83/* Raise
84 * ,-----------------------------------------------------------------------------------.
85 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | \ |
86 * |------+------+------+------+------+-------------+------+------+------+------+------|
87 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | ' |
88 * |------+------+------+------+------+------|------+------+------+------+------+------|
89 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | |
90 * |------+------+------+------+------+------+------+------+------+------+------+------|
91 * | | | | | | | | Vol- | Vol+ |Brite-|Brite+|
92 * `-----------------------------------------------------------------------------------'
93 */
94[_RAISE] = LAYOUT_planck_grid(
95 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS,
96 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_QUOT,
97 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______,
98 _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLD, KC_VOLU, KC_BRMD, KC_BRMU
99),
100
101/* Adjust (Lower + Raise)
102 * ,-----------------------------------------------------------------------------------.
103 * | | Reset| | | | | | | | | | Del |
104 * |------+------+------+------+------+-------------+------+------+------+------+------|
105 * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty| | | | |
106 * |------+------+------+------+------+------|------+------+------+------+------+------|
107 * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
108 * |------+------+------+------+------+------+------+------+------+------+------+------|
109 * | | | | | | | | | | | |
110 * `-----------------------------------------------------------------------------------'
111 */
112[_ADJUST] = LAYOUT_planck_grid(
113 _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
114 _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______,
115 _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
116 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
117)
118
119};
120
121#ifdef AUDIO_ENABLE
122 float plover_song[][2] = SONG(PLOVER_SOUND);
123 float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
124#endif
125
126uint32_t layer_state_set_user(uint32_t state) {
127 return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
128}
129
130bool process_record_user(uint16_t keycode, keyrecord_t *record) {
131 switch (keycode) {
132 case QWERTY:
133 if (record->event.pressed) {
134 print("mode just switched to qwerty and this is a huge string\n");
135 set_single_persistent_default_layer(_QWERTY);
136 }
137 return false;
138 break;
139 case BACKLIT:
140 if (record->event.pressed) {
141 register_code(KC_RSFT);
142 #ifdef BACKLIGHT_ENABLE
143 backlight_step();
144 #endif
145 #ifdef KEYBOARD_planck_rev5
146 PORTE &= ~(1<<6);
147 #endif
148 } else {
149 unregister_code(KC_RSFT);
150 #ifdef KEYBOARD_planck_rev5
151 PORTE |= (1<<6);
152 #endif
153 }
154 return false;
155 break;
156 case EXT_PLV:
157 if (record->event.pressed) {
158 #ifdef AUDIO_ENABLE
159 PLAY_SONG(plover_gb_song);
160 #endif
161 layer_off(_PLOVER);
162 }
163 return false;
164 break;
165 }
166 return true;
167}
168
169bool muse_mode = false;
170uint8_t last_muse_note = 0;
171uint16_t muse_counter = 0;
172uint8_t muse_offset = 70;
173uint16_t muse_tempo = 50;
174
175void encoder_update(bool clockwise) {
176 if (muse_mode) {
177 if (IS_LAYER_ON(_RAISE)) {
178 if (clockwise) {
179 muse_offset++;
180 } else {
181 muse_offset--;
182 }
183 } else {
184 if (clockwise) {
185 muse_tempo+=1;
186 } else {
187 muse_tempo-=1;
188 }
189 }
190 } else {
191 if (clockwise) {
192 #ifdef MOUSEKEY_ENABLE
193 tap_code(KC_MS_WH_DOWN);
194 #else
195 tap_code(KC_PGDN);
196 #endif
197 } else {
198 #ifdef MOUSEKEY_ENABLE
199 tap_code(KC_MS_WH_UP);
200 #else
201 tap_code(KC_PGUP);
202 #endif
203 }
204 }
205}
206
207void dip_update(uint8_t index, bool active) {
208 switch (index) {
209 case 0:
210 if (active) {
211 #ifdef AUDIO_ENABLE
212 PLAY_SONG(plover_song);
213 #endif
214 layer_on(_ADJUST);
215 } else {
216 #ifdef AUDIO_ENABLE
217 PLAY_SONG(plover_gb_song);
218 #endif
219 layer_off(_ADJUST);
220 }
221 break;
222 case 1:
223 if (active) {
224 muse_mode = true;
225 } else {
226 muse_mode = false;
227 #ifdef AUDIO_ENABLE
228 stop_all_notes();
229 #endif
230 }
231 }
232}
233
234void matrix_scan_user(void) {
235 #ifdef AUDIO_ENABLE
236 if (muse_mode) {
237 if (muse_counter == 0) {
238 uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
239 if (muse_note != last_muse_note) {
240 stop_note(compute_freq_for_midi_note(last_muse_note));
241 play_note(compute_freq_for_midi_note(muse_note), 0xF);
242 last_muse_note = muse_note;
243 }
244 }
245 muse_counter = (muse_counter + 1) % muse_tempo;
246 }
247 #endif
248}
249
250bool music_mask_user(uint16_t keycode) {
251 switch (keycode) {
252 case RAISE:
253 case LOWER:
254 return false;
255 default:
256 return true;
257 }
258}
259
260void rgb_matrix_indicators_user(void) {
261 #ifdef RGB_MATRIX_ENABLE
262 rgb_led led;
263 switch (biton32(layer_state)) {
264 case _RAISE:
265 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
266 led = g_rgb_leds[i];
267 if ( led.modifier ) {
268 rgb_matrix_set_color(i, 0x6B, 0x00, 0x80);
269 } else {
270 rgb_matrix_set_color(i, 0x00, 0xFF, 0x00);
271 }
272 }
273 break;
274
275 case _LOWER:
276 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
277 led = g_rgb_leds[i];
278 if ( led.modifier ) {
279 rgb_matrix_set_color(i, 0xFF, 0xA5, 0x00);
280 } else {
281 rgb_matrix_set_color(i, 0x00, 0x67, 0xC7);
282 }
283 }
284 break;
285
286 case _ADJUST:
287 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
288 rgb_matrix_set_color(i, 0xFF, 0x99, 0x00);
289 }
290 rgb_matrix_set_color(1, 0xFF, 0x00, 0x00);
291 break;
292
293 default:
294 break;
295 }
296 #endif
297}
diff --git a/keyboards/planck/keymaps/tom/readme.md b/keyboards/planck/keymaps/tom/readme.md
new file mode 100644
index 000000000..7e31e2a05
--- /dev/null
+++ b/keyboards/planck/keymaps/tom/readme.md
@@ -0,0 +1,31 @@
1# tomholford's layout
2
3This layout is data-driven: I installed [WhatPulse](https://whatpulse.org/) a few months ago and generated a heatmap of the most frequently used keys. I also optimized for my most-used programming languages, and muscle memory.
4
5## Changes from Default
6
7### QWERTY
8
9- swap escape and tab
10- rearrange arrows in original layout
11- swap rshift and Enter
12- map / to original location of left arrow key
13
14### RAISE
15
16- move backslash to backspace
17- map quote to original location from qwerty layer
18- map brightness up / down to original location of left and up arrows
19- map volume up / down to original location of down and right arrows
20
21### LOWER
22
23- move pipe to backspace
24- map quote to original location from qwerty layer
25- map brightness up / down to original location of left and up arrows
26- map volume up / down to original location of down and right arrows
27
28
29## RGB LED
30
31- Illuminate when pressing RAISE, LOWER, or ADJUST ([source](https://www.reddit.com/r/olkb/comments/8wvk8s/custom_rgb_configuration_by_keycodelayer/))
diff --git a/keyboards/planck/keymaps/tom/rules.mk b/keyboards/planck/keymaps/tom/rules.mk
new file mode 100644
index 000000000..dcf16bef3
--- /dev/null
+++ b/keyboards/planck/keymaps/tom/rules.mk
@@ -0,0 +1 @@
SRC += muse.c