main.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #include "ac780x.h"
  2. #include "timer.h"
  3. #include "gpio.h"
  4. #include "cfg.h"
  5. #include "IAP.h"
  6. #include "process.h"
  7. #include "main_task.h"
  8. #include "watchdog.h"
  9. #include "adc.h"
  10. #include "Motor.h"
  11. #include "W25Q64.h"
  12. #include "AngleSensor.h"
  13. #include "Rtcx.h"
  14. #include "storage.h"
  15. /*!
  16. * @brief entry
  17. *
  18. * @param[in] none
  19. * @return none
  20. */
  21. int main(void)
  22. {
  23. #ifndef IS_BOOTLOADER
  24. __ASM("CPSIE I");///使能全局中断
  25. SCB->VTOR = APP1_ADDRESS; ///<重映射向量表
  26. #endif
  27. InitDelay();
  28. InitDebug();
  29. Config_Init();
  30. Watchdog_Init();
  31. #ifdef IS_BOOTLOADER
  32. Start_BootLoader();
  33. #endif
  34. Gpio_Init();
  35. IAP_Init();
  36. RTCx_Init();
  37. AngleSensor_Init();
  38. ADCSample_Init();
  39. Motor_Init();
  40. W25Q64_Init();
  41. Storage_Init();
  42. Process_Init();
  43. Timer0_Init();
  44. Timer1_Init();
  45. Task_Init();
  46. //printf("111111 \r\n ");
  47. while (1)
  48. {
  49. Watchdog_Feed();
  50. Task_Handle();
  51. #ifdef W25Q64_TEST
  52. printf("read first \r\n ");
  53. W25Q64_ReadDataTest();
  54. printf("read first end \r\n ");
  55. //mdelay(1000);
  56. //W25Q64_WriteDataTest();
  57. Storage_AddItem(ITEM_RECORD, EVENT_MANUAL_LOCK);
  58. //mdelay(1000);
  59. printf("read after write \r\n ");
  60. W25Q64_ReadDataTest();
  61. printf("read end \r\n ");
  62. mdelay(1000);
  63. break;
  64. #endif
  65. }
  66. }