LoRa Access Point 1.5.2018
Dependencies: mbed ds3231 SX1276Lib_LoRa_Access_Point
Diff: ESP8266.h
- Revision:
- 0:ea088908ad26
- Child:
- 1:7543af31b91f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ESP8266.h Wed Apr 18 20:33:15 2018 +0000 @@ -0,0 +1,43 @@ +#ifndef ESP8266_H +#define ESP8266_H + +#include "mbed.h" +#include "HC05.h" + +#define BAUDRATE 115200 +#define BUFFER_SIZE 1024 + +class ESP8266 +{ +private: + Serial wifiUart; + DigitalInOut wifiReset; + Timer responseTimer; + Ticker setTicker; + char buffer[BUFFER_SIZE]; + char serverIpAddress[64]; // ip adresa servera, command + char wifiSettings[64]; // wifi connection + volatile uint16_t pt; + char* response; + volatile bool okResponse; + volatile bool receiveResponse; + volatile bool setServerIp; + volatile bool setWifiSettings; + + void ClearBuffer(); + void RxWifiInterrupt(); +public: + ESP8266(PinName tx, PinName rx, PinName reset); + ESP8266(); + void Init(); + void SendCommand(char* command, char* answer ,int timeoutMs); + void SetIpOfServer(char* command); + void SetWiFiConnection(char* command); + void SendMessage(char* message); + void Test(); + void CheckSettings(); +}; + +extern ESP8266 wifi; + +#endif \ No newline at end of file