From 0a40916845af3702135f78a1d2826577d01a33e6 Mon Sep 17 00:00:00 2001 From: James Young <18669334+noroadsleft@users.noreply.github.com> Date: Fri, 4 Feb 2022 11:35:29 -0800 Subject: [PATCH] MechanicKeys Mini Ashen 40: refactor LAYOUT macro (#16192) * info.json: apply friendly formatting * move Backspace argument/keycode to top row * info.json: correct maintainer field --- keyboards/mechanickeys/miniashen40/info.json | 73 +++++++++++++++---- .../miniashen40/keymaps/default/keymap.c | 50 ++++++------- .../miniashen40/keymaps/via/keymap.c | 24 +++--- .../mechanickeys/miniashen40/miniashen40.h | 53 ++++++++------ 4 files changed, 126 insertions(+), 74 deletions(-) diff --git a/keyboards/mechanickeys/miniashen40/info.json b/keyboards/mechanickeys/miniashen40/info.json index 6a6b1e951a4..bf46a8bdcdc 100644 --- a/keyboards/mechanickeys/miniashen40/info.json +++ b/keyboards/mechanickeys/miniashen40/info.json @@ -1,15 +1,62 @@ { - "keyboard_name": "Mini Ashen 40", - "url": "", - "maintainer": "qmk", - "layouts": { - "LAYOUT": { - "layout": [ - {"label": "Tab", "x": 0, "y": 0}, {"label": "Q", "x": 1, "y": 0}, {"label": "W", "x": 2, "y": 0}, {"label": "E", "x": 3, "y": 0}, {"label": "R", "x": 4, "y": 0}, {"label": "T", "x": 5, "y": 0}, {"label": "Y", "x": 6, "y": 0}, {"label": "U", "x": 7, "y": 0}, {"label": "I", "x": 8, "y": 0}, {"label": "O", "x": 9, "y": 0}, {"label": "P", "x": 10, "y": 0}, {"label": "Del", "x": 11, "y": 0}, {"label": "M1", "x": 12.25, "y": 0}, {"label": "M2", "x": 13.25, "y": 0}, - {"label": "Ctrl", "x": 0, "y": 1, "w":1.25}, {"label": "A", "x": 1.25, "y": 1}, {"label": "S", "x": 2.25, "y": 1}, {"label": "D", "x": 3.25, "y": 1}, {"label": "F", "x": 4.25, "y": 1}, {"label": "G", "x": 5.25, "y": 1}, {"label": "H", "x": 6.25, "y": 1}, {"label": "J", "x": 7.25, "y": 1}, {"label": "K", "x": 8.25, "y": 1}, {"label": "L", "x": 9.25, "y": 1}, {"label": "Enter", "x": 10.25, "y": 1, "w":1.75}, {"label": "M3", "x": 12.25, "y": 1}, {"label": "M4", "x": 13.25, "y": 1}, - {"label": "Shift", "x": 0, "y": 2, "w":1.75}, {"label": "Z", "x": 1.75, "y": 2}, {"label": "X", "x": 2.75, "y": 2}, {"label": "C", "x": 3.75, "y": 2}, {"label": "V", "x": 4.75, "y": 2}, {"label": "B", "x": 5.75, "y": 2}, {"label": "N", "x": 6.75, "y": 2}, {"label": "M", "x": 7.75, "y": 2}, {"label": ",", "x": 8.75, "y": 2}, {"label": ".", "x": 9.75, "y": 2}, {"label": "Fn", "x": 10.75, "y": 2, "w":1.25}, {"label": "Up", "x": 12.25, "y": 2.25}, - {"label": "Alt", "x": 1, "y": 3}, {"label": "OS", "x": 2, "y": 3, "w": 1.5}, {"label": "", "x": 3.5, "y": 3, "w": 2.75}, {"label": "", "x": 6.25, "y": 3, "w": 2.25}, {"label": "Os", "x": 8.5, "y": 3, "w": 1.5}, {"label": "Alt", "x": 10, "y": 3}, {"label": "Left", "x": 11.25, "y": 3.25}, {"label": "Down", "x": 12.25, "y": 3.25}, {"label": "Right", "x": 13.25, "y": 3.25} - ] + "keyboard_name": "Mini Ashen 40", + "url": "", + "maintainer": "jfescobar18", + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"Tab", "x":0, "y":0}, + {"label":"Q", "x":1, "y":0}, + {"label":"W", "x":2, "y":0}, + {"label":"E", "x":3, "y":0}, + {"label":"R", "x":4, "y":0}, + {"label":"T", "x":5, "y":0}, + {"label":"Y", "x":6, "y":0}, + {"label":"U", "x":7, "y":0}, + {"label":"I", "x":8, "y":0}, + {"label":"O", "x":9, "y":0}, + {"label":"P", "x":10, "y":0}, + {"label":"Del", "x":11, "y":0}, + {"label":"M1", "x":12.25, "y":0}, + {"label":"M2", "x":13.25, "y":0}, + + {"label":"Ctrl", "x":0, "y":1, "w":1.25}, + {"label":"A", "x":1.25, "y":1}, + {"label":"S", "x":2.25, "y":1}, + {"label":"D", "x":3.25, "y":1}, + {"label":"F", "x":4.25, "y":1}, + {"label":"G", "x":5.25, "y":1}, + {"label":"H", "x":6.25, "y":1}, + {"label":"J", "x":7.25, "y":1}, + {"label":"K", "x":8.25, "y":1}, + {"label":"L", "x":9.25, "y":1}, + {"label":"Enter", "x":10.25, "y":1, "w":1.75}, + {"label":"M3", "x":12.25, "y":1}, + {"label":"M4", "x":13.25, "y":1}, + + {"label":"Shift", "x":0, "y":2, "w":1.75}, + {"label":"Z", "x":1.75, "y":2}, + {"label":"X", "x":2.75, "y":2}, + {"label":"C", "x":3.75, "y":2}, + {"label":"V", "x":4.75, "y":2}, + {"label":"B", "x":5.75, "y":2}, + {"label":"N", "x":6.75, "y":2}, + {"label":"M", "x":7.75, "y":2}, + {"label":",", "x":8.75, "y":2}, + {"label":".", "x":9.75, "y":2}, + {"label":"Fn", "x":10.75, "y":2, "w":1.25}, + {"label":"Up", "x":12.25, "y":2.25}, + + {"label":"Alt", "x":1, "y":3}, + {"label":"OS", "x":2, "y":3, "w":1.5}, + {"label":"", "x":3.5, "y":3, "w":2.75}, + {"label":"", "x":6.25, "y":3, "w":2.25}, + {"label":"Os", "x":8.5, "y":3, "w":1.5}, + {"label":"Alt", "x":10, "y":3}, + {"label":"Left", "x":11.25, "y":3.25}, + {"label":"Down", "x":12.25, "y":3.25}, + {"label":"Right", "x":13.25, "y":3.25} + ] + } } - } -} \ No newline at end of file +} diff --git a/keyboards/mechanickeys/miniashen40/keymaps/default/keymap.c b/keyboards/mechanickeys/miniashen40/keymaps/default/keymap.c index b49b5882fad..4f4b79e45e5 100644 --- a/keyboards/mechanickeys/miniashen40/keymaps/default/keymap.c +++ b/keyboards/mechanickeys/miniashen40/keymaps/default/keymap.c @@ -1,47 +1,47 @@ /* Copyright 2021 jfescobar18 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT( /* 0: qwerty */ - KC_GESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MPRV, KC_MNXT, + [0] = LAYOUT( /* 0: qwerty */ + KC_GESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_MPRV, KC_MNXT, CTL_T(KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, KC_MUTE, KC_MPLY, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, MO(1), KC_UP, KC_BSPC, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, MO(1), KC_UP, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_RGUI, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT ), - [1] = LAYOUT( /* 1: Symbols */ - KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_TRNS, KC_TRNS, + [1] = LAYOUT( /* 1: Symbols */ + 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_TRNS, KC_TRNS, MO(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LBRC, KC_RBRC, KC_SCLN, KC_QUOT, KC_BSLS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_SLSH, KC_TRNS, KC_TRNS, KC_EQL, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_SLSH, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), - [2] = LAYOUT( /* 2: Fn */ - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_TRNS, KC_TRNS, + [2] = LAYOUT( /* 2: Fn */ + 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F12, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), - [3] = LAYOUT( /*3: Empty */ - RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + [3] = LAYOUT( /*3: Empty */ + RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), }; diff --git a/keyboards/mechanickeys/miniashen40/keymaps/via/keymap.c b/keyboards/mechanickeys/miniashen40/keymaps/via/keymap.c index 0aa9476b4ed..bb7721561dc 100644 --- a/keyboards/mechanickeys/miniashen40/keymaps/via/keymap.c +++ b/keyboards/mechanickeys/miniashen40/keymaps/via/keymap.c @@ -17,31 +17,31 @@ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT( /* 0: qwerty */ - KC_GESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MPRV, KC_MNXT, + [0] = LAYOUT( /* 0: qwerty */ + KC_GESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_MPRV, KC_MNXT, CTL_T(KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, KC_MUTE, KC_MPLY, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, MO(1), KC_UP, KC_BSPC, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, MO(1), KC_UP, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_RGUI, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT ), - [1] = LAYOUT( /* 1: Symbols */ - KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_TRNS, KC_TRNS, + [1] = LAYOUT( /* 1: Symbols */ + 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_TRNS, KC_TRNS, MO(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LBRC, KC_RBRC, KC_SCLN, KC_QUOT, KC_BSLS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_SLSH, KC_TRNS, KC_TRNS, KC_EQL, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_SLSH, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), - [2] = LAYOUT( /* 2: Fn */ - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_TRNS, KC_TRNS, + [2] = LAYOUT( /* 2: Fn */ + 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F12, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), - [3] = LAYOUT( /*3: Empty */ - RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + [3] = LAYOUT( /*3: Empty */ + RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), }; diff --git a/keyboards/mechanickeys/miniashen40/miniashen40.h b/keyboards/mechanickeys/miniashen40/miniashen40.h index 4430396b411..5d6e639b205 100644 --- a/keyboards/mechanickeys/miniashen40/miniashen40.h +++ b/keyboards/mechanickeys/miniashen40/miniashen40.h @@ -1,17 +1,17 @@ /* Copyright 2021 jfescobar18 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #pragma once @@ -20,19 +20,24 @@ #define XXX KC_NO -/* This is a shortcut to help you visually see your layout. - * - * The first section contains all of the arguments representing the physical - * layout of the board and position of the keys. - * - * The second converts the arguments into a two-dimensional array which - * represents the switch matrix. +/* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐┌───┬───┐ + * │00 │01 │02 │03 │04 │05 │06 │07 │08 │09 │0A │2C ││0B │0C │ + * ├───┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤├───┼───┤ + * │10 │11 │12 │13 │14 │15 │16 │17 │18 │19 │1A ││1B │1C │ + * ├────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬────┤└───┴───┘ + * │20 │21 │22 │23 │24 │25 │26 │27 │28 │29 │2A │┌───┐ + * └───┬──┴┬──┴──┬┴───┴───┴─┬─┴───┴──┬┴───┴┬──┴┬───┘│2B │ + * │30 │31 │33 │36 │38 │39 │┌───┼───┼───┐ + * └───┴─────┴──────────┴────────┴─────┴───┘│3A │3B │3C │ + * └───┴───┴───┘ */ + #define LAYOUT( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ - K30, K31, K33, K36, K38, K39, K3A, K3B, K3C \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K2C, K0B, K0C, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K33, K36, K38, K39, K3A, K3B, K3C \ ) \ { \ { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C }, \