aboutsummaryrefslogtreecommitdiff
path: root/users/bocaj/bocaj.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/bocaj/bocaj.c')
-rw-r--r--users/bocaj/bocaj.c210
1 files changed, 0 insertions, 210 deletions
diff --git a/users/bocaj/bocaj.c b/users/bocaj/bocaj.c
deleted file mode 100644
index 83fe81231..000000000
--- a/users/bocaj/bocaj.c
+++ /dev/null
@@ -1,210 +0,0 @@
1/*
2Copyright 2020 Jacob Jerrell <jacob.jerrell@gmail.com> @JacobJerrell
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "bocaj.h"
19
20#ifdef KEYBOARD_planck_ez
21userspace_config_t userspace_config;
22#endif
23
24bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) {
25 static uint16_t this_timer;
26 if (pressed) {
27 this_timer = timer_read();
28 } else {
29 if (timer_elapsed(this_timer) < TAPPING_TERM) {
30 tap_code(code);
31 } else {
32 register_code(mod_code);
33 tap_code(code);
34 unregister_code(mod_code);
35 }
36 }
37 return false;
38}
39
40bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) {
41 if (pressed) {
42 this_timer = timer_read();
43 } else {
44 if (timer_elapsed(this_timer) < TAPPING_TERM) {
45 tap_code(code);
46 } else {
47 register_code(mod_code);
48 tap_code(code);
49 unregister_code(mod_code);
50 }
51 }
52 return false;
53}
54
55void bootmagic_lite(void) {
56 matrix_scan();
57#if defined(DEBOUNCING_DELAY) && DEBOUNCING_DELAY > 0
58 wait_ms(DEBOUNCING_DELAY * 2);
59#elif defined(DEBOUNCE) && DEBOUNCE > 0
60 wait_ms(DEBOUNCE * 2);
61#else
62 wait_ms(30);
63#endif
64 matrix_scan();
65 if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) {
66 bootloader_jump();
67 }
68}
69
70__attribute__((weak)) void keyboard_pre_init_keymap(void) {}
71
72void keyboard_pre_init_user(void) {
73#ifdef KEYBOARD_planck_ez
74 userspace_config.raw = eeconfig_read_user();
75#endif
76 keyboard_pre_init_keymap();
77}
78// Add reconfigurable functions here, for keymap customization
79// This allows for a global, userspace functions, and continued
80// customization of the keymap. Use _keymap instead of _user
81// functions in the keymaps
82__attribute__((weak)) void matrix_init_keymap(void) {}
83
84// Call user matrix init, set default RGB colors and then
85// call the keymap's init function
86void matrix_init_user(void) {
87 matrix_init_keymap();
88}
89
90__attribute__((weak)) void keyboard_post_init_keymap(void) {}
91
92void keyboard_post_init_user(void) {
93#if defined(RGB_MATRIX_ENABLE)
94 keyboard_post_init_rgb_matrix();
95#endif
96 keyboard_post_init_keymap();
97}
98
99__attribute__((weak)) void shutdown_keymap(void) {}
100
101void rgb_matrix_update_pwm_buffers(void);
102
103void shutdown_user(void) {
104#ifdef RGB_MATRIX_ENABLE
105 rgb_matrix_set_color_all(0xFF, 0x00, 0x00);
106 rgb_matrix_update_pwm_buffers();
107
108#endif // RGB_MATRIX_ENABLE
109 shutdown_keymap();
110}
111
112__attribute__((weak)) void suspend_power_down_keymap(void) {}
113
114void suspend_power_down_user(void) { suspend_power_down_keymap(); }
115
116__attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
117
118void suspend_wakeup_init_user(void) { suspend_wakeup_init_keymap(); }
119
120__attribute__((weak)) void matrix_scan_secrets(void) {}
121__attribute__((weak)) void matrix_scan_keymap(void) {}
122
123LEADER_EXTERNS();
124
125// No global matrix scan code, so just run keymap's matrix
126// scan function
127void matrix_scan_user(void) {
128 static bool has_ran_yet;
129 if (!has_ran_yet) {
130 has_ran_yet = true;
131 startup_user();
132 }
133
134 LEADER_DICTIONARY() {
135 leading = false;
136 leader_end();
137
138 // Website Refresh / XCode "Run"
139 SEQ_ONE_KEY(KC_R) {
140 SEND_STRING(SS_LGUI("r"));
141 }
142
143 SEQ_TWO_KEYS(KC_B, KC_D) {
144 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " Built at: " QMK_BUILDDATE);
145 }
146
147 #ifndef NO_SECRETS
148 matrix_scan_secrets();
149 #endif // !NO_SECRETS
150 }
151
152#if defined(RGB_MATRIX_ENABLE)
153 matrix_scan_rgb_matrix();
154#endif
155
156 matrix_scan_keymap();
157}
158
159__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
160
161// on layer change, no matter where the change was initiated
162// Then runs keymap's layer change check
163layer_state_t layer_state_set_user(layer_state_t state) {
164 state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
165#if defined(RGBLIGHT_ENABLE)
166 state = layer_state_set_rgb_light(state);
167#endif // RGBLIGHT_ENABLE
168 return layer_state_set_keymap(state);
169}
170
171__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; }
172
173// Runs state check and changes underglow color and animation
174layer_state_t default_layer_state_set_user(layer_state_t state) {
175 state = default_layer_state_set_keymap(state);
176#if 0
177# if defined(RGB_MATRIX_ENABLE)
178 state = default_layer_state_set_rgb(state);
179# endif // RGB_MATRIX_ENABLE
180#endif
181 return state;
182}
183
184__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {}
185
186// Any custom LED code goes here.
187// So far, I only have keyboard specific code,
188// So nothing goes here.
189void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
190
191__attribute__((weak)) void eeconfig_init_keymap(void) {}
192
193void eeconfig_init_user(void) {
194#ifdef KEYBOARD_planck_ez
195 userspace_config.raw = 0;
196# if defined(RGB_MATRIX_ENABLE)
197 userspace_config.rgb_layer_change = true;
198# endif
199 eeconfig_update_user(userspace_config.raw);
200#endif
201 eeconfig_init_keymap();
202 keyboard_init();
203}
204
205bool hasAllBitsInMask(uint8_t value, uint8_t mask) {
206 value &= 0xF;
207 mask &= 0xF;
208
209 return (value & mask) == mask;
210}