-
Notifications
You must be signed in to change notification settings - Fork 0
/
keymap.c
233 lines (208 loc) Β· 17.8 KB
/
keymap.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#ifdef AUDIO_ENABLE
#include "muse.h"
#endif
#include "eeprom.h"
#include "ez.h"
#include "layers.h"
#include "vimmode.h"
enum planck_keycodes {
RGB_SLD = EZ_SAFE_RANGE,
};
#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
#define KC_CMD KC_LGUI
// Shorter keycodes
#define DYN_STT1 DYN_REC_START1
#define DYN_STT2 DYN_REC_START2
#define DYN_STOP DYN_REC_STOP
#define DYN_PLY1 DYN_MACRO_PLAY1
#define DYN_PLY2 DYN_MACRO_PLAY2
#define SLEEP C(S(KC_EJCT))
#define HOME G(KC_LEFT)
#define BOTTOM G(KC_DOWN)
#define TOP G(KC_UP)
#define END G(KC_RGHT)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// clang-format off
/* Base layer (Qwerty)
* βββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ
* β β₯ β Q β W β E β R β T β Y β U β I β O β P β BS β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* Tap for Esc --β β β A β S β D β F β G β H β J β K β L β ; β ' β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* Tap for ( -- β β§ β Z β X β C β V β B β N β M β , β . β / β β§ β -- Tap for Enter
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β NUM β NAV β β β β₯ βLOWERβSpaceβSpaceβRAISEβ β¬
β β¬ β β¬ β β‘ β -- Tap for ]
* βββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ
*/
[_BASE] = LAYOUT_planck_grid(
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOTE,
KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT),
TT(_NUMPAD), TT(_NAV), KC_CMD, KC_LALT, LOWER, KC_SPC, KC_NO, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
),
/* Lower layer
* βββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ
* β ~ β ! β @ β # β $ β % β ^ β & β * β ( β ) β Del β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β VIM β β A β β S β β D β β F β β β - β = β { β } β | β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β β§ β β Z β β X β β C β β V β β β N β β < β > β \ β β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β β β β β βCaps β β β β β¬
β β β¬ β β β¬ β β β‘ β
* βββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ
*/
[_LOWER] = LAYOUT_planck_grid(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL,
_______, G(KC_A), G(KC_S), G(KC_D), G(KC_F), _______, _______, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE,
KC_LSFT, G(KC_Z), G(KC_X), G(KC_C), G(KC_V), _______, G(KC_N), _______, KC_LABK, KC_RABK, KC_BSLS, _______,
_______, _______, _______, _______, _______, KC_CAPS, KC_NO, _______, HOME, BOTTOM, TOP, END
),
/* Raise layer
* βββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ
* β ` β 1 β 2 β 3 β 4 β 5 β 6 β 7 β 8 β 9 β 0 β β BSβ
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β Del β β β β β β β _ β + β [ β ] β \ β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β β§ β β β β β β β β β β β β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β β β β β β β β βHome βPgDn βPgUp β End β
* βββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ
*/
[_RAISE] = LAYOUT_planck_grid(
KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, G(KC_BSPC),
KC_DELETE, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS,
KC_RSHIFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, KC_NO, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
),
/* Adjust layer (pressing both LOWER and RAISE)
* βββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ
* β βMac1RβMac2Rβ βResetβ β β β β β β β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β Del β βMacSRβ β β β β β β β β β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β βMac1PβMac2Pβ β β β β β β β β β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β β β β β βSleepβ β β β β β β
* βββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ
*/
[_ADJUST] = LAYOUT_planck_grid(
_______, DM_REC1, DM_REC2, _______, RESET, _______, _______, _______, _______, _______, _______, _______,
KC_DEL, _______, DM_RSTP, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, DM_PLY1, DM_PLY2, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, SLEEP, KC_NO, _______, _______, _______, _______, _______
),
/* Numpad layer
* βββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ
* β β F9 β F10 β F11 β F12 β β β 7 β 8 β 9 β - β BS β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β β F5 β F6 β F7 β F8 β β ^ β 4 β 5 β 6 β + β β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β β F1 β F2 β F3 β F4 β β % β 1 β 2 β 3 β / βEnterβ
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* βBASE β β β β βNLockβ β 0 β 0 β . β * β β
* βββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ
*/
[_NUMPAD] = LAYOUT_planck_grid(
_______, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_KP_7, KC_KP_8, KC_KP_9, KC_PMNS, KC_BSPC,
_______, KC_F5, KC_F6, KC_F7, KC_F8, _______, KC_CIRC, KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, _______,
_______, KC_F1, KC_F2, KC_F3, KC_F4, _______, KC_PERC, KC_KP_1, KC_KP_2, KC_KP_3, KC_PSLS, KC_PENT,
TO(_BASE), _______, _______, _______, _______, KC_NLCK, KC_NO, KC_KP_0, KC_KP_0, KC_PDOT, KC_PAST, _______
),
/* Navigation layer
* βββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ
* β β β β β β β β β β β β β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β β β β β β β β¬
β β¬ β β¬ β β‘ β β β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β β βMidCkβ β β β β βPrev βNext β β β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β βBASE β β βVol- βPlay β βVol+ β βBrig-βBrig+β β
* βββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ
*/
[_NAV] = LAYOUT_planck_grid(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, _______, _______,
_______, _______, KC_MS_BTN3, _______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, _______, _______,
_______, TO(_BASE), _______, _______, KC_VOLD, KC_MPLY, KC_NO, KC_VOLU, _______, KC_F14, KC_F15, _______
),
/* Vim layer as a placeholder
* βββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ
* β β β β β β β β β β β β β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β β β β β β β β β β β β β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β β§ β β β β β β β β β β β β
* βββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
* β β β β βLOWERβ β βRAISEβ β β β β
* βββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ
*/
[_VIM] = LAYOUT_planck_grid(
XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______, _______, XXXXXXX,
KC_LCTRL, _______, _______, _______, XXXXXXX, _______, _______, _______, _______, _______, XXXXXXX, XXXXXXX,
KC_LSFT, XXXXXXX, _______, _______, _______, _______, _______, XXXXXXX, XXXXXXX, _______, _______, _______,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LOWER, _______, XXXXXXX, RAISE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
)
// clang-format on
};
void keyboard_post_init_user(void) {
debug_enable = true;
debug_keyboard = true;
keyboard_config.led_level = 1;
eeconfig_update_kb(keyboard_config.raw);
}
#include <print.h>
bool process_record_user(uint16_t keycode, keyrecord_t* record) {
/*if (IS_LAYER_ON(_VIM) && process_vim_key(keycode, record)) {*/
if (IS_LAYER_ON(_VIM)) {
return false;
}
/*switch (keycode) {*/
/*case:*/
/*break;*/
/*}*/
return true;
}
void encoder_update(bool clockwise) {
if (clockwise) {
#ifdef MOUSEKEY_ENABLE
register_code(KC_MS_WH_DOWN);
unregister_code(KC_MS_WH_DOWN);
#else
register_code(KC_PGDN);
unregister_code(KC_PGDN);
#endif
} else {
#ifdef MOUSEKEY_ENABLE
register_code(KC_MS_WH_UP);
unregister_code(KC_MS_WH_UP);
#else
register_code(KC_PGUP);
unregister_code(KC_PGUP);
#endif
}
}
/*void matrix_scan_user(void) {}*/
uint32_t layer_state_set_user(uint32_t state) {
planck_ez_left_led_off();
planck_ez_right_led_off();
state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
switch (get_highest_layer(state)) {
case _NUMPAD:
case _LOWER:
planck_ez_left_led_on();
break;
case _NAV:
case _RAISE:
planck_ez_right_led_on();
break;
case _ADJUST:
case _VIM:
planck_ez_left_led_on();
planck_ez_right_led_on();
break;
default:
break;
}
return state;
}