From b62829031de1ae2e5e1efaa35606981c04c443c3 Mon Sep 17 00:00:00 2001 From: James Young <18669334+noroadsleft@users.noreply.github.com> Date: Fri, 7 Feb 2020 19:15:35 -0800 Subject: [Keyboard] YMDK NP21: matrix and keymap refactor (#8112) * YMDK NP21: matrix and keymap refactor - refactored layout macros - LAYOUT_ortho_6x4 orients the keyboard with the USB port to the back instead of to the right - LAYOUT uses the previous sideways orientation (included for backwards compatibility) - removed redundant includes from ymdk_np21.h - added a readme for the default keymap * add Configurator layout support --- keyboards/ymdk_np21/info.json | 69 +++++++++++++++++++++++++++ keyboards/ymdk_np21/keymaps/default/keymap.c | 56 ++++++++-------------- keyboards/ymdk_np21/keymaps/default/readme.md | 26 ++++++++++ keyboards/ymdk_np21/ymdk_np21.h | 32 ++++++++----- 4 files changed, 137 insertions(+), 46 deletions(-) create mode 100644 keyboards/ymdk_np21/info.json create mode 100644 keyboards/ymdk_np21/keymaps/default/readme.md (limited to 'keyboards/ymdk_np21') diff --git a/keyboards/ymdk_np21/info.json b/keyboards/ymdk_np21/info.json new file mode 100644 index 0000000000..b17059a1cd --- /dev/null +++ b/keyboards/ymdk_np21/info.json @@ -0,0 +1,69 @@ +{ + "keyboard_name": "YMDK NP21", + "url": "", + "maintainer": "qmk", + "layouts": { + "LAYOUT_ortho_6x4": { + "width": 4, + "height": 6.25, + "key_count": 24, + "layout": [ + {"label":"K06", "x":0, "y":0}, + {"label":"K16", "x":1, "y":0}, + {"label":"K26", "x":2, "y":0}, + {"label":"K36", "x":3, "y":0}, + {"label":"K05", "x":0, "y":1.25}, + {"label":"K15", "x":1, "y":1.25}, + {"label":"K25", "x":2, "y":1.25}, + {"label":"K35", "x":3, "y":1.25}, + {"label":"K04", "x":0, "y":2.25}, + {"label":"K14", "x":1, "y":2.25}, + {"label":"K24", "x":2, "y":2.25}, + {"label":"K34", "x":3, "y":2.25}, + {"label":"K03", "x":0, "y":3.25}, + {"label":"K13", "x":1, "y":3.25}, + {"label":"K23", "x":2, "y":3.25}, + {"label":"K33", "x":3, "y":3.25}, + {"label":"K02", "x":0, "y":4.25}, + {"label":"K12", "x":1, "y":4.25}, + {"label":"K22", "x":2, "y":4.25}, + {"label":"K32", "x":3, "y":4.25}, + {"label":"K01", "x":0, "y":5.25}, + {"label":"K11", "x":1, "y":5.25}, + {"label":"K21", "x":2, "y":5.25}, + {"label":"K31", "x":3, "y":5.25} + ] + }, + "LAYOUT": { + "width": 6.25, + "height": 4, + "key_count": 24, + "layout": [ + {"label":"K01", "x":0, "y":0}, + {"label":"K02", "x":1, "y":0}, + {"label":"K03", "x":2, "y":0}, + {"label":"K04", "x":3, "y":0}, + {"label":"K05", "x":4, "y":0}, + {"label":"K06", "x":5.25, "y":0}, + {"label":"K11", "x":0, "y":1}, + {"label":"K12", "x":1, "y":1}, + {"label":"K13", "x":2, "y":1}, + {"label":"K14", "x":3, "y":1}, + {"label":"K15", "x":4, "y":1}, + {"label":"K16", "x":5.25, "y":1}, + {"label":"K21", "x":0, "y":2}, + {"label":"K22", "x":1, "y":2}, + {"label":"K23", "x":2, "y":2}, + {"label":"K24", "x":3, "y":2}, + {"label":"K25", "x":4, "y":2}, + {"label":"K26", "x":5.25, "y":2}, + {"label":"K31", "x":0, "y":3}, + {"label":"K32", "x":1, "y":3}, + {"label":"K33", "x":2, "y":3}, + {"label":"K34", "x":3, "y":3}, + {"label":"K35", "x":4, "y":3}, + {"label":"K36", "x":5.25, "y":3} + ] + } + } +} diff --git a/keyboards/ymdk_np21/keymaps/default/keymap.c b/keyboards/ymdk_np21/keymaps/default/keymap.c index 3ade30479f..143f4f61bb 100644 --- a/keyboards/ymdk_np21/keymaps/default/keymap.c +++ b/keyboards/ymdk_np21/keymaps/default/keymap.c @@ -1,7 +1,7 @@ #include QMK_KEYBOARD_H #define _NP 0 -#define _BL 1 +#define _BL 1 enum custom_keycodes { NP = SAFE_RANGE, @@ -9,38 +9,24 @@ enum custom_keycodes { }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -/* Qwerty - * ,-----------------------------------------. - * | 0 | 1 | 4 | 7 | NUM | ESC | - * |------+------+------+------+------+------| - * | . | 2 | 5 | 8 | / | TAB |---, - * |------+------+------+------+------+------|USB| - * | DOT | 3 | 6 | 9 | * | BS |---' - * |------+------+------+------+------+------| - * | Enter| Enter| + | + | - | FN | - * `-----------------------------------------' - */ -[_NP] = LAYOUT( \ - KC_KP_0, KC_KP_1, KC_KP_4, KC_KP_7, KC_NUMLOCK, KC_ESC, \ - KC_DOT, KC_KP_2, KC_KP_5, KC_KP_8, KC_KP_SLASH, KC_TAB, \ - KC_KP_DOT, KC_KP_3, KC_KP_6, KC_KP_9, KC_KP_ASTERISK, KC_BSPACE, \ - KC_KP_ENTER, KC_KP_ENTER, KC_KP_PLUS, KC_KP_PLUS, KC_KP_MINUS, MO(_BL) \ -), -/* Qwerty - * ,---------------------------------------------. - * | BL_BRTG | | | | | | - * |---------+--------+---------+--------+---+---| - * | | BL_OFF | BL_TOGG | BL_ON | | |---, - * |---------+--------+---------+--------+---+---|USB| - * | | | | | | |---' - * |---------+--------+---------+--------+---+---| - * | BL_DEC | BL_DEC | BL_INC | BL_INC | | | - * `---------------------------------------------' - */ -[_BL] = LAYOUT( \ - BL_BRTG, _______, _______, _______, _______, _______, \ - _______, BL_OFF, BL_TOGG, BL_ON, _______, _______, \ - _______, _______, _______, _______, _______, _______, \ - BL_DEC, BL_DEC, BL_INC, BL_INC, _______, _______ \ -) + /* Qwerty */ + + [_NP] = LAYOUT_ortho_6x4( + KC_ESC, KC_TAB, KC_BSPC, MO(_BL), + KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, + KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_P1, KC_P2, KC_P3, KC_PENT, + KC_P0, KC_DOT, KC_PDOT, KC_PENT + ), + + [_BL] = LAYOUT_ortho_6x4( + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, BL_ON, _______, BL_INC, + _______, BL_TOGG, _______, BL_INC, + _______, BL_OFF, _______, BL_DEC, + BL_BRTG, _______, _______, BL_DEC + ) + }; diff --git a/keyboards/ymdk_np21/keymaps/default/readme.md b/keyboards/ymdk_np21/keymaps/default/readme.md new file mode 100644 index 0000000000..aca4c0caba --- /dev/null +++ b/keyboards/ymdk_np21/keymaps/default/readme.md @@ -0,0 +1,26 @@ +# default + +The default keymap for the YMDK NP21 keypad. + + Base Layer Function Layer + .-----. .-----. + | USB | | USB | + ,-------------------------------. ,-------------------------------. + | Esc | Tab | Back | Fn | | | | |▒▒▒▒▒▒▒| + | | | Space | | | | | |▒▒▒▒▒▒▒| + |-------+-------+-------+-------| |-------+-------+-------+-------| + | Num | / | * | - | | | | | | + | Lock | | | | | | | | | + |-------+-------+-------+-------| |-------+-------+-------+-------| + | 7 | 8 | 9 | + | | | BL | | BL | + | Home | Up | PgUp | | | | On | | Inc | + |-------+-------+-------+-------| |-------+-------+-------+-------| + | 4 | 5 | 6 | + | | | BL | | BL | + | Left | | Right | | | | Togg | | Inc | + |-------+-------+-------+-------| |-------+-------+-------+-------| + | 1 | 2 | 3 | Ent | | | BL | | BL | + | End | Down | PgDn | | | | Off | | Dec | + |-------+-------+-------+-------| |-------+-------+-------+-------| + | 0 | . | . | Ent | | BL | | | BL | + | Ins | | Del | | | Brthg | | | Dec | + `-------------------------------' `-------------------------------' diff --git a/keyboards/ymdk_np21/ymdk_np21.h b/keyboards/ymdk_np21/ymdk_np21.h index 2cd2d13c21..afd3d38c7d 100644 --- a/keyboards/ymdk_np21/ymdk_np21.h +++ b/keyboards/ymdk_np21/ymdk_np21.h @@ -15,19 +15,17 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef KEYMAP_COMMON_H -#define KEYMAP_COMMON_H +#pragma once #include "quantum.h" -#include "quantum_keycodes.h" -#include "keycode.h" -#include "action.h" -#define LAYOUT( \ - K01, K02, K03, K04, K05, K06, \ - K11, K12, K13, K14, K15, K16, \ - K21, K22, K23, K24, K25, K26, \ - K31, K32, K33, K34, K35, K36 \ +#define LAYOUT_ortho_6x4( \ + K06, K16, K26, K36, \ + K05, K15, K25, K35, \ + K04, K14, K24, K34, \ + K03, K13, K23, K33, \ + K02, K12, K22, K32, \ + K01, K11, K21, K31 \ ) \ { \ { K06, K05, K04, K03, K02, K01 }, \ @@ -36,4 +34,16 @@ along with this program. If not, see . { K36, K35, K34, K33, K32, K31 } \ } -#endif +#define LAYOUT( \ + K01, K02, K03, K04, K05, K06, \ + K11, K12, K13, K14, K15, K16, \ + K21, K22, K23, K24, K25, K26, \ + K31, K32, K33, K34, K35, K36 \ +) LAYOUT_ortho_6x4( \ + K06, K16, K26, K36, \ + K05, K15, K25, K35, \ + K04, K14, K24, K34, \ + K03, K13, K23, K33, \ + K02, K12, K22, K32, \ + K01, K11, K21, K31 \ +) -- cgit v1.2.3