diff options
author | QMK Bot <hello@qmk.fm> | 2021-04-03 03:57:51 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2021-04-03 03:57:51 +0000 |
commit | fc8495a7443a848aa54148939f981ed5ceb357bf (patch) | |
tree | 73d811713bfd95d81782f5f77fc8b397bbe60b06 /keyboards/wilba_tech/wt70_jb/wt70_jb.c | |
parent | 428e9e7886839ee85a273d3519d32f151576d3fd (diff) | |
parent | 4caeb648881543fb822efb9fca3f54ee34a73041 (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'keyboards/wilba_tech/wt70_jb/wt70_jb.c')
-rw-r--r-- | keyboards/wilba_tech/wt70_jb/wt70_jb.c | 60 |
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 0000000000..0bb9aca092 --- /dev/null +++ b/keyboards/wilba_tech/wt70_jb/wt70_jb.c @@ -0,0 +1,60 @@ +/* Copyright 2020 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include "wt70_jb.h" + +bool g_first_execution = false; + +void keyboard_pre_init_kb(void) { + setPinOutput(F1); + + keyboard_pre_init_user(); +} + +bool led_update_kb(led_t led_state) { + if (led_update_user(led_state)) { + writePin(F1, led_state.caps_lock); + } + return true; +} + +// This is some magic so that PCBs flashed with VIA firmware at the factory +// will start with an RGB test pattern. Not relevant for non-VIA firmware. +#ifdef VIA_ENABLE + +// Called from via_init() if VIA_ENABLE +// Called from matrix_init_kb() if not VIA_ENABLE +void via_init_kb(void) +{ + // If the EEPROM has the magic, the data is good. + // OK to load from EEPROM + if (via_eeprom_is_valid()) { + } else { + // Cache "first execution" state so we can do something + // specific after QMK initialization has done its thing. + g_first_execution = true; + // DO NOT set EEPROM valid here, let caller do this + } +} + +void keyboard_post_init_kb() { + // This is a workaround to ensure "EEPROM cleared" PCBs will + // start with the RGB test mode, essential for testing LEDs. + if ( g_first_execution ) { + rgblight_mode(RGBLIGHT_MODE_RGB_TEST); + } +} + +#endif // VIA_ENABLE |