From 98916fd8629f0e8ac5bd3aef73dc59082be42d24 Mon Sep 17 00:00:00 2001 From: James Young <18669334+noroadsleft@users.noreply.github.com> Date: Fri, 4 Feb 2022 09:46:21 -0800 Subject: [PATCH] MTBKeys MTB60 Hotswap Layout Macro Refactor (#16194) --- keyboards/mtbkeys/mtb60/hotswap/hotswap.h | 38 ++++-- keyboards/mtbkeys/mtb60/hotswap/info.json | 129 +++++++++--------- .../mtb60/hotswap/keymaps/default/keymap.c | 4 +- keyboards/mtbkeys/mtb60/hotswap/rules.mk | 2 + 4 files changed, 97 insertions(+), 76 deletions(-) diff --git a/keyboards/mtbkeys/mtb60/hotswap/hotswap.h b/keyboards/mtbkeys/mtb60/hotswap/hotswap.h index 7dae44b5da..e1e607e4c9 100644 --- a/keyboards/mtbkeys/mtb60/hotswap/hotswap.h +++ b/keyboards/mtbkeys/mtb60/hotswap/hotswap.h @@ -18,16 +18,32 @@ #include "quantum.h" -#define LAYOUT( \ - k00, k10, k20, k30, k40, k50, k60, k70, k80, k90, ka0, kb0, kc0, ke0, \ - k11, k21, k31, k41, k51, k61, k71, k81, k91, ka1, kb1, kc1, kd1, ke1, \ - k02, k22, k32, k42, k52, k62, k72, k82, k92, ka2, kb2, kc2, kd2, \ - k03, k23, k33, k43, k53, k63, k73, k83, k93, ka3, kb3, kd3, \ - k04, k14, k24, k64, ka4, kb4, kd4, ke4 \ +#define ___ KC_NO + +/* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │00 │01 │02 │03 │04 │05 │06 │07 │08 │09 │0a │0b │0c │0e │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │11 │12 │13 │14 │15 │16 │17 │18 │19 │1a │1b │1c │1d │1e │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │20 │22 │23 │24 │25 │26 │27 │28 │29 │2a │2b │2c │2d │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │30 │32 │33 │34 │35 │36 │37 │38 │39 │3a │3b │3d │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │40 │41 │42 │46 │4a │4b │4d │4e │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ + +#define LAYOUT_60_ansi( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0e, \ + k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, \ + k20, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, \ + k30, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3d, \ + k40, k41, k42, k46, k4a, k4b, k4d, k4e \ ) { \ - { k00, k10, k20, k30, k40, k50, k60, k70, k80, k90, ka0, kb0, kc0, KC_NO, ke0 }, \ - { KC_NO, k11, k21, k31, k41, k51, k61, k71, k81, k91, ka1, kb1, kc1, kd1, ke1 }, \ - { k02, KC_NO, k22, k32, k42, k52, k62, k72, k82, k92, ka2, kb2, kc2, kd2, KC_NO }, \ - { k03, KC_NO, k23, k33, k43, k53, k63, k73, k83, k93, ka3, kb3, KC_NO, kd3, KC_NO }, \ - { k04, k14, k24, KC_NO, KC_NO, KC_NO, k64, KC_NO, KC_NO, KC_NO, ka4, kb4, kd4, KC_NO, ke4 } \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, ___, k0e }, \ + { ___, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e }, \ + { k20, ___, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, ___ }, \ + { k30, ___, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, ___, k3d, ___ }, \ + { k40, k41, k42, ___, ___, ___, k46, ___, ___, ___, k4a, k4b, k4d, ___, k4e } \ } diff --git a/keyboards/mtbkeys/mtb60/hotswap/info.json b/keyboards/mtbkeys/mtb60/hotswap/info.json index 5e66ec5a94..9e4ae0be29 100644 --- a/keyboards/mtbkeys/mtb60/hotswap/info.json +++ b/keyboards/mtbkeys/mtb60/hotswap/info.json @@ -1,75 +1,78 @@ { "keyboard_name": "MTB60", "url": "mtbkeys.com", - "maintainer": "MTBKeys", + "maintainer": "kgieselman", + "layout_aliases": { + "LAYOUT": "LAYOUT_60_ansi" + }, "layouts": { - "LAYOUT": { + "LAYOUT_60_ansi": { "layout": [ - {"x": 0, "y": 0}, - {"x": 1, "y": 0}, - {"x": 2, "y": 0}, - {"x": 3, "y": 0}, - {"x": 4, "y": 0}, - {"x": 5, "y": 0}, - {"x": 6, "y": 0}, - {"x": 7, "y": 0}, - {"x": 8, "y": 0}, - {"x": 9, "y": 0}, - {"x": 10, "y": 0}, - {"x": 11, "y": 0}, - {"x": 12, "y": 0}, - {"x": 13, "y": 0, "w": 2}, + {"label":"Esc", "x":0, "y":0}, + {"label":"1!", "x":1, "y":0}, + {"label":"2@", "x":2, "y":0}, + {"label":"3#", "x":3, "y":0}, + {"label":"4$", "x":4, "y":0}, + {"label":"5%", "x":5, "y":0}, + {"label":"6^", "x":6, "y":0}, + {"label":"7&", "x":7, "y":0}, + {"label":"8*", "x":8, "y":0}, + {"label":"9(", "x":9, "y":0}, + {"label":"0)", "x":10, "y":0}, + {"label":"-_", "x":11, "y":0}, + {"label":"=+", "x":12, "y":0}, + {"label":"Back Space", "x":13, "y":0, "w":2}, - {"x": 0, "y": 1, "w": 1.5}, - {"x": 1.5, "y": 1}, - {"x": 2.5, "y": 1}, - {"x": 3.5, "y": 1}, - {"x": 4.5, "y": 1}, - {"x": 5.5, "y": 1}, - {"x": 6.5, "y": 1}, - {"x": 7.5, "y": 1}, - {"x": 8.5, "y": 1}, - {"x": 9.5, "y": 1}, - {"x": 10.5, "y": 1}, - {"x": 11.5, "y": 1}, - {"x": 12.5, "y": 1}, - {"x": 13.5, "y": 1, "w": 1.5}, + {"label":"Tab", "x":0, "y":1, "w":1.5}, + {"label":"Q", "x":1.5, "y":1}, + {"label":"W", "x":2.5, "y":1}, + {"label":"E", "x":3.5, "y":1}, + {"label":"R", "x":4.5, "y":1}, + {"label":"T", "x":5.5, "y":1}, + {"label":"Y", "x":6.5, "y":1}, + {"label":"U", "x":7.5, "y":1}, + {"label":"I", "x":8.5, "y":1}, + {"label":"O", "x":9.5, "y":1}, + {"label":"P", "x":10.5, "y":1}, + {"label":"[{", "x":11.5, "y":1}, + {"label":"]}", "x":12.5, "y":1}, + {"label":"\\|", "x":13.5, "y":1, "w":1.5}, - {"x": 0, "y": 2, "w": 1.75}, - {"x": 1.75, "y": 2}, - {"x": 2.75, "y": 2}, - {"x": 3.75, "y": 2}, - {"x": 4.75, "y": 2}, - {"x": 5.75, "y": 2}, - {"x": 6.75, "y": 2}, - {"x": 7.75, "y": 2}, - {"x": 8.75, "y": 2}, - {"x": 9.75, "y": 2}, - {"x": 10.75, "y": 2}, - {"x": 11.75, "y": 2}, - {"x": 12.75, "y": 2, "w": 2.25}, + {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, + {"label":"A", "x":1.75, "y":2}, + {"label":"S", "x":2.75, "y":2}, + {"label":"D", "x":3.75, "y":2}, + {"label":"F", "x":4.75, "y":2}, + {"label":"G", "x":5.75, "y":2}, + {"label":"H", "x":6.75, "y":2}, + {"label":"J", "x":7.75, "y":2}, + {"label":"K", "x":8.75, "y":2}, + {"label":"L", "x":9.75, "y":2}, + {"label":";:", "x":10.75, "y":2}, + {"label":"'\"", "x":11.75, "y":2}, + {"label":"Enter", "x":12.75, "y":2, "w":2.25}, - {"x": 0, "y": 3, "w": 2.25}, - {"x": 2.25, "y": 3}, - {"x": 3.25, "y": 3}, - {"x": 4.25, "y": 3}, - {"x": 5.25, "y": 3}, - {"x": 6.25, "y": 3}, - {"x": 7.25, "y": 3}, - {"x": 8.25, "y": 3}, - {"x": 9.25, "y": 3}, - {"x": 10.25, "y": 3}, - {"x": 11.25, "y": 3}, - {"x": 12.25, "y": 3, "w": 2.75}, + {"label":"Left Shift", "x":0, "y":3, "w":2.25}, + {"label":"Z", "x":2.25, "y":3}, + {"label":"X", "x":3.25, "y":3}, + {"label":"C", "x":4.25, "y":3}, + {"label":"V", "x":5.25, "y":3}, + {"label":"B", "x":6.25, "y":3}, + {"label":"N", "x":7.25, "y":3}, + {"label":"M", "x":8.25, "y":3}, + {"label":",<", "x":9.25, "y":3}, + {"label":".>", "x":10.25, "y":3}, + {"label":"/?", "x":11.25, "y":3}, + {"label":"Right Shift", "x":12.25, "y":3, "w":2.75}, - {"x": 0, "y": 4, "w": 1.25}, - {"x": 1.25, "y": 4, "w": 1.25}, - {"x": 2.5, "y": 4, "w": 1.25}, - {"x": 3.75, "y": 4, "w": 6.25}, - {"x": 10, "y": 4, "w": 1.25}, - {"x": 11.25, "y": 4, "w": 1.25}, - {"x": 12.5, "y": 4, "w": 1.25}, - {"x": 13.75, "y": 4, "w": 1.25} + {"label":"Left Ctrl", "x":0, "y":4, "w":1.25}, + {"label":"GUI", "x":1.25, "y":4, "w":1.25}, + {"label":"Left Alt", "x":2.5, "y":4, "w":1.25}, + {"label":"Space", "x":3.75, "y":4, "w":6.25}, + {"label":"Right Ctrl", "x":10, "y":4, "w":1.25}, + {"label":"GUI", "x":11.25, "y":4, "w":1.25}, + {"label":"MO(1)", "x":12.5, "y":4, "w":1.25}, + {"label":"Right Ctrl", "x":13.75, "y":4, "w":1.25} ] } } diff --git a/keyboards/mtbkeys/mtb60/hotswap/keymaps/default/keymap.c b/keyboards/mtbkeys/mtb60/hotswap/keymaps/default/keymap.c index 648c8201f5..58dcf77414 100644 --- a/keyboards/mtbkeys/mtb60/hotswap/keymaps/default/keymap.c +++ b/keyboards/mtbkeys/mtb60/hotswap/keymaps/default/keymap.c @@ -22,14 +22,14 @@ enum layer_names { }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_BASE] = LAYOUT( + [_BASE] = LAYOUT_60_ansi( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(_FN), KC_RCTL ), - [_FN] = LAYOUT( + [_FN] = LAYOUT_60_ansi( KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, _______, _______, _______, diff --git a/keyboards/mtbkeys/mtb60/hotswap/rules.mk b/keyboards/mtbkeys/mtb60/hotswap/rules.mk index 3ff392a61f..0d092c2ef8 100644 --- a/keyboards/mtbkeys/mtb60/hotswap/rules.mk +++ b/keyboards/mtbkeys/mtb60/hotswap/rules.mk @@ -16,3 +16,5 @@ NKRO_ENABLE = no # Enable N-Key Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output + +LAYOUTS = 60_ansi