diff options
| author | Pascal Greilich <pascal@reonomy.com> | 2018-09-15 13:15:36 -0400 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-09-15 10:15:36 -0700 |
| commit | 232ef757832d46cb63550376a38d224472075996 (patch) | |
| tree | 4e4d52a64bc10cb1fe396ad8bdac793f54aa55d5 | |
| parent | 9712501bf3291942067ac75b50b1675a265a3f11 (diff) | |
| download | qmk_firmware-232ef757832d46cb63550376a38d224472075996.tar.gz qmk_firmware-232ef757832d46cb63550376a38d224472075996.zip | |
Keymap: A new alternative layout for planck (#3894)
* a new planck layout
* layout images
* layout images 2
* typo
* update include following PR comment
* updates following PR commments 2
* updates following PR comments
| -rw-r--r-- | keyboards/planck/keymaps/pascamel/config.h | 38 | ||||
| -rw-r--r-- | keyboards/planck/keymaps/pascamel/keymap.c | 237 | ||||
| -rw-r--r-- | keyboards/planck/keymaps/pascamel/readme.md | 29 | ||||
| -rw-r--r-- | keyboards/planck/keymaps/pascamel/rules.mk | 1 |
4 files changed, 305 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/pascamel/config.h b/keyboards/planck/keymaps/pascamel/config.h new file mode 100644 index 000000000..679d106ca --- /dev/null +++ b/keyboards/planck/keymaps/pascamel/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/pascamel/keymap.c b/keyboards/planck/keymaps/pascamel/keymap.c new file mode 100644 index 000000000..9ee0dde35 --- /dev/null +++ b/keyboards/planck/keymaps/pascamel/keymap.c | |||
| @@ -0,0 +1,237 @@ | |||
| 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 | |||
| 20 | extern keymap_config_t keymap_config; | ||
| 21 | |||
| 22 | enum planck_layers { | ||
| 23 | _QWERTY, | ||
| 24 | _LOWER, | ||
| 25 | _RAISE, | ||
| 26 | _ADJUST | ||
| 27 | }; | ||
| 28 | |||
| 29 | enum planck_keycodes { | ||
| 30 | QWERTY = SAFE_RANGE, | ||
| 31 | BACKLIT, | ||
| 32 | MY_PWD | ||
| 33 | }; | ||
| 34 | |||
| 35 | #define LOWER MO(_LOWER) | ||
| 36 | #define RAISE MO(_RAISE) | ||
| 37 | |||
| 38 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 39 | |||
| 40 | /* Qwerty | ||
| 41 | * ,-----------------------------------------------------------------------------------. | ||
| 42 | * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | | ||
| 43 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 44 | * | Esc | A | S | D | F | G | H | J | K | L | ; | " | | ||
| 45 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 46 | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | | ||
| 47 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 48 | * | Ctrl | Alt | GUI |Brite |Lower | Space |Raise | Left | Down | Up |Right | | ||
| 49 | * `-----------------------------------------------------------------------------------' | ||
| 50 | */ | ||
| 51 | [_QWERTY] = LAYOUT_planck_grid( | ||
| 52 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, | ||
| 53 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | ||
| 54 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , | ||
| 55 | KC_LCTL, KC_LALT, KC_LGUI, BACKLIT, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT | ||
| 56 | ), | ||
| 57 | |||
| 58 | /* Lower | ||
| 59 | * ,-----------------------------------------------------------------------------------. | ||
| 60 | * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | | ||
| 61 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 62 | * | | Prev | Play | Next | | | * | 4 | 5 | 6 | - | Del | | ||
| 63 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 64 | * | Pwd | Vol- | MUTE | Vol+ | | | / | 1 | 2 | 3 | + | PgUp | | ||
| 65 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 66 | * | | | | | | | | 0 | . | = | PgDn | | ||
| 67 | * `-----------------------------------------------------------------------------------' | ||
| 68 | */ | ||
| 69 | [_LOWER] = LAYOUT_planck_grid( | ||
| 70 | _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, | ||
| 71 | _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, KC_ASTR, KC_4, KC_5, KC_6, KC_MINS, KC_DEL, | ||
| 72 | MY_PWD, KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, KC_SLSH, KC_1, KC_2, KC_3, KC_PLUS, KC_PGUP, | ||
| 73 | _______, _______, _______, _______, _______, _______, _______, _______, KC_0, KC_DOT, KC_EQL, KC_PGDN | ||
| 74 | ), | ||
| 75 | |||
| 76 | /* Raise | ||
| 77 | * ,-----------------------------------------------------------------------------------. | ||
| 78 | * | ` | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | | ||
| 79 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 80 | * | | ~ | | / | { | [ | ] | } | \ | - | + | | | | ||
| 81 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 82 | * | | | | | | | | | | _ | = | | | ||
| 83 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 84 | * | | | | | | | | Home | PgDn | PgUp | End | | ||
| 85 | * `-----------------------------------------------------------------------------------' | ||
| 86 | */ | ||
| 87 | [_RAISE] = LAYOUT_planck_grid( | ||
| 88 | |||
| 89 | KC_GRV, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, | ||
| 90 | _______, KC_TILD, _______, KC_SLSH, KC_LCBR, KC_LBRC, KC_RBRC, KC_RCBR, KC_BSLS, KC_MINS, KC_PLUS, KC_PIPE, | ||
| 91 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_EQL, _______, | ||
| 92 | _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END | ||
| 93 | ), | ||
| 94 | |||
| 95 | /* Adjust (Lower + Raise) | ||
| 96 | * ,-----------------------------------------------------------------------------------. | ||
| 97 | * | | Reset| | | | | | | | | | Del | | ||
| 98 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 99 | * | | | |Aud on|Audoff|AGnorm|AGswap| | | | | | | ||
| 100 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 101 | * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | | ||
| 102 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 103 | * | | | | | | | | | | | | | ||
| 104 | * `-----------------------------------------------------------------------------------' | ||
| 105 | */ | ||
| 106 | [_ADJUST] = LAYOUT_planck_grid( | ||
| 107 | _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , | ||
| 108 | _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______, | ||
| 109 | _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, | ||
| 110 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 111 | ) | ||
| 112 | |||
| 113 | |||
| 114 | }; | ||
| 115 | |||
| 116 | #ifdef AUDIO_ENABLE | ||
| 117 | float plover_song[][2] = SONG(PLOVER_SOUND); | ||
| 118 | float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); | ||
| 119 | #endif | ||
| 120 | |||
| 121 | uint32_t layer_state_set_user(uint32_t state) { | ||
| 122 | return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); | ||
| 123 | } | ||
| 124 | |||
| 125 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 126 | switch (keycode) { | ||
| 127 | case BACKLIT: | ||
| 128 | if (record->event.pressed) { | ||
| 129 | register_code(KC_RSFT); | ||
| 130 | #ifdef BACKLIGHT_ENABLE | ||
| 131 | backlight_step(); | ||
| 132 | #endif | ||
| 133 | #ifdef KEYBOARD_planck_rev5 | ||
| 134 | PORTE &= ~(1<<6); | ||
| 135 | #endif | ||
| 136 | } else { | ||
| 137 | unregister_code(KC_RSFT); | ||
| 138 | #ifdef KEYBOARD_planck_rev5 | ||
| 139 | PORTE |= (1<<6); | ||
| 140 | #endif | ||
| 141 | } | ||
| 142 | return false; | ||
| 143 | break; | ||
| 144 | case MY_PWD: | ||
| 145 | if (record->event.pressed) { | ||
| 146 | SEND_STRING("My secret password!"); | ||
| 147 | false; | ||
| 148 | } | ||
| 149 | break; | ||
| 150 | } | ||
| 151 | return true; | ||
| 152 | } | ||
| 153 | |||
| 154 | bool muse_mode = false; | ||
| 155 | uint8_t last_muse_note = 0; | ||
| 156 | uint16_t muse_counter = 0; | ||
| 157 | uint8_t muse_offset = 70; | ||
| 158 | uint16_t muse_tempo = 50; | ||
| 159 | |||
| 160 | void encoder_update(bool clockwise) { | ||
| 161 | if (muse_mode) { | ||
| 162 | if (IS_LAYER_ON(_RAISE)) { | ||
| 163 | if (clockwise) { | ||
| 164 | muse_offset++; | ||
| 165 | } else { | ||
| 166 | muse_offset--; | ||
| 167 | } | ||
| 168 | } else { | ||
| 169 | if (clockwise) { | ||
| 170 | muse_tempo+=1; | ||
| 171 | } else { | ||
| 172 | muse_tempo-=1; | ||
| 173 | } | ||
| 174 | } | ||
| 175 | } else { | ||
| 176 | if (clockwise) { | ||
| 177 | register_code(KC_PGDN); | ||
| 178 | unregister_code(KC_PGDN); | ||
| 179 | } else { | ||
| 180 | register_code(KC_PGUP); | ||
| 181 | unregister_code(KC_PGUP); | ||
| 182 | } | ||
| 183 | } | ||
| 184 | } | ||
| 185 | |||
| 186 | void dip_update(uint8_t index, bool active) { | ||
| 187 | switch (index) { | ||
| 188 | case 0: | ||
| 189 | if (active) { | ||
| 190 | #ifdef AUDIO_ENABLE | ||
| 191 | PLAY_SONG(plover_song); | ||
| 192 | #endif | ||
| 193 | layer_on(_ADJUST); | ||
| 194 | } else { | ||
| 195 | #ifdef AUDIO_ENABLE | ||
| 196 | PLAY_SONG(plover_gb_song); | ||
| 197 | #endif | ||
| 198 | layer_off(_ADJUST); | ||
| 199 | } | ||
| 200 | break; | ||
| 201 | case 1: | ||
| 202 | if (active) { | ||
| 203 | muse_mode = true; | ||
| 204 | } else { | ||
| 205 | muse_mode = false; | ||
| 206 | #ifdef AUDIO_ENABLE | ||
| 207 | stop_all_notes(); | ||
| 208 | #endif | ||
| 209 | } | ||
| 210 | } | ||
| 211 | } | ||
| 212 | |||
| 213 | void matrix_scan_user(void) { | ||
| 214 | #ifdef AUDIO_ENABLE | ||
| 215 | if (muse_mode) { | ||
| 216 | if (muse_counter == 0) { | ||
| 217 | uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; | ||
| 218 | if (muse_note != last_muse_note) { | ||
| 219 | stop_note(compute_freq_for_midi_note(last_muse_note)); | ||
| 220 | play_note(compute_freq_for_midi_note(muse_note), 0xF); | ||
| 221 | last_muse_note = muse_note; | ||
| 222 | } | ||
| 223 | } | ||
| 224 | muse_counter = (muse_counter + 1) % muse_tempo; | ||
| 225 | } | ||
| 226 | #endif | ||
| 227 | } | ||
| 228 | |||
| 229 | bool music_mask_user(uint16_t keycode) { | ||
| 230 | switch (keycode) { | ||
| 231 | case RAISE: | ||
| 232 | case LOWER: | ||
| 233 | return false; | ||
| 234 | default: | ||
| 235 | return true; | ||
| 236 | } | ||
| 237 | } | ||
diff --git a/keyboards/planck/keymaps/pascamel/readme.md b/keyboards/planck/keymaps/pascamel/readme.md new file mode 100644 index 000000000..b6be21cc9 --- /dev/null +++ b/keyboards/planck/keymaps/pascamel/readme.md | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | #### Base Layer | ||
| 2 | |||
| 3 | A regular QWERTY layer, with Ctrl/alt/cmd on the bottom right corner | ||
| 4 | |||
| 5 |  | ||
| 6 | |||
| 7 | |||
| 8 | |||
| 9 | #### Lower ⇓ | ||
| 10 | |||
| 11 | Focused on numbers and calculations | ||
| 12 | |||
| 13 |  | ||
| 14 | |||
| 15 | |||
| 16 | |||
| 17 | #### Raise ⇑ | ||
| 18 | |||
| 19 | Symbols | ||
| 20 | |||
| 21 |  | ||
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | #### Adjust ⇑+⇓ | ||
| 26 | |||
| 27 | Settings and configurations | ||
| 28 | |||
| 29 |  | ||
diff --git a/keyboards/planck/keymaps/pascamel/rules.mk b/keyboards/planck/keymaps/pascamel/rules.mk new file mode 100644 index 000000000..dcf16bef3 --- /dev/null +++ b/keyboards/planck/keymaps/pascamel/rules.mk | |||
| @@ -0,0 +1 @@ | |||
| SRC += muse.c | |||
