grove_esp8266

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers grove_esp8266.h Source File

grove_esp8266.h

00001 
00002 
00003 
00004 #ifndef __GROVE_ESP8266_H__
00005 #define __GROVE_ESP8266_H__
00006 
00007 #include "suli2.h"
00008 
00009 
00010 #define RX_BUF_LEN          1500//the maximum message length of ESP8266 is 1460
00011 #define CONTENT_BUF_LEN     1500//the maximum message length of ESP8266 is 1460
00012 
00013 #define millis()   (us_ticker_read()/1000)
00014 
00015 typedef enum
00016 {
00017     RECV_DATA,
00018     RECV_CMD,
00019     RECV_END,
00020 }ESP8266_RecvStateMachine;
00021 
00022 typedef void (*user_cb_fun_ptr)(char *, unsigned int);//jacly add
00023 
00024 void grove_esp8266_init(UART_T *uart, int pintx, int pinrx);
00025 bool grove_esp8266_write_setup(UART_T *uart);
00026 void grove_esp8266_write_setcbfun(user_cb_fun_ptr fun);
00027 bool grove_esp8266_attach_event_handler(CALLBACK_T handler);
00028 bool grove_esp8266_read_getversion(UART_T *uart);
00029 bool grove_esp8266_write_joinwifi(UART_T *uart, char *ssid, char *pwd);
00030 bool grove_esp8266_write_socketasclient(UART_T *uart, char *ip, unsigned int port);
00031 bool grove_esp8266_read_aplist(UART_T *uart);
00032 bool grove_esp8266_write_msg(UART_T *uart, char *msg, unsigned int len);
00033 
00034 
00035 #endif