aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2021-08-25 19:04:06 +0000
committerQMK Bot <hello@qmk.fm>2021-08-25 19:04:06 +0000
commit329c130202229c50f83af4272eb8dc1c0beb30ed (patch)
tree7d647d5e3760fa84eeb712af0deb00af8bfd9023
parent527b1e52aa0c87d49b90ea18d7d3ca9728aaa9c2 (diff)
parent89f2b9486fe28685a5e53f6ef20d140ccba4aab7 (diff)
downloadqmk_firmware-329c130202229c50f83af4272eb8dc1c0beb30ed.tar.gz
qmk_firmware-329c130202229c50f83af4272eb8dc1c0beb30ed.zip
Merge remote-tracking branch 'origin/master' into develop
-rw-r--r--keyboards/preonic/keymaps/mechmaster48/config.h46
-rw-r--r--keyboards/preonic/keymaps/mechmaster48/keymap.c256
-rw-r--r--keyboards/preonic/keymaps/mechmaster48/readme.md14
-rw-r--r--keyboards/preonic/keymaps/mechmaster48/rules.mk1
4 files changed, 317 insertions, 0 deletions
diff --git a/keyboards/preonic/keymaps/mechmaster48/config.h b/keyboards/preonic/keymaps/mechmaster48/config.h
new file mode 100644
index 000000000..208d7abdb
--- /dev/null
+++ b/keyboards/preonic/keymaps/mechmaster48/config.h
@@ -0,0 +1,46 @@
1/* Copyright 2021 mechmaster48
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#pragma once
17
18#ifdef AUDIO_ENABLE
19 #define STARTUP_SONG SONG(PREONIC_SOUND)
20 // #define STARTUP_SONG SONG(NO_SOUND)
21
22 #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
23 SONG(COLEMAK_SOUND), \
24 SONG(DVORAK_SOUND) \
25 }
26#endif
27
28#define MUSIC_MASK (keycode != KC_NO)
29
30/*
31 * MIDI options
32 */
33
34/* enable basic MIDI features:
35 - MIDI notes can be sent when in Music mode is on
36*/
37
38#define MIDI_BASIC
39
40/* enable advanced MIDI features:
41 - MIDI notes can be added to the keymap
42 - Octave shift and transpose
43 - Virtual sustain, portamento, and modulation wheel
44 - etc.
45*/
46//#define MIDI_ADVANCED
diff --git a/keyboards/preonic/keymaps/mechmaster48/keymap.c b/keyboards/preonic/keymaps/mechmaster48/keymap.c
new file mode 100644
index 000000000..ede376523
--- /dev/null
+++ b/keyboards/preonic/keymaps/mechmaster48/keymap.c
@@ -0,0 +1,256 @@
1/* Copyright 2021 MechMaster48 admin@mechbox.net
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
20enum preonic_layers {
21 _QWERTY,
22 _LOWER,
23 _RAISE,
24 _ADJUST
25};
26
27enum preonic_keycodes {
28 QWERTY = SAFE_RANGE,
29 LOWER,
30 RAISE,
31 BACKLIT
32};
33
34const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
35
36/* Qwerty
37 * ,-----------------------------------------------------------------------------------.
38 * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
39 * |------+------+------+------+------+------+------+------+------+------+------+------|
40 * | Tab | Q | W | E | R | T | Y | U | I | O | P | Del |
41 * |------+------+------+------+------+-------------+------+------+------+------+------|
42 * | Caps | A | S | D | F | G | H | J | K | L | ; | Enter|
43 * |------+------+------+------+------+------|------+------+------+------+------+------|
44 * | Shift| Z | X | C | V | B | N | M | , | . | / | " |
45 * |------+------+------+------+------+------+------+------+------+------+------+------|
46 * | Ctrl | Alt | Gui | Brite |Lower | Space |Raise | Left | Down | Up |Right |
47 * `-----------------------------------------------------------------------------------'
48 */
49[_QWERTY] = LAYOUT_preonic_grid(
50 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
51 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL,
52 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
53 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT,
54 KC_LCTL, KC_LALT, KC_LGUI, BACKLIT, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
55),
56
57/* Lower
58 * ,-----------------------------------------------------------------------------------.
59 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
60 * |------+------+------+------+------+-------------+------+------+------+------+------|
61 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del |
62 * |------+------+------+------+------+-------------+------+------+------+------+------|
63 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
64 * |------+------+------+------+------+------|------+------+------+------+------+------|
65 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | |
66 * |------+------+------+------+------+------+------+------+------+------+------+------|
67 * | | | | | | | | Next | Vol- | Vol+ | Play |
68 * `-----------------------------------------------------------------------------------'
69 */
70[_LOWER] = LAYOUT_preonic_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_BSPC,
72 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL,
73 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
74 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),KC_HOME, KC_END, _______,
75 _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
76),
77
78/* Raise
79 * ,-----------------------------------------------------------------------------------.
80 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
81 * |------+------+------+------+------+------+------+------+------+------+------+------|
82 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del |
83 * |------+------+------+------+------+-------------+------+------+------+------+------|
84 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
85 * |------+------+------+------+------+------|------+------+------+------+------+------|
86 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | Pg Up| Pg Dn| |
87 * |------+------+------+------+------+------+------+------+------+------+------+------|
88 * | | | | | | | | Next | Vol- | Vol+ | Play |
89 * `-----------------------------------------------------------------------------------'
90 */
91[_RAISE] = LAYOUT_preonic_grid(
92 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
93 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,
94 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
95 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______,
96 _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
97),
98
99/* Adjust (Lower + Raise)
100 * ,-----------------------------------------------------------------------------------.
101 * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
102 * |------+------+------+------+------+------+------+------+------+------+------+------|
103 * | | Reset| Debug| | | | |TermOf|TermOn| | | Del |
104 * |------+------+------+------+------+-------------+------+------+------+------+------|
105 * | | |Aud cy|Aud on|AudOff|AGnorm|AGswap|Qwerty| | | | |
106 * |------+------+------+------+------+------|------+------+------+------+------+------|
107 * | |Voice-|Voice+|Mus on|MusOff|MidiOn|MidOff| | | | | |
108 * |------+------+------+------+------+------+------+------+------+------+------+------|
109 * | | | | | | | | | | | |
110 * `-----------------------------------------------------------------------------------'
111 */
112[_ADJUST] = LAYOUT_preonic_grid(
113 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
114 _______, RESET, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL,
115 _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______,
116 _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
117 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
118)
119
120
121};
122
123bool process_record_user(uint16_t keycode, keyrecord_t *record) {
124 switch (keycode) {
125 case QWERTY:
126 if (record->event.pressed) {
127 set_single_persistent_default_layer(_QWERTY);
128 }
129 return false;
130 break;
131 case LOWER:
132 if (record->event.pressed) {
133 layer_on(_LOWER);
134 update_tri_layer(_LOWER, _RAISE, _ADJUST);
135 } else {
136 layer_off(_LOWER);
137 update_tri_layer(_LOWER, _RAISE, _ADJUST);
138 }
139 return false;
140 break;
141 case RAISE:
142 if (record->event.pressed) {
143 layer_on(_RAISE);
144 update_tri_layer(_LOWER, _RAISE, _ADJUST);
145 } else {
146 layer_off(_RAISE);
147 update_tri_layer(_LOWER, _RAISE, _ADJUST);
148 }
149 return false;
150 break;
151 case BACKLIT:
152 if (record->event.pressed) {
153 register_code(KC_RSFT);
154 #ifdef BACKLIGHT_ENABLE
155 backlight_step();
156 #endif
157 #ifdef RGBLIGHT_ENABLE
158 rgblight_step();
159 #endif
160 #ifdef __AVR__
161 writePinLow(E6);
162 #endif
163 } else {
164 unregister_code(KC_RSFT);
165 #ifdef __AVR__
166 writePinHigh(E6);
167 #endif
168 }
169 return false;
170 break;
171 }
172 return true;
173};
174
175bool muse_mode = false;
176uint8_t last_muse_note = 0;
177uint16_t muse_counter = 0;
178uint8_t muse_offset = 70;
179uint16_t muse_tempo = 50;
180
181bool encoder_update_user(uint8_t index, bool clockwise) {
182 if (muse_mode) {
183 if (IS_LAYER_ON(_RAISE)) {
184 if (clockwise) {
185 muse_offset++;
186 } else {
187 muse_offset--;
188 }
189 } else {
190 if (clockwise) {
191 muse_tempo+=1;
192 } else {
193 muse_tempo-=1;
194 }
195 }
196 } else {
197 if (clockwise) {
198 register_code(KC_PGDN);
199 unregister_code(KC_PGDN);
200 } else {
201 register_code(KC_PGUP);
202 unregister_code(KC_PGUP);
203 }
204 }
205 return true;
206}
207
208void dip_switch_update_user(uint8_t index, bool active) {
209 switch (index) {
210 case 0:
211 if (active) {
212 layer_on(_ADJUST);
213 } else {
214 layer_off(_ADJUST);
215 }
216 break;
217 case 1:
218 if (active) {
219 muse_mode = true;
220 } else {
221 muse_mode = false;
222 }
223 }
224}
225
226
227void matrix_scan_user(void) {
228#ifdef AUDIO_ENABLE
229 if (muse_mode) {
230 if (muse_counter == 0) {
231 uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
232 if (muse_note != last_muse_note) {
233 stop_note(compute_freq_for_midi_note(last_muse_note));
234 play_note(compute_freq_for_midi_note(muse_note), 0xF);
235 last_muse_note = muse_note;
236 }
237 }
238 muse_counter = (muse_counter + 1) % muse_tempo;
239 } else {
240 if (muse_counter) {
241 stop_all_notes();
242 muse_counter = 0;
243 }
244 }
245#endif
246}
247
248bool music_mask_user(uint16_t keycode) {
249 switch (keycode) {
250 case RAISE:
251 case LOWER:
252 return false;
253 default:
254 return true;
255 }
256}
diff --git a/keyboards/preonic/keymaps/mechmaster48/readme.md b/keyboards/preonic/keymaps/mechmaster48/readme.md
new file mode 100644
index 000000000..8e2f9c111
--- /dev/null
+++ b/keyboards/preonic/keymaps/mechmaster48/readme.md
@@ -0,0 +1,14 @@
1# OLKB Preonic Rev3 layout by mechmaster48
2
3- A simple layout largely based on the default with minor tweaks to fit my typing.
4- The esacpe key has been moved to the top left, ctrl and alt moved to bottom left, and enter key has been moved up one space underneath delete.
5- Colemak and Dvorak layers have been removed in this keymap as I do not and will not use them.
6
7![base layer](https://i.imgur.com/zrmDHXx.gif)
8#------------------------------------------------------
9![lower layer](https://imgur.com/sDEeixE.gif)
10#------------------------------------------------------
11![raise layer](https://imgur.com/bGLukr1.gif)
12#------------------------------------------------------
13![adjust layer](https://imgur.com/UsB87YE.gif)
14#------------------------------------------------------
diff --git a/keyboards/preonic/keymaps/mechmaster48/rules.mk b/keyboards/preonic/keymaps/mechmaster48/rules.mk
new file mode 100644
index 000000000..dcf16bef3
--- /dev/null
+++ b/keyboards/preonic/keymaps/mechmaster48/rules.mk
@@ -0,0 +1 @@
SRC += muse.c