From 5953af32153a4813279c57396f6bebc798de2ae2 Mon Sep 17 00:00:00 2001 From: MechMerlin <30334081+mechmerlin@users.noreply.github.com> Date: Thu, 5 Jul 2018 10:43:15 -0700 Subject: [PATCH] Cospad QMK Configurator support and refactor (#3319) * Refactor KEYMAP to LAYOUT standards - Change KEYMAP to LAYOUT_ortho - Added a new LAYOUT called LAYOUT_numpad * Use the new LAYOUT_numpad macro * Add QMK Configurator support * Change LAYOUT names as per code review * Change positioning of keys in the matrix * fix compile issue --- keyboards/cospad/cospad.h | 29 ++++++++++++++++------- keyboards/cospad/info.json | 16 +++++++++++++ keyboards/cospad/keymaps/default/keymap.c | 22 ++++++++--------- 3 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 keyboards/cospad/info.json diff --git a/keyboards/cospad/cospad.h b/keyboards/cospad/cospad.h index cbcbdaf96..36c7f3367 100644 --- a/keyboards/cospad/cospad.h +++ b/keyboards/cospad/cospad.h @@ -40,13 +40,13 @@ */ // The first section contains all of the arguments // The second converts the arguments into a two-dimensional array -#define KEYMAP( \ - k00, k01, k02, k03, \ +#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 \ + k50, k51, k52, k53 \ ) \ { \ {k00, k01, k02, k03}, \ @@ -54,14 +54,27 @@ {k20, k21, k22, k23}, \ {k30, k31, k32, k33}, \ {k40, k41, k42, k43}, \ - {k50, k51, k52, k53} \ + {k50, k51, k52, k53} \ +} + +#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, KC_NO}, \ + {k40, k41, k42, k43}, \ + {k50, KC_NO, k52, KC_NO} \ } void matrix_init_user(void); void matrix_scan_user(void); -/* -inline void cospad_bl_led_on(void) { DDRF |= (1<<7); PORTF &= ~(1<<7); } -inline void cospad_bl_led_off(void) { DDRF &= ~(1<<7); PORTF &= ~(1<<7); } -*/ inline void cospad_bl_led_on(void) { PORTF &= ~(1<<7); } inline void cospad_bl_led_off(void) { PORTF |= (1<<7); } diff --git a/keyboards/cospad/info.json b/keyboards/cospad/info.json new file mode 100644 index 000000000..4fd2ea087 --- /dev/null +++ b/keyboards/cospad/info.json @@ -0,0 +1,16 @@ +{ + "keyboard_name": "", + "url": "", + "maintainer": "qmk", + "width": 4, + "height": 6, + "layouts": { + "LAYOUT_numpad_6x4": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"Tab", "x":1, "y":0}, {"label":"Fn", "x":2, "y":0}, {"label":"Back", "x":3, "y":0}, {"label":"Num Lock", "x":0, "y":1}, {"label":"/", "x":1, "y":1}, {"label":"*", "x":2, "y":1}, {"label":"-", "x":3, "y":1}, {"label":"7", "x":0, "y":2}, {"label":"8", "x":1, "y":2}, {"label":"9", "x":2, "y":2}, {"label":"+", "x":3, "y":2, "h":2}, {"label":"4", "x":0, "y":3}, {"label":"5", "x":1, "y":3}, {"label":"6", "x":2, "y":3}, {"label":"1", "x":0, "y":4}, {"label":"2", "x":1, "y":4}, {"label":"3", "x":2, "y":4}, {"label":"Enter", "x":3, "y":4, "h":2}, {"label":"0", "x":0, "y":5, "w":2}, {"label":".", "x":2, "y":5}] + }, + + "LAYOUT_ortho_6x4": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"Tab", "x":1, "y":0}, {"label":"Fn", "x":2, "y":0}, {"label":"Back", "x":3, "y":0}, {"label":"Num Lock", "x":0, "y":1}, {"label":"/", "x":1, "y":1}, {"label":"*", "x":2, "y":1}, {"label":"-", "x":3, "y":1}, {"label":"7", "x":0, "y":2}, {"label":"8", "x":1, "y":2}, {"label":"9", "x":2, "y":2}, {"label":"+", "x":3, "y":2}, {"label":"4", "x":0, "y":3}, {"label":"5", "x":1, "y":3}, {"label":"6", "x":2, "y":3}, {"x":3, "y":3}, {"label":"1", "x":0, "y":4}, {"label":"2", "x":1, "y":4}, {"label":"3", "x":2, "y":4}, {"label":"Enter", "x":3, "y":4}, {"label":"0", "x":0, "y":5}, {"x":1, "y":5}, {"label":".", "x":2, "y":5}, {"x":3, "y":5}] + } + } +} \ No newline at end of file diff --git a/keyboards/cospad/keymaps/default/keymap.c b/keyboards/cospad/keymaps/default/keymap.c index 0e762c2e4..3cea2f8e6 100644 --- a/keyboards/cospad/keymaps/default/keymap.c +++ b/keyboards/cospad/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -#include "cospad.h" +#include QMK_KEYBOARD_H #include "led.h" #ifdef RGBLIGHT_ENABLE @@ -31,13 +31,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-------------------' */ -[_BL] = KEYMAP( +[_BL] = LAYOUT_numpad_6x4( KC_ESC, KC_TAB, MO(_FL), KC_BSPC, \ KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ - KC_P7, KC_P8, KC_P9, KC_PPLS, \ - KC_P4, KC_P5, KC_P6, KC_NO, \ - KC_P1, KC_P2, KC_P3, KC_PENT, \ - KC_P0, KC_NO, KC_PDOT, KC_NO), + 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), /* Keymap _FL: Function Layer * ,-------------------. @@ -54,13 +54,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | 0 |RST | | * `-------------------' */ -[_FL] = KEYMAP( +[_FL] = LAYOUT_numpad_6x4( RGB_TOG, KC_TAB, KC_TRNS, KC_BSPC, \ RGB_MOD, RGB_M_P, BL_TOGG, KC_PMNS, \ - RGB_HUD, RGB_HUI, BL_ON, KC_PPLS, \ - RGB_SAD, RGB_SAI, BL_OFF, KC_NO, \ - RGB_VAD, RGB_VAI, KC_P3, KC_PENT, \ - KC_P0, KC_NO, RESET, KC_NO), + RGB_HUD, RGB_HUI, BL_ON, \ + RGB_SAD, RGB_SAI, BL_OFF, KC_PPLS, \ + RGB_VAD, RGB_VAI, KC_P3, \ + KC_P0, RESET, KC_PENT), };