Commit f51b4725 authored by HuangRui's avatar HuangRui
Browse files
parents 6986d9e5 7c820b4e
...@@ -27,8 +27,8 @@ Tencent QQ group: 309957875<br /> ...@@ -27,8 +27,8 @@ Tencent QQ group: 309957875<br />
- fix wifi smart connect - fix wifi smart connect
- add spi module (done) - add spi module (done)
- add mqtt module (done) - add mqtt module (done)
- add coap module - add coap module (in coap branch)
- cross compiler - cross compiler (done)
# Change log # Change log
2015-02-13<br /> 2015-02-13<br />
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
#define NODE_VERSION_MAJOR 0U #define NODE_VERSION_MAJOR 0U
#define NODE_VERSION_MINOR 9U #define NODE_VERSION_MINOR 9U
#define NODE_VERSION_REVISION 5U #define NODE_VERSION_REVISION 6U
#define NODE_VERSION_INTERNAL 0U #define NODE_VERSION_INTERNAL 0U
#define NODE_VERSION "NodeMCU 0.9.5" #define NODE_VERSION "NodeMCU 0.9.6"
#define BUILD_DATE "build 20150213" #define BUILD_DATE "build 20150216"
// #define DEVKIT_VERSION_0_9 1 // define this only if you use NodeMCU devkit v0.9 // #define DEVKIT_VERSION_0_9 1 // define this only if you use NodeMCU devkit v0.9
...@@ -77,8 +77,6 @@ ...@@ -77,8 +77,6 @@
#endif /* LUA_USE_DEVICE_DRIVER */ #endif /* LUA_USE_DEVICE_DRIVER */
// #define LUA_NUMBER_INTEGRAL
#define LUA_OPTRAM #define LUA_OPTRAM
#ifdef LUA_OPTRAM #ifdef LUA_OPTRAM
#define LUA_OPTIMIZE_MEMORY 2 #define LUA_OPTIMIZE_MEMORY 2
......
...@@ -692,6 +692,8 @@ LUALIB_API int luaL_loadfsfile (lua_State *L, const char *filename) { ...@@ -692,6 +692,8 @@ LUALIB_API int luaL_loadfsfile (lua_State *L, const char *filename) {
lf.f = fs_open(filename, FS_RDONLY); lf.f = fs_open(filename, FS_RDONLY);
if (lf.f < FS_OPEN_OK) return errfsfile(L, "open", fnameindex); if (lf.f < FS_OPEN_OK) return errfsfile(L, "open", fnameindex);
} }
// if(fs_size(lf.f)>LUAL_BUFFERSIZE)
// return luaL_error(L, "file is too big");
c = fs_getc(lf.f); c = fs_getc(lf.f);
if (c == '#') { /* Unix exec. file? */ if (c == '#') { /* Unix exec. file? */
lf.extraline = 1; lf.extraline = 1;
......
...@@ -542,7 +542,7 @@ extern int readline4lua(const char *prompt, char *buffer, int length); ...@@ -542,7 +542,7 @@ extern int readline4lua(const char *prompt, char *buffer, int length);
/* /*
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
*/ */
#define LUAL_BUFFERSIZE (BUFSIZ*4) #define LUAL_BUFFERSIZE ((BUFSIZ)*4)
/* }================================================================== */ /* }================================================================== */
......
/******************************************************************************
* FunctionName : espconn_init
* Description : dummy the espconn_init
* Parameters : none
* Returns : none
*******************************************************************************/
void espconn_init()
{
// dummy function, do nothing.
}
...@@ -1241,6 +1241,31 @@ static int net_socket_unhold( lua_State* L ) ...@@ -1241,6 +1241,31 @@ static int net_socket_unhold( lua_State* L )
return 0; return 0;
} }
// Lua: ip,port = sk:getpeer()
static int net_socket_getpeer( lua_State* L )
{
lnet_userdata *nud;
const char *mt = "net.socket";
nud = (lnet_userdata *)luaL_checkudata(L, 1, mt);
luaL_argcheck(L, nud, 1, "Server/Socket expected");
if(nud!=NULL && nud->pesp_conn!=NULL ){
char temp[20] = {0};
c_sprintf(temp, IPSTR, IP2STR( &(nud->pesp_conn->proto.tcp->remote_ip) ) );
if ( nud->pesp_conn->proto.tcp->remote_port != 0 ) {
lua_pushstring( L, temp );
lua_pushinteger( L, nud->pesp_conn->proto.tcp->remote_port );
} else {
lua_pushnil( L );
lua_pushnil( L );
}
} else {
lua_pushnil( L );
lua_pushnil( L );
}
return 2;
}
// Lua: socket:dns( string, function(ip) ) // Lua: socket:dns( string, function(ip) )
static int net_socket_dns( lua_State* L ) static int net_socket_dns( lua_State* L )
{ {
...@@ -1302,6 +1327,7 @@ static const LUA_REG_TYPE net_socket_map[] = ...@@ -1302,6 +1327,7 @@ static const LUA_REG_TYPE net_socket_map[] =
{ LSTRKEY( "hold" ), LFUNCVAL ( net_socket_hold ) }, { LSTRKEY( "hold" ), LFUNCVAL ( net_socket_hold ) },
{ LSTRKEY( "unhold" ), LFUNCVAL ( net_socket_unhold ) }, { LSTRKEY( "unhold" ), LFUNCVAL ( net_socket_unhold ) },
{ LSTRKEY( "dns" ), LFUNCVAL ( net_socket_dns ) }, { LSTRKEY( "dns" ), LFUNCVAL ( net_socket_dns ) },
{ LSTRKEY( "getpeer" ), LFUNCVAL ( net_socket_getpeer ) },
// { LSTRKEY( "delete" ), LFUNCVAL ( net_socket_delete ) }, // { LSTRKEY( "delete" ), LFUNCVAL ( net_socket_delete ) },
{ LSTRKEY( "__gc" ), LFUNCVAL ( net_socket_delete ) }, { LSTRKEY( "__gc" ), LFUNCVAL ( net_socket_delete ) },
#if LUA_OPTIMIZE_MEMORY > 0 #if LUA_OPTIMIZE_MEMORY > 0
......
...@@ -95,6 +95,7 @@ static int node_chipid( lua_State* L ) ...@@ -95,6 +95,7 @@ static int node_chipid( lua_State* L )
// Lua: readvdd33() // Lua: readvdd33()
static int node_readvdd33( lua_State* L ) static int node_readvdd33( lua_State* L )
{ {
// uint32_t vdd33 = system_get_vdd33();
uint32_t vdd33 = readvdd33(); uint32_t vdd33 = readvdd33();
lua_pushinteger(L, vdd33); lua_pushinteger(L, vdd33);
return 1; return 1;
......
...@@ -24,6 +24,7 @@ SPIFlashInfo flash_get_info(void) ...@@ -24,6 +24,7 @@ SPIFlashInfo flash_get_info(void)
{ {
volatile SPIFlashInfo spi_flash_info ICACHE_STORE_ATTR; volatile SPIFlashInfo spi_flash_info ICACHE_STORE_ATTR;
spi_flash_info = *((SPIFlashInfo *)(FLASH_MAP_START_ADDRESS)); spi_flash_info = *((SPIFlashInfo *)(FLASH_MAP_START_ADDRESS));
// spi_flash_read(0, (uint32 *)(& spi_flash_info), sizeof(spi_flash_info));
return spi_flash_info; return spi_flash_info;
} }
...@@ -56,9 +57,11 @@ uint32_t flash_get_size_byte(void) ...@@ -56,9 +57,11 @@ uint32_t flash_get_size_byte(void)
case SIZE_32MBIT: case SIZE_32MBIT:
// 32Mbit, 4MByte // 32Mbit, 4MByte
flash_size = 4 * 1024 * 1024; flash_size = 4 * 1024 * 1024;
break;
case SIZE_64MBIT: case SIZE_64MBIT:
// 64Mbit, 8MByte // 64Mbit, 8MByte
flash_size = 8 * 1024 * 1024; flash_size = 8 * 1024 * 1024;
break;
case SIZE_128MBIT: case SIZE_128MBIT:
// 128Mbit, 16MByte // 128Mbit, 16MByte
flash_size = 16 * 1024 * 1024; flash_size = 16 * 1024 * 1024;
...@@ -131,7 +134,15 @@ bool flash_set_size_byte(uint32_t size) ...@@ -131,7 +134,15 @@ bool flash_set_size_byte(uint32_t size)
uint16_t flash_get_sec_num(void) uint16_t flash_get_sec_num(void)
{ {
return flash_get_size_byte() / SPI_FLASH_SEC_SIZE; //static uint16_t sec_num = 0;
// return flash_get_size_byte() / (SPI_FLASH_SEC_SIZE);
// c_printf("\nflash_get_size_byte()=%d\n", ( flash_get_size_byte() / (SPI_FLASH_SEC_SIZE) ));
// if( sec_num == 0 )
//{
// sec_num = 4 * 1024 * 1024 / (SPI_FLASH_SEC_SIZE);
//}
//return sec_num;
return ( flash_get_size_byte() / (SPI_FLASH_SEC_SIZE) );
} }
uint8_t flash_get_mode(void) uint8_t flash_get_mode(void)
...@@ -232,13 +243,14 @@ bool flash_self_destruct(void) ...@@ -232,13 +243,14 @@ bool flash_self_destruct(void)
return true; return true;
} }
uint8_t byte_of_aligned_array(const uint8_t* aligned_array, uint32_t index) uint8_t byte_of_aligned_array(const uint8_t *aligned_array, uint32_t index)
{ {
if( (((uint32_t)aligned_array)%4) != 0 ){ if ( (((uint32_t)aligned_array) % 4) != 0 )
{
NODE_DBG("aligned_array is not 4-byte aligned.\n"); NODE_DBG("aligned_array is not 4-byte aligned.\n");
return 0; return 0;
} }
uint32_t v = ((uint32_t *)aligned_array)[ index/4 ]; uint32_t v = ((uint32_t *)aligned_array)[ index / 4 ];
uint8_t *p = (uint8_t *) (&v); uint8_t *p = (uint8_t *) (&v);
return p[ (index%4) ]; return p[ (index % 4) ];
} }
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "ets_sys.h" #include "ets_sys.h"
#include "user_config.h" #include "user_config.h"
#include "cpu_esp8266.h" #include "cpu_esp8266.h"
#define FLASH_MAP_START_ADDRESS (INTERNAL_FLASH_START_ADDRESS) #define FLASH_MAP_START_ADDRESS (INTERNAL_FLASH_START_ADDRESS)
/****************************************************************************** /******************************************************************************
...@@ -29,8 +30,8 @@ ...@@ -29,8 +30,8 @@
typedef struct typedef struct
{ {
uint8_t unknown0; uint8_t e9;
uint8_t unknown1; uint8_t segments;
enum enum
{ {
MODE_QIO = 0, MODE_QIO = 0,
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#define fs_format myspiffs_format #define fs_format myspiffs_format
#define fs_check myspiffs_check #define fs_check myspiffs_check
#define fs_rename myspiffs_rename #define fs_rename myspiffs_rename
#define fs_size myspiffs_size
#define FS_NAME_MAX_LENGTH SPIFFS_OBJ_NAME_LEN #define FS_NAME_MAX_LENGTH SPIFFS_OBJ_NAME_LEN
......
...@@ -165,6 +165,9 @@ void myspiffs_clearerr( int fd ){ ...@@ -165,6 +165,9 @@ void myspiffs_clearerr( int fd ){
int myspiffs_rename( const char *old, const char *newname ){ int myspiffs_rename( const char *old, const char *newname ){
return SPIFFS_rename(&fs, (char *)old, (char *)newname); return SPIFFS_rename(&fs, (char *)old, (char *)newname);
} }
size_t myspiffs_size( int fd ){
return SPIFFS_size(&fs, (spiffs_file)fd);
}
#if 0 #if 0
void test_spiffs() { void test_spiffs() {
char buf[12]; char buf[12];
......
...@@ -423,6 +423,7 @@ s32_t SPIFFS_check(spiffs *fs); ...@@ -423,6 +423,7 @@ s32_t SPIFFS_check(spiffs *fs);
*/ */
s32_t SPIFFS_eof(spiffs *fs, spiffs_file fh); s32_t SPIFFS_eof(spiffs *fs, spiffs_file fh);
s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh); s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh);
s32_t SPIFFS_size(spiffs *fs, spiffs_file fh);
#if SPIFFS_TEST_VISUALISATION #if SPIFFS_TEST_VISUALISATION
/** /**
...@@ -465,5 +466,6 @@ int myspiffs_error( int fd ); ...@@ -465,5 +466,6 @@ int myspiffs_error( int fd );
void myspiffs_clearerr( int fd ); void myspiffs_clearerr( int fd );
int myspiffs_check( void ); int myspiffs_check( void );
int myspiffs_rename( const char *old, const char *newname ); int myspiffs_rename( const char *old, const char *newname );
size_t myspiffs_size( int fd );
#endif /* SPIFFS_H_ */ #endif /* SPIFFS_H_ */
...@@ -798,6 +798,25 @@ s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh) { ...@@ -798,6 +798,25 @@ s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh) {
return res; return res;
} }
s32_t SPIFFS_size(spiffs *fs, spiffs_file fh) {
SPIFFS_API_CHECK_MOUNT(fs);
SPIFFS_LOCK(fs);
spiffs_fd *fd;
s32_t res;
res = spiffs_fd_get(fs, fh, &fd);
SPIFFS_API_CHECK_RES(fs, res);
#if SPIFFS_CACHE_WR
spiffs_fflush_cache(fs, fh);
#endif
res = fd->size;
SPIFFS_UNLOCK(fs);
return res;
}
#if SPIFFS_TEST_VISUALISATION #if SPIFFS_TEST_VISUALISATION
s32_t SPIFFS_vis(spiffs *fs) { s32_t SPIFFS_vis(spiffs *fs) {
s32_t res = SPIFFS_OK; s32_t res = SPIFFS_OK;
......
#ifndef __ESPCONN_H__ #ifndef __ESPCONN_H__
#define __ESPCONN_H__ #define __ESPCONN_H__
#include "lwip/ip_addr.h" #include "lwip/ip_addr.h"
typedef sint8 err_t; typedef sint8 err_t;
typedef void *espconn_handle; typedef void *espconn_handle;
typedef void (* espconn_connect_callback)(void *arg); typedef void (* espconn_connect_callback)(void *arg);
typedef void (* espconn_reconnect_callback)(void *arg, sint8 err); typedef void (* espconn_reconnect_callback)(void *arg, sint8 err);
/* Definitions for error constants. */ /* Definitions for error constants. */
#define ESPCONN_OK 0 /* No error, everything OK. */ #define ESPCONN_OK 0 /* No error, everything OK. */
#define ESPCONN_MEM -1 /* Out of memory error. */ #define ESPCONN_MEM -1 /* Out of memory error. */
#define ESPCONN_TIMEOUT -3 /* Timeout. */ #define ESPCONN_TIMEOUT -3 /* Timeout. */
#define ESPCONN_RTE -4 /* Routing problem. */ #define ESPCONN_RTE -4 /* Routing problem. */
#define ESPCONN_INPROGRESS -5 /* Operation in progress */ #define ESPCONN_INPROGRESS -5 /* Operation in progress */
#define ESPCONN_ABRT -8 /* Connection aborted. */ #define ESPCONN_ABRT -8 /* Connection aborted. */
#define ESPCONN_RST -9 /* Connection reset. */ #define ESPCONN_RST -9 /* Connection reset. */
#define ESPCONN_CLSD -10 /* Connection closed. */ #define ESPCONN_CLSD -10 /* Connection closed. */
#define ESPCONN_CONN -11 /* Not connected. */ #define ESPCONN_CONN -11 /* Not connected. */
#define ESPCONN_ARG -12 /* Illegal argument. */ #define ESPCONN_ARG -12 /* Illegal argument. */
#define ESPCONN_ISCONN -15 /* Already connected. */ #define ESPCONN_ISCONN -15 /* Already connected. */
/** Protocol family and type of the espconn */ /** Protocol family and type of the espconn */
enum espconn_type { enum espconn_type {
ESPCONN_INVALID = 0, ESPCONN_INVALID = 0,
/* ESPCONN_TCP Group */ /* ESPCONN_TCP Group */
ESPCONN_TCP = 0x10, ESPCONN_TCP = 0x10,
/* ESPCONN_UDP Group */ /* ESPCONN_UDP Group */
ESPCONN_UDP = 0x20, ESPCONN_UDP = 0x20,
}; };
/** Current state of the espconn. Non-TCP espconn are always in state ESPCONN_NONE! */ /** Current state of the espconn. Non-TCP espconn are always in state ESPCONN_NONE! */
enum espconn_state { enum espconn_state {
ESPCONN_NONE, ESPCONN_NONE,
ESPCONN_WAIT, ESPCONN_WAIT,
ESPCONN_LISTEN, ESPCONN_LISTEN,
ESPCONN_CONNECT, ESPCONN_CONNECT,
ESPCONN_WRITE, ESPCONN_WRITE,
ESPCONN_READ, ESPCONN_READ,
ESPCONN_CLOSE ESPCONN_CLOSE
}; };
typedef struct _esp_tcp { typedef struct _esp_tcp {
int remote_port; int remote_port;
int local_port; int local_port;
uint8 local_ip[4]; uint8 local_ip[4];
uint8 remote_ip[4]; uint8 remote_ip[4];
espconn_connect_callback connect_callback; espconn_connect_callback connect_callback;
espconn_reconnect_callback reconnect_callback; espconn_reconnect_callback reconnect_callback;
espconn_connect_callback disconnect_callback; espconn_connect_callback disconnect_callback;
} esp_tcp; espconn_connect_callback write_finish_fn;
} esp_tcp;
typedef struct _esp_udp {
int remote_port; typedef struct _esp_udp {
int local_port; int remote_port;
uint8 local_ip[4]; int local_port;
uint8 remote_ip[4]; uint8 local_ip[4];
} esp_udp; uint8 remote_ip[4];
} esp_udp;
typedef struct _remot_info{
enum espconn_state state; typedef struct _remot_info{
int remote_port; enum espconn_state state;
uint8 remote_ip[4]; int remote_port;
}remot_info; uint8 remote_ip[4];
}remot_info;
/** A callback prototype to inform about events for a espconn */
typedef void (* espconn_recv_callback)(void *arg, char *pdata, unsigned short len); /** A callback prototype to inform about events for a espconn */
typedef void (* espconn_sent_callback)(void *arg); typedef void (* espconn_recv_callback)(void *arg, char *pdata, unsigned short len);
typedef void (* espconn_sent_callback)(void *arg);
/** A espconn descriptor */
struct espconn { /** A espconn descriptor */
/** type of the espconn (TCP, UDP) */ struct espconn {
enum espconn_type type; /** type of the espconn (TCP, UDP) */
/** current state of the espconn */ enum espconn_type type;
enum espconn_state state; /** current state of the espconn */
union { enum espconn_state state;
esp_tcp *tcp; union {
esp_udp *udp; esp_tcp *tcp;
} proto; esp_udp *udp;
/** A callback function that is informed about events for this espconn */ } proto;
espconn_recv_callback recv_callback; /** A callback function that is informed about events for this espconn */
espconn_sent_callback sent_callback; espconn_recv_callback recv_callback;
uint8 link_cnt; espconn_sent_callback sent_callback;
void *reverse; uint8 link_cnt;
}; void *reverse;
};
enum espconn_option{
ESPCONN_REUSEADDR = 1, enum espconn_option{
ESPCONN_NODELAY, ESPCONN_START = 0x00,
ESPCONN_END ESPCONN_REUSEADDR = 0x01,
}; ESPCONN_NODELAY = 0x02,
ESPCONN_COPY = 0x04,
/****************************************************************************** ESPCONN_END
* FunctionName : espconn_connect };
* Description : The function given as the connect
* Parameters : espconn -- the espconn used to listen the connection /******************************************************************************
* Returns : none * FunctionName : espconn_connect
*******************************************************************************/ * Description : The function given as the connect
* Parameters : espconn -- the espconn used to listen the connection
sint8 espconn_connect(struct espconn *espconn); * Returns : none
*******************************************************************************/
/******************************************************************************
* FunctionName : espconn_disconnect sint8 espconn_connect(struct espconn *espconn);
* Description : disconnect with host
* Parameters : espconn -- the espconn used to disconnect the connection /******************************************************************************
* Returns : none * FunctionName : espconn_disconnect
*******************************************************************************/ * Description : disconnect with host
* Parameters : espconn -- the espconn used to disconnect the connection
sint8 espconn_disconnect(struct espconn *espconn); * Returns : none
*******************************************************************************/
/******************************************************************************
* FunctionName : espconn_delete sint8 espconn_disconnect(struct espconn *espconn);
* Description : disconnect with host
* Parameters : espconn -- the espconn used to disconnect the connection /******************************************************************************
* Returns : none * FunctionName : espconn_delete
*******************************************************************************/ * Description : disconnect with host
* Parameters : espconn -- the espconn used to disconnect the connection
sint8 espconn_delete(struct espconn *espconn); * Returns : none
*******************************************************************************/
/******************************************************************************
* FunctionName : espconn_accept sint8 espconn_delete(struct espconn *espconn);
* Description : The function given as the listen
* Parameters : espconn -- the espconn used to listen the connection /******************************************************************************
* Returns : none * FunctionName : espconn_accept
*******************************************************************************/ * Description : The function given as the listen
* Parameters : espconn -- the espconn used to listen the connection
sint8 espconn_accept(struct espconn *espconn); * Returns : none
*******************************************************************************/
/******************************************************************************
* FunctionName : espconn_create sint8 espconn_accept(struct espconn *espconn);
* Description : sent data for client or server
* Parameters : espconn -- espconn to the data transmission /******************************************************************************
* Returns : result * FunctionName : espconn_create
*******************************************************************************/ * Description : sent data for client or server
* Parameters : espconn -- espconn to the data transmission
sint8 espconn_create(struct espconn *espconn); * Returns : result
*******************************************************************************/
/******************************************************************************
* FunctionName : espconn_tcp_get_max_con sint8 espconn_create(struct espconn *espconn);
* Description : get the number of simulatenously active TCP connections
* Parameters : none /******************************************************************************
* Returns : none * FunctionName : espconn_tcp_get_max_con
*******************************************************************************/ * Description : get the number of simulatenously active TCP connections
* Parameters : none
uint8 espconn_tcp_get_max_con(void); * Returns : none
*******************************************************************************/
/******************************************************************************
* FunctionName : espconn_tcp_set_max_con uint8 espconn_tcp_get_max_con(void);
* Description : set the number of simulatenously active TCP connections
* Parameters : num -- total number /******************************************************************************
* Returns : none * FunctionName : espconn_tcp_set_max_con
*******************************************************************************/ * Description : set the number of simulatenously active TCP connections
* Parameters : num -- total number
sint8 espconn_tcp_set_max_con(uint8 num); * Returns : none
*******************************************************************************/
/******************************************************************************
* FunctionName : espconn_tcp_get_max_con_allow sint8 espconn_tcp_set_max_con(uint8 num);
* Description : get the count of simulatenously active connections on the server
* Parameters : espconn -- espconn to get the count /******************************************************************************
* Returns : result * FunctionName : espconn_tcp_get_max_con_allow
*******************************************************************************/ * Description : get the count of simulatenously active connections on the server
* Parameters : espconn -- espconn to get the count
sint8 espconn_tcp_get_max_con_allow(struct espconn *espconn); * Returns : result
*******************************************************************************/
/******************************************************************************
* FunctionName : espconn_tcp_set_max_con_allow sint8 espconn_tcp_get_max_con_allow(struct espconn *espconn);
* Description : set the count of simulatenously active connections on the server
* Parameters : espconn -- espconn to set the count /******************************************************************************
* num -- support the connection number * FunctionName : espconn_tcp_set_max_con_allow
* Returns : result * Description : set the count of simulatenously active connections on the server
*******************************************************************************/ * Parameters : espconn -- espconn to set the count
* num -- support the connection number
sint8 espconn_tcp_set_max_con_allow(struct espconn *espconn, uint8 num); * Returns : result
*******************************************************************************/
/******************************************************************************
* FunctionName : espconn_regist_time sint8 espconn_tcp_set_max_con_allow(struct espconn *espconn, uint8 num);
* Description : used to specify the time that should be called when don't recv data
* Parameters : espconn -- the espconn used to the connection /******************************************************************************
* interval -- the timer when don't recv data * FunctionName : espconn_regist_time
* Returns : none * Description : used to specify the time that should be called when don't recv data
*******************************************************************************/ * Parameters : espconn -- the espconn used to the connection
* interval -- the timer when don't recv data
sint8 espconn_regist_time(struct espconn *espconn, uint32 interval, uint8 type_flag); * Returns : none
*******************************************************************************/
/******************************************************************************
* FunctionName : espconn_get_connection_info sint8 espconn_regist_time(struct espconn *espconn, uint32 interval, uint8 type_flag);
* Description : used to specify the function that should be called when disconnect
* Parameters : espconn -- espconn to set the err callback /******************************************************************************
* discon_cb -- err callback function to call when err * FunctionName : espconn_get_connection_info
* Returns : none * Description : used to specify the function that should be called when disconnect
*******************************************************************************/ * Parameters : espconn -- espconn to set the err callback
* discon_cb -- err callback function to call when err
sint8 espconn_get_connection_info(struct espconn *pespconn, remot_info **pcon_info, uint8 typeflags); * Returns : none
*******************************************************************************/
/******************************************************************************
* FunctionName : espconn_regist_sentcb sint8 espconn_get_connection_info(struct espconn *pespconn, remot_info **pcon_info, uint8 typeflags);
* Description : Used to specify the function that should be called when data
* has been successfully delivered to the remote host. /******************************************************************************
* Parameters : struct espconn *espconn -- espconn to set the sent callback * FunctionName : espconn_regist_sentcb
* espconn_sent_callback sent_cb -- sent callback function to * Description : Used to specify the function that should be called when data
* call for this espconn when data is successfully sent * has been successfully delivered to the remote host.
* Returns : none * Parameters : struct espconn *espconn -- espconn to set the sent callback
*******************************************************************************/ * espconn_sent_callback sent_cb -- sent callback function to
* call for this espconn when data is successfully sent
sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callback sent_cb); * Returns : none
*******************************************************************************/
/******************************************************************************
* FunctionName : espconn_sent sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callback sent_cb);
* Description : sent data for client or server
* Parameters : espconn -- espconn to set for client or server /******************************************************************************
* psent -- data to send * FunctionName : espconn_regist_sentcb
* length -- length of data to send * Description : Used to specify the function that should be called when data
* Returns : none * has been successfully delivered to the remote host.
*******************************************************************************/ * Parameters : espconn -- espconn to set the sent callback
* sent_cb -- sent callback function to call for this espconn
sint8 espconn_sent(struct espconn *espconn, uint8 *psent, uint16 length); * when data is successfully sent
* Returns : none
/****************************************************************************** *******************************************************************************/
* FunctionName : espconn_regist_connectcb
* Description : used to specify the function that should be called when sint8 espconn_regist_write_finish(struct espconn *espconn, espconn_connect_callback write_finish_fn);
* connects to host.
* Parameters : espconn -- espconn to set the connect callback /******************************************************************************
* connect_cb -- connected callback function to call when connected * FunctionName : espconn_sent
* Returns : none * Description : sent data for client or server
*******************************************************************************/ * Parameters : espconn -- espconn to set for client or server
* psent -- data to send
sint8 espconn_regist_connectcb(struct espconn *espconn, espconn_connect_callback connect_cb); * length -- length of data to send
* Returns : none
/****************************************************************************** *******************************************************************************/
* FunctionName : espconn_regist_recvcb
* Description : used to specify the function that should be called when recv sint8 espconn_sent(struct espconn *espconn, uint8 *psent, uint16 length);
* data from host.
* Parameters : espconn -- espconn to set the recv callback /******************************************************************************
* recv_cb -- recv callback function to call when recv data * FunctionName : espconn_regist_connectcb
* Returns : none * Description : used to specify the function that should be called when
*******************************************************************************/ * connects to host.
* Parameters : espconn -- espconn to set the connect callback
sint8 espconn_regist_recvcb(struct espconn *espconn, espconn_recv_callback recv_cb); * connect_cb -- connected callback function to call when connected
* Returns : none
/****************************************************************************** *******************************************************************************/
* FunctionName : espconn_regist_reconcb
* Description : used to specify the function that should be called when connection sint8 espconn_regist_connectcb(struct espconn *espconn, espconn_connect_callback connect_cb);
* because of err disconnect.
* Parameters : espconn -- espconn to set the err callback /******************************************************************************
* recon_cb -- err callback function to call when err * FunctionName : espconn_regist_recvcb
* Returns : none * Description : used to specify the function that should be called when recv
*******************************************************************************/ * data from host.
* Parameters : espconn -- espconn to set the recv callback
sint8 espconn_regist_reconcb(struct espconn *espconn, espconn_reconnect_callback recon_cb); * recv_cb -- recv callback function to call when recv data
* Returns : none
/****************************************************************************** *******************************************************************************/
* FunctionName : espconn_regist_disconcb
* Description : used to specify the function that should be called when disconnect sint8 espconn_regist_recvcb(struct espconn *espconn, espconn_recv_callback recv_cb);
* Parameters : espconn -- espconn to set the err callback
* discon_cb -- err callback function to call when err /******************************************************************************
* Returns : none * FunctionName : espconn_regist_reconcb
*******************************************************************************/ * Description : used to specify the function that should be called when connection
* because of err disconnect.
sint8 espconn_regist_disconcb(struct espconn *espconn, espconn_connect_callback discon_cb); * Parameters : espconn -- espconn to set the err callback
* recon_cb -- err callback function to call when err
/****************************************************************************** * Returns : none
* FunctionName : espconn_port *******************************************************************************/
* Description : access port value for client so that we don't end up bouncing
* all connections at the same time . sint8 espconn_regist_reconcb(struct espconn *espconn, espconn_reconnect_callback recon_cb);
* Parameters : none
* Returns : access port value /******************************************************************************
*******************************************************************************/ * FunctionName : espconn_regist_disconcb
* Description : used to specify the function that should be called when disconnect
uint32 espconn_port(void); * Parameters : espconn -- espconn to set the err callback
* discon_cb -- err callback function to call when err
/****************************************************************************** * Returns : none
* FunctionName : espconn_set_opt *******************************************************************************/
* Description : access port value for client so that we don't end up bouncing
* all connections at the same time . sint8 espconn_regist_disconcb(struct espconn *espconn, espconn_connect_callback discon_cb);
* Parameters : none
* Returns : access port value /******************************************************************************
*******************************************************************************/ * FunctionName : espconn_port
* Description : access port value for client so that we don't end up bouncing
sint8 espconn_set_opt(struct espconn *espconn, uint8 opt); * all connections at the same time .
* Parameters : none
/****************************************************************************** * Returns : access port value
* TypedefName : dns_found_callback *******************************************************************************/
* Description : Callback which is invoked when a hostname is found.
* Parameters : name -- pointer to the name that was looked up. uint32 espconn_port(void);
* ipaddr -- pointer to an ip_addr_t containing the IP address of
* the hostname, or NULL if the name could not be found (or on any /******************************************************************************
* other error). * FunctionName : espconn_set_opt
* callback_arg -- a user-specified callback argument passed to * Description : access port value for client so that we don't end up bouncing
* dns_gethostbyname * all connections at the same time .
*******************************************************************************/ * Parameters : none
* Returns : access port value
typedef void (*dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *callback_arg); *******************************************************************************/
/****************************************************************************** sint8 espconn_set_opt(struct espconn *espconn, uint8 opt);
* FunctionName : espconn_gethostbyname
* Description : Resolve a hostname (string) into an IP address. /******************************************************************************
* Parameters : pespconn -- espconn to resolve a hostname * TypedefName : dns_found_callback
* hostname -- the hostname that is to be queried * Description : Callback which is invoked when a hostname is found.
* addr -- pointer to a ip_addr_t where to store the address if * Parameters : name -- pointer to the name that was looked up.
* it is already cached in the dns_table (only valid if ESPCONN_OK * ipaddr -- pointer to an ip_addr_t containing the IP address of
* is returned!) * the hostname, or NULL if the name could not be found (or on any
* found -- a callback function to be called on success, failure * other error).
* or timeout (only if ERR_INPROGRESS is returned!) * callback_arg -- a user-specified callback argument passed to
* Returns : err_t return code * dns_gethostbyname
* - ESPCONN_OK if hostname is a valid IP address string or the host *******************************************************************************/
* name is already in the local names table.
* - ESPCONN_INPROGRESS enqueue a request to be sent to the DNS server typedef void (*dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *callback_arg);
* for resolution if no errors are present.
* - ESPCONN_ARG: dns client not initialized or invalid hostname /******************************************************************************
*******************************************************************************/ * FunctionName : espconn_gethostbyname
* Description : Resolve a hostname (string) into an IP address.
err_t espconn_gethostbyname(struct espconn *pespconn, const char *hostname, ip_addr_t *addr, dns_found_callback found); * Parameters : pespconn -- espconn to resolve a hostname
* hostname -- the hostname that is to be queried
/****************************************************************************** * addr -- pointer to a ip_addr_t where to store the address if
* FunctionName : espconn_encry_connect * it is already cached in the dns_table (only valid if ESPCONN_OK
* Description : The function given as connection * is returned!)
* Parameters : espconn -- the espconn used to connect with the host * found -- a callback function to be called on success, failure
* Returns : none * or timeout (only if ERR_INPROGRESS is returned!)
*******************************************************************************/ * Returns : err_t return code
* - ESPCONN_OK if hostname is a valid IP address string or the host
sint8 espconn_secure_connect(struct espconn *espconn); * name is already in the local names table.
* - ESPCONN_INPROGRESS enqueue a request to be sent to the DNS server
/****************************************************************************** * for resolution if no errors are present.
* FunctionName : espconn_encry_disconnect * - ESPCONN_ARG: dns client not initialized or invalid hostname
* Description : The function given as the disconnection *******************************************************************************/
* Parameters : espconn -- the espconn used to disconnect with the host
* Returns : none err_t espconn_gethostbyname(struct espconn *pespconn, const char *hostname, ip_addr_t *addr, dns_found_callback found);
*******************************************************************************/
/******************************************************************************
sint8 espconn_secure_disconnect(struct espconn *espconn); * FunctionName : espconn_encry_connect
* Description : The function given as connection
/****************************************************************************** * Parameters : espconn -- the espconn used to connect with the host
* FunctionName : espconn_encry_sent * Returns : none
* Description : sent data for client or server *******************************************************************************/
* Parameters : espconn -- espconn to set for client or server
* psent -- data to send sint8 espconn_secure_connect(struct espconn *espconn);
* length -- length of data to send
* Returns : none /******************************************************************************
*******************************************************************************/ * FunctionName : espconn_encry_disconnect
* Description : The function given as the disconnection
sint8 espconn_secure_sent(struct espconn *espconn, uint8 *psent, uint16 length); * Parameters : espconn -- the espconn used to disconnect with the host
* Returns : none
/****************************************************************************** *******************************************************************************/
* FunctionName : espconn_secure_accept
* Description : The function given as the listen sint8 espconn_secure_disconnect(struct espconn *espconn);
* Parameters : espconn -- the espconn used to listen the connection
* Returns : none /******************************************************************************
*******************************************************************************/ * FunctionName : espconn_encry_sent
* Description : sent data for client or server
sint8 espconn_secure_accept(struct espconn *espconn); * Parameters : espconn -- espconn to set for client or server
* psent -- data to send
/****************************************************************************** * length -- length of data to send
* FunctionName : espconn_igmp_join * Returns : none
* Description : join a multicast group *******************************************************************************/
* Parameters : host_ip -- the ip address of udp server
* multicast_ip -- multicast ip given by user sint8 espconn_secure_sent(struct espconn *espconn, uint8 *psent, uint16 length);
* Returns : none
*******************************************************************************/ /******************************************************************************
sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip); * FunctionName : espconn_secure_accept
* Description : The function given as the listen
/****************************************************************************** * Parameters : espconn -- the espconn used to listen the connection
* FunctionName : espconn_igmp_leave * Returns : none
* Description : leave a multicast group *******************************************************************************/
* Parameters : host_ip -- the ip address of udp server
* multicast_ip -- multicast ip given by user sint8 espconn_secure_accept(struct espconn *espconn);
* Returns : none
*******************************************************************************/ /******************************************************************************
sint8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip); * FunctionName : espconn_igmp_join
* Description : join a multicast group
/****************************************************************************** * Parameters : host_ip -- the ip address of udp server
* FunctionName : espconn_recv_hold * multicast_ip -- multicast ip given by user
* Description : hold tcp receive * Returns : none
* Parameters : espconn -- espconn to hold *******************************************************************************/
* Returns : none sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
*******************************************************************************/
sint8 espconn_recv_hold(struct espconn *pespconn); /******************************************************************************
* FunctionName : espconn_igmp_leave
/****************************************************************************** * Description : leave a multicast group
* FunctionName : espconn_recv_unhold * Parameters : host_ip -- the ip address of udp server
* Description : unhold tcp receive * multicast_ip -- multicast ip given by user
* Parameters : espconn -- espconn to unhold * Returns : none
* Returns : none *******************************************************************************/
*******************************************************************************/ sint8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
sint8 espconn_recv_unhold(struct espconn *pespconn);
/******************************************************************************
#endif * FunctionName : espconn_recv_hold
* Description : hold tcp receive
* Parameters : espconn -- espconn to hold
* Returns : none
*******************************************************************************/
sint8 espconn_recv_hold(struct espconn *pespconn);
/******************************************************************************
* FunctionName : espconn_recv_unhold
* Description : unhold tcp receive
* Parameters : espconn -- espconn to unhold
* Returns : none
*******************************************************************************/
sint8 espconn_recv_unhold(struct espconn *pespconn);
#endif
...@@ -89,6 +89,7 @@ bool system_rtc_mem_write(uint8 des_addr, const void *src_addr, uint16 save_size ...@@ -89,6 +89,7 @@ bool system_rtc_mem_write(uint8 des_addr, const void *src_addr, uint16 save_size
void system_uart_swap(void); void system_uart_swap(void);
uint16 system_adc_read(void); uint16 system_adc_read(void);
uint16 system_get_vdd33(void);
const char *system_get_sdk_version(void); const char *system_get_sdk_version(void);
......
...@@ -71,7 +71,6 @@ SECTIONS ...@@ -71,7 +71,6 @@ SECTIONS
_irom0_text_start = ABSOLUTE(.); _irom0_text_start = ABSOLUTE(.);
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text) *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
*(.literal.* .text.*) *(.literal.* .text.*)
*(.rodata2.text)
_irom0_text_end = ABSOLUTE(.); _irom0_text_end = ABSOLUTE(.);
_flash_used_end = ABSOLUTE(.); _flash_used_end = ABSOLUTE(.);
} >irom0_0_seg :irom0_0_phdr } >irom0_0_seg :irom0_0_phdr
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment