From b85a9abc96e1240b8e198abf1f9e9f1cc8aa89a1 Mon Sep 17 00:00:00 2001 From: Michal S Date: Tue, 28 Feb 2023 20:23:47 +0000 Subject: [PATCH] [Keymap] sofle/keymaps/michal: rewrite (#19938) --- keyboards/sofle/keymaps/michal/config.h | 10 +--- keyboards/sofle/keymaps/michal/keymap.c | 66 ++++++------------------- keyboards/sofle/keymaps/michal/rules.mk | 2 - 3 files changed, 16 insertions(+), 62 deletions(-) diff --git a/keyboards/sofle/keymaps/michal/config.h b/keyboards/sofle/keymaps/michal/config.h index 6ab3602dfd9..0f326f7605a 100644 --- a/keyboards/sofle/keymaps/michal/config.h +++ b/keyboards/sofle/keymaps/michal/config.h @@ -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 diff --git a/keyboards/sofle/keymaps/michal/keymap.c b/keyboards/sofle/keymaps/michal/keymap.c index 9c89468a89d..49b70fd825e 100644 --- a/keyboards/sofle/keymaps/michal/keymap.c +++ b/keyboards/sofle/keymaps/michal/keymap.c @@ -1,5 +1,5 @@ -// 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 @@ -7,20 +7,18 @@ 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 @@ -71,28 +69,6 @@ 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 | @@ -100,7 +76,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | | | | | | F12 | * |------+------+------+------+------+------| |------+------+------+------+------+------| * | | | | | | |-------. ,-------| | | | | | | | - * |------+------+------+------+------+------| | | Run |------+------+------+------+------+------| + * |------+------+------+------+------+------| | | Togg. |------+------+------+------+------+------| * | | = | - | + | { | } |-------| |-------| [ | ] | | | \ | | * `-----------------------------------------/ / \ \-----------------------------------------' * | | | |LOWER | / / \ \ | | | | | @@ -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, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), @@ -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 | | | | * | | | | |/ / \ \ | | | | | @@ -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 @@ -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: @@ -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: @@ -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 @@ -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 diff --git a/keyboards/sofle/keymaps/michal/rules.mk b/keyboards/sofle/keymaps/michal/rules.mk index 63f587fd306..8088d744cd0 100644 --- a/keyboards/sofle/keymaps/michal/rules.mk +++ b/keyboards/sofle/keymaps/michal/rules.mk @@ -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