Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sofle/keymaps/michal: rewrite #19938

Merged
merged 1 commit into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions keyboards/sofle/keymaps/michal/config.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
// Copyright 2022 Michal S. (@ihatethefrench)
// SPDX-License-Identifier: GPL-2.0-only
// Copyright 2023 Michal S. (@not-my-segfault)
// SPDX-License-Identifier: GPL-3.0-only

#pragma once

// Enables features such as octave changer, suspend, etc.
#define MIDI_ADVANCED

// This autoshift delay feels most natural for me I think
#define AUTO_SHIFT_TIMEOUT 165

// I don't use too many layers, so this is more than enough
#define LAYER_STATE_8BIT

Expand Down
66 changes: 14 additions & 52 deletions keyboards/sofle/keymaps/michal/keymap.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
// Copyright 2022 Michal S. (@ihatethefrench)
// SPDX-License-Identifier: GPL-2.0-only
// Copyright 2023 Michal S. (@not-my-segfault)
// SPDX-License-Identifier: GPL-3.0-only

#include QMK_KEYBOARD_H

// This specifies the layers that will be used
enum sofle_layers {
_WORKMAN,
_QWERTY,
_MIDI,
_LOWER,
_RAISE,
_ADJUST
};

// This specifies any custom keycodes I might have set
enum custom_keycodes {
KC_WORKMAN = SAFE_RANGE,
KC_QWERTY,
KC_MIDI,
KC_LOWER,
KC_RAISE,
KC_ADJUST
KC_ADJUST,
KC_TOGGLE,
};

// Here the keymaps are defined in matrix form using KC_XYZ form keycodes
Expand Down Expand Up @@ -71,36 +69,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LGUI, KC_LALT, KC_LCTL, KC_LOWER, KC_SPC, KC_ENT, KC_RAISE, KC_RCTL, KC_RALT, KC_RGUI
),

/* MIDI
* ,-----------------------------------------. ,-----------------------------------------.
* | Pnic | OCT0 | OCT1 | OCT2 | OCT3 | OCT4 | | OCT5 | OCT6 | OCT7 | | | MTOG |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | |G#/Ab |Bb/A# | |C#/Db |D#/Eb | | |F#/Gb |G#/Ab |Bb/A# | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | A | B | C | D | E |-------. ,-------| F | G | A | B | C | Wkmn |
* |------+------+------+------+------+------| | | |------+------+------+------+------+------|
* | | | | | TNSD | TNSU |-------| |-------| BNDD | BNDU | | | | |
* `-----------------------------------------/ / \ \-----------------------------------------'
* | | | | Susd | /OCTDN / \OCTUP \ | | | | |
* | | | | |/ / \ \ | | | | |
* `----------------------------------' '------''---------------------------'
*/
[_MIDI] = LAYOUT(
MI_AOFF, MI_OC0, MI_OC1, MI_OC2, MI_OC3, MI_OC4, MI_OC5, MI_OC6, MI_OC7, _______, _______, MI_TOGG,
_______, MI_Gs, MI_As, _______, MI_Cs1, MI_Ds1, _______, MI_Fs1, MI_Gs1, MI_As1, _______, _______,
_______, MI_A, MI_B, MI_C1, MI_D1, MI_E1, MI_F1, MI_G1, MI_A1, MI_B1, MI_C2, KC_WORKMAN,
_______, _______, _______, _______, MI_TRSD, MI_TRSU, _______, _______, MI_BNDD, MI_BNDU, _______, _______, _______, _______,
_______, _______, _______, MI_SUST, MI_OCTD, MI_OCTU, _______, _______, _______, _______
),

