logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

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