Bringing keymaps up to standard.

This commit is contained in:
Ian Sterling 2019-10-23 10:31:43 -07:00
parent f1dc7dd46d
commit 2981ced2c0
2 changed files with 48 additions and 134 deletions

View File

@ -14,14 +14,14 @@
CHANGELOG: CHANGELOG:
0.1 - Initial commit. Based off of Profet's default keymap. 0.1 - Initial commit. Based off of Profet's default keymap.
0.2 - Converted to a more Planck/Preonic keymap style file with 0.2 - Converted to a more Planck/Preonic keymap style file with
persistent layers enabled. Renamed layers to reflect OLKB maps. persistent layers enabled. Renamed layers to reflect OLKB maps.
Added a TODO list. Added a TODO list.
0.3 - Moved location of media & volume keys. Added Print Screen, 0.3 - Moved location of media & volume keys. Added Print Screen,
Scroll Lock and Pause keys. Added a WOW gaming layer that Scroll Lock and Pause keys. Added a WOW gaming layer that
changes the location of Ctrl & Alt to the thumb keys. Added changes the location of Ctrl & Alt to the thumb keys. Added
readme. readme.
0.4 - After more useage, I realized that the ESC key was in the way 0.4 - After more useage, I realized that the ESC key was in the way
of my muscle memory (gee, thanks, Planck!) so I moved it to of my muscle memory (gee, thanks, Planck!) so I moved it to
the normal Caps Lock position, and moved Caps Lock to the same the normal Caps Lock position, and moved Caps Lock to the same
position on the RAISE and LOWER layers. Added code to turn off position on the RAISE and LOWER layers. Added code to turn off
@ -42,27 +42,9 @@ TODO:
// This is the canonical layout file for the Quantum project. If you want to add another keyboard, // This is the canonical layout file for the Quantum project. If you want to add another keyboard,
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
enum layer_names { enum layer_names { _DVORAK, _QWERTY, _COLEMAK, _WOW, _DESTINY, _LOWER, _RAISE, _ADJUST };
_DVORAK,
_QWERTY,
_COLEMAK,
_WOW,
_DESTINY,
_LOWER,
_RAISE,
_ADJUST
};
enum atreus52_keycodes { enum atreus52_keycodes { DVORAK = SAFE_RANGE, QWERTY, COLEMAK, WOW, DESTINY, LOWER, RAISE, ADJUST };
DVORAK = SAFE_RANGE,
QWERTY,
COLEMAK,
WOW,
DESTINY,
LOWER,
RAISE,
ADJUST
};
// Aliases to make the keymap clearer. // Aliases to make the keymap clearer.
#define CTL_ENT CTL_T(KC_ENT) #define CTL_ENT CTL_T(KC_ENT)
@ -70,6 +52,7 @@ enum atreus52_keycodes {
#define RAISE MO(_RAISE) #define RAISE MO(_RAISE)
#define ADJUST MO(_ADJUST) #define ADJUST MO(_ADJUST)
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_DVORAK] = LAYOUT ( /* dvorak */ [_DVORAK] = LAYOUT ( /* dvorak */
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS, KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS,
@ -132,8 +115,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
), ),
}; };
//clang-format on
void matrix_init_user(void) { void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA #ifdef BOOTLOADER_CATERINA
@ -150,32 +133,24 @@ uint32_t layer_state_set_user(uint32_t state) {
}; };
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { if (record->event.pressed) {
switch (keycode) {
case DVORAK: case DVORAK:
if (record->event.pressed) {
set_single_persistent_default_layer(_DVORAK); set_single_persistent_default_layer(_DVORAK);
}
return false;
case COLEMAK:
if (record->event.pressed) {
set_single_persistent_default_layer(_COLEMAK);
}
return false; return false;
case QWERTY: case QWERTY:
if (record->event.pressed) {
set_single_persistent_default_layer(_QWERTY); set_single_persistent_default_layer(_QWERTY);
} return false;
case COLEMAK:
set_single_persistent_default_layer(_COLEMAK);
return false; return false;
case WOW: case WOW:
if (record->event.pressed) {
set_single_persistent_default_layer(_WOW); set_single_persistent_default_layer(_WOW);
}
return false; return false;
case DESTINY: case DESTINY:
if (record->event.pressed) {
set_single_persistent_default_layer(_DESTINY); set_single_persistent_default_layer(_DESTINY);
}
return false; return false;
}
} }
return true; return true;
}; };