/* LOWER
* ,-----------------------------------------. ,-----------------------------------------.
* | | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | | | | | | | | | | | | F12 |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | | | | | |-------. ,-------| | | | | | | |
* |------+------+------+------+------+------| | | Run |------+------+------+------+------+------|
* |------+------+------+------+------+------| | | Togg. |------+------+------+------+------+------|
* | | = | - | + | { | } |-------| |-------| [ | ] | | | \ | |
* `-----------------------------------------/ / \ \-----------------------------------------'
* | | | |LOWER | / / \ \ | | | | |
Expand All @@ -111,7 +87,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, 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_PIPE,
_______, KC_EQL, KC_MINS, KC_PLUS, KC_LCBR, KC_RCBR, _______, LALT(KC_F2), KC_LBRC, KC_RBRC, _______, _______, KC_BSLS, _______,
_______, KC_EQL, KC_MINS, KC_PLUS, KC_LCBR, KC_RCBR, _______, KC_TOGGLE, KC_LBRC, KC_RBRC, _______, _______, KC_BSLS, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),

Expand All @@ -121,9 +97,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | | | | | | | | | Up | | | Del |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | | | | | |-------. ,-------| | Left | Down | Rght | | Wkmn |
* | | | | | | |-------. ,-------| | Left | Down | Rght | | |
* |------+------+------+------+------+------| | | |------+------+------+------+------+------|
* | | | | Midi | | |-------| |-------| | | Home | End | | Qwrt |
* | | | | | | |-------| |-------| | | Home | End | | |
* `-----------------------------------------/ / \ \-----------------------------------------'
* | | | | | / / \ \ |RAISE | | | |
* | | | | |/ / \ \ | | | | |
Expand All @@ -132,27 +108,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_RAISE] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, AS_TOGG,
_______, _______, _______, _______, _______, _______, _______, _______, KC_UP, _______, _______, KC_DEL,
_______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, KC_WORKMAN,
_______, _______, _______, KC_MIDI, _______, _______, _______, _______, _______, _______, KC_HOME, KC_END, _______, KC_QWERTY,
_______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, XXXXXXX,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_END, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)};

// This section only compiles if OLED_ENABLE is set to `yes` in rules.mk
#ifdef OLED_ENABLE

// Defining my custom text to draw to the screen :)
static void oled_screen(void) {
oled_write_ln_P(PSTR(""), false);
oled_write_ln_P(PSTR(">nix "), false);
oled_write_ln_P(PSTR(">rust"), false);
oled_write_ln_P(PSTR(">hs &"), false);
oled_write_ln_P(PSTR(">rum"), false);
oled_write_ln_P(PSTR(""), false);
oled_write_ln_P(PSTR(" . ."), false);
oled_write_ln_P(PSTR(" u "), false);
oled_write_ln_P(PSTR(" d"), false);
oled_write_ln_P(PSTR(""), false);
oled_write_ln_P(PSTR("mchal"), false);
oled_set_cursor(0, 0); // Write nothing
}

// Set correct rotation so the text doesn't end up sideways
Expand All @@ -174,7 +138,6 @@ bool oled_task_user(void) {

#endif

// This section defines custom keycodes, which I use to manage layers
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_QWERTY:
Expand All @@ -187,9 +150,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
set_single_persistent_default_layer(_WORKMAN);
}
return false;
case KC_MIDI:
case KC_TOGGLE: // Toggle between QWERTY and WORKMAN
if (record->event.pressed) {
set_single_persistent_default_layer(_MIDI);
layer_invert(_QWERTY);
layer_invert(_WORKMAN);
}
return false;
case KC_LOWER:
Expand All @@ -214,7 +178,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}

// This section only compiles if ENCODER_ENABLE is set to `yes` in rules.mk
#ifdef ENCODER_ENABLE

// This section is like the keymap matrix, but for rotary encoders
Expand All @@ -224,7 +187,6 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[_QWERTY] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(KC_VOLD, KC_VOLU )},
[_LOWER] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN)},
[_RAISE] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______ )},
[_ADJUST] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______ )},
};

#endif
2 changes: 0 additions & 2 deletions keyboards/sofle/keymaps/michal/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ MAGIC_ENABLE = no
SPACE_CADET_ENABLE = no

# I actually use these features
AUTO_SHIFT_ENABLE = yes
ENCODER_ENABLE = yes
ENCODER_MAP_ENABLE = yes
EXTRAKEY_ENABLE = yes
MIDI_ENABLE = yes
MOUSEKEY_ENABLE = yes

# More space-saving
Expand Down