aboutsummaryrefslogtreecommitdiff
path: root/keyboards/aleblazer/zodiark/keymaps/default/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/aleblazer/zodiark/keymaps/default/keymap.c')
-rw-r--r--keyboards/aleblazer/zodiark/keymaps/default/keymap.c329
1 files changed, 329 insertions, 0 deletions
diff --git a/keyboards/aleblazer/zodiark/keymaps/default/keymap.c b/keyboards/aleblazer/zodiark/keymaps/default/keymap.c
new file mode 100644
index 000000000..c6a81c67f
--- /dev/null
+++ b/keyboards/aleblazer/zodiark/keymaps/default/keymap.c
@@ -0,0 +1,329 @@
1/*
2Copyright 2021 Spencer Deven <[email protected]>
3This program is free software: you can redistribute it and/or modify
4it under the terms of the GNU General Public License as published by
5the Free Software Foundation, either version 3 of the License, or
6(at your option) any later version.
7This program is distributed in the hope that it will be useful,
8but WITHOUT ANY WARRANTY; without even the implied warranty of
9MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10GNU General Public License for more details.
11You should have received a copy of the GNU General Public License
12along with this program. If not, see <http://www.gnu.org/licenses/>.
13*/
14#include QMK_KEYBOARD_H
15
16enum sofle_layers {
17 /* _M_XYZ = Mac Os, _W_XYZ = Win/Linux */
18 _QWERTY,
19 _COLEMAK,
20 _LOWER,
21 _RAISE,
22 _ADJUST,
23};
24
25enum custom_keycodes {
26 KC_QWERTY = SAFE_RANGE,
27 KC_COLEMAK,
28 KC_LOWER,
29 KC_RAISE,
30 KC_ADJUST,
31 KC_PRVWD,
32 KC_NXTWD,
33 KC_LSTRT,
34 KC_LEND,
35 KC_DLINE
36};
37
38const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39
40 [_QWERTY] = LAYOUT(
41 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
42 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
43 KC_ADJUST, KC_A, KC_S, KC_D, KC_F, KC_G, KC_MINS, KC_EQL, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
44 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_GRV, KC_MUTE, RGB_TOG, KC_DEL,KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT ,
45 KC_LCTL, KC_LALT, KC_LGUI, LALT(KC_TAB), KC_LOWER, KC_SPC, KC_ENT, KC_ENT, KC_SPC, KC_RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
46 ),
47
48 [_LOWER] = LAYOUT(
49 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
50 KC_PSLS, KC_P7, KC_P8, KC_P9, KC_NLCK, _______, _______, _______, _______, KC_PSLS, KC_P7, KC_P8, KC_P9, KC_F12,
51 KC_CAPS, KC_P4, KC_P5, KC_P6, KC_NLCK, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_NLCK,
52 _______, KC_P1, KC_P2, KC_P3, _______, _______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, _______,
53 _______, KC_P0, KC_PDOT, KC_PENT, _______, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, KC_PENT, _______
54 ),
55
56 [_RAISE] = LAYOUT(
57 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
58 KC_PSLS, KC_P7, KC_P8, KC_P9, KC_NLCK, _______, _______, _______, _______, KC_PSLS, KC_P7, KC_P8, KC_P9, KC_F12,
59 KC_CAPS, KC_P4, KC_P5, KC_P6, KC_NLCK, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_NLCK,
60 _______, KC_P1, KC_P2, KC_P3, _______, _______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, _______,
61 _______, KC_P0, KC_PDOT, KC_PENT, _______, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, KC_PENT, _______
62 ),
63
64 [_ADJUST] = LAYOUT(
65 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
66 _______, _______, _______, _______, _______, _______, _______, _______, _______, EEP_RST, _______, _______, _______, KC_F12,
67 _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______,
68 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_MOD, RGB_SPI, RGB_HUI, RGB_SAI, RGB_VAI,
69 _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD
70 )
71
72};
73#ifdef OLED_ENABLE
74
75static void render_logo(void) {
76 static const char PROGMEM qmk_logo[] = {
77 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
78 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
79 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0
80 };
81
82 oled_write_P(qmk_logo, false);
83}
84
85static void print_status_narrow(void) {
86 // Print current mode
87 oled_write_P(PSTR("\n\n"), false);
88 oled_write_ln_P(PSTR("MODE"), false);
89 oled_write_ln_P(PSTR(""), false);
90 if (keymap_config.swap_lctl_lgui) {
91 oled_write_ln_P(PSTR("MAC"), false);
92 } else {
93 oled_write_ln_P(PSTR("WIN"), false);
94 }
95
96 switch (get_highest_layer(default_layer_state)) {
97 case _QWERTY:
98 oled_write_ln_P(PSTR("Qwrt"), false);
99 break;
100 case _COLEMAK:
101 oled_write_ln_P(PSTR("Clmk"), false);
102 break;
103 default:
104 oled_write_P(PSTR("Undef"), false);
105 }
106 oled_write_P(PSTR("\n\n"), false);
107 // Print current layer
108 oled_write_ln_P(PSTR("LAYER"), false);
109 switch (get_highest_layer(layer_state)) {
110 case _COLEMAK:
111 case _QWERTY:
112 oled_write_P(PSTR("Base\n"), false);
113 break;
114 case _RAISE:
115 oled_write_P(PSTR("Raise"), false);
116 break;
117 case _LOWER:
118 oled_write_P(PSTR("Lower"), false);
119 break;
120 case _ADJUST:
121 oled_write_P(PSTR("Adj\n"), false);
122 break;
123 default:
124 oled_write_ln_P(PSTR("Undef"), false);
125 }
126 oled_write_P(PSTR("\n\n"), false);
127 led_t led_usb_state = host_keyboard_led_state();
128 oled_write_ln_P(PSTR("CPSLK"), led_usb_state.caps_lock);
129}
130
131oled_rotation_t oled_init_user(oled_rotation_t rotation) {
132 if (is_keyboard_master()) {
133 return OLED_ROTATION_90;
134 }
135 return rotation;
136}
137
138bool oled_task_user(void) {
139 if (is_keyboard_master()) {
140 print_status_narrow();
141 } else {
142 render_logo();
143 }
144 return false;
145}
146
147#endif
148
149bool process_record_user(uint16_t keycode, keyrecord_t *record) {
150 switch (keycode) {
151 case KC_QWERTY:
152 if (record->event.pressed) {
153 set_single_persistent_default_layer(_QWERTY);
154 }
155 return false;
156 case KC_COLEMAK:
157 if (record->event.pressed) {
158 set_single_persistent_default_layer(_COLEMAK);
159 }
160 return false;
161 case KC_LOWER:
162 if (record->event.pressed) {
163 layer_on(_LOWER);
164 update_tri_layer(_LOWER, _RAISE, _ADJUST);
165 } else {
166 layer_off(_LOWER);
167 update_tri_layer(_LOWER, _RAISE, _ADJUST);
168 }
169 return false;
170 case KC_RAISE:
171 if (record->event.pressed) {
172 layer_on(_RAISE);
173 update_tri_layer(_LOWER, _RAISE, _ADJUST);
174 } else {
175 layer_off(_RAISE);
176 update_tri_layer(_LOWER, _RAISE, _ADJUST);
177 }
178 return false;
179 case KC_ADJUST:
180 if (record->event.pressed) {
181 layer_on(_ADJUST);
182 } else {
183 layer_off(_ADJUST);
184 }
185 return false;
186 case KC_PRVWD:
187 if (record->event.pressed) {
188 if (keymap_config.swap_lctl_lgui) {
189 register_mods(mod_config(MOD_LALT));
190 register_code(KC_LEFT);
191 } else {
192 register_mods(mod_config(MOD_LCTL));
193 register_code(KC_LEFT);
194 }
195 } else {
196 if (keymap_config.swap_lctl_lgui) {
197 unregister_mods(mod_config(MOD_LALT));
198 unregister_code(KC_LEFT);
199 } else {
200 unregister_mods(mod_config(MOD_LCTL));
201 unregister_code(KC_LEFT);
202 }
203 }
204 break;
205 case KC_NXTWD:
206 if (record->event.pressed) {
207 if (keymap_config.swap_lctl_lgui) {
208 register_mods(mod_config(MOD_LALT));
209 register_code(KC_RIGHT);
210 } else {
211 register_mods(mod_config(MOD_LCTL));
212 register_code(KC_RIGHT);
213 }
214 } else {
215 if (keymap_config.swap_lctl_lgui) {
216 unregister_mods(mod_config(MOD_LALT));
217 unregister_code(KC_RIGHT);
218 } else {
219 unregister_mods(mod_config(MOD_LCTL));
220 unregister_code(KC_RIGHT);
221 }
222 }
223 break;
224 case KC_LSTRT:
225 if (record->event.pressed) {
226 if (keymap_config.swap_lctl_lgui) {
227 //CMD-arrow on Mac, but we have CTL and GUI swapped
228 register_mods(mod_config(MOD_LCTL));
229 register_code(KC_LEFT);
230 } else {
231 register_code(KC_HOME);
232 }
233 } else {
234 if (keymap_config.swap_lctl_lgui) {
235 unregister_mods(mod_config(MOD_LCTL));
236 unregister_code(KC_LEFT);
237 } else {
238 unregister_code(KC_HOME);
239 }
240 }
241 break;
242 case KC_LEND:
243 if (record->event.pressed) {
244 if (keymap_config.swap_lctl_lgui) {
245 //CMD-arrow on Mac, but we have CTL and GUI swapped
246 register_mods(mod_config(MOD_LCTL));
247 register_code(KC_RIGHT);
248 } else {
249 register_code(KC_END);
250 }
251 } else {
252 if (keymap_config.swap_lctl_lgui) {
253 unregister_mods(mod_config(MOD_LCTL));
254 unregister_code(KC_RIGHT);
255 } else {
256 unregister_code(KC_END);
257 }
258 }
259 break;
260 case KC_DLINE:
261 if (record->event.pressed) {
262 register_mods(mod_config(MOD_LCTL));
263 register_code(KC_BSPC);
264 } else {
265 unregister_mods(mod_config(MOD_LCTL));
266 unregister_code(KC_BSPC);
267 }
268 break;
269 case KC_COPY:
270 if (record->event.pressed) {
271 register_mods(mod_config(MOD_LCTL));
272 register_code(KC_C);
273 } else {
274 unregister_mods(mod_config(MOD_LCTL));
275 unregister_code(KC_C);
276 }
277 return false;
278 case KC_PASTE:
279 if (record->event.pressed) {
280 register_mods(mod_config(MOD_LCTL));
281 register_code(KC_V);
282 } else {
283 unregister_mods(mod_config(MOD_LCTL));
284 unregister_code(KC_V);
285 }
286 return false;
287 case KC_CUT:
288 if (record->event.pressed) {
289 register_mods(mod_config(MOD_LCTL));
290 register_code(KC_X);
291 } else {
292 unregister_mods(mod_config(MOD_LCTL));
293 unregister_code(KC_X);
294 }
295 return false;
296 break;
297 case KC_UNDO:
298 if (record->event.pressed) {
299 register_mods(mod_config(MOD_LCTL));
300 register_code(KC_Z);
301 } else {
302 unregister_mods(mod_config(MOD_LCTL));
303 unregister_code(KC_Z);
304 }
305 return false;
306 }
307 return true;
308}
309
310#ifdef ENCODER_ENABLE
311
312bool encoder_update_user(uint8_t index, bool clockwise) {
313 if (index == 0) {
314 if (clockwise) {
315 tap_code(KC_VOLU);
316 } else {
317 tap_code(KC_VOLD);
318 }
319 } else if (index == 1) {
320 if (clockwise) {
321 rgblight_step();
322 } else {
323 rgblight_step_reverse();
324 }
325 }
326 return true;
327}
328
329#endif