View File

@ -1,34 +1,15 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#include "action_layer.h"
#include "eeconfig.h"
extern keymap_config_t keymap_config; enum layer_names { _QWERTY, _COLEMAK, _DVORAK, _LOWER, _RAISE, _ADJUST };
// Each layer gets a name for readability, which is then used in the keymap matrix below. enum custom_keycodes { QWERTY = SAFE_RANGE, COLEMAK, DVORAK, LOWER, RAISE, ADJUST };
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _QWERTY 0
#define _COLEMAK 1
#define _DVORAK 2
#define _LOWER 3
#define _RAISE 4
#define _ADJUST 16
enum custom_keycodes {
QWERTY = SAFE_RANGE,
COLEMAK,
DVORAK,
LOWER,
RAISE,
ADJUST
};
// Aliases to keep the keymap tidy // Aliases to keep the keymap tidy
#define GUIBSPC GUI_T(KC_BSPC) // GUI when held, BSPC when tapped. #define GUIBSPC GUI_T(KC_BSPC) // GUI when held, BSPC when tapped.
#define RGB_SWR RGB_M_SW // Swirl Animation alias #define RGB_SWR RGB_M_SW // Swirl Animation alias
#define RGB_SNK RGB_M_SN // Snake Animation alias #define RGB_SNK RGB_M_SN // Snake Animation alias
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty /* Qwerty
@ -47,7 +28,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
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_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_LALT, KC_LEFT, KC_RGHT, LOWER, GUIBSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \ KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUIBSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \
), ),
/* Colemak /* Colemak
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -65,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \
KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUIBSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \ KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUIBSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \
), ),
/* Dvorak /* Dvorak
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -83,7 +64,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, \ KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, \
KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUIBSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \ KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUIBSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \
), ),
/* Lower /* Lower
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -101,7 +82,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_CAPS, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ KC_CAPS, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
_______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, \ _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, \
BL_STEP, _______, KC_HOME, KC_END, _______, KC_DEL, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______ \ BL_STEP, _______, KC_HOME, KC_END, _______, KC_DEL, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______ \
), ),
/* Raise /* Raise
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -119,7 +100,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_CAPS, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ KC_CAPS, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
_______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, \ _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, \
BL_STEP, _______, KC_HOME, KC_END, _______, KC_DEL, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______ \ BL_STEP, _______, KC_HOME, KC_END, _______, KC_DEL, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______ \
), ),
/* Adjust (Lower + Raise) /* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -137,77 +118,35 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, RESET, RGB_M_P, RGB_M_B, RGB_M_R, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ _______, RESET, RGB_M_P, RGB_M_B, RGB_M_R, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
RGB_TOG, RGB_MOD, RGB_SWR, RGB_M_K, RGB_M_G, RGB_HUI, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, \ RGB_TOG, RGB_MOD, RGB_SWR, RGB_M_K, RGB_M_G, RGB_HUI, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
) )
}; };
// clang-format on
void persistent_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
void matrix_init_user(void) { void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA #ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros // This will disable the red LEDs on the ProMicros
DDRD &= ~(1<<5); setPinInput(D5);
PORTD &= ~(1<<5); writePinLow(D5);
DDRB &= ~(1<<0); setPinInput(B0);
PORTB &= ~(1<<0); writePinLow(B0);
#endif #endif
}; };
uint32_t layer_state_set_user(uint32_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); };
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { if (record->event.pressed) {
case QWERTY: switch (keycode) {
if (record->event.pressed) { case QWERTY:
persistent_default_layer_set(1UL<<_QWERTY); set_single_persistent_default_layer(_QWERTY);
} return false;
return false; case COLEMAK:
break; set_single_persistent_default_layer(_COLEMAK);
case COLEMAK: return false;
if (record->event.pressed) { case DVORAK:
persistent_default_layer_set(1UL<<_COLEMAK); set_single_persistent_default_layer(_DVORAK);
} return false;
return false; }
break; }
case DVORAK: return true;
if (record->event.pressed) { }
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
break;
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
/* case BACKLIT:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
} else {
unregister_code(KC_RSFT);
}
return false;
break; */
}
return true;
}