From a677d8a00dc7bb42c1d9ba29455d24f6d8bfaef6 Mon Sep 17 00:00:00 2001 From: noroadsleft <18669334+noroadsleft@users.noreply.github.com> Date: Sun, 27 May 2018 19:19:09 -0700 Subject: [PATCH] Refactor and Configurator updates for AMJ Pad (#3060) * Refactor for AMJ Pad * Configurator update for AMJ Pad * Add hardware agnostic layouts numpad_6x4 and ortho_6x4 * Add agnostic layouts to rules.mk * Refactor AMJ Pad to use new hardware agnostic layouts --- keyboards/amjpad/amjpad.h | 54 ++++++++++--------- keyboards/amjpad/info.json | 16 +++--- keyboards/amjpad/keymaps/default/keymap.c | 33 ++++++------ keyboards/amjpad/keymaps/max/keymap.c | 34 ++++++------ keyboards/amjpad/keymaps/ortho_left/keymap.c | 34 ++++++------ keyboards/amjpad/keymaps/ortho_right/keymap.c | 35 ++++++------ keyboards/amjpad/rules.mk | 2 + .../numpad_6x4/default_numpad_6x4/keymap.c | 21 ++++++++ layouts/default/numpad_6x4/layout.json | 6 +++ layouts/default/numpad_6x4/readme.md | 3 ++ .../ortho_6x4/default_ortho_6x4/keymap.c | 12 +++++ layouts/default/ortho_6x4/layout.json | 6 +++ layouts/default/ortho_6x4/readme.md | 3 ++ 13 files changed, 159 insertions(+), 100 deletions(-) create mode 100644 layouts/default/numpad_6x4/default_numpad_6x4/keymap.c create mode 100644 layouts/default/numpad_6x4/layout.json create mode 100644 layouts/default/numpad_6x4/readme.md create mode 100644 layouts/default/ortho_6x4/default_ortho_6x4/keymap.c create mode 100644 layouts/default/ortho_6x4/layout.json create mode 100644 layouts/default/ortho_6x4/readme.md diff --git a/keyboards/amjpad/amjpad.h b/keyboards/amjpad/amjpad.h index ffba1c9b9..d9a051621 100644 --- a/keyboards/amjpad/amjpad.h +++ b/keyboards/amjpad/amjpad.h @@ -23,38 +23,40 @@ */ // The first section contains all of the arguments // The second converts the arguments into a two-dimensional array -#define KEYMAP( \ - k00, k01, k02, k03, \ - k10, k11, k12, k13, \ - k20, k21, k22, k23, \ - k30, k31, k32, \ - k40, k41, k42, k43, \ - k50, k52 \ +#define LAYOUT_numpad_6x4( \ + k00, k01, k02, k03, \ + k10, k11, k12, k13, \ + k20, k21, k22, \ + k30, k31, k32, k23, \ + k40, k41, k42, \ + k50, k52, k43 \ ) \ { \ - {k00, k01, k02, k03}, \ - {k10, k11, k12, k13}, \ - {k20, k21, k22, k23}, \ - {k30, k31, k32, XXX}, \ - {k40, k41, k42, k43}, \ - {k50, XXX, k52, XXX} \ + {k00, k01, k02, k03}, \ + {k10, k11, k12, k13}, \ + {k20, k21, k22, k23}, \ + {k30, k31, k32, XXX}, \ + {k40, k41, k42, k43}, \ + {k50, XXX, k52, XXX} \ } -#define MAXKEYMAP( \ - k00, k01, k02, k03, \ - k10, k11, k12, k13, \ - k20, k21, k22, k23, \ - k30, k31, k32, k33, \ - k40, k41, k42, k43, \ - k50, k51, k52, k53\ + +#define LAYOUT_ortho_6x4( \ + k00, k01, k02, k03, \ + k10, k11, k12, k13, \ + k20, k21, k22, k23, \ + k30, k31, k32, k33, \ + k40, k41, k42, k43, \ + k50, k51, k52, k53 \ ) \ { \ - {k00, k01, k02, k03}, \ - {k10, k11, k12, k13}, \ - {k20, k21, k22, k23}, \ - {k30, k31, k32, k33}, \ - {k40, k41, k42, k43}, \ - {k50, k51, k52, k53} \ + {k00, k01, k02, k03}, \ + {k10, k11, k12, k13}, \ + {k20, k21, k22, k23}, \ + {k30, k31, k32, k33}, \ + {k40, k41, k42, k43}, \ + {k50, k51, k52, k53} \ } + void matrix_init_user(void); void matrix_scan_user(void); diff --git a/keyboards/amjpad/info.json b/keyboards/amjpad/info.json index 3873d548f..dde839dd8 100644 --- a/keyboards/amjpad/info.json +++ b/keyboards/amjpad/info.json @@ -1,13 +1,17 @@ { - "keyboard_name": "AMJ Pad", - "url": "", - "maintainer": "qmk", - "bootloader": "", - "width": 4, - "height": 6, + "keyboard_name": "AMJ Pad", + "url": "", + "maintainer": "qmk", + "width": 4, + "height": 6, "layouts": { "LAYOUT": { + "key_count": 21, "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2, "h":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":0, "y":4}, {"x":1, "y":4}, {"x":2, "y":4}, {"x":3, "y":4, "h":2}, {"x":0, "y":5, "w":2}, {"x":2, "y":5}] + }, + "LAYOUT_all": { + "key_count": 24, + "layout": [{"label":"k00", "x":0, "y":0}, {"label":"k01", "x":1, "y":0}, {"label":"k02", "x":2, "y":0}, {"label":"k03", "x":3, "y":0}, {"label":"k10", "x":0, "y":1}, {"label":"k11", "x":1, "y":1}, {"label":"k12", "x":2, "y":1}, {"label":"k13", "x":3, "y":1}, {"label":"k20", "x":0, "y":2}, {"label":"k21", "x":1, "y":2}, {"label":"k22", "x":2, "y":2}, {"label":"k23", "x":3, "y":2}, {"label":"k30", "x":0, "y":3}, {"label":"k31", "x":1, "y":3}, {"label":"k32", "x":2, "y":3}, {"label":"k33", "x":3, "y":3}, {"label":"k40", "x":0, "y":4}, {"label":"k41", "x":1, "y":4}, {"label":"k42", "x":2, "y":4}, {"label":"k43", "x":3, "y":4}, {"label":"k50", "x":0, "y":5}, {"label":"k51", "x":1, "y":5}, {"label":"k52", "x":2, "y":5}, {"label":"k53", "x":3, "y":5}] } } } diff --git a/keyboards/amjpad/keymaps/default/keymap.c b/keyboards/amjpad/keymaps/default/keymap.c index 362afd107..1ec81e6db 100644 --- a/keyboards/amjpad/keymaps/default/keymap.c +++ b/keyboards/amjpad/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -#include "amjpad.h" +#include QMK_KEYBOARD_H #ifdef RGBLIGHT_ENABLE #include "rgblight.h" @@ -33,13 +33,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-------------------' */ -[_BL] = KEYMAP( - KC_ESC,KC_TAB,KC_BSPC,KC_PEQL, \ - KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \ - KC_P7, KC_P8, KC_P9, KC_PPLS, \ - KC_P4, KC_P5, KC_P6, \ - KC_P1, KC_P2, KC_P3, KC_PENT, \ - KC_P0, LT(_FL,KC_PDOT)), + [_BL] = LAYOUT_numpad_6x4( + KC_ESC, KC_TAB, KC_BSPC, KC_PEQL, \ + KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ + KC_P7, KC_P8, KC_P9, \ + KC_P4, KC_P5, KC_P6, KC_PPLS, \ + KC_P1, KC_P2, KC_P3, \ + KC_P0, LT(_FL,KC_PDOT), KC_PENT \ + ), /* Keymap _FL: Function Layer * ,-------------------. @@ -56,14 +57,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | 0 |./FN| | * `-------------------' */ -[_FL] = KEYMAP( - - KC_ESC,KC_TAB,KC_BSPC,KC_PEQL, \ - KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ - KC_P7, KC_P8, KC_P9, RESET, \ - KC_P4, KC_P5, KC_P6, \ - KC_P1, KC_P2, KC_P3, KC_PENT, \ - KC_P0, LT(_FL,KC_PDOT)), + [_FL] = LAYOUT_numpad_6x4( + KC_ESC, KC_TAB, KC_BSPC, KC_PEQL, \ + KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ + KC_P7, KC_P8, KC_P9, \ + KC_P4, KC_P5, KC_P6, RESET, \ + KC_P1, KC_P2, KC_P3, \ + KC_P0, LT(_FL,KC_PDOT), KC_PENT \ + ), }; enum function_id { diff --git a/keyboards/amjpad/keymaps/max/keymap.c b/keyboards/amjpad/keymaps/max/keymap.c index 926a494a9..463a265de 100644 --- a/keyboards/amjpad/keymaps/max/keymap.c +++ b/keyboards/amjpad/keymaps/max/keymap.c @@ -1,4 +1,4 @@ -#include "amjpad.h" +#include QMK_KEYBOARD_H #ifdef RGBLIGHT_ENABLE #include "rgblight.h" @@ -33,14 +33,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-------------------' */ -[_BL] = MAXKEYMAP( - - KC_ESC, KC_TAB, KC_MINS,KC_EQL, \ - KC_F1, KC_F2, KC_F3, KC_F4, \ - KC_P7, KC_P8, KC_P9, KC_PMNS, \ - KC_P4, KC_P5, KC_P6, KC_PENT, \ - KC_P1, KC_P2, KC_P3, KC_BSLS, \ - KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT), + [_BL] = LAYOUT_ortho_6x4( + KC_ESC, KC_TAB, KC_MINS,KC_EQL, \ + KC_F1, KC_F2, KC_F3, KC_F4, \ + KC_P7, KC_P8, KC_P9, KC_PMNS, \ + KC_P4, KC_P5, KC_P6, KC_PENT, \ + KC_P1, KC_P2, KC_P3, KC_BSLS, \ + KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT + ), /* Keymap _FL: Function Layer * ,-------------------. @@ -57,14 +57,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | 0 |./FN| | * `-------------------' */ -[_FL] = MAXKEYMAP( - - KC_ESC,KC_TAB,KC_BSPC,KC_PEQL, \ - KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ - KC_P7, KC_P8, KC_P9, RESET, \ - KC_P4, KC_P5, KC_P6, KC_PENT, \ - KC_P1, KC_P2, KC_P3, KC_PENT, \ - KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT), + [_FL] = LAYOUT_ortho_6x4( + KC_ESC, KC_TAB, KC_BSPC, KC_PEQL, \ + KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ + KC_P7, KC_P8, KC_P9, RESET, \ + KC_P4, KC_P5, KC_P6, KC_PENT, \ + KC_P1, KC_P2, KC_P3, KC_PENT, \ + KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT + ), }; enum function_id { diff --git a/keyboards/amjpad/keymaps/ortho_left/keymap.c b/keyboards/amjpad/keymaps/ortho_left/keymap.c index d3e4d9944..5245138bd 100644 --- a/keyboards/amjpad/keymaps/ortho_left/keymap.c +++ b/keyboards/amjpad/keymaps/ortho_left/keymap.c @@ -1,4 +1,4 @@ -#include "amjpad.h" +#include QMK_KEYBOARD_H #ifdef RGBLIGHT_ENABLE #include "rgblight.h" @@ -30,14 +30,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-------------------' */ -[_BL] = MAXKEYMAP( - - KC_T, KC_G, KC_B, KC_SPACE,\ - KC_R, KC_F, KC_V, MO(1), \ - KC_E, KC_D, KC_C, KC_LGUI, \ - KC_W, KC_S, KC_X, KC_LALT, \ - KC_Q, KC_A, KC_Z, KC_LCTL, \ - KC_TAB, KC_ESC, KC_LSHIFT, MO(1)), + [_BL] = LAYOUT_ortho_6x4( + KC_T, KC_G, KC_B, KC_SPACE,\ + KC_R, KC_F, KC_V, MO(1), \ + KC_E, KC_D, KC_C, KC_LGUI, \ + KC_W, KC_S, KC_X, KC_LALT, \ + KC_Q, KC_A, KC_Z, KC_LCTL, \ + KC_TAB, KC_ESC, KC_LSHIFT, MO(1) + ), /* Keymap _FL: Function Layer * ,-------------------. @@ -54,12 +54,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | ` | Del|Shft| | * `-------------------' */ -[_FL] = MAXKEYMAP( - - KC_5, KC_F5, KC_F11, _______, \ - KC_4, KC_F4, KC_F10, _______, \ - KC_3, KC_F3, KC_F9, _______, \ - KC_2, KC_F2, KC_F8, _______, \ - KC_1, KC_F1, KC_F7, _______, \ - KC_GRV,KC_DEL, _______, _______), + [_FL] = LAYOUT_ortho_6x4( + KC_5, KC_F5, KC_F11, _______, \ + KC_4, KC_F4, KC_F10, _______, \ + KC_3, KC_F3, KC_F9, _______, \ + KC_2, KC_F2, KC_F8, _______, \ + KC_1, KC_F1, KC_F7, _______, \ + KC_GRV,KC_DEL, _______, _______ + ), }; diff --git a/keyboards/amjpad/keymaps/ortho_right/keymap.c b/keyboards/amjpad/keymaps/ortho_right/keymap.c index 33e599abd..52e93524b 100644 --- a/keyboards/amjpad/keymaps/ortho_right/keymap.c +++ b/keyboards/amjpad/keymaps/ortho_right/keymap.c @@ -1,4 +1,4 @@ -#include "amjpad.h" +#include QMK_KEYBOARD_H #ifdef RGBLIGHT_ENABLE #include "rgblight.h" @@ -29,15 +29,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Rght| Ret| " |Bspc| * `-------------------' */ - -[_BL] = MAXKEYMAP( - - KC_SPACE, KC_N, KC_H, KC_Y, \ - MO(1), KC_M, KC_J, KC_U, \ - KC_LEFT, KC_COMM, KC_K, KC_I, \ - KC_DOWN, KC_DOT, KC_L, KC_O, \ - KC_UP, KC_SLASH, KC_SCLN, KC_P, \ - KC_RIGHT, KC_ENT, KC_QUOT, KC_BSPC), + [_BL] = LAYOUT_ortho_6x4( + KC_SPACE, KC_N, KC_H, KC_Y, \ + MO(1), KC_M, KC_J, KC_U, \ + KC_LEFT, KC_COMM, KC_K, KC_I, \ + KC_DOWN, KC_DOT, KC_L, KC_O, \ + KC_UP, KC_SLASH, KC_SCLN, KC_P, \ + KC_RIGHT, KC_ENT, KC_QUOT, KC_BSPC + ), /* Keymap _FL: Function Layer * ,-------------------. @@ -54,12 +53,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Rght| Ret| \ | Del| * `-------------------' */ -[_FL] = MAXKEYMAP( - - _______, KC_F12, KC_F6, KC_6, \ - _______, _______, KC_MINS, KC_7, \ - _______, _______, KC_EQL, KC_8, \ - _______, _______, KC_LBRC, KC_9, \ - _______, _______, KC_RBRC, KC_0, \ - _______, _______, KC_BSLS, KC_DEL), + [_FL] = LAYOUT_ortho_6x4( + _______, KC_F12, KC_F6, KC_6, \ + _______, _______, KC_MINS, KC_7, \ + _______, _______, KC_EQL, KC_8, \ + _______, _______, KC_LBRC, KC_9, \ + _______, _______, KC_RBRC, KC_0, \ + _______, _______, KC_BSLS, KC_DEL + ), }; diff --git a/keyboards/amjpad/rules.mk b/keyboards/amjpad/rules.mk index dd5b2bbe0..f378a4ede 100644 --- a/keyboards/amjpad/rules.mk +++ b/keyboards/amjpad/rules.mk @@ -64,3 +64,5 @@ MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID + +LAYOUTS = numpad_6x4 ortho_6x4 diff --git a/layouts/default/numpad_6x4/default_numpad_6x4/keymap.c b/layouts/default/numpad_6x4/default_numpad_6x4/keymap.c new file mode 100644 index 000000000..3901595b7 --- /dev/null +++ b/layouts/default/numpad_6x4/default_numpad_6x4/keymap.c @@ -0,0 +1,21 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_numpad_6x4( + KC_ESC, KC_TAB, MO(1), KC_BSPC, \ + KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ + KC_P7, KC_P8, KC_P9, \ + KC_P4, KC_P5, KC_P6, KC_PPLS, \ + KC_P1, KC_P2, KC_P3, \ + KC_P0, KC_PDOT, KC_PENT \ + ), + + [1] = LAYOUT_numpad_6x4( + RESET, KC_TAB, KC_TRNS, KC_PEQL, \ + KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ + KC_HOME, KC_UP, KC_PGUP, \ + KC_LEFT, KC_NO, KC_RGHT, KC_PPLS, \ + KC_END, KC_DOWN, KC_PGDN, \ + KC_INS, KC_DEL, KC_PENT \ + ), +}; diff --git a/layouts/default/numpad_6x4/layout.json b/layouts/default/numpad_6x4/layout.json new file mode 100644 index 000000000..7264cd5a6 --- /dev/null +++ b/layouts/default/numpad_6x4/layout.json @@ -0,0 +1,6 @@ +["","","",""], +[{y:0.5},"","","",""], +["","","",{h:2},""], +["","",""], +["","","",{h:2},""], +[{w:2},"",""] diff --git a/layouts/default/numpad_6x4/readme.md b/layouts/default/numpad_6x4/readme.md new file mode 100644 index 000000000..c539baef7 --- /dev/null +++ b/layouts/default/numpad_6x4/readme.md @@ -0,0 +1,3 @@ +# numpad_6x4 + + LAYOUT_numpad_6x4 \ No newline at end of file diff --git a/layouts/default/ortho_6x4/default_ortho_6x4/keymap.c b/layouts/default/ortho_6x4/default_ortho_6x4/keymap.c new file mode 100644 index 000000000..39c1ed481 --- /dev/null +++ b/layouts/default/ortho_6x4/default_ortho_6x4/keymap.c @@ -0,0 +1,12 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_ortho_6x4( + 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_F13, KC_F14, KC_F15, KC_F16, \ + KC_F17, KC_F18, KC_F19, KC_F20, \ + KC_F21, KC_F22, KC_F23, KC_F24 \ + ), +}; diff --git a/layouts/default/ortho_6x4/layout.json b/layouts/default/ortho_6x4/layout.json new file mode 100644 index 000000000..4db1bb0fd --- /dev/null +++ b/layouts/default/ortho_6x4/layout.json @@ -0,0 +1,6 @@ +["","","",""], +["","","",""], +["","","",""], +["","","",""], +["","","",""], +["","","",""], diff --git a/layouts/default/ortho_6x4/readme.md b/layouts/default/ortho_6x4/readme.md new file mode 100644 index 000000000..6014d4b19 --- /dev/null +++ b/layouts/default/ortho_6x4/readme.md @@ -0,0 +1,3 @@ +# ortho_6x4 + + LAYOUT_ortho_6x4 \ No newline at end of file