Keyboard: Ckeys refactor (#3681)

* Obelus Refactor: LAYOUT to LAYOUT_ortho_4x4

- Keymap also now uses #include QMK_KEYBOARD_H
- Readability and white space changes
- rules.mk now has LAYOUTS = ortho_4x4
- added info.json

* naKey Refactor: LAYOUT to LAYOUT_numpad_5x4

- Matrix LAYOUT renamed to LAYOUT_numpad_5x4
- Now supports community layout numpad_5x4
- White space changes

* naKey Configurator update

Updated order of JSON objects to match new matrix order.
This commit is contained in:
noroadsleft 2018-08-17 16:12:22 -07:00 committed by Drashna Jaelre
parent 9175eebc87
commit 19fdfccca2
8 changed files with 81 additions and 67 deletions

View File

@ -5,8 +5,8 @@
"width": 4, "width": 4,
"height": 5, "height": 5,
"layouts": { "layouts": {
"LAYOUT": { "LAYOUT_numpad_5x4": {
"layout": [{"label":"Num Lock", "x":0, "y":0}, {"label":"/", "x":1, "y":0}, {"label":"*", "x":2, "y":0}, {"label":"-", "x":3, "y":0}, {"label":"7", "x":0, "y":1}, {"label":"8", "x":1, "y":1}, {"label":"9", "x":2, "y":1}, {"label":"+", "x":3, "y":1, "h":2}, {"label":"4", "x":0, "y":2}, {"label":"5", "x":1, "y":2}, {"label":"6", "x":2, "y":2}, {"label":"1", "x":0, "y":3}, {"label":"2", "x":1, "y":3}, {"label":"3", "x":2, "y":3}, {"label":"Enter", "x":3, "y":3, "h":2}, {"label":"0", "x":0, "y":4, "w":2}, {"label":".", "x":2, "y":4}] "layout": [{"label":"Num Lock", "x":0, "y":0}, {"label":"/", "x":1, "y":0}, {"label":"*", "x":2, "y":0}, {"label":"-", "x":3, "y":0}, {"label":"7", "x":0, "y":1}, {"label":"8", "x":1, "y":1}, {"label":"9", "x":2, "y":1}, {"label":"4", "x":0, "y":2}, {"label":"5", "x":1, "y":2}, {"label":"6", "x":2, "y":2}, {"label":"+", "x":3, "y":1, "h":2}, {"label":"1", "x":0, "y":3}, {"label":"2", "x":1, "y":3}, {"label":"3", "x":2, "y":3}, {"label":"0", "x":0, "y":4, "w":2}, {"label":".", "x":2, "y":4}, {"label":"Enter", "x":3, "y":3, "h":2}]
} }
} }
} }

View File

@ -16,32 +16,31 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT( /* Base */ [0] = LAYOUT_numpad_5x4( /* Base */
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \
KC_P7, KC_P8, KC_P9, KC_PPLS, \ KC_P7, KC_P8, KC_P9, \
KC_P4, KC_P5, KC_P6, \ KC_P4, KC_P5, KC_P6, KC_PPLS, \
KC_P1, KC_P2, KC_P3, KC_PENT, \ KC_P1, KC_P2, KC_P3, \
KC_P0, KC_PDOT \ KC_P0, KC_PDOT, KC_PENT \
), ),
}; };
const uint16_t PROGMEM fn_actions[] = { const uint16_t PROGMEM fn_actions[] = {
}; };
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
{
// MACRODOWN only works in this function // MACRODOWN only works in this function
switch(id) { switch(id) {
case 0: case 0:
if (record->event.pressed) { if (record->event.pressed) {
register_code(KC_RSFT); register_code(KC_RSFT);
} else { } else {
unregister_code(KC_RSFT); unregister_code(KC_RSFT);
}
break;
} }
return MACRO_NONE; break;
}
return MACRO_NONE;
}; };

View File

