main.c 951 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "app_task.h"
  2. #include "ble_core.h"
  3. #include "can.h"
  4. #include "gpio.h"
  5. #include "i2c1.h"
  6. #include "iap.h"
  7. #include "key.h"
  8. #include "misc.h"
  9. #include "pwm.h"
  10. #include "systick.h"
  11. #include "uart4.h"
  12. #define APP_FLASH_OFFSET 0x8000
  13. #define BOOT_EN 1
  14. int main(void)
  15. {
  16. #if (BOOT_EN == 1)
  17. NVIC_SetVectorTable(NVIC_VectTab_FLASH, APP_FLASH_OFFSET);
  18. __set_PRIMASK(0);
  19. #endif
  20. NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
  21. systick_init();
  22. gpio_init();
  23. pwm_init(&pwm_timer3_content);
  24. pwm_mode(&pwm_timer3_content, 0);
  25. can_init();
  26. can_network_init();
  27. usart_config_init(&usart1_context, 115200);
  28. usart_config_init(&usart2_context, 9600);
  29. usart_config_init(&usart3_context, 115200);
  30. uart4_init();
  31. ble_init();
  32. i2c1_init();
  33. key_button_init();
  34. set_firmver();
  35. iap_flag_release();
  36. iap_param_init();
  37. while (1)
  38. {
  39. app_task_schdule();
  40. }
  41. return 0;
  42. }