No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.c 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * main.c
  3. *
  4. * Copyright (c) 2022 - 2024 Thomas Buck (thomas@xythobuz.de)
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * See <http://www.gnu.org/licenses/>.
  17. */
  18. #include "hardware/watchdog.h"
  19. #include "config.h"
  20. #include "console.h"
  21. #include "log.h"
  22. #include "usb.h"
  23. #include "buttons.h"
  24. #include "lcd.h"
  25. #include "main.h"
  26. void main_loop_hw(void) {
  27. watchdog_update();
  28. usb_run();
  29. }
  30. int main(void) {
  31. watchdog_enable(WATCHDOG_PERIOD_MS, 1);
  32. // detect hardware type
  33. // TODO
  34. // required for debug console
  35. cnsl_init();
  36. usb_init();
  37. debug("init");
  38. if (watchdog_caused_reboot()) {
  39. debug("reset by watchdog");
  40. }
  41. buttons_init();
  42. lcd_init();
  43. debug("go");
  44. while (1) {
  45. main_loop_hw();
  46. buttons_run();
  47. cnsl_run();
  48. }
  49. return 0;
  50. }