@ -22,14 +22,13 @@
// The following is an example using the Planck MIT layout // The following is an example using the Planck MIT layout
// The first section contains all of the arguments // The first section contains all of the arguments
// The second converts the arguments into a two-dimensional array // The second converts the arguments into a two-dimensional array
#define LAYOUT( \ #define LAYOUT_numpad_5x4( \
k00, k01, k02, k03, \ k00, k01, k02, k03, \
k10, k11, k12, k13, \ k10, k11, k12, \
k20, k21, k22, \ k20, k21, k22, k13, \
k30, k31, k32, k33, \ k30, k31, k32, \
k40, k41 \ k40, k41, k33 \
) \ ) { \
{ \
{ k00, k01, k02, k03 }, \ { k00, k01, k02, k03 }, \
{ k10, k11, k12, k13 }, \ { k10, k11, k12, k13 }, \
{ k20, k21, k22, KC_NO }, \ { k20, k21, k22, KC_NO }, \

View File

@ -66,3 +66,5 @@ UNICODE_ENABLE ?= no # Unicode
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE ?= no # Audio output on port C6 AUDIO_ENABLE ?= no # Audio output on port C6
FAUXCLICKY_ENABLE ?= no # Use buzzer to emulate clicky switches FAUXCLICKY_ENABLE ?= no # Use buzzer to emulate clicky switches
LAYOUTS = numpad_5x4

View File

@ -0,0 +1,13 @@
{
"keyboard_name": "Obelus",
"url": "",
"maintainer": "qmk",
"width": 4,
"height": 4,
"layouts": {
"LAYOUT_ortho_4x4": {
"key_count": 16,
"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}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}]
}
}
}

View File

@ -1,5 +1,4 @@
#include "obelus.h" #include QMK_KEYBOARD_H
#include "action_layer.h"
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
#include "audio.h" #include "audio.h"
#endif #endif
@ -18,12 +17,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | * | | | | |
* `---------------------- ' * `---------------------- '
*/ */
[0] = LAYOUT( /* LAYER SELECT */ [0] = LAYOUT_ortho_4x4( /* LAYER SELECT */
KC_TRNS, KC_TRNS, KC_TRNS, RESET, \ _______, _______, _______, RESET, \
TO(4), KC_TRNS, KC_TRNS, KC_TRNS, \ TO(4), _______, _______, _______, \
TO(1), TO(2), TO(3), KC_TRNS, \ TO(1), TO(2), TO(3), _______, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ _______, _______, _______, _______ \
), ),
/* NUMPAD /* NUMPAD
* ,-----------------------. * ,-----------------------.
* | 7 | 8 | 9 | * | * | 7 | 8 | 9 | * |
@ -35,12 +34,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | 0 | . | / | = | * | 0 | . | / | = |
* `---------------------- ' * `---------------------- '
*/ */
[1] = LAYOUT( /* NUMPAD */ [1] = LAYOUT_ortho_4x4( /* NUMPAD */
KC_P7, KC_P8, KC_P9, KC_PAST, \ KC_P7, KC_P8, KC_P9, KC_PAST, \
KC_P4, KC_P5, KC_P6, KC_PMNS, \ KC_P4, KC_P5, KC_P6, KC_PMNS, \
KC_P1, KC_P2, KC_P3, KC_PPLS, \ KC_P1, KC_P2, KC_P3, KC_PPLS, \
KC_P0, KC_PDOT, KC_PSLS, LT(5,KC_PENT) \ KC_P0, KC_PDOT, KC_PSLS, LT(5, KC_PENT) \
), ),
/* NUMPAD SUPPLEMENT /* NUMPAD SUPPLEMENT
* ,-----------------------. * ,-----------------------.
* |NUMLK| | | | * |NUMLK| | | |
@ -52,12 +51,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | * | | | | |
* `---------------------- ' * `---------------------- '
*/ */
[5] = LAYOUT( /* NUMPAD SUPPLEMENT */ [5] = LAYOUT_ortho_4x4( /* NUMPAD SUPPLEMENT */
KC_NLCK, KC_TRNS, KC_TRNS, TO(0), \ KC_NLCK, _______, _______, TO(0), \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ _______, _______, _______, _______, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ _______, _______, _______, _______, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ _______, _______, _______, _______ \
), ),
/* NAV /* NAV
* ,-----------------------. * ,-----------------------.
* | INS |PGUP | TAB |PRSCR| * | INS |PGUP | TAB |PRSCR|
@ -69,12 +68,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |LEFT |DOWN |RIGHT|ENTER| * |LEFT |DOWN |RIGHT|ENTER|
* `---------------------- ' * `---------------------- '
*/ */
[2] = LAYOUT( /* NAV CLUSTER */ [2] = LAYOUT_ortho_4x4( /* NAV CLUSTER */
KC_INS, KC_PGUP, KC_TAB, KC_PSCR, \ KC_INS, KC_PGUP, KC_TAB, KC_PSCR, \
KC_DEL, KC_PGDN, KC_VOLD, KC_VOLU, \ KC_DEL, KC_PGDN, KC_VOLD, KC_VOLU, \
KC_HOME, KC_UP, KC_END, TO(0), \ KC_HOME, KC_UP, KC_END, TO(0), \
KC_LEFT, KC_DOWN, KC_RGHT, KC_ENT \ KC_LEFT, KC_DOWN, KC_RGHT, KC_ENT \
), ),
/* GAMING /* GAMING
* ,-----------------------. * ,-----------------------.
* | ESC | 1 | 2 | 3 | * | ESC | 1 | 2 | 3 |
@ -86,12 +85,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |CTRL | C | R |SPACE| * |CTRL | C | R |SPACE|
* `---------------------- ' * `---------------------- '
*/ */
[3] = LAYOUT( /* GAMING */ [3] = LAYOUT_ortho_4x4( /* GAMING */
LT(4, KC_ESC), KC_1, KC_2, KC_3, \ LT(4, KC_ESC), KC_1, KC_2, KC_3, \
KC_TAB, KC_Q, KC_W, KC_E, \ KC_TAB, KC_Q, KC_W, KC_E, \
KC_LSFT, KC_A, KC_S, KC_D, \ KC_LSFT, KC_A, KC_S, KC_D, \
KC_LCTL, KC_C, KC_R, KC_SPC \ KC_LCTL, KC_C, KC_R, KC_SPC \
), ),
/* MUSIC /* MUSIC
* ,-----------------------. * ,-----------------------.
* | | | | | * | | | | |
@ -103,12 +102,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |TOGGL|MODE | | | * |TOGGL|MODE | | |
* `---------------------- ' * `---------------------- '
*/ */
[4] = LAYOUT( /* NUMPAD SUPPLEMENT */ [4] = LAYOUT_ortho_4x4( /* NUMPAD SUPPLEMENT */
KC_NO, KC_NO, KC_NO, KC_NO, \ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
KC_NO, KC_NO, KC_NO, KC_NO, \ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
KC_NO, KC_NO, KC_NO, KC_NO, \ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
MU_TOG, MU_MOD, KC_NO, TO(0) \ MU_TOG, MU_MOD, XXXXXXX, TO(0) \
), ),
}; };
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {

View File

@ -7,7 +7,7 @@
// The following is an example using the Planck MIT layout // The following is an example using the Planck MIT layout
// The first section contains all of the arguements // The first section contains all of the arguements
// The second converts the arguments into a two-dimensional array // The second converts the arguments into a two-dimensional array
#define LAYOUT( \ #define LAYOUT_ortho_4x4( \
k00, k01, k02, k03, \ k00, k01, k02, k03, \
k10, k11, k12, k13, \ k10, k11, k12, k13, \
k20, k21, k22, k23, \ k20, k21, k22, k23, \

View File

@ -66,3 +66,5 @@ UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = yes # Audio output on port C6 AUDIO_ENABLE = yes # Audio output on port C6
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
LAYOUTS = ortho_4x4