app.c 720 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "app/app.h"
  2. #include "bsp/bsp.h"
  3. #include "os/timer.h"
  4. #include "os/co_task.h"
  5. #include "libs/logger.h"
  6. #include "prot/can_message.h"
  7. #include "foc/foc_api.h"
  8. static void _test_timer_handler(timer_t *t);
  9. static void _log_test(void *args);
  10. static timer_t test_timer = TIMER_INIT(test_timer, _test_timer_handler);
  11. void app_start(void){
  12. set_log_level(MOD_SYSTEM, L_debug);
  13. can_message_init();
  14. foc_init();
  15. co_task_create(_log_test, NULL, 512);
  16. timer_post(&test_timer, 200);
  17. co_task_schedule();
  18. }
  19. static void _test_timer_handler(timer_t *t){
  20. //foc_start_motor();
  21. }
  22. static void _log_test(void *args) {
  23. int count = 0;
  24. while(1) {
  25. sys_debug("log test count %d\n", count++);
  26. co_task_delay(500);
  27. }
  28. }