ESP32_WROOM_32D.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * hy40r204.h
  3. *
  4. * Created on: 2022年4月11日
  5. * Author: dell
  6. */
  7. #ifndef ESP32_WROOM_32D_H_
  8. #define ESP32_WROOM_32D_H_
  9. #include <stdio.h>
  10. #include <string.h>
  11. #include "onechip_include_header.h"
  12. /* USER CODE BEGIN Private defines */
  13. #define MAX_RESEND_TIME 5
  14. //WIFI模块状态
  15. enum WIFI_State
  16. {
  17. WIFI_POWEROFF = -1, //重启
  18. WIFI_POWERON = 0, //上电
  19. WIFI_INIT, //初始化
  20. WIFI_STATION, //设置Station模式
  21. WIFI_CWLAP, //禁止自动连接
  22. WIFI_DISAUTO, //禁止自动连接
  23. WIFI_LINK_AP, //连接AP
  24. WIFI_GET_IP, //查询IP
  25. WIFI_SETMUX, //打开多链接
  26. WIFI_LISTEN, //监听广播
  27. WIFI_TRANS, //数据传输
  28. WIFI_CLOSE, //关闭链接
  29. WIFI_ERROR, //错误状态
  30. };
  31. typedef enum
  32. {
  33. STA,
  34. AP,
  35. STA_AP
  36. }ENUM_Net_ModeTypeDef;
  37. typedef enum{
  38. enumTCP,
  39. enumUDP,
  40. } ENUM_NetPro_TypeDef;
  41. typedef enum{
  42. Multiple_ID_0 = 0,
  43. Multiple_ID_1 = 1,
  44. Multiple_ID_2 = 2,
  45. Multiple_ID_3 = 3,
  46. Multiple_ID_4 = 4,
  47. Single_ID_0 = 5,
  48. } ENUM_ID_NO_TypeDef;
  49. #define User_ESP32_SSID "Onechip"
  50. #define User_ESP32_PWD "onechip1003"
  51. #define User_ESP32_TCPServer_IP "192.168.3.182"
  52. #define User_ESP32_TCPServer_PORT "8002"
  53. #define User_ESP32_UDPServer_IP "255.255.255.255"
  54. #define User_ESP32_UDPServer_PORT "9090"
  55. char* find_str(void *src, int size,char *str);
  56. void WIFI_set_ssid(void);
  57. void WIFI_process(void);
  58. void WIFI_set_CloseConnect(void);
  59. int WIFI_Send_Data(uint8_t *data, uint16_t len, uint8_t flag);
  60. int WIFI_Send_MSG(uint8_t*msgHead,uint8_t *data, uint8_t * crc, uint16_t len);
  61. int WIFI_ReSend(void);
  62. int WIFI_SendIlde(void);
  63. int my_sprintf(char *pdes,unsigned int len, const char* str, ...);
  64. #endif /* ESP32_WROOM_32D_H_ */