Prime_R refactor and Configurator support (#3289)

* Matrix refactor: rename KEYMAP to LAYOUT

* Keymap refactor: QMK_KEYBOARD_H; new matrix names

* Configurator support
This commit is contained in:
noroadsleft 2018-07-03 16:15:23 -07:00 committed by Drashna Jaelre
parent a120bbc4de
commit d49e4543b3
4 changed files with 149 additions and 134 deletions

View file

@ -0,0 +1,13 @@
{
"keyboard_name": "Prime_R",
"url": "",
"maintainer": "qmk",
"width": 16,
"height": 5,
"layouts": {
"LAYOUT": {
"key_count": 75,
"layout": [{"label":"K000", "x":0, "y":0}, {"label":"K001", "x":1, "y":0}, {"label":"K002", "x":2, "y":0}, {"label":"K003", "x":3, "y":0}, {"label":"K004", "x":4, "y":0}, {"label":"K005", "x":5, "y":0}, {"label":"K006", "x":6, "y":0}, {"label":"K007", "x":7, "y":0}, {"label":"K008", "x":8, "y":0}, {"label":"K009", "x":9, "y":0}, {"label":"K010", "x":10, "y":0}, {"label":"K011", "x":11, "y":0}, {"label":"K012", "x":12, "y":0}, {"label":"K013", "x":13, "y":0}, {"label":"K014", "x":14, "y":0}, {"label":"K015", "x":15, "y":0}, {"label":"K100", "x":0, "y":1}, {"label":"K101", "x":1, "y":1}, {"label":"K102", "x":2, "y":1}, {"label":"K103", "x":3, "y":1}, {"label":"K104", "x":4, "y":1}, {"label":"K105", "x":5, "y":1}, {"label":"K106", "x":6, "y":1}, {"label":"K107", "x":7, "y":1}, {"label":"K108", "x":8, "y":1}, {"label":"K109", "x":9, "y":1}, {"label":"K110", "x":10, "y":1}, {"label":"K111", "x":11, "y":1}, {"label":"K112", "x":12, "y":1}, {"label":"K113", "x":13, "y":1}, {"label":"K114", "x":14, "y":1}, {"label":"K115", "x":15, "y":1}, {"label":"K200", "x":0, "y":2, "w":1.25}, {"label":"K201", "x":1.25, "y":2}, {"label":"K202", "x":2.25, "y":2}, {"label":"K203", "x":3.25, "y":2}, {"label":"K204", "x":4.25, "y":2}, {"label":"K205", "x":5.25, "y":2}, {"label":"K206", "x":6.25, "y":2}, {"label":"K207", "x":7.25, "y":2}, {"label":"K208", "x":8.25, "y":2}, {"label":"K209", "x":9.25, "y":2}, {"label":"K210", "x":10.25, "y":2}, {"label":"K212", "x":11.25, "y":2, "w":1.75}, {"label":"K213", "x":13, "y":2}, {"label":"K214", "x":14, "y":2}, {"label":"K215", "x":15, "y":2}, {"label":"K300", "x":0, "y":3, "w":1.75}, {"label":"K302", "x":1.75, "y":3}, {"label":"K303", "x":2.75, "y":3}, {"label":"K304", "x":3.75, "y":3}, {"label":"K305", "x":4.75, "y":3}, {"label":"K306", "x":5.75, "y":3}, {"label":"K307", "x":6.75, "y":3}, {"label":"K308", "x":7.75, "y":3}, {"label":"K309", "x":8.75, "y":3}, {"label":"K310", "x":9.75, "y":3}, {"label":"K311", "x":10.75, "y":3}, {"label":"K312", "x":11.75, "y":3, "w":1.25}, {"label":"K313", "x":13, "y":3}, {"label":"K314", "x":14, "y":3}, {"label":"K315", "x":15, "y":3}, {"label":"K400", "x":0, "y":4, "w":1.25}, {"label":"K402", "x":1.25, "y":4, "w":1.25}, {"label":"K403", "x":2.5, "y":4}, {"label":"K404", "x":3.5, "y":4}, {"label":"K405", "x":4.5, "y":4, "w":2}, {"label":"K407", "x":6.5, "y":4, "w":2.25}, {"label":"K409", "x":8.75, "y":4}, {"label":"K410", "x":9.75, "y":4}, {"label":"K411", "x":10.75, "y":4}, {"label":"K412", "x":11.75, "y":4, "w":1.25}, {"label":"K413", "x":13, "y":4}, {"label":"K414", "x":14, "y":4}, {"label":"K415", "x":15, "y":4}]
}
}
}

View file

@ -17,9 +17,7 @@
*/
// Prime_R Rev 1.0
#include "prime_r.h"
#include "action_layer.h"
#include "backlight.h"
#include QMK_KEYBOARD_H
// Fillers to make layering more clear
#define _______ KC_TRNS
@ -40,29 +38,31 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `---------------------------------------------------------------'
*/
// 0: Base Layer
KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_PGUP, KC_BSPC, KC_PSCR, KC_PGUP, KC_PGDN, \
KC_GRV, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_PGDN, KC_DEL, KC_7, KC_8, KC_9, \
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_DQUO, KC_ENT, KC_4, KC_5, KC_6, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_LABK, KC_RABK, KC_QUES, KC_LSFT, KC_1, KC_2, KC_3, \
KC_LCTL, KC_LGUI, KC_APP, KC_LALT, MO(0), KC_SPC, KC_RALT, KC_APP, KC_RGUI, KC_RCTL, KC_0, KC_DOT, KC_ENT), \
[0] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_PGUP, KC_BSPC, KC_PSCR, KC_PGUP, KC_PGDN, \
KC_GRV, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_PGDN, KC_DEL, KC_7, KC_8, KC_9, \
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_DQUO, KC_ENT, KC_4, KC_5, KC_6, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_LABK, KC_RABK, KC_QUES, KC_LSFT, KC_1, KC_2, KC_3, \
KC_LCTL, KC_LGUI, KC_APP, KC_LALT, MO(0), KC_SPC, KC_RALT, KC_APP, KC_RGUI, KC_RCTL, KC_0, KC_DOT, KC_ENT \
),
// 1: Function Layer
KEYMAP(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
// 1: Function Layer
[1] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
),
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
switch (id) {
switch (id) {
}
return MACRO_NONE;
}
return MACRO_NONE;
}
void matrix_init_user(void) {
@ -72,5 +72,5 @@ void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
return true;
}

View file

@ -16,9 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/// Prime_R Rev 1.0
#include "prime_r.h"
#include "action_layer.h"
#include "backlight.h"
#include QMK_KEYBOARD_H
// Fillers to make layering more clear
#define _______ KC_TRNS
@ -29,13 +27,13 @@ static bool arrow_toggle = false;
//Arrow Keys
enum custom_keycodes{
AR_TOG = SAFE_RANGE, //Toggle Arrow Keys
AR_LT, //Num0 or Left Arrow
AR_RT, //NumEnt or Right Arrow
AR_DN, //NumDot or Down Arrow
AR_UP, //Num2 or Up Arrow
AR_TOG = SAFE_RANGE, //Toggle Arrow Keys
AR_LT, //Num0 or Left Arrow
AR_RT, //NumEnt or Right Arrow
AR_DN, //NumDot or Down Arrow
AR_UP, //Num2 or Up Arrow
};
// Tap/Hold Space Layer
#define SPC_LT LT(1, KC_SPC)
@ -54,12 +52,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `---------------------------------------------------------------'
*/
// 0: Base Layer
KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_BSPC, KC_DEL, KC_HOME, KC_END, \
KC_GRV, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_P7, KC_P8, KC_P9, \
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, KC_P4, KC_P5, KC_P6, \
KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, KC_P1, AR_UP, KC_P3, \
KC_LCTL, KC_LGUI, KC_LALT, TO(1), SPC_LT, SPC_LT, AR_TOG, KC_APP, KC_RALT, KC_RCTL, AR_LT, AR_DN, AR_RT), \
[0] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_BSPC, KC_DEL, KC_HOME, KC_END, \
KC_GRV, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_P7, KC_P8, KC_P9, \
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, KC_P4, KC_P5, KC_P6, \
KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, KC_P1, AR_UP, KC_P3, \
KC_LCTL, KC_LGUI, KC_LALT, TO(1), SPC_LT, SPC_LT, AR_TOG, KC_APP, KC_RALT, KC_RCTL, AR_LT, AR_DN, AR_RT \
),
/* (Function Layer)
* ,---------------------------------------------------------------.
@ -73,14 +72,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |---------------------------------------------------------------|
* |Ctrl|Gui |Alt|TO0| 1/SP | 1/SP |ART|TO2|Alt|Ctrl |MUT|VDN|STP|
* `---------------------------------------------------------------'
*/
*/
// 1: Function Layer
KEYMAP(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_EQL, _______, KC_PSLS, KC_PAST, KC_PPLS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BSLS, _______, _______, _______,
BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_QUOT, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, _______,
_______, _______, _______, TO(0), _______, _______, _______, TO(2), _______, _______, KC_MUTE, KC_VOLD, KC_MSTP),
[1] = LAYOUT(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_EQL, _______, KC_PSLS, KC_PAST, KC_PPLS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BSLS, _______, _______, _______,
BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_QUOT, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, _______,
_______, _______, _______, TO(0), _______, _______, _______, TO(2), _______, _______, KC_MUTE, KC_VOLD, KC_MSTP
),
/* (Numpad Mods)
* ,---------------------------------------------------------------.
@ -96,104 +96,106 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `---------------------------------------------------------------'
*/
// 2: Numpad Mods
KEYMAP(
_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, _______, KC_PSLS, KC_PAST, KC_PPLS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RBRC, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_SCLN, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, AR_UP, _______,
_______, _______, _______, TO(0), _______, _______, _______, KC_APP, _______, _______, AR_LT, AR_DN, AR_RT ),
[2] = LAYOUT(
_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, _______, KC_PSLS, KC_PAST, KC_PPLS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RBRC, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_SCLN, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, AR_UP, _______,
_______, _______, _______, TO(0), _______, _______, _______, KC_APP, _______, _______, AR_LT, AR_DN, AR_RT
),
// 3: Extra
KEYMAP(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[3] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
};
void matrix_init_user(void) {
if (get_backlight_level() != 0){
backlight_toggle();
}
if (get_backlight_level() != 0){
backlight_toggle();
}
};
void matrix_scan_user(void) {
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if(record->event.pressed){
switch(keycode) {
case AR_TOG:
arrow_toggle = !arrow_toggle;
backlight_toggle();
return false; break;
case AR_UP:
if(arrow_toggle == 1){
SEND_STRING(SS_DOWN(X_UP));
} else {
SEND_STRING(SS_DOWN(X_KP_2));
}
return false; break;
case AR_DN:
if(arrow_toggle == 1){
SEND_STRING(SS_DOWN(X_DOWN));
} else {
SEND_STRING(SS_DOWN(X_KP_DOT));
}
return false; break;
case AR_LT:
if(arrow_toggle == 1){
SEND_STRING(SS_DOWN(X_LEFT));
} else {
SEND_STRING(SS_DOWN(X_KP_0));
}
return false; break;
case AR_RT:
if(arrow_toggle == 1){
SEND_STRING(SS_DOWN(X_RIGHT));
} else {
SEND_STRING(SS_DOWN(X_KP_ENTER));
}
return false; break;
}
}
if(!record->event.pressed){
switch(keycode) {
case AR_UP:
if(arrow_toggle == 1){
SEND_STRING(SS_UP(X_UP));
} else {
SEND_STRING(SS_UP(X_KP_2));
}
return false; break;
case AR_DN:
if(arrow_toggle == 1){
SEND_STRING(SS_UP(X_DOWN));
} else {
SEND_STRING(SS_UP(X_KP_DOT));
}
return false; break;
case AR_LT:
if(arrow_toggle == 1){
SEND_STRING(SS_UP(X_LEFT));
} else {
SEND_STRING(SS_UP(X_KP_0));
}
return false; break;
case AR_RT:
if(arrow_toggle == 1){
SEND_STRING(SS_UP(X_RIGHT));
} else {
SEND_STRING(SS_UP(X_KP_ENTER));
}
return false; break;
}
}
return true;
};
if(record->event.pressed){
switch(keycode) {
case AR_TOG:
arrow_toggle = !arrow_toggle;
backlight_toggle();
return false; break;
case AR_UP:
if(arrow_toggle == 1){
SEND_STRING(SS_DOWN(X_UP));
} else {
SEND_STRING(SS_DOWN(X_KP_2));
}
return false; break;
case AR_DN:
if(arrow_toggle == 1){
SEND_STRING(SS_DOWN(X_DOWN));
} else {
SEND_STRING(SS_DOWN(X_KP_DOT));
}
return false; break;
case AR_LT:
if(arrow_toggle == 1){
SEND_STRING(SS_DOWN(X_LEFT));
} else {
SEND_STRING(SS_DOWN(X_KP_0));
}
return false; break;
case AR_RT:
if(arrow_toggle == 1){
SEND_STRING(SS_DOWN(X_RIGHT));
} else {
SEND_STRING(SS_DOWN(X_KP_ENTER));
}
return false; break;
}
}
if(!record->event.pressed){
switch(keycode) {
case AR_UP:
if(arrow_toggle == 1){
SEND_STRING(SS_UP(X_UP));
} else {
SEND_STRING(SS_UP(X_KP_2));
}
return false; break;
case AR_DN:
if(arrow_toggle == 1){
SEND_STRING(SS_UP(X_DOWN));
} else {
SEND_STRING(SS_UP(X_KP_DOT));
}
return false; break;
case AR_LT:
if(arrow_toggle == 1){
SEND_STRING(SS_UP(X_LEFT));
} else {
SEND_STRING(SS_UP(X_KP_0));
}
return false; break;
case AR_RT:
if(arrow_toggle == 1){
SEND_STRING(SS_UP(X_RIGHT));
} else {
SEND_STRING(SS_UP(X_KP_ENTER));
}
return false; break;
}
}
return true;
};

View file

@ -18,7 +18,7 @@
#include "quantum.h"
#define KEYMAP( \
#define LAYOUT( \
K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, K015, \
K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, K115, \
K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K212, K213, K214, K215, \