aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEshan <dalaleshan@gmail.com>2021-01-10 22:38:06 -0800
committerGitHub <noreply@github.com>2021-01-10 22:38:06 -0800
commitbeace23bca43347e61c3f6915af5666e7918599e (patch)
treee8389f684d8240c555686d3d7407dafa6524a0b6
parentabda419f5a7a177d213748f47cb0e5fc39920ce6 (diff)
downloadqmk_firmware-beace23bca43347e61c3f6915af5666e7918599e.tar.gz
qmk_firmware-beace23bca43347e61c3f6915af5666e7918599e.zip
[Keymap] Adding my Planck Keymap (#11315)
* Adding keymap files * Added compatible license header to config file * Apply suggestions from code review Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Ryan <fauxpark@gmail.com>
-rw-r--r--keyboards/planck/keymaps/eshesh2/config.h57
-rw-r--r--keyboards/planck/keymaps/eshesh2/keymap.c261
-rw-r--r--keyboards/planck/keymaps/eshesh2/readme.md64
-rw-r--r--keyboards/planck/keymaps/eshesh2/rules.mk4
4 files changed, 386 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/eshesh2/config.h b/keyboards/planck/keymaps/eshesh2/config.h
new file mode 100644
index 000000000..585511f91
--- /dev/null
+++ b/keyboards/planck/keymaps/eshesh2/config.h
@@ -0,0 +1,57 @@
1/* Copyright 2021 Eshan Dalal
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 }
25#endif
26
27/*
28 * MIDI options
29 */
30
31/* Prevent use of disabled MIDI features in the keymap */
32//#define MIDI_ENABLE_STRICT 1
33
34/* enable basic MIDI features:
35 - MIDI notes can be sent when in Music mode is on
36*/
37
38//#define MIDI_BASIC
39
40/* enable advanced MIDI features:
41 - MIDI notes can be added to the keymap
42 - Octave shift and transpose
43 - Virtual sustain, portamento, and modulation wheel
44 - etc.
45*/
46//#define MIDI_ADVANCED
47
48/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
49//#define MIDI_TONE_KEYCODE_OCTAVES 2
50
51// Most tactile encoders have detents every 4 stages
52#define ENCODER_RESOLUTION 4
53
54#define TAP_CODE_DELAY 10
55
56#define ENCODERS_PAD_A { B12 }
57#define ENCODERS_PAD_B { B13 }
diff --git a/keyboards/planck/keymaps/eshesh2/keymap.c b/keyboards/planck/keymaps/eshesh2/keymap.c
new file mode 100644
index 000000000..1872b42cd
--- /dev/null
+++ b/keyboards/planck/keymaps/eshesh2/keymap.c
@@ -0,0 +1,261 @@
1/* Copyright 2020 Eshan Dalal
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 _LOWER,
24 _RAISE,
25 _NUMPAD,
26 _ADJUST
27};
28
29enum planck_keycodes {
30 QWERTY = SAFE_RANGE,
31 ADJUST,
32 NUMPAD,
33 EXT_NUM
34};
35
36#define LOWER MO(_LOWER)
37#define RAISE MO(_RAISE)
38
39const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
40
41/* Qwerty
42 * ,-----------------------------------------------------------------------------------.
43 * | Mute | Q | W | E | R | T | Y | U | I | O | P | Bksp |
44 * |------+------+------+------+------+------+------+------+------+------+------+------|
45 * | Tab | A | S | D | F | G | H | J | K | L | ; | " |
46 * |------+------+------+------+------+------+------+------+------+------+------+------|
47 * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
48 * |------+------+------+------+------+------+------+------+------+------+------+------|
49 * | Esc | Ctrl | GUI | Alt |Lower | Space |Raise | Left | Down | Up |Right |
50 * `-----------------------------------------------------------------------------------'
51 */
52[_QWERTY] = LAYOUT_planck_grid(
53 KC_MUTE, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
54 KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
55 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT ,
56 KC_ESC, KC_LCTL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
57),
58
59/* Lower
60 * ,-----------------------------------------------------------------------------------.
61 * | Mute | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
62 * |------+------+------+------+------+------+------+------+------+------+------+------|
63 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
64 * |------+------+------+------+------+------+------+------+------+------+------+------|
65 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | |
66 * |------+------+------+------+------+------+------+------+------+------+------+------|
67 * | | | | | | | | Next | Vol- | Vol+ | Play |
68 * `-----------------------------------------------------------------------------------'
69 */
70[_LOWER] = LAYOUT_planck_grid(
71 KC_MPLY, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
72 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
73 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______,
74 _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
75),
76
77/* Raise
78 * ,-----------------------------------------------------------------------------------.
79 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
80 * |------+------+------+------+------+------+------+------+------+------+------+------|
81 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
82 * |------+------+------+------+------+------+------+------+------+------+------+------|
83 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | |
84 * |------+------+------+------+------+------+------+------+------+------+------+------|
85 * | | | | | | | | Next | Vol- | Vol+ | Play |
86 * `-----------------------------------------------------------------------------------'
87 */
88[_RAISE] = LAYOUT_planck_grid(
89 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
90 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
91 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______,
92 _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
93),
94
95/* Numpad layer
96 * ,-----------------------------------------------------------------------------------.
97 * | | | | | | | |NumLck| 7 | 8 | 9 |Bksp |
98 * |------+------+------+------+------+------+------+------+------+------+------+------|
99 * | | Left | Down | Up |Right | | | | 4 | 5 | 6 |Enter |
100 * |------+------+------+------+------+------+------+------+------+------+------+------|
101 * | | | | | | | | | 1 | 2 | 3 |Tab |
102 * |------+------+------+------+------+------+------+------+------+------+------+------|
103 * | Exit | | | | | | | . | 0 | | |
104 * `-----------------------------------------------------------------------------------'
105 */
106[_NUMPAD] = LAYOUT_planck_grid(
107 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NLCK, KC_KP_7, KC_KP_8, KC_KP_9, KC_BSPC,
108 XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_KP_4, KC_KP_5, KC_KP_6, KC_ENTER,
109 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_KP_1, KC_KP_2, KC_KP_3, KC_TAB,
110 EXT_NUM, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_KP_DOT, KC_KP_0, XXXXXXX, XXXXXXX
111),
112
113/* Adjust (Lower + Raise)
114 * v------------------------RGB CONTROL--------------------v
115 * ,-----------------------------------------------------------------------------------.
116 * | | Reset|Debug | RGB |RGBMOD| HUE+ | HUE- | SAT+ | SAT- |BRGTH+|BRGTH-| Del |
117 * |------+------+------+------+------+------+------+------+------+------+------+------|
118 * | | |MUSmod|Aud on|Audoff|AGnorm|AGswap|Qwerty| | |Numpad| |
119 * |------+------+------+------+------+------+------+------+------+------+------+------|
120 * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof|TermOn|TermOf| | | |
121 * |------+------+------+------+------+------+------+------+------+------+------+------|
122 * | | | | | | | | | | | |
123 * `-----------------------------------------------------------------------------------'
124 */
125[_ADJUST] = LAYOUT_planck_grid(
126 _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
127 _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, XXXXXXX, XXXXXXX, NUMPAD, _______,
128 _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
129 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
130)
131
132};
133
134#ifdef AUDIO_ENABLE
135 float plover_song[][2] = SONG(PLOVER_SOUND);
136 float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
137#endif
138
139layer_state_t layer_state_set_user(layer_state_t state) {
140 return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
141}
142
143bool process_record_user(uint16_t keycode, keyrecord_t *record) {
144 switch (keycode) {
145 case QWERTY:
146 if (record->event.pressed) {
147 print("mode just switched to qwerty and this is a huge string\n");
148 set_single_persistent_default_layer(_QWERTY);
149 }
150 return false;
151 break;
152 case NUMPAD:
153 if (record->event.pressed) {
154 #ifdef AUDIO_ENABLE
155 stop_all_notes();
156 PLAY_SONG(plover_song);
157 #endif
158 layer_off(_RAISE);
159 layer_off(_LOWER);
160 layer_off(_ADJUST);
161 layer_on(_NUMPAD);
162 if (!eeconfig_is_enabled()) {
163 eeconfig_init();
164 }
165 keymap_config.raw = eeconfig_read_keymap();
166 keymap_config.nkro = 1;
167 eeconfig_update_keymap(keymap_config.raw);
168 }
169 return false;
170 break;
171 case EXT_NUM:
172 if (record->event.pressed) {
173 #ifdef AUDIO_ENABLE
174 PLAY_SONG(plover_gb_song);
175 #endif
176 layer_off(_NUMPAD);
177 }
178 return false;
179 break;
180 }
181 return true;
182}
183
184bool muse_mode = false;
185uint8_t last_muse_note = 0;
186uint16_t muse_counter = 0;
187uint8_t muse_offset = 70;
188uint16_t muse_tempo = 50;
189
190void encoder_update(bool clockwise) {
191 if (muse_mode) {
192 if (IS_LAYER_ON(_RAISE)) {
193 if (clockwise) {
194 muse_offset++;
195 } else {
196 muse_offset--;
197 }
198 } else {
199 if (clockwise) {
200 muse_tempo+=1;
201 } else {
202 muse_tempo-=1;
203 }
204 }
205 } else {
206 switch (get_highest_layer(layer_state)) {
207 case _LOWER: // Seek Track
208 if (clockwise) {
209 tap_code16(KC_MPRV);
210 } else {
211 tap_code16(KC_MNXT);
212 break;
213 case _RAISE: // Page Scroll
214 if (clockwise) {
215 tap_code16(KC_BRID);
216 } else {
217 tap_code16(KC_BRIU);
218 break;
219 default: // Volume
220 if (clockwise) {
221 tap_code16(KC_VOLD);
222 } else {
223 tap_code16(KC_VOLU);
224 }
225 }
226 }
227 }
228 }
229}
230
231
232void matrix_scan_user(void) {
233#ifdef AUDIO_ENABLE
234 if (muse_mode) {
235 if (muse_counter == 0) {
236 uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
237 if (muse_note != last_muse_note) {
238 stop_note(compute_freq_for_midi_note(last_muse_note));
239 play_note(compute_freq_for_midi_note(muse_note), 0xF);
240 last_muse_note = muse_note;
241 }
242 }
243 muse_counter = (muse_counter + 1) % muse_tempo;
244 } else {
245 if (muse_counter) {
246 stop_all_notes();
247 muse_counter = 0;
248 }
249 }
250#endif
251}
252
253bool music_mask_user(uint16_t keycode) {
254 switch (keycode) {
255 case RAISE:
256 case LOWER:
257 return false;
258 default:
259 return true;
260 }
261}
diff --git a/keyboards/planck/keymaps/eshesh2/readme.md b/keyboards/planck/keymaps/eshesh2/readme.md
new file mode 100644
index 000000000..73510c202
--- /dev/null
+++ b/keyboards/planck/keymaps/eshesh2/readme.md
@@ -0,0 +1,64 @@
1![eshesh2's Planck Layout](https://i.imgur.com/eVgHH6k.png)
2
3eshesh2's Planck layout with a rotary encoder on the top left of the Planck. It is designed for everyday use along with a numpad layer for quickly typing in Excel and other workbook programs.
4
5## Qwerty
6
7 ,-----------------------------------------------------------------------------------.
8 | Mute | Q | W | E | R | T | Y | U | I | O | P | Bksp |
9 |------+------+------+------+------+------+------+------+------+------+------+------|
10 | Tab | A | S | D | F | G | H | J | K | L | ; | " |
11 |------+------+------+------+------+------+------+------+------+------+------+------|
12 | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
13 |------+------+------+------+------+------+------+------+------+------+------+------|
14 | Esc | Ctrl | GUI | Alt |Lower | Space |Raise | Left | Down | Up |Right |
15 `-----------------------------------------------------------------------------------'
16
17## Lower
18
19 ,-----------------------------------------------------------------------------------.
20 | Play | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
21 |------+------+------+------+------+------+------+------+------+------+------+------|
22 | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
23 |------+------+------+------+------+------+------+------+------+------+------+------|
24 | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | |
25 |------+------+------+------+------+------+------+------+------+------+------+------|
26 | | | | | | | | Next | Vol- | Vol+ | Play |
27 `-----------------------------------------------------------------------------------'
28
29## Raise
30
31 ,-----------------------------------------------------------------------------------.
32 | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
33 |------+------+------+------+------+------+------+------+------+------+------+------|
34 | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
35 |------+------+------+------+------+------+------+------+------+------+------+------|
36 | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | |
37 |------+------+------+------+------+------+------+------+------+------+------+------|
38 | | | | | | | | Next | Vol- | Vol+ | Play |
39 `-----------------------------------------------------------------------------------'
40
41# Numpad layer
42
43 ,-----------------------------------------------------------------------------------.
44 | | | Up | | | | | |NumLck| 7 | 8 | 9 |
45 |------+------+------+------+------+------+------+------+------+------+------+------|
46 | | Left | Down | Right| | | | | | 4 | 5 | 6 |
47 |------+------+------+------+------+------+------+------+------+------+------+------|
48 | |Enter | Tab | | | | | | | 1 | 2 | 3 |
49 |------+------+------+------+------+------+------+------+------+------+------+------|
50 | Exit | | | | | | | | . | 0 |Bksp |
51 `-----------------------------------------------------------------------------------'
52
53# Adjust (Lower + Raise)
54
55 v------------------------RGB CONTROL--------------------v
56 ,-----------------------------------------------------------------------------------.
57 | | Reset|Debug | RGB |RGBMOD| HUE+ | HUE- | SAT+ | SAT- |BRGTH+|BRGTH-| Del |
58 |------+------+------+------+------+------+------+------+------+------+------+------|
59 | | |MUSmod|Aud on|Audoff|AGnorm|AGswap|Qwerty| | |Numpad| |
60 |------+------+------+------+------+------+------+------+------+------+------+------|
61 | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof|TermOn|TermOf| | | |
62 |------+------+------+------+------+------+------+------+------+------+------+------|
63 | | | | | | | | | | | |
64 `-----------------------------------------------------------------------------------'
diff --git a/keyboards/planck/keymaps/eshesh2/rules.mk b/keyboards/planck/keymaps/eshesh2/rules.mk
new file mode 100644
index 000000000..07a64e2fb
--- /dev/null
+++ b/keyboards/planck/keymaps/eshesh2/rules.mk
@@ -0,0 +1,4 @@
1SRC += muse.c
2ENCODER_ENABLE = yes
3EXTRAKEY_ENABLE = yes
4MOUSEKEY_ENABLE = yes