aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/planck/keymaps/jetpacktuxedo/config.h32
-rw-r--r--keyboards/planck/keymaps/jetpacktuxedo/keymap.c278
-rw-r--r--keyboards/planck/keymaps/jetpacktuxedo/rules.mk1
3 files changed, 311 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/jetpacktuxedo/config.h b/keyboards/planck/keymaps/jetpacktuxedo/config.h
new file mode 100644
index 000000000..f216dc02d
--- /dev/null
+++ b/keyboards/planck/keymaps/jetpacktuxedo/config.h
@@ -0,0 +1,32 @@
1#pragma once
2
3#ifdef AUDIO_ENABLE
4 #define STARTUP_SONG SONG(PLANCK_SOUND)
5#endif
6
7/*
8 * MIDI options
9 */
10
11/* Prevent use of disabled MIDI features in the keymap */
12//#define MIDI_ENABLE_STRICT 1
13
14/* enable basic MIDI features:
15 - MIDI notes can be sent when in Music mode is on
16*/
17
18#define MIDI_BASIC
19
20/* enable advanced MIDI features:
21 - MIDI notes can be added to the keymap
22 - Octave shift and transpose
23 - Virtual sustain, portamento, and modulation wheel
24 - etc.
25*/
26//#define MIDI_ADVANCED
27
28/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
29//#define MIDI_TONE_KEYCODE_OCTAVES 2
30
31// Most tactile encoders have detents every 4 stages
32#define ENCODER_RESOLUTION 4
diff --git a/keyboards/planck/keymaps/jetpacktuxedo/keymap.c b/keyboards/planck/keymaps/jetpacktuxedo/keymap.c
new file mode 100644
index 000000000..2994c0c07
--- /dev/null
+++ b/keyboards/planck/keymaps/jetpacktuxedo/keymap.c
@@ -0,0 +1,278 @@
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 _LOWER,
25 _RAISE,
26 _PLOVER,
27 _ADJUST
28};
29
30enum planck_keycodes {
31 QWERTY = SAFE_RANGE,
32 PLOVER,
33 EXT_PLV
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 * | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp |
44 * |------+------+------+------+------+-------------+------+------+------+------+------|
45 * | Tab | A | S | D | F | G | H | J | K | L | ; |Enter |
46 * |------+------+------+------+------+------+------+------+------+------+------+------|
47 * | Shift| Z | X | C | V | B | N | M | , | . | Up |Shift |
48 * |------+------+------+------+------+------+------+------+------+------+------+------|
49 * |Brite | Ctrl | Alt | GUI |Lower | Space |Raise | / | Left | Down |Right |
50 * `-----------------------------------------------------------------------------------'
51 */
52[_QWERTY] = LAYOUT_planck_grid(
53 KC_GESC, 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_ENT,
55 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_RSFT,
56 RGB_TOG, KC_LCTL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT
57),
58
59/* Lower
60 * ,-----------------------------------------------------------------------------------.
61 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del |
62 * |------+------+------+------+------+-------------+------+------+------+------+------|
63 * | | | | | | | | | _ | + | " | |
64 * |------+------+------+------+------+------+------+------+------+------+------+------|
65 * | | | | | | | | | { | } | PgUp | |
66 * |------+------+------+------+------+------+------+------+------+------+------+------|
67 * | | | | | | | | | | Home | PgDn | End |
68 * `-----------------------------------------------------------------------------------'
69 */
70[_LOWER] = LAYOUT_planck_grid(
71 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL,
72 _______, _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_DQUO, _______,
73 _______, _______, _______, _______, _______, _______, _______, _______, KC_LCBR, KC_RCBR, KC_PGUP, _______,
74 _______, _______, _______, _______, _______, _______, _______, _______, KC_PIPE, KC_HOME, KC_PGDN, KC_END
75),
76
77/* Raise
78 * ,-----------------------------------------------------------------------------------.
79 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del |
80 * |------+------+------+------+------+-------------+------+------+------+------+------|
81 * | | | | | | | | - | = | | | |
82 * |------+------+------+------+------+------+------+------+------+------+------+------|
83 * | | | | | | | | | [ | ] | PgUp | |
84 * |------+------+------+------+------+------+------+------+------+------+------+------|
85 * | | | | | | | | \ | Home | PgDn | End |
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_DEL,
90 _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_QUOT, _______,
91 _______, _______, _______, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, KC_PGUP, _______,
92 _______, _______, _______, _______, _______, _______, _______, _______, KC_BSLS, KC_HOME, KC_PGDN, KC_END
93),
94
95/* Plover layer (http://opensteno.org)
96 * ,-----------------------------------------------------------------------------------.
97 * | Exit | # | # | # | # | # | # | # | # | # | # | # |
98 * |------+------+------+------+------+-------------+------+------+------+------+------|
99 * | | S | T | P | H | * | * | F | P | L | T | D |
100 * |------+------+------+------+------+------+------+------+------+------+------+------|
101 * | | S | K | W | R | * | * | R | B | G | S | Z |
102 * |------+------+------+------+------+------+------+------+------+------+------+------|
103 * | | | | A | O | | E | U | | | |
104 * `-----------------------------------------------------------------------------------'
105 */
106
107[_PLOVER] = LAYOUT_planck_grid(
108 EXT_PLV, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1,
109 XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,
110 XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
111 XXXXXXX, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX
112),
113
114/* Adjust (Lower + Raise)
115 * ,-----------------------------------------------------------------------------------.
116 * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | |
117 * |------+------+------+------+------+-------------+------+------+------+------+------|
118 * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty| | |Plover| |
119 * |------+------+------+------+------+------+------+------+------+------+------+------|
120 * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
121 * |------+------+------+------+------+------+------+------+------+------+------+------|
122 * | | | | | | | | | | | |
123 * `-----------------------------------------------------------------------------------'
124 */
125[_ADJUST] = LAYOUT_planck_grid(
126 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, RESET,
127 _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, PLOVER, _______,
128 _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
129 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
130)
131
132
133};
134
135#ifdef AUDIO_ENABLE
136 float plover_song[][2] = SONG(PLOVER_SOUND);
137 float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
138#endif
139
140uint32_t layer_state_set_user(uint32_t state) {
141 return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
142}
143
144bool process_record_user(uint16_t keycode, keyrecord_t *record) {
145 switch (keycode) {
146 case QWERTY:
147 if (record->event.pressed) {
148 print("mode just switched to qwerty and this is a huge string\n");
149 set_single_persistent_default_layer(_QWERTY);
150 }
151 return false;
152 break;
153 case PLOVER:
154 if (record->event.pressed) {
155 #ifdef AUDIO_ENABLE
156 stop_all_notes();
157 PLAY_SONG(plover_song);
158 #endif
159 layer_off(_RAISE);
160 layer_off(_LOWER);
161 layer_off(_ADJUST);
162 layer_on(_PLOVER);
163 if (!eeconfig_is_enabled()) {
164 eeconfig_init();
165 }
166 keymap_config.raw = eeconfig_read_keymap();
167 keymap_config.nkro = 1;
168 eeconfig_update_keymap(keymap_config.raw);
169 }
170 return false;
171 break;
172 case EXT_PLV:
173 if (record->event.pressed) {
174 #ifdef AUDIO_ENABLE
175 PLAY_SONG(plover_gb_song);
176 #endif
177 layer_off(_PLOVER);
178 }
179 return false;
180 break;
181 }
182 return true;
183}
184
185bool muse_mode = false;
186uint8_t last_muse_note = 0;
187uint16_t muse_counter = 0;
188uint8_t muse_offset = 70;
189uint16_t muse_tempo = 20;
190
191void encoder_update(bool clockwise) {
192 if (muse_mode) {
193 if (IS_LAYER_ON(_RAISE)) {
194 if (clockwise) {
195 muse_offset++;
196 } else {
197 muse_offset--;
198 }
199 } else {
200 if (clockwise) {
201 muse_tempo+=1;
202 } else {
203 muse_tempo-=1;
204 }
205 }
206 } else {
207 if (IS_LAYER_ON(_RAISE)) {
208 if (clockwise) {
209 register_code(KC_RGHT);
210 unregister_code(KC_RGHT);
211 } else {
212 register_code(KC_LEFT);
213 unregister_code(KC_LEFT);
214 }
215 } else {
216 if (clockwise) {
217 register_code(KC_DOWN);
218 unregister_code(KC_DOWN);
219 } else {
220 register_code(KC_UP);
221 unregister_code(KC_UP);
222 }
223 }
224 }
225}
226
227void dip_update(uint8_t index, bool active) {
228 switch (index) {
229 case 0:
230 if (active) {
231 #ifdef AUDIO_ENABLE
232 PLAY_SONG(plover_song);
233 #endif
234 layer_on(_ADJUST);
235 } else {
236 #ifdef AUDIO_ENABLE
237 PLAY_SONG(plover_gb_song);
238 #endif
239 layer_off(_ADJUST);
240 }
241 break;
242 case 1:
243 if (active) {
244 muse_mode = true;
245 } else {
246 muse_mode = false;
247 #ifdef AUDIO_ENABLE
248 stop_all_notes();
249 #endif
250 }
251 }
252}
253
254void matrix_scan_user(void) {
255 #ifdef AUDIO_ENABLE
256 if (muse_mode) {
257 if (muse_counter == 0) {
258 uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
259 if (muse_note != last_muse_note) {
260 stop_note(compute_freq_for_midi_note(last_muse_note));
261 play_note(compute_freq_for_midi_note(muse_note), 0xF);
262 last_muse_note = muse_note;
263 }
264 }
265 muse_counter = (muse_counter + 1) % muse_tempo;
266 }
267 #endif
268}
269
270bool music_mask_user(uint16_t keycode) {
271 switch (keycode) {
272 case RAISE:
273 case LOWER:
274 return false;
275 default:
276 return true;
277 }
278}
diff --git a/keyboards/planck/keymaps/jetpacktuxedo/rules.mk b/keyboards/planck/keymaps/jetpacktuxedo/rules.mk
new file mode 100644
index 000000000..dcf16bef3
--- /dev/null
+++ b/keyboards/planck/keymaps/jetpacktuxedo/rules.mk
@@ -0,0 +1 @@
SRC += muse.c