123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- #ifndef __BSP_ESP8266_H
- #define __BSP_ESP8266_H
- #include "stm32f1xx_hal.h"
- //#include "common.h"
- #include <stdio.h>
- #include <stdbool.h>
- #include "sys.h"
- #if defined ( __CC_ARM )
- #pragma anon_unions
- #endif
- /******************************* ESP8266 数据类型定义 ***************************/
- typedef enum{
- STA,
- AP,
- STA_AP
- } ENUM_Net_ModeTypeDef;
- typedef enum{
- enumTCP,
- enumUDP,
- } ENUM_NetPro_TypeDef;
-
- typedef enum{
- Multiple_ID_0 = 0,
- Multiple_ID_1 = 1,
- Multiple_ID_2 = 2,
- Multiple_ID_3 = 3,
- Multiple_ID_4 = 4,
- Single_ID_0 = 5,
- } ENUM_ID_NO_TypeDef;
-
- typedef enum{
- OPEN = 0,
- WEP = 1,
- WPA_PSK = 2,
- WPA2_PSK = 3,
- WPA_WPA2_PSK = 4,
- } ENUM_AP_PsdMode_TypeDef;
- /******************************* ESP8266 外部全局变量声明 ***************************/
- #define RX_BUF_MAX_LEN 1024 //最大接收缓存字节数
- extern struct STRUCT_USARTx_Fram //串口数据帧的处理结构体
- {
- char Data_RX_BUF [ RX_BUF_MAX_LEN ];
-
- union {
- __IO u16 InfAll;
- struct {
- __IO u16 FramLength :15; // 14:0
- __IO u16 FramFinishFlag :1; // 15
- } InfBit;
- };
-
- } strEsp8266_Fram_Record;
- /******************************** ESP8266 连接引脚定义 ***********************************/
- /*********************************************** ESP8266 函数宏定义 *******************************************/
- #define macESP8266_USARTx
- #define macESP8266_Usart( fmt, ... ) USART_printf ( macESP8266_USARTx, fmt, ##__VA_ARGS__ )
- #define macPC_Usart( fmt, ... ) printf ( fmt, ##__VA_ARGS__ )
- #define ESP8266_IO0 PCin(11) //ESP8266 IO0管脚
- #define ESP8266_RST PCout(10) //ESP8266复位管脚 低电平复位有效
- /****************************************** ESP8266 函数声明 ***********************************************/
- void ESP8266_Init ( void );
- void ESP8266_Rst ( void );
- bool ESP8266_Cmd ( char * cmd, char * reply1, char * reply2, u32 waittime );
- void ESP8266_AT_Test ( void );
- bool ESP8266_Net_Mode_Choose ( ENUM_Net_ModeTypeDef enumMode );
- bool ESP8266_JoinAP ( char * pSSID, char * pPassWord );
- bool ESP8266_BuildAP ( char * pSSID, char * pPassWord, ENUM_AP_PsdMode_TypeDef enunPsdMode );
- bool ESP8266_Enable_MultipleId ( FunctionalState enumEnUnvarnishTx );
- bool ESP8266_Link_Server ( ENUM_NetPro_TypeDef enumE, char * ip, char * ComNum, ENUM_ID_NO_TypeDef id);
- bool ESP8266_StartOrShutServer ( FunctionalState enumMode, char * pPortNum, char * pTimeOver );
- uint8_t ESP8266_Get_LinkStatus ( void );
- uint8_t ESP8266_Get_IdLinkStatus ( void );
- uint8_t ESP8266_Inquire_ApIp ( char * pApIp, uint8_t ucArrayLength );
- bool ESP8266_UnvarnishSend ( void );
- void ESP8266_ExitUnvarnishSend ( void );
- bool ESP8266_SendString ( FunctionalState enumEnUnvarnishTx, char * pStr, u32 ulStrLength, ENUM_ID_NO_TypeDef ucId );
- char * ESP8266_ReceiveString ( FunctionalState enumEnUnvarnishTx );
- uint8_t ESP8266_CWLIF ( char * pStaIp );
- uint8_t ESP8266_CIPAP ( char * pApIp );
- #endif
|