Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
ad966146
Commit
ad966146
authored
Jan 24, 2015
by
funshine
Browse files
migrate to sdk 0.9.5 release version
parent
360fb59e
Changes
35
Show whitespace changes
Inline
Side-by-side
README.md
View file @
ad966146
# **NodeMcu** #
# **NodeMcu** #
version 0.9.5
version 0.9.5
###A lua based firmware for wifi-soc esp8266
###A lua based firmware for wifi-soc esp8266
Build on
[
ESP8266 sdk 0.9.5
](
http://bbs.espressif.com/viewtopic.php?f=
7
&t=1
0
4
)
<br
/>
Build on
[
ESP8266 sdk 0.9.5
](
http://bbs.espressif.com/viewtopic.php?f=
5
&t=1
5
4
)
<br
/>
Lua core based on
[
eLua project
](
http://www.eluaproject.net/
)
<br
/>
Lua core based on
[
eLua project
](
http://www.eluaproject.net/
)
<br
/>
File system based on
[
spiffs
](
https://github.com/pellepl/spiffs
)
<br
/>
File system based on
[
spiffs
](
https://github.com/pellepl/spiffs
)
<br
/>
Open source development kit for NodeMCU
[
nodemcu-devkit
](
https://github.com/nodemcu/nodemcu-devkit
)
<br
/>
Open source development kit for NodeMCU
[
nodemcu-devkit
](
https://github.com/nodemcu/nodemcu-devkit
)
<br
/>
...
@@ -16,16 +16,22 @@ Tencent QQ group: 309957875<br />
...
@@ -16,16 +16,22 @@ Tencent QQ group: 309957875<br />
-
Easy to access wireless router
-
Easy to access wireless router
-
Based on Lua 5.1.4 (without
*io, math, debug, os*
module.)
-
Based on Lua 5.1.4 (without
*io, math, debug, os*
module.)
-
Event-Drive programming preferred.
-
Event-Drive programming preferred.
-
Build-in file, timer, pwm, i2c, 1-wire, net, gpio, wifi, adc, uart and system api.
-
Build-in file, timer, pwm, i2c,
spi,
1-wire, net,
mqtt,
gpio, wifi, adc, uart and system api.
-
GPIO pin re-mapped, use the index to access gpio, i2c, pwm.
-
GPIO pin re-mapped, use the index to access gpio, i2c, pwm.
# To Do List (pull requests are very welcomed)
# To Do List (pull requests are very welcomed)
-
fix wifi smart connect
-
fix wifi smart connect
-
add spi module
-
add spi module
(done)
-
add mqtt module
-
add mqtt module
(done)
-
add coap module
-
add coap module
-
cross compiler
# Change log
# Change log
2015-01-24
<br
/>
migrate to sdk 0.9.5 release.
<br
/>
tmr.time() now return second(not precise yet).
<br
/>
build pre_build bin.
2015-01-23
<br
/>
2015-01-23
<br
/>
merge mqtt branch to master.
<br
/>
merge mqtt branch to master.
<br
/>
build pre_build bin.
build pre_build bin.
...
@@ -80,39 +86,6 @@ pre_build/latest/nodemcu_512k_latest.bin is removed. use pre_build/latest/nodemc
...
@@ -80,39 +86,6 @@ pre_build/latest/nodemcu_512k_latest.bin is removed. use pre_build/latest/nodemc
</table>
</table>
#### [*] D0(GPIO16) can only be used as gpio read/write. no interrupt supported. no pwm/i2c/ow supported.
#### [*] D0(GPIO16) can only be used as gpio read/write. no interrupt supported. no pwm/i2c/ow supported.
##GPIO OLD TABLE (Before build 20141212)
<a
id=
"old_gpio_map"
></a>
<table>
<tr>
<th
scope=
"col"
>
IO index
</th><th
scope=
"col"
>
ESP8266 pin
</th><th
scope=
"col"
>
IO index
</th><th
scope=
"col"
>
ESP8266 pin
</th>
</tr>
<tr>
<td>
0
</td><td>
GPIO12
</td><td>
8
</td><td>
GPIO0
</td>
</tr>
<tr>
<td>
1
</td><td>
GPIO13
</td><td>
9
</td><td>
GPIO2
</td>
</tr>
<tr>
<td>
2
</td><td>
GPIO14
</td><td>
10
</td><td>
GPIO4
</td>
</tr>
<tr>
<td>
3
</td><td>
GPIO15
</td><td>
11
</td><td>
GPIO5
</td>
</tr>
<tr>
<td>
4
</td><td>
GPIO3
</td><td></td><td></td>
</tr>
<tr>
<td>
5
</td><td>
GPIO1
</td><td></td><td></td>
</tr>
<tr>
<td>
6
</td><td>
GPIO9
</td><td></td><td></td>
</tr>
<tr>
<td>
7
</td><td>
GPIO10
</td
<td
></td><td></td>
</tr>
</table>
#Build option
#Build option
####file ./app/include/user_config.h
####file ./app/include/user_config.h
```
c
```
c
...
@@ -145,10 +118,8 @@ for most esp8266 modules, just pull GPIO0 down and restart.<br />
...
@@ -145,10 +118,8 @@ for most esp8266 modules, just pull GPIO0 down and restart.<br />
You can use the
[
nodemcu-flasher
](
https://github.com/nodemcu/nodemcu-flasher
)
to burn the firmware.
You can use the
[
nodemcu-flasher
](
https://github.com/nodemcu/nodemcu-flasher
)
to burn the firmware.
Or, if you build your own bin from source code.
<br
/>
Or, if you build your own bin from source code.
<br
/>
eagle.app.v6.flash.bin: 0x00000
<br
/>
0x00000.bin: 0x00000
<br
/>
eagle.app.v6.irom0text.bin: 0x10000
<br
/>
0x10000.bin: 0x10000
<br
/>
esp_init_data_default.bin: 0x7c000
<br
/>
blank.bin: 0x7e000
<br
/>
*Better run file.format() after flash*
*Better run file.format() after flash*
...
...
app/Makefile
View file @
ad966146
...
@@ -42,6 +42,7 @@ endif # } PDIR
...
@@ -42,6 +42,7 @@ endif # } PDIR
APPDIR
=
.
APPDIR
=
.
LDDIR
=
../ld
LDDIR
=
../ld
CCFLAGS
+=
-Os
TARGET_LDFLAGS
=
\
TARGET_LDFLAGS
=
\
-nostdlib
\
-nostdlib
\
...
@@ -49,7 +50,6 @@ TARGET_LDFLAGS = \
...
@@ -49,7 +50,6 @@ TARGET_LDFLAGS = \
--longcalls
\
--longcalls
\
--text-section-literals
--text-section-literals
ifeq
($(FLAVOR),debug)
ifeq
($(FLAVOR),debug)
TARGET_LDFLAGS
+=
-g
-O2
TARGET_LDFLAGS
+=
-g
-O2
endif
endif
...
@@ -101,6 +101,7 @@ LINKFLAGS_eagle.app.v6 = \
...
@@ -101,6 +101,7 @@ LINKFLAGS_eagle.app.v6 = \
-lwpa
\
-lwpa
\
-lmain
\
-lmain
\
-ljson
\
-ljson
\
-lsmartconfig
\
$(DEP_LIBS_eagle.app.v6)
\
$(DEP_LIBS_eagle.app.v6)
\
-Wl
,--end-group
-Wl
,--end-group
...
...
app/driver/i2c_master.c
View file @
ad966146
...
@@ -219,6 +219,45 @@ i2c_master_getAck(void)
...
@@ -219,6 +219,45 @@ i2c_master_getAck(void)
return
retVal
;
return
retVal
;
}
}
/******************************************************************************
* FunctionName : i2c_master_checkAck
* Description : get dev response
* Parameters : NONE
* Returns : true : get ack ; false : get nack
*******************************************************************************/
bool
ICACHE_FLASH_ATTR
i2c_master_checkAck
(
void
)
{
if
(
i2c_master_getAck
()){
return
FALSE
;
}
else
{
return
TRUE
;
}
}
/******************************************************************************
* FunctionName : i2c_master_send_ack
* Description : response ack
* Parameters : NONE
* Returns : NONE
*******************************************************************************/
void
ICACHE_FLASH_ATTR
i2c_master_send_ack
(
void
)
{
i2c_master_setAck
(
0x0
);
}
/******************************************************************************
* FunctionName : i2c_master_send_nack
* Description : response nack
* Parameters : NONE
* Returns : NONE
*******************************************************************************/
void
ICACHE_FLASH_ATTR
i2c_master_send_nack
(
void
)
{
i2c_master_setAck
(
0x1
);
}
/******************************************************************************
/******************************************************************************
* FunctionName : i2c_master_readByte
* FunctionName : i2c_master_readByte
* Description : read Byte from i2c bus
* Description : read Byte from i2c bus
...
...
app/driver/pwm.c
View file @
ad966146
...
@@ -349,11 +349,6 @@ pwm_init(uint16 freq, uint16 *duty)
...
@@ -349,11 +349,6 @@ pwm_init(uint16 freq, uint16 *duty)
{
{
uint8
i
;
uint8
i
;
ETS_FRC_TIMER1_INTR_ATTACH
(
pwm_tim1_intr_handler
,
NULL
);
TM1_EDGE_INT_ENABLE
();
ETS_FRC1_INTR_ENABLE
();
RTC_CLR_REG_MASK
(
FRC1_INT_ADDRESS
,
FRC1_INT_CLR_MASK
);
RTC_REG_WRITE
(
FRC1_CTRL_ADDRESS
,
//FRC2_AUTO_RELOAD|
RTC_REG_WRITE
(
FRC1_CTRL_ADDRESS
,
//FRC2_AUTO_RELOAD|
DIVDED_BY_16
DIVDED_BY_16
|
FRC1_ENABLE_TIMER
|
FRC1_ENABLE_TIMER
...
@@ -377,6 +372,10 @@ pwm_init(uint16 freq, uint16 *duty)
...
@@ -377,6 +372,10 @@ pwm_init(uint16 freq, uint16 *duty)
// pwm_set_freq_duty(freq, duty);
// pwm_set_freq_duty(freq, duty);
pwm_start
();
pwm_start
();
ETS_FRC_TIMER1_INTR_ATTACH
(
pwm_tim1_intr_handler
,
NULL
);
TM1_EDGE_INT_ENABLE
();
ETS_FRC1_INTR_ENABLE
();
}
}
bool
ICACHE_FLASH_ATTR
bool
ICACHE_FLASH_ATTR
...
...
app/include/driver/i2c_master.h
View file @
ad966146
...
@@ -63,6 +63,11 @@ void i2c_master_setAck(uint8 level);
...
@@ -63,6 +63,11 @@ void i2c_master_setAck(uint8 level);
uint8
i2c_master_getAck
(
void
);
uint8
i2c_master_getAck
(
void
);
uint8
i2c_master_readByte
(
void
);
uint8
i2c_master_readByte
(
void
);
void
i2c_master_writeByte
(
uint8
wrdata
);
void
i2c_master_writeByte
(
uint8
wrdata
);
bool
i2c_master_checkAck
(
void
);
void
i2c_master_send_ack
(
void
);
void
i2c_master_send_nack
(
void
);
uint8
i2c_master_get_pinSDA
();
uint8
i2c_master_get_pinSDA
();
uint8
i2c_master_get_pinSCL
();
uint8
i2c_master_get_pinSCL
();
...
...
app/include/user_config.h
View file @
ad966146
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#define NODE_VERSION_INTERNAL 0U
#define NODE_VERSION_INTERNAL 0U
#define NODE_VERSION "NodeMCU 0.9.5"
#define NODE_VERSION "NodeMCU 0.9.5"
#define BUILD_DATE "build 2015012
3
"
#define BUILD_DATE "build 2015012
4
"
// #define FLASH_512K
// #define FLASH_512K
// #define FLASH_1M
// #define FLASH_1M
...
@@ -18,6 +18,9 @@
...
@@ -18,6 +18,9 @@
#define FULL_VERSION_FOR_USER
#define FULL_VERSION_FOR_USER
#ifdef DEVELOP_VERSION
#ifdef DEVELOP_VERSION
#define USE_OPTIMIZE_PRINTF
#define NODE_DEBUG
#define NODE_DEBUG
#endif
/* DEVELOP_VERSION */
#endif
/* DEVELOP_VERSION */
...
@@ -38,7 +41,7 @@
...
@@ -38,7 +41,7 @@
#define ICACHE_STORE_TYPEDEF_ATTR __attribute__((aligned(4),packed))
#define ICACHE_STORE_TYPEDEF_ATTR __attribute__((aligned(4),packed))
#define ICACHE_STORE_ATTR __attribute__((aligned(4)))
#define ICACHE_STORE_ATTR __attribute__((aligned(4)))
#define ICACHE_RAM_ATTR __attribute__((section(".iram0.text")))
#define ICACHE_RAM_ATTR __attribute__((section(".iram0.text")))
#define ICACHE_RODATA_ATTR __attribute__((section(".rodata2.text")))
//
#define ICACHE_RODATA_ATTR __attribute__((section(".rodata2.text")))
#define CLIENT_SSL_ENABLE
#define CLIENT_SSL_ENABLE
#define GPIO_INTERRUPT_ENABLE
#define GPIO_INTERRUPT_ENABLE
...
...
app/libc/c_stdio.h
View file @
ad966146
...
@@ -47,6 +47,10 @@ extern int c_stderr;
...
@@ -47,6 +47,10 @@ extern int c_stderr;
#define SEEK_END 2
/* set file offset to EOF plus offset */
#define SEEK_END 2
/* set file offset to EOF plus offset */
#endif
#endif
#define c_malloc os_malloc
#define c_zalloc os_zalloc
#define c_free os_free
extern
void
output_redirect
(
const
char
*
str
);
extern
void
output_redirect
(
const
char
*
str
);
#define c_puts output_redirect
#define c_puts output_redirect
...
...
app/libc/c_stdlib.c
View file @
ad966146
...
@@ -20,27 +20,27 @@ const char *c_getenv(const char *__string){
...
@@ -20,27 +20,27 @@ const char *c_getenv(const char *__string){
}
}
// make sure there is enough memory before real malloc, otherwise malloc will panic and reset
// make sure there is enough memory before real malloc, otherwise malloc will panic and reset
void
*
c_malloc
(
size_t
__size
){
//
void *c_malloc(size_t __size){
if
(
__size
>
system_get_free_heap_size
()){
//
if(__size>system_get_free_heap_size()){
NODE_ERR
(
"malloc: not enough memory
\n
"
);
//
NODE_ERR("malloc: not enough memory\n");
return
NULL
;
//
return NULL;
}
//
}
return
(
void
*
)
os_malloc
(
__size
);
//
return (void *)os_malloc(__size);
}
//
}
void
*
c_zalloc
(
size_t
__size
){
//
void *c_zalloc(size_t __size){
if
(
__size
>
system_get_free_heap_size
()){
//
if(__size>system_get_free_heap_size()){
NODE_ERR
(
"zalloc: not enough memory
\n
"
);
//
NODE_ERR("zalloc: not enough memory\n");
return
NULL
;
//
return NULL;
}
//
}
return
(
void
*
)
os_zalloc
(
__size
);
//
return (void *)os_zalloc(__size);
}
//
}
void
c_free
(
void
*
p
){
//
void c_free(void *p){
// NODE_ERR("free1: %d\n", system_get_free_heap_size());
//
// NODE_ERR("free1: %d\n", system_get_free_heap_size());
os_free
(
p
);
//
os_free(p);
// NODE_ERR("-free1: %d\n", system_get_free_heap_size());
//
// NODE_ERR("-free1: %d\n", system_get_free_heap_size());
}
//
}
// int c_rand(void){
// int c_rand(void){
...
...
app/lua/lundump.c
View file @
ad966146
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
*/
*/
#include "c_string.h"
#include "c_string.h"
#include "c_types.h"
#define lundump_c
#define lundump_c
#define LUA_CORE
#define LUA_CORE
...
@@ -141,13 +142,11 @@ static lua_Number LoadNumber(LoadState* S)
...
@@ -141,13 +142,11 @@ static lua_Number LoadNumber(LoadState* S)
LoadVar
(
S
,
y
);
LoadVar
(
S
,
y
);
x
=
(
lua_Number
)
y
;
x
=
(
lua_Number
)
y
;
}
break
;
}
break
;
#if 0
case
8
:
{
case
8
:
{
int64_t
y
;
int64_t
y
;
LoadVar
(
S
,
y
);
LoadVar
(
S
,
y
);
x
=
(
lua_Number
)
y
;
x
=
(
lua_Number
)
y
;
}
break
;
}
break
;
#endif
default:
lua_assert
(
0
);
default:
lua_assert
(
0
);
}
}
}
}
...
...
app/lwip/app/espconn_tcp.c
View file @
ad966146
...
@@ -812,10 +812,6 @@ espconn_tcp_accept(void *arg, struct tcp_pcb *pcb, err_t err)
...
@@ -812,10 +812,6 @@ espconn_tcp_accept(void *arg, struct tcp_pcb *pcb, err_t err)
remot_info
*
pinfo
=
NULL
;
remot_info
*
pinfo
=
NULL
;
LWIP_UNUSED_ARG
(
err
);
LWIP_UNUSED_ARG
(
err
);
if
(
4096
>
system_get_free_heap_size
()){
return
ERR_MEM
;
}
paccept
=
(
espconn_msg
*
)
os_zalloc
(
sizeof
(
espconn_msg
));
paccept
=
(
espconn_msg
*
)
os_zalloc
(
sizeof
(
espconn_msg
));
tcp_arg
(
pcb
,
paccept
);
tcp_arg
(
pcb
,
paccept
);
tcp_err
(
pcb
,
esponn_server_err
);
tcp_err
(
pcb
,
esponn_server_err
);
...
...
app/modules/tmr.c
View file @
ad966146
...
@@ -147,14 +147,33 @@ static int tmr_wdclr( lua_State* L )
...
@@ -147,14 +147,33 @@ static int tmr_wdclr( lua_State* L )
return
0
;
return
0
;
}
}
static
os_timer_t
rtc_timer_updator
;
static
unsigned
rtc_second
=
0
;
// TODO: load from rtc memory
static
uint64_t
cur_count
=
0
;
static
uint64_t
rtc_count
=
0
;
void
rtc_timer_update_cb
(
void
*
arg
){
uint64_t
t
=
(
uint64_t
)
system_get_rtc_time
();
// NODE_ERR("%x\n",t);
if
(
t
>=
cur_count
){
rtc_count
+=
t
-
cur_count
;
cur_count
=
t
;
}
else
{
rtc_count
+=
0x100000000
+
t
-
cur_count
;
cur_count
=
t
;
}
unsigned
c
=
system_rtc_clock_cali_proc
();
uint64_t
itg
=
c
>>
12
;
uint64_t
dec
=
c
&
0xFFF
;
uint64_t
second
=
(
cur_count
*
itg
+
((
cur_count
*
dec
)
>>
12
))
/
1000000
;
// NODE_ERR("%x\n",second);
rtc_second
=
(
unsigned
)
second
;
// TODO: store rtc_count, rtc_second to rtc memory.
}
// Lua: time() , return rtc time in us
// Lua: time() , return rtc time in us
static
int
tmr_time
(
lua_State
*
L
)
static
int
tmr_time
(
lua_State
*
L
)
{
{
unsigned
t
=
0xFFFFFFFF
&
system_get_rtc_time
();
lua_pushinteger
(
L
,
rtc_second
&
0x7FFFFFFF
);
unsigned
c
=
0xFFFFFFFF
&
system_rtc_clock_cali_proc
();
return
1
;
lua_pushinteger
(
L
,
t
);
lua_pushinteger
(
L
,
c
);
return
2
;
}
}
// Module function map
// Module function map
...
@@ -182,6 +201,10 @@ LUALIB_API int luaopen_tmr( lua_State *L )
...
@@ -182,6 +201,10 @@ LUALIB_API int luaopen_tmr( lua_State *L )
os_timer_setfn
(
&
(
alarm_timer
[
i
]),
(
os_timer_func_t
*
)(
alarm_timer_cb
[
i
]),
L
);
os_timer_setfn
(
&
(
alarm_timer
[
i
]),
(
os_timer_func_t
*
)(
alarm_timer_cb
[
i
]),
L
);
}
}
os_timer_disarm
(
&
rtc_timer_updator
);
os_timer_setfn
(
&
rtc_timer_updator
,
(
os_timer_func_t
*
)(
rtc_timer_update_cb
),
NULL
);
os_timer_arm
(
&
rtc_timer_updator
,
500
,
1
);
#if LUA_OPTIMIZE_MEMORY > 0
#if LUA_OPTIMIZE_MEMORY > 0
return
0
;
return
0
;
#else // #if LUA_OPTIMIZE_MEMORY > 0
#else // #if LUA_OPTIMIZE_MEMORY > 0
...
...
app/modules/wifi.c
View file @
ad966146
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include "c_types.h"
#include "c_types.h"
#include "user_interface.h"
#include "user_interface.h"
#include "smart.h"
#include "smart.h"
#include "smartconfig.h"
static
int
wifi_smart_succeed
=
LUA_NOREF
;
static
int
wifi_smart_succeed
=
LUA_NOREF
;
...
@@ -19,6 +20,13 @@ static void wifi_smart_succeed_cb(void *arg){
...
@@ -19,6 +20,13 @@ static void wifi_smart_succeed_cb(void *arg){
NODE_DBG
(
"wifi_smart_succeed_cb is called.
\n
"
);
NODE_DBG
(
"wifi_smart_succeed_cb is called.
\n
"
);
if
(
!
arg
)
if
(
!
arg
)
return
;
return
;
#if 0
struct station_config *sta_conf = arg;
wifi_station_set_config(sta_conf);
wifi_station_disconnect();
wifi_station_connect();
smartconfig_stop();
#endif
if
(
wifi_smart_succeed
==
LUA_NOREF
)
if
(
wifi_smart_succeed
==
LUA_NOREF
)
return
;
return
;
lua_State
*
L
=
(
lua_State
*
)
arg
;
lua_State
*
L
=
(
lua_State
*
)
arg
;
...
@@ -81,6 +89,7 @@ static void wifi_scan_done(void *arg, STATUS status)
...
@@ -81,6 +89,7 @@ static void wifi_scan_done(void *arg, STATUS status)
}
}
// Lua: smart(channel, function succeed_cb)
// Lua: smart(channel, function succeed_cb)
// Lua: smart(type, function succeed_cb)
static
int
wifi_start_smart
(
lua_State
*
L
)
static
int
wifi_start_smart
(
lua_State
*
L
)
{
{
unsigned
channel
;
unsigned
channel
;
...
@@ -109,13 +118,15 @@ static int wifi_start_smart( lua_State* L )
...
@@ -109,13 +118,15 @@ static int wifi_start_smart( lua_State* L )
}
else
{
}
else
{
smart_begin
(
channel
,
(
smart_succeed
)
wifi_smart_succeed_cb
,
L
);
smart_begin
(
channel
,
(
smart_succeed
)
wifi_smart_succeed_cb
,
L
);
}
}
// smartconfig_start(0, wifi_smart_succeed_cb);
return
0
;
return
0
;
}
}
// Lua: exit_smart(
channel
)
// Lua: exit_smart()
static
int
wifi_exit_smart
(
lua_State
*
L
)
static
int
wifi_exit_smart
(
lua_State
*
L
)
{
{
smart_end
();
smart_end
();
// smartconfig_stop();
if
(
wifi_smart_succeed
!=
LUA_NOREF
)
if
(
wifi_smart_succeed
!=
LUA_NOREF
)
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
wifi_smart_succeed
);
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
wifi_smart_succeed
);
wifi_smart_succeed
=
LUA_NOREF
;
wifi_smart_succeed
=
LUA_NOREF
;
...
...
include/at_custom.h
0 → 100644
View file @
ad966146
/*
* custom_at.h
*
* This file is part of Espressif's AT+ command set program.
* Copyright (C) 2013 - 2016, Espressif Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CUSTOM_AT_H_
#define CUSTOM_AT_H_
#include "c_types.h"
typedef
struct
{
char
*
at_cmdName
;
int8_t
at_cmdLen
;
void
(
*
at_testCmd
)(
uint8_t
id
);
void
(
*
at_queryCmd
)(
uint8_t
id
);
void
(
*
at_setupCmd
)(
uint8_t
id
,
char
*
pPara
);
void
(
*
at_exeCmd
)(
uint8_t
id
);
}
at_funcationType
;
/**
* @brief Response "OK" to uart.
* @param None
* @retval None
*/
void
at_response_ok
(
void
);
/**
* @brief Response "ERROR" to uart.
* @param events: no used
* @retval None
*/
void
at_response_error
(
void
);
/**
* @brief Task of process command or txdata.
* @param custom_at_cmd_array: the array of at cmd that custom defined
* cmd_num : the num of at cmd that custom defined
* @retval None
*/
void
at_cmd_array_regist
(
at_funcationType
*
custom_at_cmd_array
,
uint32
cmd_num
);
/**
* @brief get digit form at cmd line.the maybe alter pSrc
* @param p_src: at cmd line string
* result:the buffer to be placed result
* err : err num
* @retval TRUE:
* FALSE:
*/
bool
at_get_next_int_dec
(
char
**
p_src
,
int
*
result
,
int
*
err
);
/**
* @brief get string form at cmd line.the maybe alter pSrc
* @param p_dest: the buffer to be placed result
* p_src: at cmd line string
* max_len :max len of string excepted to get
* @retval None
*/
int32
at_data_str_copy
(
char
*
p_dest
,
char
**
p_src
,
int32
max_len
);
/**
* @brief initialize at module
* @param None
* @retval None
*/
void
at_init
(
void
);
/**
* @brief print string to at port
* @param string
* @retval None
*/
void
at_port_print
(
const
char
*
str
);
#endif
include/c_types.h
View file @
ad966146
...
@@ -16,6 +16,7 @@ typedef unsigned long uint32_t;
...
@@ -16,6 +16,7 @@ typedef unsigned long uint32_t;
typedef
signed
long
sint32_t
;
typedef
signed
long
sint32_t
;
typedef
signed
long
int32_t
;
typedef
signed
long
int32_t
;
typedef
signed
long
long
sint64_t
;
typedef
signed
long
long
sint64_t
;
typedef
signed
long
long
int64_t
;
typedef
unsigned
long
long
uint64_t
;
typedef
unsigned
long
long
uint64_t
;
typedef
unsigned
long
long
u_int64_t
;
typedef
unsigned
long
long
u_int64_t
;
typedef
float
real32_t
;
typedef
float
real32_t
;
...
@@ -78,6 +79,7 @@ typedef enum {
...
@@ -78,6 +79,7 @@ typedef enum {
#ifdef ICACHE_FLASH
#ifdef ICACHE_FLASH
#define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
#define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
#define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
#else
#else
#define ICACHE_FLASH_ATTR
#define ICACHE_FLASH_ATTR
#endif
/* ICACHE_FLASH */
#endif
/* ICACHE_FLASH */
...
...
include/espconn.h
View file @
ad966146
...
@@ -91,6 +91,7 @@ struct espconn {
...
@@ -91,6 +91,7 @@ struct espconn {
enum
espconn_option
{
enum
espconn_option
{
ESPCONN_REUSEADDR
=
1
,
ESPCONN_REUSEADDR
=
1
,
ESPCONN_NODELAY
,
ESPCONN_END
ESPCONN_END
};
};
...
@@ -371,5 +372,21 @@ sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
...
@@ -371,5 +372,21 @@ sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
*******************************************************************************/
*******************************************************************************/
sint8
espconn_igmp_leave
(
ip_addr_t
*
host_ip
,
ip_addr_t
*
multicast_ip
);
sint8
espconn_igmp_leave
(
ip_addr_t
*
host_ip
,
ip_addr_t
*
multicast_ip
);
/******************************************************************************
* 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
#endif
include/ip_addr.h
View file @
ad966146
...
@@ -52,6 +52,11 @@ struct ip_info {
...
@@ -52,6 +52,11 @@ struct ip_info {
#define ip4_addr3_16(ipaddr) ((uint16)ip4_addr3(ipaddr))
#define ip4_addr3_16(ipaddr) ((uint16)ip4_addr3(ipaddr))
#define ip4_addr4_16(ipaddr) ((uint16)ip4_addr4(ipaddr))
#define ip4_addr4_16(ipaddr) ((uint16)ip4_addr4(ipaddr))
/** 255.255.255.255 */
#define IPADDR_NONE ((uint32)0xffffffffUL)
/** 0.0.0.0 */
#define IPADDR_ANY ((uint32)0x00000000UL)
uint32
ipaddr_addr
(
const
char
*
cp
);
uint32
ipaddr_addr
(
const
char
*
cp
);
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
...
...
include/osapi.h
View file @
ad966146
...
@@ -44,5 +44,14 @@
...
@@ -44,5 +44,14 @@
#define os_sprintf ets_sprintf
#define os_sprintf ets_sprintf
#define os_update_cpu_frequency ets_update_cpu_frequency
#define os_update_cpu_frequency ets_update_cpu_frequency
#ifdef USE_OPTIMIZE_PRINTF
#define os_printf(fmt, ...) do { \
static const char flash_str[] ICACHE_RODATA_ATTR = fmt; \
os_printf_plus(flash_str, ##__VA_ARGS__); \
} while(0)
#else
#define os_printf os_printf_plus
#endif
#endif
#endif
include/ping.h
0 → 100644
View file @
ad966146
#ifndef __PING_H__
#define __PING_H__
typedef
void
(
*
ping_recv_function
)(
void
*
arg
,
void
*
pdata
);
typedef
void
(
*
ping_sent_function
)(
void
*
arg
,
void
*
pdata
);
struct
ping_option
{
uint32
count
;
uint32
ip
;
uint32
coarse_time
;
ping_recv_function
recv_function
;
ping_sent_function
sent_function
;
void
*
reverse
;
};
struct
ping_resp
{
uint32
total_count
;
uint32
resp_time
;
uint32
seqno
;
uint32
timeout_count
;
uint32
bytes
;
uint32
total_bytes
;
uint32
total_time
;
sint8
ping_err
;
};
bool
ping_start
(
struct
ping_option
*
ping_opt
);
bool
ping_regist_recv
(
struct
ping_option
*
ping_opt
,
ping_recv_function
ping_recv
);
bool
ping_regist_sent
(
struct
ping_option
*
ping_opt
,
ping_sent_function
ping_sent
);
#endif
/* __PING_H__ */
include/smartconfig.h
0 → 100644
View file @
ad966146
/*
* Copyright (C) 2015 -2018 Espressif System
*
*/
#ifndef __SMARTCONFIG_H__
#define __SMARTCONFIG_H__
typedef
void
(
*
sc_callback_t
)(
void
*
data
);
typedef
enum
{
SC_STATUS_FIND_CHANNEL
=
0
,
SC_STATUS_GETTING_SSID_PSWD
,
SC_STATUS_GOT_SSID_PSWD
,
SC_STATUS_LINK
,
}
sc_status
;
typedef
enum
{
SC_TYPE_ESPTOUCH
=
0
,
SC_TYPE_AIRKISS
,
}
sc_type
;
sc_status
smartconfig_get_status
(
void
);
const
char
*
smartconfig_get_version
(
void
);
bool
smartconfig_start
(
sc_type
type
,
sc_callback_t
cb
);
bool
smartconfig_stop
(
void
);
#endif
include/spi_flash.h
View file @
ad966146
...
@@ -24,8 +24,6 @@ typedef struct{
...
@@ -24,8 +24,6 @@ typedef struct{
#define SPI_FLASH_SEC_SIZE 4096
#define SPI_FLASH_SEC_SIZE 4096
uint32
spi_flash_get_id
(
void
);
uint32
spi_flash_get_id
(
void
);
SpiFlashOpResult
spi_flash_read_status
(
uint32
*
status
);
SpiFlashOpResult
spi_flash_write_status
(
uint32
status_value
);
SpiFlashOpResult
spi_flash_erase_sector
(
uint16
sec
);
SpiFlashOpResult
spi_flash_erase_sector
(
uint16
sec
);
SpiFlashOpResult
spi_flash_write
(
uint32
des_addr
,
uint32
*
src_addr
,
uint32
size
);
SpiFlashOpResult
spi_flash_write
(
uint32
des_addr
,
uint32
*
src_addr
,
uint32
size
);
SpiFlashOpResult
spi_flash_read
(
uint32
src_addr
,
uint32
*
des_addr
,
uint32
size
);
SpiFlashOpResult
spi_flash_read
(
uint32
src_addr
,
uint32
*
des_addr
,
uint32
size
);
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment