From fb79015049ebd1309cd4f69a7584db614f50d1db Mon Sep 17 00:00:00 2001 From: MechMerlin <30334081+mechmerlin@users.noreply.github.com> Date: Fri, 31 Aug 2018 14:49:18 -0700 Subject: [PATCH] Keymap: Merlin Learns to QMK (#3820) * Fix up my keymaps to use more QMK features * update 60_ansi readme * add the start of my userspace * begin to use my new userspace * use more of my userspace * spread userspace love to my clueboard * spread userspace love to 75 layout * add a fairly vanilla readme * put the FNX into a userspace incase I ever want to use it for something else * respond to drashna's code review comments --- .../60_ansi/mechmerlin-ansi/keymap.c | 38 +++---------------- .../60_ansi/mechmerlin-ansi/readme.md | 4 +- .../60_ansi/mechmerlin-ansi/rules.mk | 1 + .../mechmerlin-split/keymap.c | 17 ++++----- .../mechmerlin-split/rules.mk | 1 + layouts/community/66_ansi/mechmerlin/keymap.c | 15 ++------ layouts/community/66_ansi/mechmerlin/rules.mk | 1 + .../75_ansi/mechmerlin-75_ansi/keymap.c | 12 +++--- .../75_ansi/mechmerlin-75_ansi/rules.mk | 1 + users/mechmerlin/mechmerlin.c | 20 ++++++++++ users/mechmerlin/mechmerlin.h | 17 +++++++++ users/mechmerlin/readme.md | 3 ++ users/mechmerlin/rules.mk | 1 + 13 files changed, 68 insertions(+), 63 deletions(-) create mode 100644 layouts/community/60_ansi/mechmerlin-ansi/rules.mk create mode 100644 layouts/community/60_ansi_split_bs_rshift/mechmerlin-split/rules.mk create mode 100644 layouts/community/66_ansi/mechmerlin/rules.mk create mode 100644 layouts/community/75_ansi/mechmerlin-75_ansi/rules.mk create mode 100644 users/mechmerlin/mechmerlin.c create mode 100644 users/mechmerlin/mechmerlin.h create mode 100644 users/mechmerlin/readme.md create mode 100644 users/mechmerlin/rules.mk diff --git a/layouts/community/60_ansi/mechmerlin-ansi/keymap.c b/layouts/community/60_ansi/mechmerlin-ansi/keymap.c index 47316915ca..e48fddea46 100644 --- a/layouts/community/60_ansi/mechmerlin-ansi/keymap.c +++ b/layouts/community/60_ansi/mechmerlin-ansi/keymap.c @@ -1,29 +1,22 @@ #include QMK_KEYBOARD_H - -#define BASE 0 -#define FN 1 -#define ARROWS 2 - -enum keycodes { - KC_FNX, // Hold for FN layer, tap to toggle ARROWS layer. -}; +#include "mechmerlin.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[BASE] = LAYOUT_60_ansi( +[_BL] = LAYOUT_60_ansi( KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_TAB, 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_BSLASH, \ - KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ + KC_CTCP, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_FNX, KC_RALT, KC_RGUI, KC_RCTL), -[FN] = LAYOUT_60_ansi( +[_FL] = LAYOUT_60_ansi( KC_GRV, 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_DEL, \ RGB_TOG, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), -[ARROWS] = LAYOUT_60_ansi( +[_AL] = LAYOUT_60_ansi( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ @@ -31,22 +24,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT) }; - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - static uint16_t fnx_layer_timer; - - switch (keycode){ - case KC_FNX: - if(record->event.pressed){ - fnx_layer_timer = timer_read(); - layer_on(FN); - } else { - layer_off(FN); - if (timer_elapsed(fnx_layer_timer) < 150) { - layer_invert(ARROWS); - } - } - return false; - } - return true; -} \ No newline at end of file diff --git a/layouts/community/60_ansi/mechmerlin-ansi/readme.md b/layouts/community/60_ansi/mechmerlin-ansi/readme.md index c81a126d5d..1c40def2a2 100644 --- a/layouts/community/60_ansi/mechmerlin-ansi/readme.md +++ b/layouts/community/60_ansi/mechmerlin-ansi/readme.md @@ -10,8 +10,8 @@ It is used on his [NPKC KC60](https://github.com/qmk/qmk_firmware/tree/master/keyboards/kc60) ## Keymap Notes -- Highly influenced by the KBP V60 and WKL B.Face standard layouts -- Arrow toggle switch is FN + Space +- Arrow toggle switch is tapping the `FN` key once. +- `Caps Lock` can be held to act as a `Left Control` ### Build To build the firmware file associated with this keymap, simply run `make your_keyboard:mechmerlin-ansi`. diff --git a/layouts/community/60_ansi/mechmerlin-ansi/rules.mk b/layouts/community/60_ansi/mechmerlin-ansi/rules.mk new file mode 100644 index 0000000000..e2ce3d7731 --- /dev/null +++ b/layouts/community/60_ansi/mechmerlin-ansi/rules.mk @@ -0,0 +1 @@ +USER_NAME := mechmerlin \ No newline at end of file diff --git a/layouts/community/60_ansi_split_bs_rshift/mechmerlin-split/keymap.c b/layouts/community/60_ansi_split_bs_rshift/mechmerlin-split/keymap.c index 4c6458c9b4..5ec005162f 100644 --- a/layouts/community/60_ansi_split_bs_rshift/mechmerlin-split/keymap.c +++ b/layouts/community/60_ansi_split_bs_rshift/mechmerlin-split/keymap.c @@ -1,25 +1,22 @@ #include QMK_KEYBOARD_H - -#define BASE 0 -#define FN 1 -#define ARROWS 2 +#include "mechmerlin.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[BASE] = LAYOUT_60_ansi_split_bs_rshift( +[_BL] = LAYOUT_60_ansi_split_bs_rshift( KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_NO, KC_BSPC, \ KC_TAB, 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_BSLASH, \ - KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ + KC_CTCP, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, TG(2), \ KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, MO(1), KC_RALT, KC_RGUI, KC_RCTL), -[FN] = LAYOUT_60_ansi_split_bs_rshift( - KC_GRV, 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_NO, KC_DEL, \ +[_FL] = LAYOUT_60_ansi_split_bs_rshift( + KC_GRV, 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_NO, KC_DEL, \ RGB_TOG, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, KC_TRNS, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), -[ARROWS] = LAYOUT_60_ansi_split_bs_rshift( +[_AL] = LAYOUT_60_ansi_split_bs_rshift( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ diff --git a/layouts/community/60_ansi_split_bs_rshift/mechmerlin-split/rules.mk b/layouts/community/60_ansi_split_bs_rshift/mechmerlin-split/rules.mk new file mode 100644 index 0000000000..e2ce3d7731 --- /dev/null +++ b/layouts/community/60_ansi_split_bs_rshift/mechmerlin-split/rules.mk @@ -0,0 +1 @@ +USER_NAME := mechmerlin \ No newline at end of file diff --git a/layouts/community/66_ansi/mechmerlin/keymap.c b/layouts/community/66_ansi/mechmerlin/keymap.c index b8142f9674..ea2e923b1c 100644 --- a/layouts/community/66_ansi/mechmerlin/keymap.c +++ b/layouts/community/66_ansi/mechmerlin/keymap.c @@ -1,32 +1,23 @@ #include QMK_KEYBOARD_H +#include "mechmerlin.h" -// Each layer gets a name for readability, which is then used in the keymap matrix below. -// The underscores don't mean anything - you can have a layer called STUFF or any other name. -#define _BL 0 -#define _FL 1 #define _CL 2 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* Keymap _BL: Base Layer (Default Layer) - */ [_BL] = LAYOUT_66_ansi( KC_GESC,KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSPC, KC_PGUP, \ KC_TAB, 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_BSLS, KC_PGDN, \ - KC_LCTL,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT, \ + KC_CTCP,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT, \ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, KC_UP, \ KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, MO(_FL),KC_RGUI,KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT), - /* Keymap _FL: Function Layer - */ [_FL] = LAYOUT_66_ansi( KC_GRV, 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_DEL, KC_VOLU, \ _______,_______,_______,_______,_______,_______,_______,_______,_______,KC_MPRV,KC_MPLY,KC_MNXT,_______,KC_MUTE, KC_VOLD, \ - KC_CAPS,_______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \ + _______,_______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \ _______, _______,_______,_______,_______,_______,_______,KC_MUTE,KC_VOLU,KC_VOLD,_______, _______, KC_PGUP, \ _______,_______,_______, _______, _______,_______,_______,KC_HOME,KC_PGDN,KC_END), - /* Keymap _CL: Control layer - */ [_CL] = LAYOUT_66_ansi( BL_STEP,RGB_M_P,RGB_M_B,RGB_M_R,RGB_M_SW,RGB_M_SN,RGB_M_K,RGB_M_X,RGB_M_G,_______,_______,_______,_______, _______, RGB_VAI, \ RGB_TOG,_______,_______,_______,RESET, _______,_______,_______,_______,_______,_______,_______,_______,_______, RGB_VAD, \ diff --git a/layouts/community/66_ansi/mechmerlin/rules.mk b/layouts/community/66_ansi/mechmerlin/rules.mk new file mode 100644 index 0000000000..e2ce3d7731 --- /dev/null +++ b/layouts/community/66_ansi/mechmerlin/rules.mk @@ -0,0 +1 @@ +USER_NAME := mechmerlin \ No newline at end of file diff --git a/layouts/community/75_ansi/mechmerlin-75_ansi/keymap.c b/layouts/community/75_ansi/mechmerlin-75_ansi/keymap.c index 70506da52a..ec3286b097 100644 --- a/layouts/community/75_ansi/mechmerlin-75_ansi/keymap.c +++ b/layouts/community/75_ansi/mechmerlin-75_ansi/keymap.c @@ -1,23 +1,21 @@ #include QMK_KEYBOARD_H - -#define BASE 0 -#define FN 1 +#include "mechmerlin.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[BASE] = LAYOUT_75_ansi(\ +[_BL] = LAYOUT_75_ansi(\ KC_ESC, 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_PSCR, KC_PAUS, KC_DEL, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, KC_TAB, 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_BSLS, KC_PGUP, - KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_CTCP, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), -[FN] = LAYOUT_75_ansi(\ +[_FL] = LAYOUT_75_ansi(\ KC_TRNS, RGB_TOG, RGB_MOD, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) }; \ No newline at end of file diff --git a/layouts/community/75_ansi/mechmerlin-75_ansi/rules.mk b/layouts/community/75_ansi/mechmerlin-75_ansi/rules.mk new file mode 100644 index 0000000000..e2ce3d7731 --- /dev/null +++ b/layouts/community/75_ansi/mechmerlin-75_ansi/rules.mk @@ -0,0 +1 @@ +USER_NAME := mechmerlin \ No newline at end of file diff --git a/users/mechmerlin/mechmerlin.c b/users/mechmerlin/mechmerlin.c new file mode 100644 index 0000000000..8d6cecd18b --- /dev/null +++ b/users/mechmerlin/mechmerlin.c @@ -0,0 +1,20 @@ +#include "mechmerlin.h" + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + static uint16_t fnx_layer_timer; + + switch (keycode){ + case KC_FNX: + if(record->event.pressed){ + fnx_layer_timer = timer_read(); + layer_on(_FL); + } else { + layer_off(_FL); + if (timer_elapsed(fnx_layer_timer) < 150) { + layer_invert(_AL); + } + } + return false; + } + return true; +} \ No newline at end of file diff --git a/users/mechmerlin/mechmerlin.h b/users/mechmerlin/mechmerlin.h new file mode 100644 index 0000000000..c140ac70c9 --- /dev/null +++ b/users/mechmerlin/mechmerlin.h @@ -0,0 +1,17 @@ +#pragma once + +#include "quantum.h" + +enum userspace_layers { + _BL = 0, // Base Layer + _FL, // Function Layer + _AL // Arrow Layer +}; + +// Enum of custom keycodes defined in process_record_user +enum keycodes { + KC_FNX, // Hold for FN layer, tap to toggle ARROWS layer. +}; + +// Custom #defined keycodes +#define KC_CTCP MT(KC_LCTL, KC_CAPS) diff --git a/users/mechmerlin/readme.md b/users/mechmerlin/readme.md new file mode 100644 index 0000000000..6a76dd2a9d --- /dev/null +++ b/users/mechmerlin/readme.md @@ -0,0 +1,3 @@ +# MechMerlin's Userspace + +This is a collection of my most commonly used QMK functions diff --git a/users/mechmerlin/rules.mk b/users/mechmerlin/rules.mk new file mode 100644 index 0000000000..70c20ec71e --- /dev/null +++ b/users/mechmerlin/rules.mk @@ -0,0 +1 @@ +SRC += mechmerlin.c \ No newline at end of file