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.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 "hw_id.h"
  26. #include "main.h"
  27. void main_loop_hw(void) {
  28. watchdog_update();
  29. usb_run();
  30. }
  31. int main(void) {
  32. watchdog_enable(WATCHDOG_PERIOD_MS, 1);
  33. // detect hardware type
  34. hw_id_init();
  35. hw_id_read();
  36. // required for debug console
  37. cnsl_init();
  38. usb_init();
  39. debug("init");
  40. if (watchdog_caused_reboot()) {
  41. debug("reset by watchdog");
  42. }
  43. debug("HW Type: %d", hw_type());
  44. debug("HW ID: %d", hw_id());
  45. //buttons_init();
  46. lcd_init();
  47. lcd_splash_version();
  48. debug("go");
  49. while (1) {
  50. main_loop_hw();
  51. //buttons_run();
  52. cnsl_run();
  53. }
  54. return 0;
  55. }