aboutsummaryrefslogtreecommitdiff
path: root/keyboards/wilba_tech/wt70_jb/wt70_jb.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/wilba_tech/wt70_jb/wt70_jb.c')
-rw-r--r--keyboards/wilba_tech/wt70_jb/wt70_jb.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/keyboards/wilba_tech/wt70_jb/wt70_jb.c b/keyboards/wilba_tech/wt70_jb/wt70_jb.c
new file mode 100644
index 000000000..0bb9aca09
--- /dev/null
+++ b/keyboards/wilba_tech/wt70_jb/wt70_jb.c
@@ -0,0 +1,60 @@
1/* Copyright 2020 Jason Williams (Wilba)
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 "wt70_jb.h"
17
18bool g_first_execution = false;
19
20void keyboard_pre_init_kb(void) {
21 setPinOutput(F1);
22
23 keyboard_pre_init_user();
24}
25
26bool led_update_kb(led_t led_state) {
27 if (led_update_user(led_state)) {
28 writePin(F1, led_state.caps_lock);
29 }
30 return true;
31}
32
33// This is some magic so that PCBs flashed with VIA firmware at the factory
34// will start with an RGB test pattern. Not relevant for non-VIA firmware.
35#ifdef VIA_ENABLE
36
37// Called from via_init() if VIA_ENABLE
38// Called from matrix_init_kb() if not VIA_ENABLE
39void via_init_kb(void)
40{
41 // If the EEPROM has the magic, the data is good.
42 // OK to load from EEPROM
43 if (via_eeprom_is_valid()) {
44 } else {
45 // Cache "first execution" state so we can do something
46 // specific after QMK initialization has done its thing.
47 g_first_execution = true;
48 // DO NOT set EEPROM valid here, let caller do this
49 }
50}
51
52void keyboard_post_init_kb() {
53 // This is a workaround to ensure "EEPROM cleared" PCBs will
54 // start with the RGB test mode, essential for testing LEDs.
55 if ( g_first_execution ) {
56 rgblight_mode(RGBLIGHT_MODE_RGB_TEST);
57 }
58}
59
60#endif // VIA_ENABLE