aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/planck/keymaps/raffle/config.h38
-rw-r--r--keyboards/planck/keymaps/raffle/keymap.c305
-rw-r--r--keyboards/planck/keymaps/raffle/readme.md11
-rw-r--r--keyboards/planck/keymaps/raffle/rules.mk1
4 files changed, 355 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/raffle/config.h b/keyboards/planck/keymaps/raffle/config.h
new file mode 100644
index 000000000..e8c13caac
--- /dev/null
+++ b/keyboards/planck/keymaps/raffle/config.h
@@ -0,0 +1,38 @@
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
diff --git a/keyboards/planck/keymaps/raffle/keymap.c b/keyboards/planck/keymaps/raffle/keymap.c
new file mode 100644
index 000000000..0dbab3893
--- /dev/null
+++ b/keyboards/planck/keymaps/raffle/keymap.c
@@ -0,0 +1,305 @@
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 "action_layer.h"
19#include "muse.h"
20
21extern keymap_config_t keymap_config;
22
23enum planck_layers {
24 _QWERTY,
25 _LOWER,
26 _RAISE,
27 _ADJUST,
28 _NAV,
29 _DEV
30};
31
32enum planck_keycodes {
33 QWERTY = SAFE_RANGE,
34 BACKLIT,
35 // my macros
36 R_ASGN,
37 R_PIPE,
38 R_CMLN,
39};
40
41#define LOWER MO(_LOWER)
42#define RAISE MO(_RAISE)
43
44// my defs
45#define LT_ESC LT(_NAV, KC_ESC) //tap for esc, hold for mouse nav layer
46#define DEV MO(_DEV) // get to dev layer
47#define KC_CAD LALT(LCTL(KC_DEL)) // because awkwardness
48
49const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
50
51/* Qwerty
52 * ,-----------------------------------------------------------------------------------.
53 * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
54 * |------+------+------+------+------+-------------+------+------+------+------+------|
55 * | CTRL | A | S | D | F | G | H | J | K | L | ; | " |
56 * |------+------+------+------+------+------|------+------+------+------+------+------|
57 * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
58 * |------+------+------+------+------+------+------+------+------+------+------+------|
59 * | ESC | APP | GUI | ALT |Lower | Space |Raise | DEV | | | |
60 * `-----------------------------------------------------------------------------------'
61 */
62[_QWERTY] = LAYOUT_planck_grid(
63 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
64 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
65 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT ,
66 LT_ESC, KC_APP, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, DEV, _______, _______, _______
67),
68
69
70/* Lower
71 * ,-----------------------------------------------------------------------------------.
72 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp|
73 * |------+------+------+------+------+-------------+------+------+------+------+------|
74 * | | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
75 * |------+------+------+------+------+------|------+------+------+------+------+------|
76 * | | F7 | F8 | F9 | F10 | F11 | F12 | | Home | END | | |
77 * |------+------+------+------+------+------+------+------+------+------+------+------|
78 * | DEL | | | | | | | Next | Vol- | Vol+ | Play |
79 * `-----------------------------------------------------------------------------------'
80 */
81[_LOWER] = LAYOUT_planck_grid(
82 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
83 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
84 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_HOME, KC_END, _______, _______,
85 KC_DEL, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
86),
87
88/* Raise
89 * ,-----------------------------------------------------------------------------------.
90 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
91 * |------+------+------+------+------+-------------+------+------+------+------+------|
92 * | | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
93 * |------+------+------+------+------+------|------+------+------+------+------+------|
94 * | | F7 | F8 | F9 | F10 | F11 | F12 | |Pg Up |Pg Dn | | |
95 * |------+------+------+------+------+------+------+------+------+------+------+------|
96 * | Del | | | | | | | Next | Vol- | Vol+ | Play
97 * `-----------------------------------------------------------------------------------'
98 */
99[_RAISE] = LAYOUT_planck_grid(
100 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
101 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
102 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_PGUP, KC_PGDN, _______, _______,
103 KC_DEL, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
104),
105
106/* Adjust (Lower + Raise)
107 * ,-----------------------------------------------------------------------------------.
108 * | | Reset| | | | | | | | | | Del |
109 * |------+------+------+------+------+-------------+------+------+------+------+------|
110 * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty| | | | |
111 * |------+------+------+------+------+------|------+------+------+------+------+------|
112 * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
113 * |------+------+------+------+------+------+------+------+------+------+------+------|
114 * | | | | | | | | | | | |
115 * `-----------------------------------------------------------------------------------'
116 */
117[_ADJUST] = LAYOUT_planck_grid(
118 _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
119 _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______,
120 _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
121 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
122),
123
124/* Nav Layer
125 * ,-----------------------------------------------------------------------------------.
126 * | | | | | | | | PGUP | UP | PGDN | |KC_CAD|
127 * |------+------+------+------+------+-------------+------+------+------+------+------|
128 * | | | | | | | HOME | LEFT | DOWN |RIGHT | | |
129 * |------+------+------+------+------+------|------+------+------+------+------+------|
130 * | | | | | | | END | | | | | |
131 * |------+------+------+------+------+------+------+------+------+------+------+------|
132 * | | | | | | | | | | | |
133 * `-----------------------------------------------------------------------------------'
134 */
135[_NAV] = LAYOUT_planck_grid(
136 _______, _______, _______, _______, _______, _______, _______, KC_PGUP, KC_UP, KC_PGDN, _______, KC_CAD,
137 _______, _______, _______, _______, _______, _______, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______,
138 _______, _______, _______, _______, _______, _______, KC_END, _______, _______, _______, _______, _______,
139 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
140),
141
142/* DEV Layer
143 * ,-----------------------------------------------------------------------------------.
144 * | | | |R_CMLM| | | | | | | |KC_CAD|
145 * |------+------+------+------+------+-------------+------+------+------+------+------|
146 * | | | | | | | |R_ASGN|R_PIPE| | | |
147 * |------+------+------+------+------+------|------+------+------+------+------+------|
148 * | | | | | | | | | | | | |
149 * |------+------+------+------+------+------+------+------+------+------+------+------|
150 * | | | | | | | | | | | |
151 * `-----------------------------------------------------------------------------------'
152 */
153[_DEV] = LAYOUT_planck_grid(
154 _______, _______, _______, R_CMLN, _______, _______, _______, _______, _______, _______, _______, KC_CAD,
155 _______, _______, _______, _______, _______, _______, _______, R_ASGN, R_PIPE, _______, _______, _______,
156 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
157 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
158)
159
160};
161
162#ifdef AUDIO_ENABLE
163 float plover_song[][2] = SONG(PLOVER_SOUND);
164 float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
165#endif
166
167uint32_t layer_state_set_user(uint32_t state) {
168 return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
169}
170
171bool process_record_user(uint16_t keycode, keyrecord_t *record) {
172 switch (keycode) {
173 case QWERTY:
174 if (record->event.pressed) {
175 print("mode just switched to qwerty and this is a huge string\n");
176 set_single_persistent_default_layer(_QWERTY);
177 }
178 return false;
179 break;
180 case BACKLIT:
181 if (record->event.pressed) {
182 register_code(KC_RSFT);
183 #ifdef BACKLIGHT_ENABLE
184 backlight_step();
185 #endif
186 #ifdef KEYBOARD_planck_rev5
187 PORTE &= ~(1<<6);
188 #endif
189 } else {
190 unregister_code(KC_RSFT);
191 #ifdef KEYBOARD_planck_rev5
192 PORTE |= (1<<6);
193 #endif
194 }
195 return false;
196 break;
197 // my macros
198 case R_ASGN:
199 if (record->event.pressed) {
200 SEND_STRING(" <- ");
201 }
202 return false;
203 break;
204 case R_PIPE:
205 if (record->event.pressed) {
206 SEND_STRING(" %>%\n");
207 }
208 return false;
209 break;
210 case R_CMLN:
211 if (record->event.pressed) {
212 SEND_STRING("################################################################################");
213 }
214 return false;
215 break;
216 }
217 return true;
218}
219
220bool muse_mode = false;
221uint8_t last_muse_note = 0;
222uint16_t muse_counter = 0;
223uint8_t muse_offset = 70;
224uint16_t muse_tempo = 50;
225
226void encoder_update(bool clockwise) {
227 if (muse_mode) {
228 if (IS_LAYER_ON(_RAISE)) {
229 if (clockwise) {
230 muse_offset++;
231 } else {
232 muse_offset--;
233 }
234 } else {
235 if (clockwise) {
236 muse_tempo+=1;
237 } else {
238 muse_tempo-=1;
239 }
240 }
241 } else {
242 if (clockwise) {
243 register_code(KC_PGDN);
244 unregister_code(KC_PGDN);
245 } else {
246 register_code(KC_PGUP);
247 unregister_code(KC_PGUP);
248 }
249 }
250}
251
252void dip_update(uint8_t index, bool active) {
253 switch (index) {
254 case 0:
255 if (active) {
256 #ifdef AUDIO_ENABLE
257 PLAY_SONG(plover_song);
258 #endif
259 layer_on(_ADJUST);
260 } else {
261 #ifdef AUDIO_ENABLE
262 PLAY_SONG(plover_gb_song);
263 #endif
264 layer_off(_ADJUST);
265 }
266 break;
267 case 1:
268 if (active) {
269 muse_mode = true;
270 } else {
271 muse_mode = false;
272 #ifdef AUDIO_ENABLE
273 stop_all_notes();
274 #endif
275 }
276 }
277}
278
279void matrix_scan_user(void) {
280 #ifdef AUDIO_ENABLE
281 if (muse_mode) {
282 if (muse_counter == 0) {
283 uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
284 if (muse_note != last_muse_note) {
285 stop_note(compute_freq_for_midi_note(last_muse_note));
286 play_note(compute_freq_for_midi_note(muse_note), 0xF);
287 last_muse_note = muse_note;
288 }
289 }
290 muse_counter = (muse_counter + 1) % muse_tempo;
291 }
292 #endif
293}
294
295bool music_mask_user(uint16_t keycode) {
296 switch (keycode) {
297 case RAISE:
298 case LOWER:
299 return false;
300 default:
301 return true;
302 }
303}
304
305
diff --git a/keyboards/planck/keymaps/raffle/readme.md b/keyboards/planck/keymaps/raffle/readme.md
new file mode 100644
index 000000000..4cfb312b9
--- /dev/null
+++ b/keyboards/planck/keymaps/raffle/readme.md
@@ -0,0 +1,11 @@
1# Raffle's Planck Layout
2
3- Caps -> LCtrl
4- LCtrol -> Nav Layer
5 + Nav uses pok3r-like nav (IJKL, H/N for home/end, U/P for pgup/pgdn)
6- RArrow -> Dev layer
7 + handy macros for R programming
8
9Also removes keymaps I don't use (dvorak, etc).
10
11
diff --git a/keyboards/planck/keymaps/raffle/rules.mk b/keyboards/planck/keymaps/raffle/rules.mk
new file mode 100644
index 000000000..dcf16bef3
--- /dev/null
+++ b/keyboards/planck/keymaps/raffle/rules.mk
@@ -0,0 +1 @@
SRC += muse.c