diff options
| author | QMK Bot <hello@qmk.fm> | 2021-01-10 04:01:40 +0000 |
|---|---|---|
| committer | QMK Bot <hello@qmk.fm> | 2021-01-10 04:01:40 +0000 |
| commit | 54a8262dfe3b3bf5e27024e1fdb18448bac53408 (patch) | |
| tree | dc42f86ce0a258193efeaa55f86db414ffb593df | |
| parent | 1092cc4bbf287ff91ad34b3bb1dbfb1eff3ab2e4 (diff) | |
| parent | acdcc622028a7c8e6ec086a5da2bff67fd137445 (diff) | |
| download | qmk_firmware-54a8262dfe3b3bf5e27024e1fdb18448bac53408.tar.gz qmk_firmware-54a8262dfe3b3bf5e27024e1fdb18448bac53408.zip | |
Merge remote-tracking branch 'origin/master' into develop
| -rw-r--r-- | keyboards/planck/keymaps/atreus/config.h | 55 | ||||
| -rw-r--r-- | keyboards/planck/keymaps/atreus/keymap.c | 239 | ||||
| -rw-r--r-- | keyboards/planck/keymaps/atreus/readme.md | 9 | ||||
| -rw-r--r-- | keyboards/planck/keymaps/atreus/rules.mk | 1 |
4 files changed, 304 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/atreus/config.h b/keyboards/planck/keymaps/atreus/config.h new file mode 100644 index 000000000..c83a0279d --- /dev/null +++ b/keyboards/planck/keymaps/atreus/config.h | |||
| @@ -0,0 +1,55 @@ | |||
| 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 | #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 | SONG(COLEMAK_SOUND), \ | ||
| 25 | SONG(DVORAK_SOUND) \ | ||
| 26 | } | ||
| 27 | #endif | ||
| 28 | |||
| 29 | /* | ||
| 30 | * MIDI options | ||
| 31 | */ | ||
| 32 | |||
| 33 | /* Prevent use of disabled MIDI features in the keymap */ | ||
| 34 | //#define MIDI_ENABLE_STRICT 1 | ||
| 35 | |||
| 36 | /* enable basic MIDI features: | ||
| 37 | - MIDI notes can be sent when in Music mode is on | ||
| 38 | */ | ||
| 39 | |||
| 40 | #define MIDI_BASIC | ||
| 41 | |||
| 42 | /* enable advanced MIDI features: | ||
| 43 | - MIDI notes can be added to the keymap | ||
| 44 | - Octave shift and transpose | ||
| 45 | - Virtual sustain, portamento, and modulation wheel | ||
| 46 | - etc. | ||
| 47 | */ | ||
| 48 | //#define MIDI_ADVANCED | ||
| 49 | |||
| 50 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
| 51 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
| 52 | |||
| 53 | // Most tactile encoders have detents every 4 stages | ||
| 54 | #define ENCODER_RESOLUTION 4 | ||
| 55 | |||
diff --git a/keyboards/planck/keymaps/atreus/keymap.c b/keyboards/planck/keymaps/atreus/keymap.c new file mode 100644 index 000000000..b78a7017e --- /dev/null +++ b/keyboards/planck/keymaps/atreus/keymap.c | |||
| @@ -0,0 +1,239 @@ | |||
| 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 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 21 | /* Default layer | ||
| 22 | * ,-----------------------------------------------------------------------------------. | ||
| 23 | * | Q | W | E | R | T | | | Y | U | I | O | P | | ||
| 24 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 25 | * | A | S | D | F | G | | | H | J | K | L | ; | | ||
| 26 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 27 | * | Z | X | C | V | B | ` | \ | N | M | , | . | / | | ||
| 28 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 29 | * | Esc | Tab | GUI | Shift| Bksp | Ctrl | Alt |Space | Fun | - | ' |Enter | | ||
| 30 | * `-----------------------------------------------------------------------------------' | ||
| 31 | */ | ||
| 32 | [0] = LAYOUT_ortho_4x12( | ||
| 33 | KC_Q, KC_W, KC_E, KC_R, KC_T, KC_NO, KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO, KC_NO, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_GRV, KC_BSLS, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ESC, KC_TAB, KC_LGUI, KC_LSFT, KC_BSPC, KC_LCTL, KC_LALT, KC_SPC, MO(1), KC_MINS, KC_QUOT, KC_ENT), | ||
| 34 | /* Function layer | ||
| 35 | * ,-----------------------------------------------------------------------------------. | ||
| 36 | * | ! | @ | Up | $ | % | | | PgUp | 7 | 8 | 9 | Bksp | | ||
| 37 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 38 | * | ( | Left | Down |Right | ) | | | PgDn | 4 | 5 | 6 | | | ||
| 39 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 40 | * | [ | ] | # | { | } | ^ | & | * | 1 | 2 | 3 | + | | ||
| 41 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 42 | * | Upper| Ins | | | | | | | | . | 0 | = | | ||
| 43 | * `-----------------------------------------------------------------------------------' | ||
| 44 | */ | ||
| 45 | [1] = LAYOUT_ortho_4x12( | ||
| 46 | KC_EXLM, KC_AT, KC_UP, KC_DLR, KC_PERC, KC_NO, KC_NO, KC_PGUP, KC_7, KC_8, KC_9, KC_BSPC, KC_LPRN, KC_LEFT, KC_DOWN, KC_RGHT, KC_RPRN, KC_NO, KC_NO, KC_PGDN, KC_4, KC_5, KC_6, KC_NO, KC_LBRC, KC_RBRC, KC_HASH, KC_LCBR, KC_RCBR, KC_CIRC, KC_AMPR, KC_ASTR, KC_1, KC_2, KC_3, KC_PLUS, TG(2), KC_INS, KC_LGUI, KC_LSFT, KC_DEL, KC_LCTL, KC_LALT, KC_SPC, KC_TRNS, KC_DOT, KC_0, KC_EQL), | ||
| 47 | /* Upper layer | ||
| 48 | * ,-----------------------------------------------------------------------------------. | ||
| 49 | * | Ins | Home | | End | PgUp | | | Up | F7 | F8 | F9 | F10 | | ||
| 50 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 51 | * | Del | | | | PgDn | | | Down | F4 | F5 | F6 | F11 | | ||
| 52 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 53 | * | | Vol+ | | | | | | | F1 | F2 | F3 | F12 | | ||
| 54 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 55 | * | | Vol- | | | | | | | |PrtSc |ScrLk | Play | | ||
| 56 | * `-----------------------------------------------------------------------------------' | ||
| 57 | */ | ||
| 58 | [2] = LAYOUT_ortho_4x12( | ||
| 59 | KC_INS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_NO, KC_NO, KC_UP, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_NO, KC_NO, KC_DOWN, KC_F4, KC_F5, KC_F6, KC_F11, KC_NO, KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_F1, KC_F2, KC_F3, KC_F12, KC_NO, KC_VOLD, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, TO(0), KC_PSCR, KC_SLCK, KC_MPLY) | ||
| 60 | }; | ||
| 61 | |||
| 62 | #ifdef AUDIO_ENABLE | ||
| 63 | float plover_song[][2] = SONG(PLOVER_SOUND); | ||
| 64 | float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); | ||
| 65 | #endif | ||
| 66 | |||
| 67 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
| 68 | return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); | ||
| 69 | } | ||
| 70 | |||
| 71 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 72 | switch (keycode) { | ||
| 73 | case QWERTY: | ||
| 74 | if (record->event.pressed) { | ||
| 75 | print("mode just switched to qwerty and this is a huge string\n"); | ||
| 76 | set_single_persistent_default_layer(_QWERTY); | ||
| 77 | } | ||
| 78 | return false; | ||
| 79 | break; | ||
| 80 | case COLEMAK: | ||
| 81 | if (record->event.pressed) { | ||
| 82 | set_single_persistent_default_layer(_COLEMAK); | ||
| 83 | } | ||
| 84 | return false; | ||
| 85 | break; | ||
| 86 | case DVORAK: | ||
| 87 | if (record->event.pressed) { | ||
| 88 | set_single_persistent_default_layer(_DVORAK); | ||
| 89 | } | ||
| 90 | return false; | ||
| 91 | break; | ||
| 92 | case BACKLIT: | ||
| 93 | if (record->event.pressed) { | ||
| 94 | register_code(KC_RSFT); | ||
| 95 | #ifdef BACKLIGHT_ENABLE | ||
| 96 | backlight_step(); | ||
| 97 | #endif | ||
| 98 | #ifdef KEYBOARD_planck_rev5 | ||
| 99 | writePinLow(E6); | ||
| 100 | #endif | ||
| 101 | } else { | ||
| 102 | unregister_code(KC_RSFT); | ||
| 103 | #ifdef KEYBOARD_planck_rev5 | ||
| 104 | writePinHigh(E6); | ||
| 105 | #endif | ||
| 106 | } | ||
| 107 | return false; | ||
| 108 | break; | ||
| 109 | case PLOVER: | ||
| 110 | if (record->event.pressed) { | ||
| 111 | #ifdef AUDIO_ENABLE | ||
| 112 | stop_all_notes(); | ||
| 113 | PLAY_SONG(plover_song); | ||
| 114 | #endif | ||
| 115 | layer_off(_RAISE); | ||
| 116 | layer_off(_LOWER); | ||
| 117 | layer_off(_ADJUST); | ||
| 118 | layer_on(_PLOVER); | ||
| 119 | if (!eeconfig_is_enabled()) { | ||
| 120 | eeconfig_init(); | ||
| 121 | } | ||
| 122 | keymap_config.raw = eeconfig_read_keymap(); | ||
| 123 | keymap_config.nkro = 1; | ||
| 124 | eeconfig_update_keymap(keymap_config.raw); | ||
| 125 | } | ||
| 126 | return false; | ||
| 127 | break; | ||
| 128 | case EXT_PLV: | ||
| 129 | if (record->event.pressed) { | ||
| 130 | #ifdef AUDIO_ENABLE | ||
| 131 | PLAY_SONG(plover_gb_song); | ||
| 132 | #endif | ||
| 133 | layer_off(_PLOVER); | ||
| 134 | } | ||
| 135 | return false; | ||
| 136 | break; | ||
| 137 | } | ||
| 138 | return true; | ||
| 139 | } | ||
| 140 | |||
| 141 | bool muse_mode = false; | ||
| 142 | uint8_t last_muse_note = 0; | ||
| 143 | uint16_t muse_counter = 0; | ||
| 144 | uint8_t muse_offset = 70; | ||
| 145 | uint16_t muse_tempo = 50; | ||
| 146 | |||
| 147 | void encoder_update(bool clockwise) { | ||
| 148 | if (muse_mode) { | ||
| 149 | if (IS_LAYER_ON(_RAISE)) { | ||
| 150 | if (clockwise) { | ||
| 151 | muse_offset++; | ||
| 152 | } else { | ||
| 153 | muse_offset--; | ||
| 154 | } | ||
| 155 | } else { | ||
| 156 | if (clockwise) { | ||
| 157 | muse_tempo+=1; | ||
| 158 | } else { | ||
| 159 | muse_tempo-=1; | ||
| 160 | } | ||
| 161 | } | ||
| 162 | } else { | ||
| 163 | if (clockwise) { | ||
| 164 | #ifdef MOUSEKEY_ENABLE | ||
| 165 | tap_code(KC_MS_WH_DOWN); | ||
| 166 | #else | ||
| 167 | tap_code(KC_PGDN); | ||
| 168 | #endif | ||
| 169 | } else { | ||
| 170 | #ifdef MOUSEKEY_ENABLE | ||
| 171 | tap_code(KC_MS_WH_UP); | ||
| 172 | #else | ||
| 173 | tap_code(KC_PGUP); | ||
| 174 | #endif | ||
| 175 | } | ||
| 176 | } | ||
| 177 | } | ||
| 178 | |||
| 179 | void dip_switch_update_user(uint8_t index, bool active) { | ||
| 180 | switch (index) { | ||
| 181 | case 0: { | ||
| 182 | #ifdef AUDIO_ENABLE | ||
| 183 | static bool play_sound = false; | ||
| 184 | #endif | ||
| 185 | if (active) { | ||
| 186 | #ifdef AUDIO_ENABLE | ||
| 187 | if (play_sound) { PLAY_SONG(plover_song); } | ||
| 188 | #endif | ||
| 189 | layer_on(_ADJUST); | ||
| 190 | } else { | ||
| 191 | #ifdef AUDIO_ENABLE | ||
| 192 | if (play_sound) { PLAY_SONG(plover_gb_song); } | ||
| 193 | #endif | ||
| 194 | layer_off(_ADJUST); | ||
| 195 | } | ||
| 196 | #ifdef AUDIO_ENABLE | ||
| 197 | play_sound = true; | ||
| 198 | #endif | ||
| 199 | break; | ||
| 200 | } | ||
| 201 | case 1: | ||
| 202 | if (active) { | ||
| 203 | muse_mode = true; | ||
| 204 | } else { | ||
| 205 | muse_mode = false; | ||
| 206 | } | ||
| 207 | } | ||
| 208 | } | ||
| 209 | |||
| 210 | void matrix_scan_user(void) { | ||
| 211 | #ifdef AUDIO_ENABLE | ||
| 212 | if (muse_mode) { | ||
| 213 | if (muse_counter == 0) { | ||
| 214 | uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; | ||
| 215 | if (muse_note != last_muse_note) { | ||
| 216 | stop_note(compute_freq_for_midi_note(last_muse_note)); | ||
| 217 | play_note(compute_freq_for_midi_note(muse_note), 0xF); | ||
| 218 | last_muse_note = muse_note; | ||
| 219 | } | ||
| 220 | } | ||
| 221 | muse_counter = (muse_counter + 1) % muse_tempo; | ||
| 222 | } else { | ||
| 223 | if (muse_counter) { | ||
| 224 | stop_all_notes(); | ||
| 225 | muse_counter = 0; | ||
| 226 | } | ||
| 227 | } | ||
| 228 | #endif | ||
| 229 | } | ||
| 230 | |||
| 231 | bool music_mask_user(uint16_t keycode) { | ||
| 232 | switch (keycode) { | ||
| 233 | case RAISE: | ||
| 234 | case LOWER: | ||
| 235 | return false; | ||
| 236 | default: | ||
| 237 | return true; | ||
| 238 | } | ||
| 239 | } | ||
diff --git a/keyboards/planck/keymaps/atreus/readme.md b/keyboards/planck/keymaps/atreus/readme.md new file mode 100644 index 000000000..81940642c --- /dev/null +++ b/keyboards/planck/keymaps/atreus/readme.md | |||
| @@ -0,0 +1,9 @@ | |||
| 1 |  | ||
| 2 | |||
| 3 | # Keyboardio Atreus layout for Planck | ||
| 4 | |||
| 5 | This is the same layout as the new Atreus from Keyboardio (the one with 44 keys, so not the atreus v1). | ||
| 6 | There are 4 unused keys in the center as the Planck has 48 keys. | ||
| 7 | It is mostly for people with a Planck to try this new layout before buying. | ||
| 8 | |||
| 9 | More details here: https://shop.keyboard.io/products/keyboardio-atreus | ||
diff --git a/keyboards/planck/keymaps/atreus/rules.mk b/keyboards/planck/keymaps/atreus/rules.mk new file mode 100644 index 000000000..dcf16bef3 --- /dev/null +++ b/keyboards/planck/keymaps/atreus/rules.mk | |||
| @@ -0,0 +1 @@ | |||
| SRC += muse.c | |||
