ESP32_WROOM_32D.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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_IPDINFO, // fixed +IPD header format
  27. WIFI_LISTEN, //监听广播
  28. WIFI_TCPOPT, // TCP send timeout
  29. WIFI_TRANS, //数据传输
  30. WIFI_CLOSE, //关闭链接
  31. WIFI_ERROR, //错误状态
  32. };
  33. typedef enum
  34. {
  35. STA,
  36. AP,
  37. STA_AP
  38. }ENUM_Net_ModeTypeDef;
  39. typedef enum{
  40. enumTCP,
  41. enumUDP,
  42. } ENUM_NetPro_TypeDef;
  43. typedef enum{
  44. Multiple_ID_0 = 0,
  45. Multiple_ID_1 = 1,
  46. Multiple_ID_2 = 2,
  47. Multiple_ID_3 = 3,
  48. Multiple_ID_4 = 4,
  49. Single_ID_0 = 5,
  50. } ENUM_ID_NO_TypeDef;
  51. #define User_ESP32_SSID "Onechip"
  52. #define User_ESP32_PWD "onechip1003"
  53. #define User_ESP32_TCPServer_IP "192.168.3.182"
  54. #define User_ESP32_TCPServer_PORT "8002"
  55. #define User_ESP32_UDPServer_IP "255.255.255.255"
  56. #define User_ESP32_UDPServer_PORT "9090"
  57. char* find_str(void *src, int size,char *str);
  58. void WIFI_set_ssid(void);
  59. void WIFI_process(void);
  60. void WIFI_set_CloseConnect(void);
  61. /* 热点配网(SoftAP WiFi配网): 按键长按30s触发 */
  62. uint8_t WIFI_provision_request(void);
  63. uint8_t WIFI_provision_active(void);
  64. int WIFI_Send_Data(uint8_t *data, uint16_t len, uint8_t flag);
  65. int WIFI_Send_MSG(uint8_t*msgHead,uint8_t *data, uint8_t * crc, uint16_t len);
  66. int WIFI_ReSend(void);
  67. int WIFI_SendIlde(void);
  68. int my_sprintf(char *pdes,unsigned int len, const char* str, ...);
  69. #endif /* ESP32_WROOM_32D_H_ */