aboutsummaryrefslogtreecommitdiff
path: root/users/jjerrell/jjerrell.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/jjerrell/jjerrell.c')
-rw-r--r--users/jjerrell/jjerrell.c138
1 files changed, 138 insertions, 0 deletions
diff --git a/users/jjerrell/jjerrell.c b/users/jjerrell/jjerrell.c
new file mode 100644
index 000000000..95c2acba5
--- /dev/null
+++ b/users/jjerrell/jjerrell.c
@@ -0,0 +1,138 @@
1/**
2 * Copyright (C) 2021 Jerrell, Jacob <@jjerrell>
3 *
4 * This file is part of qmk_firmware.
5 *
6 * qmk_firmware is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * qmk_firmware is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with qmk_firmware. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "jjerrell.h"
21
22__attribute__((weak)) void matrix_scan_keymap(void) {}
23__attribute__((weak)) void leader_scan_secrets(void) {}
24
25#ifdef LEADER_ENABLE
26 LEADER_EXTERNS();
27 void matrix_scan_leader(void) {
28 static uint8_t mods = 0;
29 mods = get_mods();
30 LEADER_DICTIONARY() {
31 leading = false;
32 leader_end();
33 clear_mods();
34
35 // Website Refresh / XCode "Run"
36 SEQ_ONE_KEY(KC_R) {
37 SEND_STRING(SS_LGUI("r"));
38 }
39
40 SEQ_TWO_KEYS(KC_B, KC_D) {
41 send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " Built at: " QMK_BUILDDATE), TAP_CODE_DELAY);
42 }
43
44 SEQ_TWO_KEYS(KC_L, KC_C) {
45 send_string_with_delay("/** */", TAP_CODE_DELAY);
46 wait_ms(TAPPING_TERM);
47 tap_code(KC_LEFT);
48 tap_code(KC_LEFT);
49 tap_code(KC_LEFT);
50 if (!(mods & MOD_MASK_SHIFT)) {
51 tap_code(KC_ENT);
52 }
53 }
54
55 set_mods(mods);
56 #ifndef NO_SECRETS
57 leader_scan_secrets();
58 #endif // !NO_SECRETS
59 }
60 }
61#endif
62
63static bool is_first_run = true;
64void matrix_scan_user(void) {
65 if (is_first_run) {
66 is_first_run = false;
67 startup_user();
68 }
69 #ifdef LEADER_ENABLE
70 matrix_scan_leader();
71 #endif
72 matrix_scan_keymap();
73}
74
75__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
76
77// on layer change, no matter where the change was initiated
78// Then runs keymap's layer change check
79layer_state_t layer_state_set_user(layer_state_t state) {
80 if (!is_keyboard_master()) {
81 return state;
82 }
83
84 state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
85 state = layer_state_set_keymap(state);
86#if defined(RGBLIGHT_ENABLE)
87 state = layer_state_set_rgb_light(state);
88#endif // RGBLIGHT_ENABLE
89 return state;
90}
91
92__attribute__((weak)) void dip_switch_update_keymap(uint8_t index, bool active) {}
93void dip_switch_update_user(uint8_t index, bool active) {
94 dip_switch_update_keymap(index, active);
95}
96
97__attribute__((weak)) bool music_mask_keymap(uint16_t keycode) { return true; }
98bool music_mask_user(uint16_t keycode) {
99 switch (keycode){
100 default:
101 return music_mask_keymap(keycode);
102 break;
103 }
104}
105
106__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; }
107
108// Runs state check and changes underglow color and animation
109layer_state_t default_layer_state_set_user(layer_state_t state) {
110 if (!is_keyboard_master()) {
111 return state;
112 }
113 return default_layer_state_set_keymap(state);
114}
115
116#ifdef AUDIO_ENABLE
117__attribute__((weak)) void startup_keymap(void) {}
118void startup_user(void)
119{
120 wait_ms(TAP_CODE_DELAY); // gets rid of tick
121 startup_keymap();
122}
123
124__attribute__((weak)) void shutdown_keymap(void) {}
125void shutdown_user(void)
126{
127 wait_ms(TAP_CODE_DELAY);
128 stop_all_notes();
129 shutdown_keymap();
130}
131
132__attribute__((weak)) void music_on_keymap(void) {}
133void music_on_user(void)
134{
135 music_scale_user();
136 music_on_keymap();
137}
138#endif // AUDIO_ENABLE