main.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Copyright 2021 QMK
  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 3 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 "keyboard.h"
  17. void platform_setup(void);
  18. void protocol_setup(void);
  19. void protocol_init(void);
  20. void protocol_pre_task(void);
  21. void protocol_post_task(void);
  22. // Bodge as refactoring vusb sucks....
  23. void protocol_task(void) __attribute__((weak));
  24. void protocol_task(void) {
  25. protocol_pre_task();
  26. keyboard_task();
  27. protocol_post_task();
  28. }
  29. /** \brief Main
  30. *
  31. * FIXME: Needs doc
  32. */
  33. int main(void) __attribute__((weak));
  34. int main(void) {
  35. platform_setup();
  36. protocol_setup();
  37. keyboard_setup();
  38. protocol_init();
  39. keyboard_init();
  40. /* Main loop */
  41. while (true) {
  42. protocol_task();
  43. housekeeping_task();
  44. }
  45. }