qmk/keymap.c

201 lines
10 KiB
C
Raw Normal View History

2022-10-01 11:03:31 +02:00
/* Copyright 2015-2021 Jack Humbert
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
2022-10-01 16:34:28 +02:00
// our layers, used as index in layers and rgb lights
2022-10-01 11:03:31 +02:00
enum planck_layers {
_QWERTY,
_LOWER,
_RAISE,
_NAV,
_CMD,
_FN
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Esc | A | S | D | F | G | H | J | K | L | ; | ' |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
2022-10-01 11:10:16 +02:00
* | Ctrl | GUI | Alt | Cmd |Lower |Space |Space |Raise | Fn | Alt | GUI | Ctrl |
2022-10-01 11:03:31 +02:00
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = LAYOUT_planck_grid(
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
LCTL_T(KC_ESC), KC_A, RALT_T(KC_S), LALT_T(KC_D), LSFT_T(KC_F), LGUI_T(KC_G), RGUI_T(KC_H), RSFT_T(KC_J), LALT_T(KC_K), RALT_T(KC_L), LT(_NAV, KC_SCLN), RCTL_T(KC_QUOT),
LSFT_T(KC_ENT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT),
2022-10-01 17:54:59 +02:00
KC_LCTL, KC_LGUI, KC_LALT, MO(_CMD), MO(_LOWER), LT(_LOWER, KC_SPC), LT(_RAISE, KC_SPC), MO(_RAISE), MO(_FN), KC_RALT, KC_RGUI, KC_RCTL,
2022-10-01 11:03:31 +02:00
),
/* Lower
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_LOWER] = LAYOUT_planck_grid(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,
2022-10-01 11:03:31 +02:00
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______,
2022-10-01 17:54:59 +02:00
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
2022-10-01 11:03:31 +02:00
),
/* Raise
* ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_RAISE] = LAYOUT_planck_grid(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,
2022-10-01 11:03:31 +02:00
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______,
2022-10-01 17:54:59 +02:00
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
2022-10-01 11:03:31 +02:00
),
/* Navigation layer
* ,-----------------------------------------------------------------------------------.
* | | | | | | | | | Up | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | Home | PgUp | PgDn | End | | | Left | Down | Right| | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_NAV] = LAYOUT_planck_grid(
_______, _______, _______, _______, _______, _______, _______, _______, KC_UP, _______, _______, _______,
_______, KC_HOME, KC_PGUP, KC_PGDN, KC_END, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
2022-10-01 17:54:59 +02:00
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
2022-10-01 11:03:31 +02:00
),
/* Command layer
* ,-----------------------------------------------------------------------------------.
2022-10-01 17:54:59 +02:00
* | | | | | | | | | | | |
2022-10-01 11:03:31 +02:00
* |------+------+------+------+------+------+------+------+------+------+------+------|
2022-10-01 17:54:59 +02:00
* | | | | | | | | | | | |
2022-10-01 11:03:31 +02:00
* |------+------+------+------+------+------+------+------+------+------+------+------|
2022-10-01 17:54:59 +02:00
* | | | | | | | | | | | |
2022-10-01 11:03:31 +02:00
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_CMD] = LAYOUT_planck_grid(
2022-10-01 17:54:59 +02:00
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
2022-10-01 11:03:31 +02:00
),
/*
* Function layer
2022-10-01 17:54:59 +02:00
* v------------------------RGB CONTROL--------------------v
2022-10-01 11:03:31 +02:00
* ,-----------------------------------------------------------------------------------.
2022-10-01 17:54:59 +02:00
* | | | RGB |RGBMOD| HUE+ | HUE- | SAT+ | SAT- |BRGTH+|BRGTH-| | |
2022-10-01 11:03:31 +02:00
* |------+------+------+------+------+------+------+------+------+------+------+------|
2022-10-01 17:54:59 +02:00
* | Boot | | | | | | | | | | |
2022-10-01 11:03:31 +02:00
* |------+------+------+------+------+------+------+------+------+------+------+------|
2022-10-01 17:54:59 +02:00
* | | | | | | | | | | |Reboot|
2022-10-01 11:03:31 +02:00
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_FN] = LAYOUT_planck_grid(
2022-10-01 17:54:59 +02:00
_______, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______,
QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_RBT,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
2022-10-01 11:03:31 +02:00
)
};
2022-10-01 16:34:28 +02:00
/* plwnck rev6 RGB layout:
* ----------------------------------
* | 6 5 4 3 |
* | 0 |
* | 7 8 1 2 |
* ----------------------------------
*/
const rgblight_segment_t PROGMEM game_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{2, 2, HSV_RED},
{6, 2, HSV_RED}
);
const rgblight_segment_t PROGMEM raise_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{3, 4, HSV_GREEN}
);
const rgblight_segment_t PROGMEM lower_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{3, 4, HSV_BLUE}
);
const rgblight_segment_t PROGMEM adjust_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{1, 8, HSV_BLUE}
);
const rgblight_segment_t PROGMEM capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{1, 1, HSV_WHITE},
{8, 1, HSV_WHITE}
);
const rgblight_segment_t PROGMEM numlock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{6, 2, HSV_PURPLE}
);
const rgblight_segment_t * const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
[_QWERTY] = game_layer,
[_LOWER] = lower_layer,
[_RAISE] = raise_layer,
[_NAV] = adjust_layer,
[_CMD] = capslock_layer,
[_FN] = numlock_layer
);
void keyboard_post_init_user(void) {
// Enable the LED layers
rgblight_layers = my_rgb_layers;
}
layer_state_t layer_state_set_user(layer_state_t state)
{
rgblight_set_layer_state(_LOWER, layer_state_cmp(state, _LOWER));
rgblight_set_layer_state(_RAISE, layer_state_cmp(state, _RAISE));
rgblight_set_layer_state(_NAV, layer_state_cmp(state, _NAV));
rgblight_set_layer_state(_CMD, layer_state_cmp(state, _CMD));
rgblight_set_layer_state(_FN, layer_state_cmp(state, _FN));
return state;
}