main.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. AngleSensor_Setoffset(config->angle_offset);
  39. ADCSample_Init();
  40. Motor_Init();
  41. //W25Q64_Init();
  42. //Storage_Init();
  43. Process_Init();
  44. //Timer0_Init();
  45. Timer1_Init();
  46. Task_Init();
  47. printf("111111 \r\n ");
  48. while (1)
  49. {
  50. Watchdog_Feed();
  51. Task_Handle();
  52. #ifdef W25Q64_TEST
  53. printf("read first \r\n ");
  54. W25Q64_ReadDataTest();
  55. printf("read first end \r\n ");
  56. //mdelay(1000);
  57. //W25Q64_WriteDataTest();
  58. Storage_AddItem(ITEM_RECORD, EVENT_MANUAL_LOCK);
  59. //mdelay(1000);
  60. printf("read after write \r\n ");
  61. W25Q64_ReadDataTest();
  62. printf("read end \r\n ");
  63. mdelay(1000);
  64. break;
  65. #endif
  66. }
  67. }