aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjonavin <71780717+Jonavin@users.noreply.github.com>2021-09-02 00:12:57 -0400
committerGitHub <noreply@github.com>2021-09-01 21:12:57 -0700
commit98a2e9dc0ef7b18826e21af75fd24861ac683173 (patch)
treef1a25bc76db6ef969998d6fc32f9851fba08f144
parente056ae58a045d59686572ec1349c5c9f285517e5 (diff)
downloadqmk_firmware-98a2e9dc0ef7b18826e21af75fd24861ac683173.tar.gz
qmk_firmware-98a2e9dc0ef7b18826e21af75fd24861ac683173.zip
[Keymap] new murphpad landscape keymap with encoder enhanced functions (#14103)
Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Jonavin <=>
-rw-r--r--keyboards/mechwild/murphpad/keymaps/jonavin/config.h23
-rw-r--r--keyboards/mechwild/murphpad/keymaps/jonavin/keymap.c343
-rw-r--r--keyboards/mechwild/murphpad/keymaps/jonavin/layout_landscape.h43
-rw-r--r--keyboards/mechwild/murphpad/keymaps/jonavin/readme.md65
-rw-r--r--keyboards/mechwild/murphpad/keymaps/jonavin/rules.mk5
5 files changed, 479 insertions, 0 deletions
diff --git a/keyboards/mechwild/murphpad/keymaps/jonavin/config.h b/keyboards/mechwild/murphpad/keymaps/jonavin/config.h
new file mode 100644
index 000000000..7c1621515
--- /dev/null
+++ b/keyboards/mechwild/murphpad/keymaps/jonavin/config.h
@@ -0,0 +1,23 @@
1/* Copyright 2021 Jonavin Eng
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// Standard encoder position. Set to 1 for top right optional position
20#define ENCODER_DEFAULTACTIONS_INDEX 0
21
22// Increase layers to 6 for VIA
23#define DYNAMIC_KEYMAP_LAYER_COUNT 6
diff --git a/keyboards/mechwild/murphpad/keymaps/jonavin/keymap.c b/keyboards/mechwild/murphpad/keymaps/jonavin/keymap.c
new file mode 100644
index 000000000..001abc502
--- /dev/null
+++ b/keyboards/mechwild/murphpad/keymaps/jonavin/keymap.c
@@ -0,0 +1,343 @@
1/* Copyright 2021 Kyle McCreery
2 * Copyright 2021 Jonavin Eng
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17#include QMK_KEYBOARD_H
18#include "jonavin.h"
19#include "layout_landscape.h"
20
21#define LANDSCAPE_MODE
22
23// Defines names for use in layer keycodes and the keymap
24enum layer_names {
25 _FN2 = 2,
26 _FN3,
27 _FN4,
28 _RGB
29};
30
31const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
32
33 [_BASE] = LAYOUT_landscape(
34 TT(_FN1), TT(_FN2), KC_MUTE,
35
36 KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_PPLS, KC_BSPC,
37 KC_TAB, KC_P7, KC_P8, KC_P9, KC_PDOT, KC_RGUI,
38 KC_RSFT, KC_P4, KC_P5, KC_P6, KC_COMMA, KC_RCTL,
39 KC_P0, KC_P1, KC_P2, KC_P3, KC_PENT, KC_RALT,
40
41 TT(_FN3), TT(_FN4), TT(_RGB)
42 ),
43 [_FN1] = LAYOUT_landscape(
44 _______, _______, ENCFUNC,
45
46 _______, KC_F10, KC_F11, KC_F12, KC_PSCR, _______,
47 _______, KC_F7, KC_F8, KC_F9, KC_SLCK, _______,
48 _______, KC_F4, KC_F5, KC_F6, KC_PAUS, _______,
49 _______, KC_F1, KC_F2, KC_F3, _______, _______,
50
51 _______, _______, _______
52 ),
53 [_FN2] = LAYOUT_landscape(
54 _______, _______, RESET,
55
56 _______, _______, _______, _______, _______, _______,
57 _______, _______, _______, _______, _______, _______,
58 _______, _______, _______, _______, _______, _______,
59 _______, _______, _______, _______, _______, _______,
60
61 _______, _______, _______
62 ),
63 [_FN3] = LAYOUT_landscape(
64 _______, _______, _______,
65
66 _______, _______, _______, _______, _______, _______,
67 _______, _______, _______, _______, _______, _______,
68 _______, _______, _______, _______, _______, _______,
69 _______, _______, _______, _______, _______, _______,
70
71 _______, _______, _______
72 ),
73 [_FN4] = LAYOUT_landscape(
74 _______, _______, _______,
75
76 _______, _______, _______, _______, _______, _______,
77 _______, _______, _______, _______, _______, _______,
78 _______, _______, _______, _______, _______, _______,
79 _______, _______, _______, _______, _______, _______,
80
81 _______, _______, _______
82 ),
83 [_RGB] = LAYOUT_landscape(
84 _______, _______, _______,
85
86 _______, _______, _______, _______, _______, _______,
87 _______, RGB_HUD, RGB_SPI, RGB_HUI, RGB_SAI, _______,
88 _______, RGB_RMOD, RGB_TOG, RGB_MOD, RGB_SAD, _______,
89 _______, RGB_VAD, RGB_SPD, RGB_VAI, KC_NO, _______,
90
91 _______, _______, _______
92 ),
93};
94
95typedef struct {
96 char keydesc[6]; // this will be displayed on OLED
97 uint16_t keycode; // this is the keycode that will be sent when activted
98} keycodedescType;
99
100static const keycodedescType PROGMEM keyselection[] = {
101 // list of key codes that will be scrolled through by encoder and description
102 {"TASK", KC_TASK},
103 {"INS", KC_INS},
104 {"DEL", KC_DEL},
105 {"PrtSc", KC_PSCR},
106 {"ScrLk", KC_SCLN},
107 {"Break", KC_PAUS},
108 {"C-A-D", KC_CAD}, // Ctrl-Alt-Del
109 {"AltF4", KC_AF4},
110 {"PLAY", KC_MEDIA_PLAY_PAUSE},
111 {"RESET", RESET}, // firmware flash mode
112};
113
114#define MAX_KEYSELECTION sizeof(keyselection)/sizeof(keyselection[0])
115
116static uint8_t selectedkey_idx = 0;
117static keycodedescType selectedkey_rec;
118
119static void set_selectedkey(uint8_t idx) {
120 // make a copy from PROGMEM
121 memcpy_P (&selectedkey_rec, &keyselection[idx], sizeof selectedkey_rec);
122
123 //selectedkey_rec = keyselection[idx];
124
125}
126
127void keyboard_post_init_keymap(void) {
128 // Call the keyboard post init code.
129 set_selectedkey(selectedkey_idx);
130}
131
132bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
133 switch (keycode) {
134 case ENCFUNC:
135 if (record->event.pressed) {
136 selectedkey_rec.keycode == RESET ? reset_keyboard() : tap_code16(selectedkey_rec.keycode); // handle RESET code
137 } else {
138 // when keycode is released
139 }
140 break;
141 }
142 return true;
143};
144
145
146#ifdef ENCODER_ENABLE // Encoder Functionality
147 uint8_t selected_layer = 0;
148
149 bool encoder_update_user(uint8_t index, bool clockwise) {
150 #ifdef OLED_ENABLE
151 oled_clear();
152 oled_render();
153 #endif
154 switch (index) {
155 case 0: // This is the only encoder right now, keeping for consistency
156 switch(get_highest_layer(layer_state)){ // special handling per layer
157 case _FN1: // on Fn layer select what the encoder does when pressed
158 if (!keyboard_report->mods) {
159 if ( clockwise ) {
160 if ( selectedkey_idx < MAX_KEYSELECTION-1) {
161 selectedkey_idx ++;
162 } else {
163 // do nothing
164 }
165 } else if ( !clockwise ) {
166 if ( selectedkey_idx > 0){
167 selectedkey_idx --;
168 } else {
169 // do nothing
170 }
171 }
172 set_selectedkey(selectedkey_idx);
173 break;
174 } else {
175 // continue to default
176 }
177 default: // all other layers
178 if ( clockwise ) {
179 if (keyboard_report->mods & MOD_BIT(KC_RSFT) ) { // If you are holding Right Shift, encoder changes layers
180 if(selected_layer < (DYNAMIC_KEYMAP_LAYER_COUNT-1)) {
181 selected_layer ++;
182 layer_move(selected_layer);
183 }
184 } else if (keyboard_report->mods & MOD_BIT(KC_RCTL)) { // if holding Right Ctrl, navigate next word
185 tap_code16(LCTL(KC_RGHT));
186 } else if (keyboard_report->mods & MOD_BIT(KC_RALT)) { // if holding Right Alt, change media next track
187 tap_code(KC_MEDIA_NEXT_TRACK);
188 } else {
189 tap_code(KC_VOLU); // Otherwise it just changes volume
190 }
191 } else if ( !clockwise ) {
192 if (keyboard_report->mods & MOD_BIT(KC_RSFT) ) {
193 if (selected_layer > 0) {
194 selected_layer --;
195 layer_move(selected_layer);
196 }
197 } else if (keyboard_report->mods & MOD_BIT(KC_RCTL)) { // if holding Right Ctrl, navigate previous word
198 tap_code16(LCTL(KC_LEFT));
199 } else if (keyboard_report->mods & MOD_BIT(KC_RALT)) { // if holding Right Alt, change media previous track
200 tap_code(KC_MEDIA_PREV_TRACK);
201 } else {
202 tap_code(KC_VOLD);
203 }
204 }
205 break;
206 }
207 break;
208 }
209 return true;
210 }
211#endif
212
213
214#ifdef OLED_ENABLE
215 static void render_logo(void) { // Render MechWild "MW" Logo
216 static const char PROGMEM logo_1[] = {0x8A, 0x8B, 0x8C, 0x8D, 0x00};
217 static const char PROGMEM logo_2[] = {0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0x00};
218 static const char PROGMEM logo_3[] = {0xCA, 0xCB, 0xCC, 0xCD, 0x00};
219 static const char PROGMEM logo_4[] = {0x20, 0x8E, 0x8F, 0x90, 0x00};
220 oled_set_cursor(0,0);
221 oled_write_P(logo_1, false);
222 oled_set_cursor(0,1);
223 oled_write_P(logo_2, false);
224 oled_set_cursor(0,2);
225 oled_write_P(logo_3, false);
226 oled_set_cursor(0,3);
227 oled_write_P(logo_4, false);
228 }
229
230 #ifdef LANDSCAPE_MODE
231 void oled_task_user(void) {
232
233 render_logo();
234 oled_set_cursor(8,2);
235 switch(selected_layer){
236 case _BASE:
237 oled_write_P(PSTR("BASE"), false);
238 break;
239 case _FN1:
240 oled_write_P(PSTR("FN "), false);
241 oled_write(selectedkey_rec.keydesc, false);
242 break;
243 case _FN2:
244 oled_write_P(PSTR("FN2 "), false);
245 break;
246 case _FN3:
247 oled_write_P(PSTR("FN3 "), false);
248 break;
249 case _FN4:
250 oled_write_P(PSTR("FN4 "), false);
251 break;
252 case _RGB:
253 oled_write_P(PSTR("RGB "), false);
254 break;
255 default:
256 oled_write_P(PSTR(" ?? "), false); // Should never display, here as a catchall
257 }
258 oled_write_P(keymap_config.no_gui ? PSTR(" WL") : PSTR(" "), false);
259 oled_set_cursor(8,3);
260 if (get_highest_layer(layer_state) == selected_layer) {
261 oled_write_P(PSTR(" "), false);
262 } else {
263 switch (get_highest_layer(layer_state)) {
264 case _BASE:
265 oled_write_P(PSTR("Temp BASE"), false);
266 break;
267 case _FN1:
268 oled_write_P(PSTR("Temp FN "), false);
269 oled_write(selectedkey_rec.keydesc, false);
270 break;
271 case _FN2:
272 oled_write_P(PSTR("Temp FN2 "), false);
273 break;
274 case _FN3:
275 oled_write_P(PSTR("Temp FN3 "), false);
276 break;
277 case _FN4:
278 oled_write_P(PSTR("Temp FN4 "), false);
279 break;
280 case _RGB:
281 oled_write_P(PSTR("Temp RGB "), false);
282 break;
283 default:
284 oled_write_P(PSTR("Temp ????"), false); // Should never display, here as a catchall
285 }
286 }
287 led_t led_state = host_keyboard_led_state();
288 oled_set_cursor(8,0);
289 oled_write_P(PSTR(" JONAVIN "), false);
290 oled_set_cursor(8,1);
291 oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
292 oled_write_P(led_state.caps_lock ? PSTR("CAPS ") : PSTR(" "), false);
293 oled_write_P(led_state.scroll_lock ? PSTR("SCR") : PSTR(" "), false);
294 }
295 #endif // LANDSCAPE_MODE
296
297 // regular mode
298 #ifndef LANDSCAPE_MODE
299 oled_rotation_t oled_init_user(oled_rotation_t rotation) {
300 return OLED_ROTATION_270; // flips the display 270 degrees
301 }
302
303 void oled_task_user(void) {
304 render_logo();
305 oled_set_cursor(0,6);
306
307 oled_write_ln_P(PSTR("Layer"), false);
308
309 switch (get_highest_layer(layer_state)) {
310 case _BASE:
311 oled_write_ln_P(PSTR("Base"), false);
312 break;
313 case _FN1:
314 oled_write_ln_P(PSTR("FN 1"), false);
315 break;
316 case _FN2:
317 oled_write_ln_P(PSTR("FN 2"), false);
318 break;
319 case _FN3:
320 oled_write_ln_P(PSTR("FN 3"), false);
321 break;
322 case _FN4:
323 oled_write_ln_P(PSTR("FN 4"), false);
324 break;
325 case _RGB:
326 oled_write_ln_P(PSTR("RGB "), false);
327 break;
328 default:
329 oled_write_ln_P(PSTR("Undef"), false);
330 }
331 oled_write_ln_P(PSTR(""), false);
332 // Host Keyboard LED Status
333 led_t led_state = host_keyboard_led_state();
334 oled_write_ln_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
335 oled_write_ln_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
336 oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
337 }
338 #endif // !LANDSCAPE_MODE
339
340 void suspend_power_down_user(void) { // shutdown oled when powered down to prevent OLED from showing Mercutio all the time
341 oled_off();
342 }
343#endif
diff --git a/keyboards/mechwild/murphpad/keymaps/jonavin/layout_landscape.h b/keyboards/mechwild/murphpad/keymaps/jonavin/layout_landscape.h
new file mode 100644
index 000000000..2a3dce21d
--- /dev/null
+++ b/keyboards/mechwild/murphpad/keymaps/jonavin/layout_landscape.h
@@ -0,0 +1,43 @@
1/* Copyright 2021 Jonavin Eng
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#include "quantum.h"
20
21/* First section contains the physical layout of the board and position of keys.
22 *
23 * Second is a two-dimensional array which represents the switch matrix.
24 */
25
26#define LAYOUT_landscape( \
27 k50, k40, k30, \
28 k51, k41, k31, k20, k10, k00, \
29 k52, k42, k32, k21, k11, k01, \
30 k53, k43, k33, k22, k12, k02, \
31 k54, k44, k34, k23, k13, k03, \
32 \
33 BACK00, BACK01, BACK02 \
34\
35) { \
36 { BACK00, k00, k01, k02, k03 }, \
37 { BACK01, k10, k11, k12, k13 }, \
38 { BACK02, k20, k21, k22, k23 }, \
39 { k30, k31, k32, k33, k34 }, \
40 { k40, k41, k42, k43, k44 }, \
41 { k50, k51, k52, k53, k54 } \
42}
43
diff --git a/keyboards/mechwild/murphpad/keymaps/jonavin/readme.md b/keyboards/mechwild/murphpad/keymaps/jonavin/readme.md
new file mode 100644
index 000000000..933157063
--- /dev/null
+++ b/keyboards/mechwild/murphpad/keymaps/jonavin/readme.md
@@ -0,0 +1,65 @@
1Jonavin's Custom MurphPad Landscape Layout
2
3This allows you to use Murphpad in a horizontal/landscape orientation with extra layers
4
5 - OLED has been rotated for landscape mode
6 - Keymap positions have been updated so it's easier to visualize the keymap in landscape
7
8 [_BASE] = LAYOUT_landscape(
9 TT(_FN1), TT(_FN2), KC_MUTE,
10
11 KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_PPLS, KC_BSPC,
12 KC_TAB, KC_P7, KC_P8, KC_P9, KC_PDOT, KC_RGUI,
13 KC_RSFT, KC_P4, KC_P5, KC_P6, KC_COMMA, KC_RCTL,
14 KC_P0, KC_P1, KC_P2, KC_P3, KC_PENT, KC_RALT,
15
16 _______, _______, _______
17 ),
18
19NOTE: VIA is enabled, but it will show it in the normal orientation until I build a landscape layout version
20
21Special Features
22 - FN1 layer has encoder selectable key codes and displayed on OLED
23
24 Change these in keymap.c to assign your desired key selection
25
26 static const keycodedescType PROGMEM keyselection[] = {
27 // list of key codes that will be scrollled through by encoder and description
28 {"TASK", KC_TASK},
29 {"INS", KC_INS},
30 {"DEL", KC_DEL},
31 {"PrtSc", KC_PSCR},
32 {"ScrLk", KC_SCLN},
33 {"Break", KC_PAUS},
34 {"C-A-D", KC_CAD}, // Ctrl-Alt-Del
35 {"AltF4", KC_AF4},
36 {"PLAY", KC_MEDIA_PLAY_PAUSE},
37 {"RESET", RESET}, // firmware flash mode
38 };
39
40 - Additional encoder functionality
41 - While holding R Shift, changes layers
42 - While holding R Ctrl, navigates next or previous word
43 - While holding R Alt, media next track or previous track
44 - Otherwise change volume up/dn
45
46
47rules.mk OPTIONS - Active features from userspace
48
49 - STARTUP_NUMLOCK_ON = yes
50 - turns on NUMLOCK by default
51
52DEFAULT MAPPING
53
54![image](https://user-images.githubusercontent.com/71780717/131718965-b20afef6-3bc5-49e4-952f-5755a9d6d539.png)
55
56
57FN1 Layer 1
58
59![image](https://user-images.githubusercontent.com/71780717/131719025-d41cbcd9-80b1-4a0a-abb5-55d878752dc6.png)
60
61
62RGB Layer 5 - Use Shift+Encoder to get to RGB layer 5
63
64![image](https://user-images.githubusercontent.com/71780717/131719492-e2d05a75-3a7a-48ca-94a3-faa3ff891914.png)
65
diff --git a/keyboards/mechwild/murphpad/keymaps/jonavin/rules.mk b/keyboards/mechwild/murphpad/keymaps/jonavin/rules.mk
new file mode 100644
index 000000000..4887fb1bd
--- /dev/null
+++ b/keyboards/mechwild/murphpad/keymaps/jonavin/rules.mk
@@ -0,0 +1,5 @@
1VIA_ENABLE = yes
2LTO_ENABLE = yes
3
4STARTUP_NUMLOCK_ON = yes
5ENCODER_DEFAULTACTIONS_ENABLE = no