2023-08-14 20:21:34 +02:00
|
|
|
// Copyright 2023 Your Name (@rpbaptist)
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-10-02 18:39:43 +02:00
|
|
|
|
2023-08-14 20:21:34 +02:00
|
|
|
#include "rpbaptist.h"
|
2019-10-02 18:39:43 +02:00
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
2023-08-14 20:21:34 +02:00
|
|
|
[_COLEMAKDH] = LAYOUT_split_3x6_3( \
|
2019-10-02 18:39:43 +02:00
|
|
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
2023-08-14 20:21:34 +02:00
|
|
|
KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, BSP_DEL,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
TAB_NUM, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
LCTL_BR, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, RCTL_BR,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
KC_LALT, T_SYM, SFT_SPC, SFT_ENT, T_NAV, KC_RGUI \
|
2019-10-02 18:39:43 +02:00
|
|
|
//`--------------------------' `--------------------------'
|
|
|
|
),
|
|
|
|
|
2023-08-14 20:21:34 +02:00
|
|
|
[_GAMING] = LAYOUT_split_3x6_3( \
|
2019-10-02 18:39:43 +02:00
|
|
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
2023-08-14 20:21:34 +02:00
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BSPC,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
KC_TAB, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
KC_LCTL, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RCTL,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
EXTALT, KC_LSFT, KC_SPC, _______, _______, _______ \
|
2019-10-02 18:39:43 +02:00
|
|
|
//`--------------------------' `--------------------------'
|
|
|
|
),
|
|
|
|
|
2023-08-14 20:21:34 +02:00
|
|
|
[_WASD] = LAYOUT_split_3x6_3( \
|
2019-10-02 18:39:43 +02:00
|
|
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
2023-08-14 20:21:34 +02:00
|
|
|
_______, KC_T, KC_Q, KC_W, KC_E, KC_R, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, KC_H, KC_J, KC_K, KC_L, KC_SCLN, _______,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
KC_LCTL, KC_B, KC_Z, KC_X, KC_C, KC_V, KC_N, KC_M, _______, _______, _______, KC_RCTL,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
EXTALT, KC_LSFT, KC_SPC, _______, _______, _______ \
|
2019-10-02 18:39:43 +02:00
|
|
|
//`--------------------------' `--------------------------'
|
|
|
|
),
|
|
|
|
|
2023-08-14 20:21:34 +02:00
|
|
|
[_GAMING_EXT] = LAYOUT_split_3x6_3( \
|
2019-10-02 18:39:43 +02:00
|
|
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
2023-08-14 20:21:34 +02:00
|
|
|
KC_GRV, KC_Y, KC_I, KC_J, KC_M, KC_N, _______, _______, _______, _______, _______, KC_DEL,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
KC_CAPS, KC_6, KC_7, KC_LBRC, KC_RBRC, KC_BSLS, _______, _______, _______, _______, _______, _______,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
_______, KC_LALT, KC_ENT, KC_ENT, _______, _______ \
|
2019-10-02 18:39:43 +02:00
|
|
|
//`--------------------------' `--------------------------'
|
|
|
|
),
|
|
|
|
|
2023-08-14 20:21:34 +02:00
|
|
|
[_NUMPAD] = LAYOUT_split_3x6_3( \
|
2019-10-02 18:39:43 +02:00
|
|
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
2023-08-14 20:21:34 +02:00
|
|
|
_______, XXXXXXX, KC_MPRV, KC_VOLU, KC_MNXT, XXXXXXX, KC_EUR, KC_7, KC_8, KC_9, _______, _______,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
S_NUM, XXXXXXX, KC_MSTP, KC_VOLD, KC_MPLY, XXXXXXX, KC_UNDS, KC_4, KC_5, KC_6, KC_MINS, KC_PLUS,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
SC_LCPO, XXXXXXX, XXXXXXX, KC_MUTE, KC_PSCR, KC_NUM, KC_EQL, KC_1, KC_2, KC_3, KC_SLSH, KC_ASTR,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
_______, _______, _______, _______, KC_0, KC_DOT \
|
2019-10-02 18:39:43 +02:00
|
|
|
//`--------------------------' `--------------------------'
|
|
|
|
),
|
|
|
|
|
2023-08-14 20:21:34 +02:00
|
|
|
[_SYM] = LAYOUT_split_3x6_3( \
|
2019-10-02 18:39:43 +02:00
|
|
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
2023-08-14 20:21:34 +02:00
|
|
|
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_UNDS, KC_MINS, KC_PLUS,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
SC_LCPO, XXXXXXX, XXXXXXX, XXXXXXX, KC_EUR, XXXXXXX, KC_EQL, KC_PIPE, KC_LT, KC_GT, KC_EXLM, SC_RCPC,\
|
|
|
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
|
|
|
_______, S_SYM, _______, _______, _______, _______ \
|
|
|
|
//`--------------------------' `--------------------------'
|
|
|
|
),
|
|
|
|
|
|
|
|
[_NAV] = LAYOUT_split_3x6_3( \
|
|
|
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
|
|
|
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_INS, KC_BSPC,\
|
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
|
|
|
KC_TILD, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, KC_RSFT,\
|
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
|
|
|
SC_LCPO, KC_F11, KC_F12, KC_F13, KC_PSCR, KC_CAPS, WIN_CLS, TAB_BCK, TAB_CLS, TAB_FWD, KC_BSLS, SC_RCPC,\
|
2020-03-10 07:40:27 +01:00
|
|
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+---------|
|
2023-08-14 20:21:34 +02:00
|
|
|
_______, _______, _______, _______, S_NAV, _______ \
|
2019-10-02 18:39:43 +02:00
|
|
|
//`--------------------------' `--------------------------'
|
|
|
|
),
|
|
|
|
|
2023-08-14 20:21:34 +02:00
|
|
|
[_UTIL] = LAYOUT_split_3x6_3( \
|
2019-10-02 18:39:43 +02:00
|
|
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
2023-08-14 20:21:34 +02:00
|
|
|
QK_BOOT, RGB_RST, XXXXXXX, XXXXXXX, XXXXXXX, TYPING, RGB_ATG, XXXXXXX, XXXXXXX, RGB_IDL, RGB_UND, RGB_TOG,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
LCK_NMP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, GAMING, RGB_PST, XXXXXXX, RGB_SPI, RGB_HUI, RGB_SAI, RGB_VAI,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
EE_CLR, KC_SLEP, XXXXXXX, XXXXXXX, XXXXXXX, WASD, RGB_PCT, XXXXXXX, RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD,\
|
2019-10-02 18:39:43 +02:00
|
|
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
2023-08-14 20:21:34 +02:00
|
|
|
_______, _______, _______, _______, _______, _______ \
|
2019-10-02 18:39:43 +02:00
|
|
|
//`--------------------------' `--------------------------'
|
|
|
|
)
|
|
|
|
};
|
|
|
|
|
|
|
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
2020-03-10 07:40:27 +01:00
|
|
|
switch (get_highest_layer(default_layer_state)) {
|
2023-08-14 20:21:34 +02:00
|
|
|
case _COLEMAKDH:
|
2020-03-10 07:40:27 +01:00
|
|
|
state = update_tri_layer_state(state, _SYM, _NAV, _UTIL);
|
|
|
|
break;
|
|
|
|
case _GAMING:
|
2023-08-14 20:21:34 +02:00
|
|
|
case _WASD:
|
2020-03-10 07:40:27 +01:00
|
|
|
state = update_tri_layer_state(state, _GAMING_EXT, _NAV, _UTIL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return state;
|
2019-10-02 18:39:43 +02:00
|
|
|
}
|
|
|
|
|
2023-08-14 20:21:34 +02:00
|
|
|
void suspend_power_down_keymap(void) {
|
2021-08-24 08:28:26 +02:00
|
|
|
#ifdef OLED_ENABLE
|
2023-08-14 20:21:34 +02:00
|
|
|
oled_off();
|
2020-03-10 07:40:27 +01:00
|
|
|
#endif
|
|
|
|
#ifdef RGB_MATRIX_ENABLE
|
2019-10-02 18:39:43 +02:00
|
|
|
rgb_matrix_set_suspend_state(true);
|
2023-08-14 20:21:34 +02:00
|
|
|
#endif
|
2019-10-02 18:39:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void suspend_wakeup_init_keymap(void) {
|
2023-08-14 20:21:34 +02:00
|
|
|
#ifdef OLED_ENABLE
|
2020-03-10 07:40:27 +01:00
|
|
|
oled_on();
|
2023-08-14 20:21:34 +02:00
|
|
|
#endif
|
|
|
|
#ifdef RGB_MATRIX_ENABLE
|
2019-10-02 18:39:43 +02:00
|
|
|
rgb_matrix_set_suspend_state(false);
|
2023-08-14 20:21:34 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
switch (keycode) {
|
|
|
|
case SFT_ENT:
|
|
|
|
return TAPPING_TERM - 20;
|
|
|
|
default:
|
|
|
|
return TAPPING_TERM;
|
|
|
|
}
|
2019-10-02 18:39:43 +02:00
|
|
|
}
|
2020-03-10 07:40:27 +01:00
|
|
|
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
static uint8_t saved_mods = 0;
|
|
|
|
uint16_t temp_keycode = keycode;
|
|
|
|
|
|
|
|
#ifdef RGB_MATRIX_ENABLE
|
2023-08-14 20:21:34 +02:00
|
|
|
process_record_user_rgb_matrix(temp_keycode, record);
|
2020-03-10 07:40:27 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Filter out the actual keycode from MT and LT keys.
|
|
|
|
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
|
|
|
|
temp_keycode &= 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (temp_keycode) {
|
|
|
|
case BSP_DEL:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
saved_mods = get_mods() & MOD_MASK_SHIFT;
|
|
|
|
|
2023-08-14 20:21:34 +02:00
|
|
|
if (saved_mods == MOD_MASK_SHIFT) { // Both shifts pressed
|
2020-03-10 07:40:27 +01:00
|
|
|
register_code(KC_DEL);
|
2023-08-14 20:21:34 +02:00
|
|
|
} else if (saved_mods) { // One shift pressed
|
|
|
|
del_mods(saved_mods); // Remove any Shifts present
|
2020-03-10 07:40:27 +01:00
|
|
|
register_code(KC_DEL);
|
2023-08-14 20:21:34 +02:00
|
|
|
add_mods(saved_mods); // Add shifts again
|
2020-03-10 07:40:27 +01:00
|
|
|
} else {
|
|
|
|
register_code(KC_BSPC);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
unregister_code(KC_DEL);
|
|
|
|
unregister_code(KC_BSPC);
|
|
|
|
}
|
|
|
|
return false;
|
2023-08-14 20:21:34 +02:00
|
|
|
case TYPING:
|
2020-03-10 07:40:27 +01:00
|
|
|
if (record->event.pressed) {
|
2023-08-14 20:21:34 +02:00
|
|
|
#ifdef RGB_MATRIX_ENABLE
|
|
|
|
rgb_matrix_set_typing_defaults();
|
|
|
|
#endif
|
|
|
|
default_layer_set(1U << _COLEMAKDH);
|
2020-03-10 07:40:27 +01:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
case GAMING:
|
|
|
|
if (record->event.pressed) {
|
2023-08-14 20:21:34 +02:00
|
|
|
#ifdef RGB_MATRIX_ENABLE
|
|
|
|
rgb_matrix_set_gaming_defaults();
|
|
|
|
#endif
|
|
|
|
default_layer_set(1U << _GAMING);
|
2020-03-10 07:40:27 +01:00
|
|
|
}
|
|
|
|
return true;
|
2023-08-14 20:21:34 +02:00
|
|
|
case WASD:
|
2020-03-10 07:40:27 +01:00
|
|
|
if (record->event.pressed) {
|
2023-08-14 20:21:34 +02:00
|
|
|
#ifdef RGB_MATRIX_ENABLE
|
|
|
|
rgb_matrix_set_gaming_defaults();
|
2020-03-10 07:40:27 +01:00
|
|
|
#endif
|
2023-08-14 20:21:34 +02:00
|
|
|
default_layer_set(1U << _WASD);
|
|
|
|
}
|
|
|
|
return true;
|
2020-03-10 07:40:27 +01:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2023-08-14 20:21:34 +02:00
|
|
|
|
|
|
|
// Override functions to save memory
|
|
|
|
// https://docs.qmk.fm/#/squeezing_avr?id=magic-keycodes
|
|
|
|
uint16_t keycode_config(uint16_t keycode) {
|
|
|
|
return keycode;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t mod_config(uint8_t mod) {
|
|
|
|
return mod;
|
|
|
|
}
|