main.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include "stm32f10x.h"
  5. #include "Timer.h"
  6. #include "OLED.h"
  7. #include "GPIOA.h"
  8. #include "Usart1.h"
  9. #include "Usart2.h"
  10. #include "Regist.h"
  11. #include "PumpBusiness.h"
  12. #include "CONFIG.h"
  13. #include "mbedtls_util.h"
  14. #include "Timer_Module.h"
  15. #include "Log_Module.h"
  16. #include "Tuoreniot.h"
  17. #include "bc260y.h"
  18. #include "At_Module.h"
  19. // 计时器
  20. static struct TIMER_Struct timer;
  21. //static uint8_t send_flag = 1;
  22. //static char AT_CMD[512];
  23. int main(void)
  24. {
  25. // uint8_t memmem_flag = 0;
  26. Timer_Init();//定时器
  27. Usart1_Init();//打印串口
  28. Usart2_Init();//4G模块通信
  29. GPIOA_Init();//4G模块DTR IO口
  30. OLED_Init();
  31. OLED_Clear();
  32. OLED_ShowString(1, 1, "MS:");
  33. Log_Printf_Debug("1234\r\n");
  34. // my_delay_ms(5000);
  35. //注册设备,最多失败三次
  36. regist_device_sync();
  37. Log_Printf_Debug("注册结束\r\n");
  38. while(1)
  39. {
  40. // 循环执行udp客户端OLED_ShowNum
  41. OLED_ShowNum(1, 4, time_get_delay(&timer), 6);
  42. if(time_get_delay(&timer) > 60 * 1000)
  43. {
  44. time_clear(&timer);
  45. }
  46. // if(send_flag == 1)
  47. // {
  48. // uint8_t connectID = 1;
  49. // uint16_t data_length = 6;
  50. // uint8_t data[10] = {0x03, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38};
  51. // uint8_t rai = 2;
  52. //
  53. //
  54. // memset(AT_CMD, 0, sizeof(AT_CMD));
  55. // sprintf(AT_CMD + strlen(AT_CMD), "AT+QISEND=%d,%d,\"", connectID, data_length); // 拼接AT指令
  56. // for(uint16_t i = 0; i < data_length; i++)
  57. // {
  58. // sprintf(AT_CMD + strlen(AT_CMD), "%02X", data[i]);
  59. // }
  60. // sprintf(AT_CMD + strlen(AT_CMD), "\",%d\r\n", rai); // 拼接AT指令
  61. //
  62. //
  63. //
  64. // Log_Printf_Debug("\r\n");
  65. // Log_Printf_Debug(AT_CMD);
  66. // Log_Printf_Debug("\r\n");
  67. //
  68. // send_flag = 0;
  69. // }
  70. //
  71. // AT_Handle();
  72. pump_business_loop_execution();
  73. }
  74. }