wt70_jb.c (1754B)
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 "quantum.h" 17 18 bool g_first_execution = false; 19 20 // This is some magic so that PCBs flashed with VIA firmware at the factory 21 // will start with an RGB test pattern. Not relevant for non-VIA firmware. 22 #ifdef VIA_ENABLE 23 24 // Called from via_init() if VIA_ENABLE 25 // Called from matrix_init_kb() if not VIA_ENABLE 26 void via_init_kb(void) 27 { 28 // This checks both an EEPROM reset (from bootmagic lite, keycodes) 29 // and also firmware build date (from via_eeprom_is_valid()) 30 if (eeconfig_is_enabled()) { 31 } else { 32 // Cache "first execution" state so we can do something 33 // specific after QMK initialization has done its thing. 34 g_first_execution = true; 35 // DO NOT set EEPROM valid here, let caller do this 36 } 37 } 38 39 void keyboard_post_init_kb(void) { 40 // This is a workaround to ensure "EEPROM cleared" PCBs will 41 // start with the RGB test mode, essential for testing LEDs. 42 if ( g_first_execution ) { 43 rgblight_mode(RGBLIGHT_MODE_RGB_TEST); 44 } 45 46 keyboard_post_init_user(); 47 } 48 49 #endif // VIA_ENABLE