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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * main.c
  3. *
  4. * Copyright (c) 2022 - 2023 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 "pico/stdlib.h"
  19. #include "hardware/watchdog.h"
  20. #include "config.h"
  21. #include "util.h"
  22. #include "console.h"
  23. #include "log.h"
  24. #include "usb.h"
  25. #include "buttons.h"
  26. #include "lcd.h"
  27. #include "main.h"
  28. void main_loop_hw(void) {
  29. watchdog_update();
  30. usb_run();
  31. heartbeat_run();
  32. }
  33. int main(void) {
  34. watchdog_enable(WATCHDOG_PERIOD_MS, 1);
  35. // detect hardware type
  36. // TODO
  37. // required for debug console
  38. cnsl_init();
  39. usb_init();
  40. debug("init");
  41. if (watchdog_caused_reboot()) {
  42. debug("reset by watchdog");
  43. }
  44. buttons_init();
  45. debug("go");
  46. while (1) {
  47. main_loop_hw();
  48. buttons_run();
  49. cnsl_run();
  50. }
  51. return 0;
  52. }