Skip to content

Instantly share code, notes, and snippets.

@kechol
Last active January 8, 2019 13:13
Show Gist options
  • Save kechol/84d048e680268c9942f72dfe368d337b to your computer and use it in GitHub Desktop.
Save kechol/84d048e680268c9942f72dfe368d337b to your computer and use it in GitHub Desktop.
#include QMK_KEYBOARD_H
#include "bootloader.h"
#ifdef PROTOCOL_LUFA
#include "lufa.h"
#include "split_util.h"
#endif
extern keymap_config_t keymap_config;
// 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.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum layer_number {
_QWERTY = 0,
_KECHOL,
_LOWER,
_RAISE,
_ADJUST,
};
enum custom_keycodes {
QWERTY = SAFE_RANGE,
KECHOL,
LOWER,
RAISE,
ADJUST,
};
#define _______ KC_TRNS
#define XXXXXXX KC_NO
#if HELIX_ROWS == 5
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
* ,-----------------------------------------. ,-----------------------------------------.
* | Bksp | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Tab | Q | W | E | R | T | | Y | U | I | O | P | = |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Ctrl | A | S | D | F | G | | H | J | K | L | ; | - |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | Raise| Raise| N | M | , | . | / | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Esc | | Alt | Cmd | Space| Enter| Lower| Lower| Enter| Left | Down | Up | Right| Cmd |
* `-------------------------------------------------------------------------------------------------'
*/
[_QWERTY] = LAYOUT( \
KC_BSPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, 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_EQL, \
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_MINS, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, RAISE, RAISE, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \
KC_ESC, _______, KC_LALT, KC_LGUI, KC_SPC, KC_ENT, LOWER, LOWER, KC_ENT, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_RGUI \
),
/* Kechol
* ,-----------------------------------------. ,-----------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | ' |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | ( | ) | Q | W | Y | P | | L | R | T | D | - | ? |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Ctrl | A | O | U | E | I | | H | N | K | S | . | , |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| Z | X | C | V | F | Raise| Raise| J | M | B | G | @ | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Esc | | Alt | Cmd | Space| Enter| Lower| Lower| Enter| Left | Down | Up | Right| Cmd |
* `-------------------------------------------------------------------------------------------------'
*/
[_KECHOL] = LAYOUT( \
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_QUOT, \
KC_LPRN, KC_RPRN, KC_Q, KC_W, KC_Y, KC_P, KC_L, KC_R, KC_T, KC_D, KC_MINS, KC_QUES, \
KC_LCTL, KC_A, KC_O, KC_U, KC_E, KC_I, KC_H, KC_N, KC_K, KC_S, KC_DOT, KC_COMM, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_F, RAISE, RAISE, KC_J, KC_M, KC_B, KC_G, KC_AT, KC_RSFT, \
KC_ESC, _______, KC_LALT, KC_LGUI, KC_SPC, KC_ENT, LOWER, LOWER, KC_ENT, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_RGUI \
),
/* Lower
* ,-----------------------------------------. ,-----------------------------------------.
* | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Tab | ` | ~ | # | \ | | | | | { | } | [ | ] | + |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Ctrl | ! | @ | $ | ^ | & | | | ' | ( | ) | : | _ |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| % | * | / | + | - | Raise| Raise| | " | < | > | ? | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Esc | | Alt | Cmd | Space| Enter| Lower| Lower| Enter| Left | Down | Up | Right| Cmd |
* `-------------------------------------------------------------------------------------------------'
*/
[_LOWER] = LAYOUT( \
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_TAB, KC_GRV, KC_TILD, KC_HASH, KC_BSLS, KC_PIPE, _______, KC_LCBR, KC_RCBR, KC_LBRC, KC_RBRC, KC_PLUS, \
KC_LCTL, KC_EXLM, KC_AT, KC_DLR, KC_CIRC, KC_AMPR, _______, KC_QUOT, KC_LPRN, KC_RPRN, KC_COLN, KC_UNDS, \
KC_LSFT, KC_PERC, KC_ASTR, KC_SLSH, KC_PLUS, KC_MINS, RAISE, RAISE, _______, KC_DQUO, KC_LABK, KC_RABK, KC_QUES, KC_RSFT, \
KC_ESC, _______, KC_LALT, KC_LGUI, KC_SPC, KC_ENT, LOWER, LOWER, KC_ENT, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_RGUI \
),
/* Raise
* ,-----------------------------------------. ,-----------------------------------------.
* | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Tab | 0 | 1 | 2 | 3 | | |Qwerty|Kechol| | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Ctrl | | 4 | 5 | 6 | | | Left | Down | Up | Right| | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| | 7 | 8 | 9 | | Raise| Raise| | | | | | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Esc | | Alt | Cmd | Space| Enter| Lower| Lower| Enter| Left | Down | Up | Right| Cmd |
* `-------------------------------------------------------------------------------------------------'
*/
[_RAISE] = LAYOUT( \
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_TAB, KC_0, KC_1, KC_2, KC_3, _______, QWERTY, KECHOL, _______, _______, _______, _______, \
KC_LCTL, _______, KC_4, KC_5, KC_6, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, \
KC_LSFT, _______, KC_7, KC_8, KC_9, _______, RAISE, RAISE, _______, _______, _______, _______, _______, KC_RSFT, \
KC_ESC, _______, KC_LALT, KC_LGUI, KC_SPC, KC_ENT, LOWER, LOWER, KC_ENT, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_RGUI \
),
/* Adjust (Lower + Raise)
* ,-----------------------------------------. ,-----------------------------------------.
* | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Tab | | | | | | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Ctrl | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| | | | | | Raise| Raise| | | | | | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Esc | | Alt | Cmd | Space| Enter| Lower| Lower| Enter| Left | Down | Up | Right| Cmd |
* `-------------------------------------------------------------------------------------------------'
*/
[_ADJUST] = LAYOUT( \
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_TAB, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
KC_LCTL, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
KC_LSFT, _______, _______, _______, _______, _______, RAISE, RAISE, _______, _______, _______, _______, _______, KC_RSFT, \
KC_ESC, _______, KC_LALT, KC_LGUI, KC_SPC, KC_ENT, LOWER, LOWER, KC_ENT, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_RGUI \
)
};
#else
#error "undefined keymaps"
#endif
void persistent_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
break;
case KECHOL:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_KECHOL);
}
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 ADJUST:
if (record->event.pressed) {
layer_on(_ADJUST);
} else {
layer_off(_ADJUST);
}
return false;
break;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment