aboutsummaryrefslogtreecommitdiff
path: root/users/cwebster2/cwebster2.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/cwebster2/cwebster2.c')
-rw-r--r--users/cwebster2/cwebster2.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/users/cwebster2/cwebster2.c b/users/cwebster2/cwebster2.c
new file mode 100644
index 000000000..cfebc12c6
--- /dev/null
+++ b/users/cwebster2/cwebster2.c
@@ -0,0 +1,65 @@
1/* Copyright 2020 Casey Webster <casey@e1337.dev>
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 "cwebster2.h"
17
18userspace_config_t userspace_config;
19
20__attribute__((weak)) void matrix_scan_keymap(void) {}
21
22void matrix_scan_user(void) {
23 static bool has_ran_yet;
24 if (!has_ran_yet) {
25 has_ran_yet = true;
26 startup_user();
27 }
28
29 matrix_scan_keymap();
30}
31
32void keyboard_post_init_rgb(void) {
33#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_STARTUP_ANIMATION)
34 /*if (userspace_config.rgb_layer_change) { rgblight_enable_noeeprom(); }*/
35 /*if (rgblight_config.enable) {*/
36 /*layer_state_set_user(layer_state);*/
37 /*uint16_t old_hue = rgblight_config.hue;*/
38 uint16_t old_hue = 170;
39 rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
40 for (uint16_t i = 255; i > 0; i--) {
41 rgblight_sethsv_noeeprom( ( i + old_hue) % 255, 255, 255);
42 matrix_scan();
43 wait_ms(10);
44 }
45 /*}*/
46#endif
47 /*layer_state_set_user(layer_state);*/
48}
49
50__attribute__((weak)) void eeconfig_init_keymap(void) {}
51
52void eeconfig_init_user(void) {
53 userspace_config.raw = 0;
54 userspace_config.rgb_layer_change = true;
55 eeconfig_update_user(userspace_config.raw);
56 eeconfig_init_keymap();
57 keyboard_init();
58}
59
60bool hasAllBitsInMask(uint8_t value, uint8_t mask) {
61 value &= 0xF;
62 mask &= 0xF;
63
64 return (value & mask) == mask;
65}