[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
This commit is contained in:
James Young 2020-02-07 19:15:35 -08:00 committed by GitHub
parent 43c0a9293e
commit b62829031d
4 changed files with 137 additions and 46 deletions

View File

@ -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}
]
}
}
}

View File

@ -9,38 +9,24 @@ enum custom_keycodes {
}; };
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty /* Qwerty */
* ,-----------------------------------------.
* | 0 | 1 | 4 | 7 | NUM | ESC | [_NP] = LAYOUT_ortho_6x4(
* |------+------+------+------+------+------| KC_ESC, KC_TAB, KC_BSPC, MO(_BL),
* | . | 2 | 5 | 8 | / | TAB |---, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
* |------+------+------+------+------+------|USB| KC_P7, KC_P8, KC_P9, KC_PPLS,
* | DOT | 3 | 6 | 9 | * | BS |---' KC_P4, KC_P5, KC_P6, KC_PPLS,
* |------+------+------+------+------+------| KC_P1, KC_P2, KC_P3, KC_PENT,
* | Enter| Enter| + | + | - | FN | KC_P0, KC_DOT, KC_PDOT, KC_PENT
* `-----------------------------------------' ),
*/
[_NP] = LAYOUT( \ [_BL] = LAYOUT_ortho_6x4(
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, \ _______, BL_ON, _______, BL_INC,
KC_KP_ENTER, KC_KP_ENTER, KC_KP_PLUS, KC_KP_PLUS, KC_KP_MINUS, MO(_BL) \ _______, BL_TOGG, _______, BL_INC,
), _______, BL_OFF, _______, BL_DEC,
/* Qwerty BL_BRTG, _______, _______, BL_DEC
* ,---------------------------------------------. )
* | 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, _______, _______ \
)
}; };

View File

@ -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 |
`-------------------------------' `-------------------------------'

View File

@ -15,19 +15,17 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef KEYMAP_COMMON_H #pragma once
#define KEYMAP_COMMON_H
#include "quantum.h" #include "quantum.h"
#include "quantum_keycodes.h"
#include "keycode.h"
#include "action.h"
#define LAYOUT( \ #define LAYOUT_ortho_6x4( \
K01, K02, K03, K04, K05, K06, \ K06, K16, K26, K36, \
K11, K12, K13, K14, K15, K16, \ K05, K15, K25, K35, \
K21, K22, K23, K24, K25, K26, \ K04, K14, K24, K34, \
K31, K32, K33, K34, K35, K36 \ K03, K13, K23, K33, \
K02, K12, K22, K32, \
K01, K11, K21, K31 \
) \ ) \
{ \ { \
{ K06, K05, K04, K03, K02, K01 }, \ { K06, K05, K04, K03, K02, K01 }, \
@ -36,4 +34,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{ K36, K35, K34, K33, K32, K31 } \ { 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 \
)