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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 "can.h"
  27. #include "main.h"
  28. void main_loop_hw(void) {
  29. watchdog_update();
  30. usb_run();
  31. }
  32. int main(void) {
  33. watchdog_enable(WATCHDOG_PERIOD_MS, 1);
  34. // detect hardware type
  35. hw_id_init();
  36. hw_id_read();
  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. debug("HW Type: %d", hw_type());
  45. debug("HW ID: %d", hw_id());
  46. //buttons_init();
  47. lcd_init();
  48. lcd_splash_version();
  49. can_init();
  50. debug("go");
  51. while (1) {
  52. can_hello();
  53. main_loop_hw();
  54. //buttons_run();
  55. cnsl_run();
  56. }
  57. return 0;
  58. }