logo

qmk_firmware

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

baguette.c (1702B)


  1. /* Copyright 2018 Yiancar
  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. #ifndef DEBOUNCE
  18. # define DEBOUNCE 5
  19. #endif
  20. void bootmagic_lite(void)
  21. {
  22. // The lite version of TMK's bootmagic made by Wilba.
  23. // 100% less potential for accidentally making the
  24. // keyboard do stupid things.
  25. // We need multiple scans because debouncing can't be turned off.
  26. matrix_scan();
  27. wait_ms(DEBOUNCE);
  28. matrix_scan();
  29. // If the Esc and space bar are held down on power up,
  30. // reset the EEPROM valid state and jump to bootloader.
  31. // Assumes Esc is at [0,0] and spacebar is at [4,7].
  32. // This isn't very generalized, but we need something that doesn't
  33. // rely on user's keymaps in firmware or EEPROM.
  34. if ( ( matrix_get_row(0) & (1<<0) ) &&
  35. ( matrix_get_row(4) & (1<<7) ) )
  36. {
  37. // Set the TMK/QMK EEPROM state as invalid.
  38. eeconfig_disable();
  39. //eeprom_set_valid(false);
  40. // Jump to bootloader.
  41. bootloader_jump();
  42. }
  43. }
  44. void matrix_init_kb(void) {
  45. // put your keyboard start-up code here
  46. // runs once when the firmware starts up
  47. bootmagic_lite();
  48. matrix_init_user();
  49. }