Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
Add planck keymap
Browse files Browse the repository at this point in the history
  • Loading branch information
richardbaptist committed Aug 25, 2023
1 parent 75b9d59 commit 218419d
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 0 deletions.
49 changes: 49 additions & 0 deletions keyboards/planck/keymaps/rpbaptist/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* 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/>.
*/

#pragma once

#ifdef AUDIO_ENABLE
# define STARTUP_SONG SONG(PLANCK_SOUND)
// #define STARTUP_SONG SONG(NO_SOUND)

# define DEFAULT_LAYER_SONGS \
{ SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND) }
#endif

/*
* MIDI options
*/

/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/

#define MIDI_BASIC

/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED

/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2

// Most tactile encoders have detents every 4 stages
#define ENCODER_RESOLUTION 4
174 changes: 174 additions & 0 deletions keyboards/planck/keymaps/rpbaptist/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
/* 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 "rpbaptist.h"


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[_COLEMAKDH] = LAYOUT_planck_grid(
KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, BSP_DEL,
TAB_NUM, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
LCTL_BR, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, RCTL_BR ,
XXXXXXX, KC_LSFT, KC_LGUI, KC_LALT, T_SYM, SFT_SPC, SFT_ENT, T_NAV, KC_RGUI, KC_RALT, KC_RSFT, XXXXXXX
),

[_GAMING] = LAYOUT_planck_grid(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_TAB, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_LCTL, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RCTL,
XXXXXXX, GAME_XT, _______, KC_LALT, KC_LSFT, KC_SPC, KC_ENT, _______, _______, _______, _______, _______
),

[_WASD] = LAYOUT_planck_grid(
_______, _______, _______, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, _______,
_______, _______, KC_S, KC_D, KC_F, _______, KC_H, KC_J, KC_K, KC_L, _______, _______,
_______, _______, _______, _______, KC_V, KC_B, KC_N, KC_M, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),

[_GAMING_EXT] = LAYOUT_planck_grid(
KC_GRV, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL,
_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,
KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
XXXXXXX, _______, _______, _______, KC_LSFT, KC_SPC, KC_ENT, _______, _______, _______, _______, _______
),

[_NUMPAD] = LAYOUT_planck_grid(
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_EUR, KC_7, KC_8, KC_9, _______, _______,
S_NUM, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UNDS, KC_4, KC_5, KC_6, KC_MINS, KC_PLUS,
KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX, KC_PSCR, KC_NLCK, KC_EQL, KC_1, KC_2, KC_3, KC_SLSH, KC_ASTR,
XXXXXXX, XXXXXXX, _______, _______, _______, _______, KC_ENT, KC_0, KC_DOT, _______, _______, _______
),

[_SYM] = 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, _______,
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_UNDS, KC_MINS, KC_PLUS,
LCT_PRN, XXXXXXX, XXXXXXX, XXXXXXX, KC_EUR, XXXXXXX, KC_EQL, KC_PIPE, KC_LT, KC_GT, KC_EXLM, RCT_PRN,
_______, _______, _______, _______, S_SYM, _______, _______, _______, _______, _______, _______, _______
),

[_NAV] = LAYOUT_planck_grid(
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,
LCT_PRN, KC_F11, KC_F12, KC_F13, KC_PSCR, KC_CAPS, WIN_CLS, TAB_BCK, TAB_CLS, TAB_FWD, KC_BSLS, RCT_PRN,
_______, _______, _______, _______, _______, _______, _______, S_NAV, _______, _______, _______, _______
),

[_UTIL] = LAYOUT_planck_grid(
RESET, XXXXXXX, KC_MPRV, KC_VOLU, KC_MNXT, TYPING, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
LCK_NMP, XXXXXXX, KC_MSTP, KC_VOLD, KC_MPLY, GAMING, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
EEP_RST, KC_SLEP, XXXXXXX, KC_MUTE, XXXXXXX, WASD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)

};

layer_state_t layer_state_set_user(layer_state_t state) {
switch (get_highest_layer(default_layer_state)) {
case _COLEMAKDH:
state = update_tri_layer_state(state, _SYM, _NAV, _UTIL);
break;
case _GAMING:
case _WASD:
state = update_tri_layer_state(state, _GAMING_EXT, _NAV, _UTIL);
break;
}
return state;
}

uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case SFT_ENT:
return TAPPING_TERM - 20;
default:
return TAPPING_TERM;
}
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint8_t saved_mods = 0;
uint16_t temp_keycode = keycode;

#if defined(RGB_MATRIX_ENABLE) || defined(OLED_DRIVER_ENABLE)
idle_timer = sync_timer_read32();
#endif

#ifdef RGB_MATRIX_ENABLE
process_record_user_rgb_matrix(temp_keycode, record);
#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;

if (saved_mods == MOD_MASK_SHIFT) { // Both shifts pressed
register_code(KC_DEL);
} else if (saved_mods) { // One shift pressed
del_mods(saved_mods); // Remove any Shifts present
register_code(KC_DEL);
add_mods(saved_mods); // Add shifts again
} else {
register_code(KC_BSPC);
}
} else {
unregister_code(KC_DEL);
unregister_code(KC_BSPC);
}
return false;
case TYPING:
if (record->event.pressed) {
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_set_typing_defaults();
#endif
default_layer_set(1U << _COLEMAKDH);
}
return true;
case GAMING:
if (record->event.pressed) {
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_set_gaming_defaults();
#endif
default_layer_set(1U << _GAMING);
}
return true;
case WASD:
if (record->event.pressed) {
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_set_gaming_defaults();
#endif
default_layer_set(1U << _WASD);
}
return true;
}
return true;
}

bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
return true;
}

2 changes: 2 additions & 0 deletions keyboards/planck/keymaps/rpbaptist/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The Default Planck Layout

58 changes: 58 additions & 0 deletions keyboards/planck/keymaps/rpbaptist/rpbaptist.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#pragma once
#include QMK_KEYBOARD_H


enum layer_names {
_COLEMAKDH,
_GAMING,
_WASD,
_GAMING_EXT,
_NUMPAD,
_SYM,
_NAV,
_UTIL
};

enum custom_keycodes {
BSP_DEL = SAFE_RANGE,
TYPING, // Switch to Colemak layer
GAMING, // Switch to gaming Colemak layer
WASD // Switch to gaming with WASD positions
};

// Layer toggle and switch
#define T_NAV TT(_NAV)
#define S_NAV MO(_NAV)

#define T_SYM TT(_SYM)
#define S_SYM MO(_SYM)

// Layer keys with functionality on tap
#define NAV_0 LT(_NAV, KC_0)
#define TAB_NUM LT(_NUMPAD, KC_TAB)
#define LCK_NMP TG(_NUMPAD)
#define S_NUM MO(_NUMPAD)

#define GAME_XT MO(_GAMING_EXT)
#define EXTALT LT(_GAMING_EXT, KC_LALT)

// Tap/mod keys
#define RCTL_BR RCTL_T(KC_RBRACKET)
#define LCTL_BR LCTL_T(KC_LBRACKET)

#define SFT_SPC LSFT_T(KC_SPACE)
#define SFT_ENT RSFT_T(KC_ENTER)

// Global tab forward and backward
#define TAB_FWD LCTL(KC_TAB)
#define TAB_BCK LCTL(LSFT(KC_TAB))
#define TAB_CLS LCTL(KC_W)

#define WIN_CLS LALT(KC_F4)

// CTRL become parens keys on NAV and NUM layers
#define LCT_PRN KC_LCPO
#define RCT_PRN KC_RCPC

// €
#define KC_EUR ALGR(KC_5)
22 changes: 22 additions & 0 deletions keyboards/planck/keymaps/rpbaptist/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
LTO_ENABLE = yes

EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
DYNAMIC_MACRO_ENABLE = no

MOUSEKEY_ENABLE = no # Mouse keys(+4700)
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
SWAP_HANDS_ENABLE = no # Enable one-hand typing

RGB_MATRIX_ENABLE = no
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

DEBOUNCE_TYPE = sym_eager_pk

0 comments on commit 218419d

Please sign in to comment.