main.c 922 B

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