1 /* Copyright 2015-2017 Jack Humbert
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.
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.
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/>.
17 #include QMK_KEYBOARD_H
20 extern keymap_config_t keymap_config;
39 #define LOWER MO(_LOWER)
40 #define RAISE MO(_RAISE)
41 #define ESC_CTL CTL_T(KC_ESCAPE)
43 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
46 * ,-----------------------------------------------------------------------------------.
47 * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
48 * |------+------+------+------+------+-------------+------+------+------+------+------|
49 * | Esc | A | S | D | F | G | H | J | K | L | ; | " |
50 * |------+------+------+------+------+------|------+------+------+------+------+------|
51 * | Shift| Z | X | C | V | B | N | M | , | . | / |Shift |
52 * |------+------+------+------+------+------+------+------+------+------+------+------|
53 * | Brite| Ctrl | Alt | GUI |Lower | Enter|Space |Raise | Left | Down | Up |Right |
54 * `-----------------------------------------------------------------------------------'
56 [_QWERTY] = LAYOUT_planck_grid(
57 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
58 ESC_CTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
59 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
60 BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_ENT, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT),
63 * ,-----------------------------------------------------------------------------------.
64 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
65 * |------+------+------+------+------+-------------+------+------+------+------+------|
66 * |ESCCTL| := | | { | } | ( | ) | - | = | \ | ~ | GUI |
67 * |------+------+------+------+------+------|------+------+------+------+------+------|
68 * | | => | | [ | ] | | | _ | + | | | Home | End |
69 * |------+------+------+------+------+------+------+------+------+------+------+------|
70 * | | | | | | | | Next | Vol- | Vol+ | Play |
71 * `-----------------------------------------------------------------------------------'
74 [_LOWER] = LAYOUT_planck_grid(
75 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
76 ESC_CTL, CLNEQLS, _______, KC_LCBR, KC_RCBR, KC_LPRN, KC_RPRN, KC_MINS, KC_EQL, KC_BSLS, KC_TILD, KC_RGUI,
77 _______, HASHRKT, _______, KC_LBRC, KC_RBRC, _______, _______, KC_UNDS, KC_PLUS, KC_PIPE, KC_HOME, KC_END,
78 _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY),
81 * ,-----------------------------------------------------------------------------------.
82 * | ` | | | Up | | | | 7 | 8 | 9 | 0 | Bksp |
83 * |------+------+------+------+------+-------------+------+------+------+------+------|
84 * |ESCCTL| | Left | Down | Right | | | 4 | 5 | 6 | | GUI |
85 * |------+------+------+------+------+------|------+------+------+------+------+------|
86 * | | | | | | | | 1 | 2 | 3 | | |
87 * |------+------+------+------+------+------+------+------+------+------+------+------|
88 * | | | | | | | | Next | Vol- | Vol+ | Play |
89 * `-----------------------------------------------------------------------------------'
91 [_RAISE] = LAYOUT_planck_grid(
92 KC_GRV, _______, _______, KC_UP, _______, _______, _______, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
93 ESC_CTL, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, KC_4, KC_5, KC_6, _______, KC_RGUI,
94 _______, _______, _______, _______, _______, _______, _______, KC_1, KC_2, KC_3, _______, _______,
95 _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY),
97 /* Adjust (Lower + Raise)
98 * ,-----------------------------------------------------------------------------------.
99 * | | Reset| | | | | | | | | | Del |
100 * |------+------+------+------+------+-------------+------+------+------+------+------|
101 * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| |
102 * |------+------+------+------+------+------|------+------+------+------+------+------|
103 * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
104 * |------+------+------+------+------+------+------+------+------+------+------+------|
105 * | | | | | | | | | | | |
106 * `-----------------------------------------------------------------------------------'
108 [_ADJUST] = LAYOUT_planck_grid(
109 _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL,
110 _______, _______, MU_MOD, AU_ON, AU_OFF, _______, _______, QWERTY, _______, _______, _______, _______,
111 _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
112 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
117 float plover_song[][2] = SONG(PLOVER_SOUND);
118 float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
121 uint32_t layer_state_set_user(uint32_t state)
123 return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
126 bool process_record_user(uint16_t keycode, keyrecord_t *record)
131 if (record->event.pressed)
137 if (record->event.pressed)
143 if (record->event.pressed)
145 print("mode just switched to qwerty and this is a huge string\n");
146 set_single_persistent_default_layer(_QWERTY);
151 if (record->event.pressed)
153 register_code(KC_RSFT);
154 #ifdef BACKLIGHT_ENABLE
157 #ifdef KEYBOARD_planck_rev5
163 unregister_code(KC_RSFT);
164 #ifdef KEYBOARD_planck_rev5
174 bool muse_mode = false;
175 uint8_t last_muse_note = 0;
176 uint16_t muse_counter = 0;
177 uint8_t muse_offset = 70;
178 uint16_t muse_tempo = 50;
180 void encoder_update(bool clockwise)
184 if (IS_LAYER_ON(_RAISE))
211 #ifdef MOUSEKEY_ENABLE
212 register_code(KC_MS_WH_DOWN);
213 unregister_code(KC_MS_WH_DOWN);
215 register_code(KC_PGDN);
216 unregister_code(KC_PGDN);
221 #ifdef MOUSEKEY_ENABLE
222 register_code(KC_MS_WH_UP);
223 unregister_code(KC_MS_WH_UP);
225 register_code(KC_PGUP);
226 unregister_code(KC_PGUP);
232 void dip_update(uint8_t index, bool active)
240 PLAY_SONG(plover_song);
247 PLAY_SONG(plover_gb_song);
267 void matrix_scan_user(void)
272 if (muse_counter == 0)
274 uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
275 if (muse_note != last_muse_note)
277 stop_note(compute_freq_for_midi_note(last_muse_note));
278 play_note(compute_freq_for_midi_note(muse_note), 0xF);
279 last_muse_note = muse_note;
282 muse_counter = (muse_counter + 1) % muse_tempo;
287 bool music_mask_user(uint16_t keycode)