aboutsummaryrefslogtreecommitdiff
path: root/users/greatwizard/greatwizard.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/greatwizard/greatwizard.c')
-rw-r--r--users/greatwizard/greatwizard.c112
1 files changed, 112 insertions, 0 deletions
diff --git a/users/greatwizard/greatwizard.c b/users/greatwizard/greatwizard.c
new file mode 100644
index 000000000..46ee41436
--- /dev/null
+++ b/users/greatwizard/greatwizard.c
@@ -0,0 +1,112 @@
1/* Copyright 2020 Guillaume Gérard
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "greatwizard.h"
17
18void eeconfig_init_user(void) {
19 user_config_t user_config;
20 user_config.raw = 0;
21#ifdef RGBLIGHT_ENABLE
22 user_config.rgb_layer_change = true;
23#endif
24 eeconfig_update_user(user_config.raw);
25 keyboard_init();
26}
27
28void keyboard_post_init_user(void) {
29#ifdef RGBLIGHT_ENABLE
30 keyboard_post_init_rgb();
31#endif
32}
33
34bool process_record_user(uint16_t keycode, keyrecord_t *record) {
35#ifdef RGBLIGHT_ENABLE
36 process_record_rgb(keycode, record);
37#endif
38#ifdef LAYER_GAME
39 process_record_game(keycode, record);
40#endif
41#ifdef LAYER_GIT
42 process_record_git(keycode, record);
43#endif
44#ifdef LAYERS_PROGRAMMER
45 process_record_pg(keycode, record);
46#endif
47 switch (keycode) {
48 case QWERTY:
49 if (record->event.pressed) {
50 set_single_persistent_default_layer(_QWERTY);
51 }
52 return false;
53 case WORKMAN:
54 if (record->event.pressed) {
55 set_single_persistent_default_layer(_WORKMAN);
56 }
57 return false;
58 case COLEMAK:
59 if (record->event.pressed) {
60 set_single_persistent_default_layer(_COLEMAK);
61 }
62 return false;
63 case DVORAK:
64 if (record->event.pressed) {
65 set_single_persistent_default_layer(_DVORAK);
66 }
67 return false;
68 }
69 return true;
70}
71
72#ifdef ENCODER_ENABLE
73void encoder_update_user(uint8_t index, bool clockwise) {
74 switch (get_highest_layer(layer_state)) {
75 case _QWERTY:
76#ifdef LAYERS_PROGRAMMER
77 case _PROGRAMMER_SHIFTED:
78#endif
79 if (clockwise) {
80 tap_code(KC_AUDIO_VOL_UP);
81 } else {
82 tap_code(KC_AUDIO_VOL_DOWN);
83 }
84 break;
85 default:
86 if (clockwise) {
87 tap_code(KC_MEDIA_NEXT_TRACK);
88 } else {
89 tap_code(KC_MEDIA_PREV_TRACK);
90 }
91 break;
92 }
93}
94#endif
95
96layer_state_t layer_state_set_user(layer_state_t state) {
97 state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
98#ifdef RGBLIGHT_ENABLE
99 state = layer_state_set_rgb(state);
100#endif
101#ifdef LAYERS_ORTHO
102 state = layer_state_set_ortho(state);
103#endif
104 return state;
105}
106
107bool led_update_user(led_t led_state) {
108#ifdef RGBLIGHT_ENABLE
109 led_update_rgb(led_state);
110#endif
111 return true;
112}