pengfei wu
/
ESP8266Program
For test
Diff: ESP8266.h
- Revision:
- 29:75185b05d6a4
- Parent:
- 28:c25aff31dcc5
- Child:
- 30:46a560b71e61
diff -r c25aff31dcc5 -r 75185b05d6a4 ESP8266.h --- a/ESP8266.h Wed Feb 04 13:35:35 2015 +0000 +++ b/ESP8266.h Wed Feb 04 14:27:30 2015 +0000 @@ -42,10 +42,18 @@ class ESP8266 { - public: - ESP8266(PinName tx, PinName rx); - - bool begin(void); +public: + + /** + * Constructor. + * + * Need an serial port for communication between MCU and ESP8266. + * + * @param tx - the TX of serial port. + * @param rx - the RX of serial port. + * @param baud_rate - the baud rate of communication(default 9600). + */ + ESP8266(PinName tx, PinName rx, int baud_rate = 9600); //init port bool init(uint8_t mode, String ssid, String pwd, uint8_t chl = ESP8266_CHANNEL_7, uint8_t ecn = ESP8266_ECN_WAP_WAP2_PSK); @@ -61,7 +69,7 @@ int recvData(char *buf); //reset the module - void reset(void); + bool reset(void); //set the working mode of module bool confMode(uint8_t mode); @@ -114,12 +122,12 @@ //set the parameter of server bool confServer(uint8_t mode, int port); - // get m_chl_id - int getChannelID(void); + // get m_mux_id + int getMuxID(void); private: - ArduinoSerial m_esp_uart; - int m_chl_id; + ArduinoSerial m_uart; + int m_mux_id; }; #endif /* #ifndef __ESP8266_H__ */ \ No newline at end of file