logo

qmk_firmware

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

main.c (1919B)


  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_pre_init(void);
  20. void protocol_post_init(void);
  21. void protocol_pre_task(void);
  22. void protocol_post_task(void);
  23. // Bodge as refactoring this area sucks....
  24. void protocol_keyboard_task(void) __attribute__((weak));
  25. void protocol_keyboard_task(void) {
  26. keyboard_task();
  27. }
  28. /** \brief Main
  29. *
  30. * FIXME: Needs doc
  31. */
  32. int main(void) __attribute__((weak));
  33. int main(void) {
  34. platform_setup();
  35. protocol_setup();
  36. keyboard_setup();
  37. protocol_pre_init();
  38. keyboard_init();
  39. protocol_post_init();
  40. /* Main loop */
  41. while (true) {
  42. protocol_pre_task();
  43. protocol_keyboard_task();
  44. protocol_post_task();
  45. #ifdef RAW_ENABLE
  46. void raw_hid_task(void);
  47. raw_hid_task();
  48. #endif
  49. #ifdef CONSOLE_ENABLE
  50. void console_task(void);
  51. console_task();
  52. #endif
  53. #ifdef QUANTUM_PAINTER_ENABLE
  54. // Run Quantum Painter task
  55. void qp_internal_task(void);
  56. qp_internal_task();
  57. #endif
  58. #ifdef DEFERRED_EXEC_ENABLE
  59. // Run deferred executions
  60. void deferred_exec_task(void);
  61. deferred_exec_task();
  62. #endif // DEFERRED_EXEC_ENABLE
  63. housekeeping_task();
  64. }
  65. }