wt_main.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright 2018 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. #include "keyboards/wilba_tech/wt_mono_backlight.h"
  18. void bootmagic_lite(void)
  19. {
  20. // The lite version of TMK's bootmagic.
  21. // 100% less potential for accidentally making the
  22. // keyboard do stupid things.
  23. // We need multiple scans because debouncing can't be turned off.
  24. matrix_scan();
  25. wait_ms(DEBOUNCING_DELAY);
  26. wait_ms(DEBOUNCING_DELAY);
  27. matrix_scan();
  28. // If the Esc (matrix 0,0) is held down on power up,
  29. // reset the EEPROM valid state and jump to bootloader.
  30. if ( matrix_get_row(0) & (1<<0) ) {
  31. // Set the TMK/QMK EEPROM state as invalid.
  32. eeconfig_disable();
  33. // Jump to bootloader.
  34. bootloader_jump();
  35. }
  36. }
  37. void matrix_init_kb(void)
  38. {
  39. bootmagic_lite();
  40. backlight_init_drivers();
  41. backlight_timer_init();
  42. backlight_timer_enable();
  43. matrix_init_user();
  44. }
  45. void matrix_scan_kb(void)
  46. {
  47. backlight_update_pwm_buffers();
  48. matrix_scan_user();
  49. }