]> git.donarmstrong.com Git - qmk_firmware.git/blob - users/bocaj/bocaj.c
Remove more commented out MCUs
[qmk_firmware.git] / users / bocaj / bocaj.c
1 /*
2 Copyright 2018 Jacob Jerrell <jacob.jerrell@gmail.com> @JacobJerrell
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include "bocaj.h"
19
20 userspace_config_t userspace_config;
21 #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
22   #define BOCAJ_UNICODE_MODE UC_OSX
23 #else
24   // set to 2 for UC_WIN, set to 4 for UC_WINC
25   #define BOCAJ_UNICODE_MODE 2
26 #endif
27
28 void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); };
29
30 // Add reconfigurable functions here, for keymap customization
31 // This allows for a global, userspace functions, and continued
32 // customization of the keymap.  Use _keymap instead of _user
33 // functions in the keymaps
34 __attribute__ ((weak))
35 void matrix_init_keymap(void) {}
36
37 __attribute__ ((weak))
38 void startup_keymap(void) {}
39
40 __attribute__ ((weak))
41 void suspend_power_down_keymap(void) {}
42
43 __attribute__ ((weak))
44 void suspend_wakeup_init_keymap(void) {}
45
46 __attribute__ ((weak))
47 void matrix_scan_keymap(void) {}
48
49 __attribute__ ((weak))
50 bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
51   return true;
52 }
53
54 __attribute__ ((weak))
55 void matrix_scan_secrets(void) {}
56
57 __attribute__ ((weak))
58 uint32_t layer_state_set_keymap (uint32_t state) {
59   return state;
60 }
61
62 __attribute__ ((weak))
63 uint32_t default_layer_state_set_keymap (uint32_t state) {
64   return state;
65 }
66
67 __attribute__ ((weak))
68 void led_set_keymap(uint8_t usb_led) {}
69
70 // Call user matrix init, set default RGB colors and then
71 // call the keymap's init function
72 void matrix_init_user(void) {
73   userspace_config.raw = eeconfig_read_user();
74
75   #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
76     set_unicode_input_mode(BOCAJ_UNICODE_MODE);
77     get_unicode_input_mode();
78   #endif //UNICODE_ENABLE
79
80
81   matrix_init_keymap();
82 }
83
84 void startup_user (void) {
85   startup_keymap();
86 }
87
88 void suspend_power_down_user(void)
89 {
90     suspend_power_down_keymap();
91 }
92
93 void suspend_wakeup_init_user(void)
94 {
95   suspend_wakeup_init_keymap();
96   #ifdef KEYBOARD_ergodox_ez
97   wait_ms(10);
98   #endif
99 }
100
101 void eeconfig_init_user(void) {
102   userspace_config.raw = 0;
103   eeconfig_update_user(userspace_config.raw);
104   #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
105     set_unicode_input_mode(BOCAJ_UNICODE_MODE);
106     get_unicode_input_mode();
107   #else
108     eeprom_update_byte(EECONFIG_UNICODEMODE, BOCAJ_UNICODE_MODE);
109   #endif
110 }
111
112 LEADER_EXTERNS();
113 // No global matrix scan code, so just run keymap's matrix
114 // scan function
115 void matrix_scan_user(void) {
116   static bool has_ran_yet;
117   if (!has_ran_yet) {
118     has_ran_yet = true;
119     startup_user();
120   }
121   LEADER_DICTIONARY() {
122     leading = false;
123     leader_end();
124
125     // Mac Save (Leader -> s)
126     SEQ_ONE_KEY(KC_S) {
127       SEND_STRING(SS_LGUI("s"));
128     }
129
130     // Mac copy line down (Leader -> d, d)
131     SEQ_TWO_KEYS(KC_D, KC_D) {
132       register_code(KC_LSHIFT);
133       register_code(KC_HOME);
134       unregister_code(KC_HOME);
135       unregister_code(KC_LSHIFT);
136       SEND_STRING(SS_LGUI("c"));
137       tap(KC_END);
138       tap(KC_ENTER);
139       SEND_STRING(SS_LGUI("v"));
140     }
141
142     // Mac copy line up (Leader -> u, u)
143     SEQ_TWO_KEYS(KC_U, KC_U) {
144       register_code(KC_LSHIFT);
145       register_code(KC_HOME);
146       unregister_code(KC_HOME);
147       unregister_code(KC_LSHIFT);
148       SEND_STRING(SS_LGUI("c"));
149       tap(KC_UP);
150       tap(KC_END);
151       tap(KC_ENTER);
152       SEND_STRING(SS_LGUI("v"));
153     }
154
155     // Mac VS Debug
156     SEQ_ONE_KEY(KC_D) {
157       tap(KC_F5);
158     }
159
160     // Mac VS Stop Debug
161     SEQ_TWO_KEYS(KC_S, KC_D) {
162       register_code(KC_LSHIFT);
163       tap(KC_F5);
164       unregister_code(KC_LSHIFT);
165     }
166
167     // Start Diablo 3
168     SEQ_ONE_KEY(KC_3) {
169       SEND_STRING(SS_LCTRL(" "));
170       SEND_STRING("Diablo");
171       tap(KC_ENTER);
172     }
173
174     SEQ_ONE_KEY(KC_B) {
175       SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " ");
176       tap(KC_ENTER);
177       SEND_STRING ("Built at: " QMK_BUILDDATE);
178     }
179 #ifndef NO_SECRETS
180     matrix_scan_secrets();
181 #endif // !NO_SECRETS
182   }
183
184 #ifdef TAP_DANCE_ENABLE  // Run Diablo 3 macro checking code.
185   run_diablo_macro_check();
186 #endif // TAP_DANCE_ENABLE
187
188   matrix_scan_keymap();
189 }