1
- // Copyright 2022 Michal S. (@ihatethefrench )
2
- // SPDX-License-Identifier: GPL-2 .0-only
1
+ // Copyright 2023 Michal S. (@not-my-segfault )
2
+ // SPDX-License-Identifier: GPL-3 .0-only
3
3
4
4
#include QMK_KEYBOARD_H
5
5
6
6
// This specifies the layers that will be used
7
7
enum sofle_layers {
8
8
_WORKMAN ,
9
9
_QWERTY ,
10
- _MIDI ,
11
10
_LOWER ,
12
11
_RAISE ,
13
12
_ADJUST
14
13
};
15
14
16
- // This specifies any custom keycodes I might have set
17
15
enum custom_keycodes {
18
16
KC_WORKMAN = SAFE_RANGE ,
19
17
KC_QWERTY ,
20
- KC_MIDI ,
21
18
KC_LOWER ,
22
19
KC_RAISE ,
23
- KC_ADJUST
20
+ KC_ADJUST ,
21
+ KC_TOGGLE ,
24
22
};
25
23
26
24
// Here the keymaps are defined in matrix form using KC_XYZ form keycodes
@@ -71,36 +69,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
71
69
KC_LGUI , KC_LALT , KC_LCTL , KC_LOWER , KC_SPC , KC_ENT , KC_RAISE , KC_RCTL , KC_RALT , KC_RGUI
72
70
),
73
71
74
- /* MIDI
75
- * ,-----------------------------------------. ,-----------------------------------------.
76
- * | Pnic | OCT0 | OCT1 | OCT2 | OCT3 | OCT4 | | OCT5 | OCT6 | OCT7 | | | MTOG |
77
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
78
- * | |G#/Ab |Bb/A# | |C#/Db |D#/Eb | | |F#/Gb |G#/Ab |Bb/A# | | |
79
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
80
- * | | A | B | C | D | E |-------. ,-------| F | G | A | B | C | Wkmn |
81
- * |------+------+------+------+------+------| | | |------+------+------+------+------+------|
82
- * | | | | | TNSD | TNSU |-------| |-------| BNDD | BNDU | | | | |
83
- * `-----------------------------------------/ / \ \-----------------------------------------'
84
- * | | | | Susd | /OCTDN / \OCTUP \ | | | | |
85
- * | | | | |/ / \ \ | | | | |
86
- * `----------------------------------' '------''---------------------------'
87
- */
88
- [_MIDI ] = LAYOUT (
89
- MI_AOFF , MI_OC0 , MI_OC1 , MI_OC2 , MI_OC3 , MI_OC4 , MI_OC5 , MI_OC6 , MI_OC7 , _______ , _______ , MI_TOGG ,
90
- _______ , MI_Gs , MI_As , _______ , MI_Cs1 , MI_Ds1 , _______ , MI_Fs1 , MI_Gs1 , MI_As1 , _______ , _______ ,
91
- _______ , MI_A , MI_B , MI_C1 , MI_D1 , MI_E1 , MI_F1 , MI_G1 , MI_A1 , MI_B1 , MI_C2 , KC_WORKMAN ,
92
- _______ , _______ , _______ , _______ , MI_TRSD , MI_TRSU , _______ , _______ , MI_BNDD , MI_BNDU , _______ , _______ , _______ , _______ ,
93
- _______ , _______ , _______ , MI_SUST , MI_OCTD , MI_OCTU , _______ , _______ , _______ , _______
94
- ),
95
-
96
72
/* LOWER
97
73
* ,-----------------------------------------. ,-----------------------------------------.
98
74
* | | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 |
99
75
* |------+------+------+------+------+------| |------+------+------+------+------+------|
100
76
* | | | | | | | | | | | | | F12 |
101
77
* |------+------+------+------+------+------| |------+------+------+------+------+------|
102
78
* | | | | | | |-------. ,-------| | | | | | | |
103
- * |------+------+------+------+------+------| | | Run |------+------+------+------+------+------|
79
+ * |------+------+------+------+------+------| | | Togg. |------+------+------+------+------+------|
104
80
* | | = | - | + | { | } |-------| |-------| [ | ] | | | \ | |
105
81
* `-----------------------------------------/ / \ \-----------------------------------------'
106
82
* | | | |LOWER | / / \ \ | | | | |
@@ -111,7 +87,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
111
87
_______ , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 ,
112
88
_______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , KC_F12 ,
113
89
_______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , KC_PIPE ,
114
- _______ , KC_EQL , KC_MINS , KC_PLUS , KC_LCBR , KC_RCBR , _______ , LALT ( KC_F2 ), KC_LBRC , KC_RBRC , _______ , _______ , KC_BSLS , _______ ,
90
+ _______ , KC_EQL , KC_MINS , KC_PLUS , KC_LCBR , KC_RCBR , _______ , KC_TOGGLE , KC_LBRC , KC_RBRC , _______ , _______ , KC_BSLS , _______ ,
115
91
_______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______
116
92
),
117
93
@@ -121,9 +97,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
121
97
* |------+------+------+------+------+------| |------+------+------+------+------+------|
122
98
* | | | | | | | | | | Up | | | Del |
123
99
* |------+------+------+------+------+------| |------+------+------+------+------+------|
124
- * | | | | | | |-------. ,-------| | Left | Down | Rght | | Wkmn |
100
+ * | | | | | | |-------. ,-------| | Left | Down | Rght | | |
125
101
* |------+------+------+------+------+------| | | |------+------+------+------+------+------|
126
- * | | | | Midi | | |-------| |-------| | | Home | End | | Qwrt |
102
+ * | | | | | | |-------| |-------| | | Home | End | | |
127
103
* `-----------------------------------------/ / \ \-----------------------------------------'
128
104
* | | | | | / / \ \ |RAISE | | | |
129
105
* | | | | |/ / \ \ | | | | |
@@ -132,27 +108,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
132
108
[_RAISE ] = LAYOUT (
133
109
_______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , AS_TOGG ,
134
110
_______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , KC_UP , _______ , _______ , KC_DEL ,
135
- _______ , _______ , _______ , _______ , _______ , _______ , _______ , KC_LEFT , KC_DOWN , KC_RGHT , _______ , KC_WORKMAN ,
136
- _______ , _______ , _______ , KC_MIDI , _______ , _______ , _______ , _______ , _______ , _______ , KC_HOME , KC_END , _______ , KC_QWERTY ,
111
+ _______ , _______ , _______ , _______ , _______ , _______ , _______ , KC_LEFT , KC_DOWN , KC_RGHT , _______ , XXXXXXX ,
112
+ _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , KC_HOME , KC_END , _______ , _______ ,
137
113
_______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______
138
114
)};
139
115
140
- // This section only compiles if OLED_ENABLE is set to `yes` in rules.mk
141
116
#ifdef OLED_ENABLE
142
117
143
- // Defining my custom text to draw to the screen :)
144
118
static void oled_screen (void ) {
145
- oled_write_ln_P (PSTR ("" ), false);
146
- oled_write_ln_P (PSTR (">nix " ), false);
147
- oled_write_ln_P (PSTR (">rust" ), false);
148
- oled_write_ln_P (PSTR (">hs &" ), false);
149
- oled_write_ln_P (PSTR (">rum" ), false);
150
- oled_write_ln_P (PSTR ("" ), false);
151
- oled_write_ln_P (PSTR (" . ." ), false);
152
- oled_write_ln_P (PSTR (" u " ), false);
153
- oled_write_ln_P (PSTR (" d" ), false);
154
- oled_write_ln_P (PSTR ("" ), false);
155
- oled_write_ln_P (PSTR ("mchal" ), false);
119
+ oled_set_cursor (0 , 0 ); // Write nothing
156
120
}
157
121
158
122
// Set correct rotation so the text doesn't end up sideways
@@ -174,7 +138,6 @@ bool oled_task_user(void) {
174
138
175
139
#endif
176
140
177
- // This section defines custom keycodes, which I use to manage layers
178
141
bool process_record_user (uint16_t keycode , keyrecord_t * record ) {
179
142
switch (keycode ) {
180
143
case KC_QWERTY :
@@ -187,9 +150,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
187
150
set_single_persistent_default_layer (_WORKMAN );
188
151
}
189
152
return false;
190
- case KC_MIDI :
153
+ case KC_TOGGLE : // Toggle between QWERTY and WORKMAN
191
154
if (record -> event .pressed ) {
192
- set_single_persistent_default_layer (_MIDI );
155
+ layer_invert (_QWERTY );
156
+ layer_invert (_WORKMAN );
193
157
}
194
158
return false;
195
159
case KC_LOWER :
@@ -214,7 +178,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
214
178
return true;
215
179
}
216
180
217
- // This section only compiles if ENCODER_ENABLE is set to `yes` in rules.mk
218
181
#ifdef ENCODER_ENABLE
219
182
220
183
// This section is like the keymap matrix, but for rotary encoders
@@ -224,7 +187,6 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
224
187
[_QWERTY ] = { ENCODER_CCW_CW (_______ , _______ ), ENCODER_CCW_CW (KC_VOLD , KC_VOLU )},
225
188
[_LOWER ] = { ENCODER_CCW_CW (_______ , _______ ), ENCODER_CCW_CW (KC_MS_WH_UP , KC_MS_WH_DOWN )},
226
189
[_RAISE ] = { ENCODER_CCW_CW (_______ , _______ ), ENCODER_CCW_CW (_______ , _______ )},
227
- [_ADJUST ] = { ENCODER_CCW_CW (_______ , _______ ), ENCODER_CCW_CW (_______ , _______ )},
228
190
};
229
191
230
192
#endif
0 commit comments