Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
4911d2db
Commit
4911d2db
authored
Jun 03, 2016
by
Arnim Läuger
Browse files
Merge pull request #1336 from nodemcu/dev
1.5.1 master drop
parents
c8037568
2e109686
Changes
396
Hide whitespace changes
Inline
Side-by-side
sdk/esp_iot_sdk_v1.4.0/examples/readme.txt
deleted
100644 → 0
View file @
c8037568
1compile options
(1) COMPILE
Possible value: gcc
Default value:
If not set, use xt-xcc by default.
(2) BOOT
Possible value: none/old/new
none: no need boot
old: use boot_v1.1
new: use boot_v1.2+
Default value: none
(3) APP
Possible value: 0/1/2
0: original mode, generate eagle.app.v6.flash.bin and eagle.app.v6.irom0text.bin
1: generate user1
2: generate user2
Default value: 0
(3) SPI_SPEED
Possible value: 20/26.7/40/80
Default value: 40
(4) SPI_MODE
Possible value: QIO/QOUT/DIO/DOUT
Default value: QIO
(4) SPI_SIZE_MAP
Possible value: 0/2/3/4/5/6
Default value: 0
For example:
make COMPILE=gcc BOOT=new APP=1 SPI_SPEED=40 SPI_MODE=QIO SPI_SIZE_MAP=0
2You can also use gen_misc to make and generate specific bin you needed.
Linux: ./gen_misc.sh
Windows: gen_misc.bat
Follow the tips and steps.
\ No newline at end of file
sdk/esp_iot_sdk_v1.4.0/examples/smart_config/Makefile
deleted
100644 → 0
View file @
c8037568
#############################################################
# Required variables for each makefile
# Discard this section from all parent makefiles
# Expected variables (with automatic defaults):
# CSRCS (all "C" files in the dir)
# SUBDIRS (all subdirs with a Makefile)
# GEN_LIBS - list of libs to be generated ()
# GEN_IMAGES - list of object file images to be generated ()
# GEN_BINS - list of binaries to be generated ()
# COMPONENTS_xxx - a list of libs/objs in the form
# subdir/lib to be extracted and rolled up into
# a generated lib/image xxx.a ()
#
TARGET
=
eagle
#FLAVOR = release
FLAVOR
=
debug
#EXTRA_CCFLAGS += -u
ifndef
PDIR
# {
GEN_IMAGES
=
eagle.app.v6.out
GEN_BINS
=
eagle.app.v6.bin
SPECIAL_MKTARGETS
=
$(APP_MKTARGETS)
SUBDIRS
=
\
user
endif
# } PDIR
APPDIR
=
.
LDDIR
=
../ld
CCFLAGS
+=
-Os
TARGET_LDFLAGS
=
\
-nostdlib
\
-Wl,-EL
\
--longcalls
\
--text-section-literals
ifeq
($(FLAVOR),debug)
TARGET_LDFLAGS
+=
-g
-O2
endif
ifeq
($(FLAVOR),release)
TARGET_LDFLAGS
+=
-g
-O0
endif
COMPONENTS_eagle.app.v6
=
\
user/libuser.a
LINKFLAGS_eagle.app.v6
=
\
-L../lib
\
-nostdlib
\
-T$(LD_FILE)
\
-Wl,--no-check-sections
\
-u
call_user_start
\
-Wl,-static
\
-Wl,--start-group
\
-lc
\
-lgcc
\
-lhal
\
-lphy
\
-lpp
\
-lnet80211
\
-llwip
\
-lwpa
\
-lmain
\
-ljson
\
-lssl
\
-lupgrade
\
-lsmartconfig
\
$(DEP_LIBS_eagle.app.v6)
\
-Wl,--end-group
DEPENDS_eagle.app.v6
=
\
$(LD_FILE)
\
$(LDDIR)/eagle.rom.addr.v6.ld
#############################################################
# Configuration i.e. compile options etc.
# Target specific stuff (defines etc.) goes in here!
# Generally values applying to a tree are captured in the
# makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein
#
#UNIVERSAL_TARGET_DEFINES = \
# Other potential configuration flags include:
# -DTXRX_TXBUF_DEBUG
# -DTXRX_RXBUF_DEBUG
# -DWLAN_CONFIG_CCX
CONFIGURATION_DEFINES
=
-DICACHE_FLASH
DEFINES
+=
\
$(UNIVERSAL_TARGET_DEFINES)
\
$(CONFIGURATION_DEFINES)
DDEFINES
+=
\
$(UNIVERSAL_TARGET_DEFINES)
\
$(CONFIGURATION_DEFINES)
#############################################################
# Recursion Magic - Don't touch this!!
#
# Each subtree potentially has an include directory
# corresponding to the common APIs applicable to modules
# rooted at that subtree. Accordingly, the INCLUDE PATH
# of a module can only contain the include directories up
# its parent path, and not its siblings
#
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
.PHONY
:
FORCE
FORCE
:
sdk/esp_iot_sdk_v1.4.0/examples/smart_config/gen_misc.bat
deleted
100644 → 0
View file @
c8037568
@echo
off
echo
gen_misc
.bat
version
20150511
echo
.
echo
Please
follow
below
steps
(
1
-
5
)
to
generate
specific
bin
(
s
)
:
echo
STEP
1
:
choose
boot
version
(
0
=
boot_v1
.1
,
1
=
boot_v1
.2
+,
2
=
none
)
set
input
=
default
set
/p
input
=
enter
(
0
/1/2
,
default
2
)
:
if
%input%
equ
0
(
set
boot
=
old
)
else
(
if
%input%
equ
1
(
set
boot
=
new
)
else
(
set
boot
=
none
)
)
echo
boot
mode
:
%boot%
echo
.
echo
STEP
2
:
choose
bin
generate
(
0
=
eagle
.flash.bin
+eagle
.irom0text.bin
,
1
=
user1
.bin
,
2
=
user2
.bin
)
set
input
=
default
set
/p
input
=
enter
(
0
/1/2
,
default
0
)
:
if
%input%
equ
1
(
if
%boot%
equ
none
(
set
app
=
0
echo
choose
no
boot
before
echo
generate
bin
:
eagle
.flash.bin
+eagle
.irom0text.bin
)
else
(
set
app
=
1
echo
generate
bin
:
user1
.bin
)
)
else
(
if
%input%
equ
2
(
if
%boot%
equ
none
(
set
app
=
0
echo
choose
no
boot
before
echo
generate
bin
:
eagle
.flash.bin
+eagle
.irom0text.bin
)
else
(
set
app
=
2
echo
generate
bin
:
user2
.bin
)
)
else
(
if
%boot%
neq
none
(
set
boot
=
none
echo
ignore
boot
)
set
app
=
0
echo
generate
bin
:
eagle
.flash.bin
+eagle
.irom0text.bin
))
echo
.
echo
STEP
3
:
choose
spi
speed
(
0
=
20
MHz
,
1
=
26
.7MHz
,
2
=
40
MHz
,
3
=
80
MHz
)
set
input
=
default
set
/p
input
=
enter
(
0
/1/2/3
,
default
2
)
:
if
%input%
equ
0
(
set
spi_speed
=
20
)
else
(
if
%input%
equ
1
(
set
spi_speed
=
26
.7
)
else
(
if
%input%
equ
3
(
set
spi_speed
=
80
)
else
(
set
spi_speed
=
40
)))
echo
spi
speed
:
%spi_speed%
MHz
echo
.
echo
STEP
4
:
choose
spi
mode
(
0
=
QIO
,
1
=
QOUT
,
2
=
DIO
,
3
=
DOUT
)
set
input
=
default
set
/p
input
=
enter
(
0
/1/2/3
,
default
0
)
:
if
%input%
equ
1
(
set
spi_mode
=
QOUT
)
else
(
if
%input%
equ
2
(
set
spi_mode
=
DIO
)
else
(
if
%input%
equ
3
(
set
spi_mode
=
DOUT
)
else
(
set
spi_mode
=
QIO
)))
echo
spi
mode
:
%spi_mode%
echo
.
echo
STEP
5
:
choose
flash
size
and
map
echo
0
=
512
KB
(
256
KB
+
256
KB
)
echo
2
=
1024
KB
(
512
KB
+
512
KB
)
echo
3
=
2048
KB
(
512
KB
+
512
KB
)
echo
4
=
4096
KB
(
512
KB
+
512
KB
)
echo
5
=
2048
KB
(
1024
KB
+
1024
KB
)
echo
6
=
4096
KB
(
1024
KB
+
1024
KB
)
set
input
=
default
set
/p
input
=
enter
(
0
/1/2/3/4/5/6
,
default
0
)
:
if
%input%
equ
2
(
set
spi_size_map
=
2
echo
spi
size
:
1024
KB
echo
spi
ota
map
:
512
KB
+
512
KB
)
else
(
if
%input%
equ
3
(
set
spi_size_map
=
3
echo
spi
size
:
2048
KB
echo
spi
ota
map
:
512
KB
+
512
KB
)
else
(
if
%input%
equ
4
(
set
spi_size_map
=
4
echo
spi
size
:
4096
KB
echo
spi
ota
map
:
512
KB
+
512
KB
)
else
(
if
%input%
equ
5
(
set
spi_size_map
=
5
echo
spi
size
:
2048
KB
echo
spi
ota
map
:
1024
KB
+
1024
KB
)
else
(
if
%input%
equ
6
(
set
spi_size_map
=
6
echo
spi
size
:
4096
KB
echo
spi
ota
map
:
1024
KB
+
1024
KB
)
else
(
set
spi_size_map
=
0
echo
spi
size
:
512
KB
echo
spi
ota
map
:
256
KB
+
256
KB
)
)
)
)
)
touch
user
/user
_main.c
echo
.
echo
start
...
echo
.
make
BOOT
=
%boot%
APP
=
%app%
SPI_SPEED
=
%spi_speed%
SPI_MODE
=
%spi_mode%
SPI_SIZE
=
%spi_size_map%
sdk/esp_iot_sdk_v1.4.0/examples/smart_config/gen_misc.sh
deleted
100644 → 0
View file @
c8037568
#!/bin/bash
echo
"gen_misc.sh version 20150511"
echo
""
echo
"Please follow below steps(1-5) to generate specific bin(s):"
echo
"STEP 1: choose boot version(0=boot_v1.1, 1=boot_v1.2+, 2=none)"
echo
"enter(0/1/2, default 2):"
read
input
if
[
-z
"
$input
"
]
;
then
boot
=
none
elif
[
$input
==
0
]
;
then
boot
=
old
elif
[
$input
==
1
]
;
then
boot
=
new
else
boot
=
none
fi
echo
"boot mode:
$boot
"
echo
""
echo
"STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)"
echo
"enter (0/1/2, default 0):"
read
input
if
[
-z
"
$input
"
]
;
then
if
[
$boot
!=
none
]
;
then
boot
=
none
echo
"ignore boot"
fi
app
=
0
echo
"generate bin: eagle.flash.bin+eagle.irom0text.bin"
elif
[
$input
==
1
]
;
then
if
[
$boot
==
none
]
;
then
app
=
0
echo
"choose no boot before"
echo
"generate bin: eagle.flash.bin+eagle.irom0text.bin"
else
app
=
1
echo
"generate bin: user1.bin"
fi
elif
[
$input
==
2
]
;
then
if
[
$boot
==
none
]
;
then
app
=
0
echo
"choose no boot before"
echo
"generate bin: eagle.flash.bin+eagle.irom0text.bin"
else
app
=
2
echo
"generate bin: user2.bin"
fi
else
if
[
$boot
!=
none
]
;
then
boot
=
none
echo
"ignore boot"
fi
app
=
0
echo
"generate bin: eagle.flash.bin+eagle.irom0text.bin"
fi
echo
""
echo
"STEP 3: choose spi speed(0=20MHz, 1=26.7MHz, 2=40MHz, 3=80MHz)"
echo
"enter (0/1/2/3, default 2):"
read
input
if
[
-z
"
$input
"
]
;
then
spi_speed
=
40
elif
[
$input
==
0
]
;
then
spi_speed
=
20
elif
[
$input
==
1
]
;
then
spi_speed
=
26.7
elif
[
$input
==
3
]
;
then
spi_speed
=
80
else
spi_speed
=
40
fi
echo
"spi speed:
$spi_speed
MHz"
echo
""
echo
"STEP 4: choose spi mode(0=QIO, 1=QOUT, 2=DIO, 3=DOUT)"
echo
"enter (0/1/2/3, default 0):"
read
input
if
[
-z
"
$input
"
]
;
then
spi_mode
=
QIO
elif
[
$input
==
1
]
;
then
spi_mode
=
QOUT
elif
[
$input
==
2
]
;
then
spi_mode
=
DIO
elif
[
$input
==
3
]
;
then
spi_mode
=
DOUT
else
spi_mode
=
QIO
fi
echo
"spi mode:
$spi_mode
"
echo
""
echo
"STEP 5: choose spi size and map"
echo
" 0= 512KB( 256KB+ 256KB)"
echo
" 2=1024KB( 512KB+ 512KB)"
echo
" 3=2048KB( 512KB+ 512KB)"
echo
" 4=4096KB( 512KB+ 512KB)"
echo
" 5=2048KB(1024KB+1024KB)"
echo
" 6=4096KB(1024KB+1024KB)"
echo
"enter (0/2/3/4/5/6, default 0):"
read
input
if
[
-z
"
$input
"
]
;
then
spi_size_map
=
0
echo
"spi size: 512KB"
echo
"spi ota map: 256KB + 256KB"
elif
[
$input
==
2
]
;
then
spi_size_map
=
2
echo
"spi size: 1024KB"
echo
"spi ota map: 512KB + 512KB"
elif
[
$input
==
3
]
;
then
spi_size_map
=
3
echo
"spi size: 2048KB"
echo
"spi ota map: 512KB + 512KB"
elif
[
$input
==
4
]
;
then
spi_size_map
=
4
echo
"spi size: 4096KB"
echo
"spi ota map: 512KB + 512KB"
elif
[
$input
==
5
]
;
then
spi_size_map
=
5
echo
"spi size: 2048KB"
echo
"spi ota map: 1024KB + 1024KB"
elif
[
$input
==
6
]
;
then
spi_size_map
=
6
echo
"spi size: 4096KB"
echo
"spi ota map: 1024KB + 1024KB"
else
spi_size_map
=
0
echo
"spi size: 512KB"
echo
"spi ota map: 256KB + 256KB"
fi
echo
""
touch
user/user_main.c
echo
""
echo
"start..."
echo
""
make
COMPILE
=
gcc
BOOT
=
$boot
APP
=
$app
SPI_SPEED
=
$spi_speed
SPI_MODE
=
$spi_mode
SPI_SIZE_MAP
=
$spi_size_map
sdk/esp_iot_sdk_v1.4.0/examples/smart_config/include/user_config.h
deleted
100644 → 0
View file @
c8037568
#ifndef __USER_CONFIG_H__
#define __USER_CONFIG_H__
#endif
sdk/esp_iot_sdk_v1.4.0/examples/smart_config/user/Makefile
deleted
100644 → 0
View file @
c8037568
#############################################################
# Required variables for each makefile
# Discard this section from all parent makefiles
# Expected variables (with automatic defaults):
# CSRCS (all "C" files in the dir)
# SUBDIRS (all subdirs with a Makefile)
# GEN_LIBS - list of libs to be generated ()
# GEN_IMAGES - list of images to be generated ()
# COMPONENTS_xxx - a list of libs/objs in the form
# subdir/lib to be extracted and rolled up into
# a generated lib/image xxx.a ()
#
ifndef
PDIR
GEN_LIBS
=
libuser.a
endif
#############################################################
# Configuration i.e. compile options etc.
# Target specific stuff (defines etc.) goes in here!
# Generally values applying to a tree are captured in the
# makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein
#
#DEFINES +=
#############################################################
# Recursion Magic - Don't touch this!!
#
# Each subtree potentially has an include directory
# corresponding to the common APIs applicable to modules
# rooted at that subtree. Accordingly, the INCLUDE PATH
# of a module can only contain the include directories up
# its parent path, and not its siblings
#
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
INCLUDES
+=
-I
../../include/ets
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
sdk/esp_iot_sdk_v1.4.0/examples/smart_config/user/user_main.c
deleted
100644 → 0
View file @
c8037568
/******************************************************************************
* Copyright 2013-2014 Espressif Systems (Wuxi)
*
* FileName: user_main.c
*
* Description: entry file of user application
*
* Modification history:
* 2014/1/1, v1.0 create this file.
*******************************************************************************/
#include "ets_sys.h"
#include "osapi.h"
#include "user_interface.h"
#include "smartconfig.h"
void
ICACHE_FLASH_ATTR
smartconfig_done
(
sc_status
status
,
void
*
pdata
)
{
switch
(
status
)
{
case
SC_STATUS_WAIT
:
os_printf
(
"SC_STATUS_WAIT
\n
"
);
break
;
case
SC_STATUS_FIND_CHANNEL
:
os_printf
(
"SC_STATUS_FIND_CHANNEL
\n
"
);
break
;
case
SC_STATUS_GETTING_SSID_PSWD
:
os_printf
(
"SC_STATUS_GETTING_SSID_PSWD
\n
"
);
sc_type
*
type
=
pdata
;
if
(
*
type
==
SC_TYPE_ESPTOUCH
)
{
os_printf
(
"SC_TYPE:SC_TYPE_ESPTOUCH
\n
"
);
}
else
{
os_printf
(
"SC_TYPE:SC_TYPE_AIRKISS
\n
"
);
}
break
;
case
SC_STATUS_LINK
:
os_printf
(
"SC_STATUS_LINK
\n
"
);
struct
station_config
*
sta_conf
=
pdata
;
wifi_station_set_config
(
sta_conf
);
wifi_station_disconnect
();
wifi_station_connect
();
break
;
case
SC_STATUS_LINK_OVER
:
os_printf
(
"SC_STATUS_LINK_OVER
\n
"
);
if
(
pdata
!=
NULL
)
{
uint8
phone_ip
[
4
]
=
{
0
};
os_memcpy
(
phone_ip
,
(
uint8
*
)
pdata
,
4
);
os_printf
(
"Phone ip: %d.%d.%d.%d
\n
"
,
phone_ip
[
0
],
phone_ip
[
1
],
phone_ip
[
2
],
phone_ip
[
3
]);
}
smartconfig_stop
();
break
;
}
}
void
user_rf_pre_init
(
void
)
{
}
void
user_init
(
void
)
{
os_printf
(
"SDK version:%s
\n
"
,
system_get_sdk_version
());
smartconfig_set_type
(
SC_TYPE_ESPTOUCH
);
//SC_TYPE_ESPTOUCH,SC_TYPE_AIRKISS,SC_TYPE_ESPTOUCH_AIRKISS
wifi_set_opmode
(
STATION_MODE
);
smartconfig_start
(
smartconfig_done
);
}
sdk/esp_iot_sdk_v1.4.0/examples/wps/Makefile
deleted
100644 → 0
View file @
c8037568
#############################################################
# Required variables for each makefile
# Discard this section from all parent makefiles
# Expected variables (with automatic defaults):
# CSRCS (all "C" files in the dir)
# SUBDIRS (all subdirs with a Makefile)
# GEN_LIBS - list of libs to be generated ()
# GEN_IMAGES - list of object file images to be generated ()
# GEN_BINS - list of binaries to be generated ()
# COMPONENTS_xxx - a list of libs/objs in the form
# subdir/lib to be extracted and rolled up into
# a generated lib/image xxx.a ()
#
TARGET
=
eagle
#FLAVOR = release
FLAVOR
=
debug
#EXTRA_CCFLAGS += -u
ifndef
PDIR
# {
GEN_IMAGES
=
eagle.app.v6.out
GEN_BINS
=
eagle.app.v6.bin
SPECIAL_MKTARGETS
=
$(APP_MKTARGETS)
SUBDIRS
=
\
user
\
driver
endif
# } PDIR
APPDIR
=
.
LDDIR
=
../ld
CCFLAGS
+=
-Os
TARGET_LDFLAGS
=
\
-nostdlib
\
-Wl,-EL
\
--longcalls
\
--text-section-literals
ifeq
($(FLAVOR),debug)
TARGET_LDFLAGS
+=
-g
-O2
endif
ifeq
($(FLAVOR),release)
TARGET_LDFLAGS
+=
-g
-O0
endif
COMPONENTS_eagle.app.v6
=
\
user/libuser.a
\
driver/libdriver.a
LINKFLAGS_eagle.app.v6
=
\
-L../lib
\
-nostdlib
\
-T$(LD_FILE)
\
-Wl,--no-check-sections
\
-u
call_user_start
\
-Wl,-static
\
-Wl,--start-group
\
-lc
\
-lgcc
\
-lhal
\
-lphy
\
-lpp
\
-lnet80211
\
-llwip
\
-lwpa
\
-lmain
\
-lwps
\
-lcrypto
\
$(DEP_LIBS_eagle.app.v6)
\
-Wl,--end-group
DEPENDS_eagle.app.v6
=
\
$(LD_FILE)
\
$(LDDIR)/eagle.rom.addr.v6.ld
#############################################################
# Configuration i.e. compile options etc.
# Target specific stuff (defines etc.) goes in here!
# Generally values applying to a tree are captured in the
# makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein
#
#UNIVERSAL_TARGET_DEFINES = \
# Other potential configuration flags include:
# -DTXRX_TXBUF_DEBUG
# -DTXRX_RXBUF_DEBUG
# -DWLAN_CONFIG_CCX
CONFIGURATION_DEFINES
=
-DICACHE_FLASH
DEFINES
+=
\
$(UNIVERSAL_TARGET_DEFINES)
\
$(CONFIGURATION_DEFINES)
DDEFINES
+=
\
$(UNIVERSAL_TARGET_DEFINES)
\
$(CONFIGURATION_DEFINES)
#############################################################
# Recursion Magic - Don't touch this!!
#
# Each subtree potentially has an include directory
# corresponding to the common APIs applicable to modules
# rooted at that subtree. Accordingly, the INCLUDE PATH
# of a module can only contain the include directories up
# its parent path, and not its siblings
#
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
.PHONY
:
FORCE
FORCE
:
sdk/esp_iot_sdk_v1.4.0/examples/wps/driver/Makefile
deleted
100644 → 0
View file @
c8037568
#############################################################
# Required variables for each makefile
# Discard this section from all parent makefiles
# Expected variables (with automatic defaults):
# CSRCS (all "C" files in the dir)
# SUBDIRS (all subdirs with a Makefile)
# GEN_LIBS - list of libs to be generated ()
# GEN_IMAGES - list of images to be generated ()
# COMPONENTS_xxx - a list of libs/objs in the form
# subdir/lib to be extracted and rolled up into
# a generated lib/image xxx.a ()
#
ifndef
PDIR
GEN_LIBS
=
libdriver.a
endif
#############################################################
# Configuration i.e. compile options etc.
# Target specific stuff (defines etc.) goes in here!
# Generally values applying to a tree are captured in the
# makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein
#
#DEFINES +=
#############################################################
# Recursion Magic - Don't touch this!!
#
# Each subtree potentially has an include directory
# corresponding to the common APIs applicable to modules
# rooted at that subtree. Accordingly, the INCLUDE PATH
# of a module can only contain the include directories up
# its parent path, and not its siblings
#
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
sdk/esp_iot_sdk_v1.4.0/examples/wps/driver/key.c
deleted
100644 → 0
View file @
c8037568
/******************************************************************************
* Copyright 2013-2014 Espressif Systems (Wuxi)
*
* FileName: key.c
*
* Description: key driver, now can use different gpio and install different function
*
* Modification history:
* 2014/5/1, v1.0 create this file.
*******************************************************************************/
#include "ets_sys.h"
#include "os_type.h"
#include "osapi.h"
#include "mem.h"
#include "gpio.h"
#include "user_interface.h"
#include "driver/key.h"
LOCAL
void
key_intr_handler
(
struct
keys_param
*
keys
);
/******************************************************************************
* FunctionName : key_init_single
* Description : init single key's gpio and register function
* Parameters : uint8 gpio_id - which gpio to use
* uint32 gpio_name - gpio mux name
* uint32 gpio_func - gpio function
* key_function long_press - long press function, needed to install
* key_function short_press - short press function, needed to install
* Returns : single_key_param - single key parameter, needed by key init
*******************************************************************************/
struct
single_key_param
*
ICACHE_FLASH_ATTR
key_init_single
(
uint8
gpio_id
,
uint32
gpio_name
,
uint8
gpio_func
,
key_function
long_press
,
key_function
short_press
)
{
struct
single_key_param
*
single_key
=
(
struct
single_key_param
*
)
os_zalloc
(
sizeof
(
struct
single_key_param
));
single_key
->
gpio_id
=
gpio_id
;
single_key
->
gpio_name
=
gpio_name
;
single_key
->
gpio_func
=
gpio_func
;
single_key
->
long_press
=
long_press
;
single_key
->
short_press
=
short_press
;
return
single_key
;
}
/******************************************************************************
* FunctionName : key_init
* Description : init keys
* Parameters : key_param *keys - keys parameter, which inited by key_init_single
* Returns : none
*******************************************************************************/
void
ICACHE_FLASH_ATTR
key_init
(
struct
keys_param
*
keys
)
{
uint8
i
;
ETS_GPIO_INTR_ATTACH
(
key_intr_handler
,
keys
);
ETS_GPIO_INTR_DISABLE
();
for
(
i
=
0
;
i
<
keys
->
key_num
;
i
++
)
{
keys
->
single_key
[
i
]
->
key_level
=
1
;
PIN_FUNC_SELECT
(
keys
->
single_key
[
i
]
->
gpio_name
,
keys
->
single_key
[
i
]
->
gpio_func
);
gpio_output_set
(
0
,
0
,
0
,
GPIO_ID_PIN
(
keys
->
single_key
[
i
]
->
gpio_id
));
gpio_register_set
(
GPIO_PIN_ADDR
(
keys
->
single_key
[
i
]
->
gpio_id
),
GPIO_PIN_INT_TYPE_SET
(
GPIO_PIN_INTR_DISABLE
)
|
GPIO_PIN_PAD_DRIVER_SET
(
GPIO_PAD_DRIVER_DISABLE
)
|
GPIO_PIN_SOURCE_SET
(
GPIO_AS_PIN_SOURCE
));
//clear gpio14 status
GPIO_REG_WRITE
(
GPIO_STATUS_W1TC_ADDRESS
,
BIT
(
keys
->
single_key
[
i
]
->
gpio_id
));
//enable interrupt
gpio_pin_intr_state_set
(
GPIO_ID_PIN
(
keys
->
single_key
[
i
]
->
gpio_id
),
GPIO_PIN_INTR_NEGEDGE
);
}
ETS_GPIO_INTR_ENABLE
();
}
/******************************************************************************
* FunctionName : key_5s_cb
* Description : long press 5s timer callback
* Parameters : single_key_param *single_key - single key parameter
* Returns : none
*******************************************************************************/
LOCAL
void
ICACHE_FLASH_ATTR
key_5s_cb
(
struct
single_key_param
*
single_key
)
{
os_timer_disarm
(
&
single_key
->
key_5s
);
// low, then restart
if
(
0
==
GPIO_INPUT_GET
(
GPIO_ID_PIN
(
single_key
->
gpio_id
)))
{
if
(
single_key
->
long_press
)
{
single_key
->
long_press
();
}
}
}
/******************************************************************************
* FunctionName : key_50ms_cb
* Description : 50ms timer callback to check it's a real key push
* Parameters : single_key_param *single_key - single key parameter
* Returns : none
*******************************************************************************/
LOCAL
void
ICACHE_FLASH_ATTR
key_50ms_cb
(
struct
single_key_param
*
single_key
)
{
os_timer_disarm
(
&
single_key
->
key_50ms
);
// high, then key is up
if
(
1
==
GPIO_INPUT_GET
(
GPIO_ID_PIN
(
single_key
->
gpio_id
)))
{
os_timer_disarm
(
&
single_key
->
key_5s
);
single_key
->
key_level
=
1
;
gpio_pin_intr_state_set
(
GPIO_ID_PIN
(
single_key
->
gpio_id
),
GPIO_PIN_INTR_NEGEDGE
);
if
(
single_key
->
short_press
)
{
single_key
->
short_press
();
}
}
else
{
gpio_pin_intr_state_set
(
GPIO_ID_PIN
(
single_key
->
gpio_id
),
GPIO_PIN_INTR_POSEDGE
);
}
}
/******************************************************************************
* FunctionName : key_intr_handler
* Description : key interrupt handler
* Parameters : key_param *keys - keys parameter, which inited by key_init_single
* Returns : none
*******************************************************************************/
LOCAL
void
key_intr_handler
(
struct
keys_param
*
keys
)
{
uint8
i
;
uint32
gpio_status
=
GPIO_REG_READ
(
GPIO_STATUS_ADDRESS
);
for
(
i
=
0
;
i
<
keys
->
key_num
;
i
++
)
{
if
(
gpio_status
&
BIT
(
keys
->
single_key
[
i
]
->
gpio_id
))
{
//disable interrupt
gpio_pin_intr_state_set
(
GPIO_ID_PIN
(
keys
->
single_key
[
i
]
->
gpio_id
),
GPIO_PIN_INTR_DISABLE
);
//clear interrupt status
GPIO_REG_WRITE
(
GPIO_STATUS_W1TC_ADDRESS
,
gpio_status
&
BIT
(
keys
->
single_key
[
i
]
->
gpio_id
));
if
(
keys
->
single_key
[
i
]
->
key_level
==
1
)
{
// 5s, restart & enter softap mode
os_timer_disarm
(
&
keys
->
single_key
[
i
]
->
key_5s
);
os_timer_setfn
(
&
keys
->
single_key
[
i
]
->
key_5s
,
(
os_timer_func_t
*
)
key_5s_cb
,
keys
->
single_key
[
i
]);
os_timer_arm
(
&
keys
->
single_key
[
i
]
->
key_5s
,
5000
,
0
);
keys
->
single_key
[
i
]
->
key_level
=
0
;
gpio_pin_intr_state_set
(
GPIO_ID_PIN
(
keys
->
single_key
[
i
]
->
gpio_id
),
GPIO_PIN_INTR_POSEDGE
);
}
else
{
// 50ms, check if this is a real key up
os_timer_disarm
(
&
keys
->
single_key
[
i
]
->
key_50ms
);
os_timer_setfn
(
&
keys
->
single_key
[
i
]
->
key_50ms
,
(
os_timer_func_t
*
)
key_50ms_cb
,
keys
->
single_key
[
i
]);
os_timer_arm
(
&
keys
->
single_key
[
i
]
->
key_50ms
,
50
,
0
);
}
}
}
}
sdk/esp_iot_sdk_v1.4.0/examples/wps/gen_misc.bat
deleted
100644 → 0
View file @
c8037568
@echo
off
echo
gen_misc
.bat
version
20150511
echo
.
echo
Please
follow
below
steps
(
1
-
5
)
to
generate
specific
bin
(
s
)
:
echo
STEP
1
:
choose
boot
version
(
0
=
boot_v1
.1
,
1
=
boot_v1
.2
+,
2
=
none
)
set
input
=
default
set
/p
input
=
enter
(
0
/1/2
,
default
2
)
:
if
%input%
equ
0
(
set
boot
=
old
)
else
(
if
%input%
equ
1
(
set
boot
=
new
)
else
(
set
boot
=
none
)
)
echo
boot
mode
:
%boot%
echo
.
echo
STEP
2
:
choose
bin
generate
(
0
=
eagle
.flash.bin
+eagle
.irom0text.bin
,
1
=
user1
.bin
,
2
=
user2
.bin
)
set
input
=
default
set
/p
input
=
enter
(
0
/1/2
,
default
0
)
:
if
%input%
equ
1
(
if
%boot%
equ
none
(
set
app
=
0
echo
choose
no
boot
before
echo
generate
bin
:
eagle
.flash.bin
+eagle
.irom0text.bin
)
else
(
set
app
=
1
echo
generate
bin
:
user1
.bin
)
)
else
(
if
%input%
equ
2
(
if
%boot%
equ
none
(
set
app
=
0
echo
choose
no
boot
before
echo
generate
bin
:
eagle
.flash.bin
+eagle
.irom0text.bin
)
else
(
set
app
=
2
echo
generate
bin
:
user2
.bin
)
)
else
(
if
%boot%
neq
none
(
set
boot
=
none
echo
ignore
boot
)
set
app
=
0
echo
generate
bin
:
eagle
.flash.bin
+eagle
.irom0text.bin
))
echo
.
echo
STEP
3
:
choose
spi
speed
(
0
=
20
MHz
,
1
=
26
.7MHz
,
2
=
40
MHz
,
3
=
80
MHz
)
set
input
=
default
set
/p
input
=
enter
(
0
/1/2/3
,
default
2
)
:
if
%input%
equ
0
(
set
spi_speed
=
20
)
else
(
if
%input%
equ
1
(
set
spi_speed
=
26
.7
)
else
(
if
%input%
equ
3
(
set
spi_speed
=
80
)
else
(
set
spi_speed
=
40
)))
echo
spi
speed
:
%spi_speed%
MHz
echo
.
echo
STEP
4
:
choose
spi
mode
(
0
=
QIO
,
1
=
QOUT
,
2
=
DIO
,
3
=
DOUT
)
set
input
=
default
set
/p
input
=
enter
(
0
/1/2/3
,
default
0
)
:
if
%input%
equ
1
(
set
spi_mode
=
QOUT
)
else
(
if
%input%
equ
2
(
set
spi_mode
=
DIO
)
else
(
if
%input%
equ
3
(
set
spi_mode
=
DOUT
)
else
(
set
spi_mode
=
QIO
)))
echo
spi
mode
:
%spi_mode%
echo
.
echo
STEP
5
:
choose
flash
size
and
map
echo
0
=
512
KB
(
256
KB
+
256
KB
)
echo
2
=
1024
KB
(
512
KB
+
512
KB
)
echo
3
=
2048
KB
(
512
KB
+
512
KB
)
echo
4
=
4096
KB
(
512
KB
+
512
KB
)
echo
5
=
2048
KB
(
1024
KB
+
1024
KB
)
echo
6
=
4096
KB
(
1024
KB
+
1024
KB
)
set
input
=
default
set
/p
input
=
enter
(
0
/1/2/3/4/5/6
,
default
0
)
:
if
%input%
equ
2
(
set
spi_size_map
=
2
echo
spi
size
:
1024
KB
echo
spi
ota
map
:
512
KB
+
512
KB
)
else
(
if
%input%
equ
3
(
set
spi_size_map
=
3
echo
spi
size
:
2048
KB
echo
spi
ota
map
:
512
KB
+
512
KB
)
else
(
if
%input%
equ
4
(
set
spi_size_map
=
4
echo
spi
size
:
4096
KB
echo
spi
ota
map
:
512
KB
+
512
KB
)
else
(
if
%input%
equ
5
(
set
spi_size_map
=
5
echo
spi
size
:
2048
KB
echo
spi
ota
map
:
1024
KB
+
1024
KB
)
else
(
if
%input%
equ
6
(
set
spi_size_map
=
6
echo
spi
size
:
4096
KB
echo
spi
ota
map
:
1024
KB
+
1024
KB
)
else
(
set
spi_size_map
=
0
echo
spi
size
:
512
KB
echo
spi
ota
map
:
256
KB
+
256
KB
)
)
)
)
)
touch
user
/user
_main.c
echo
.
echo
start
...
echo
.
make
BOOT
=
%boot%
APP
=
%app%
SPI_SPEED
=
%spi_speed%
SPI_MODE
=
%spi_mode%
SPI_SIZE
=
%spi_size_map%
sdk/esp_iot_sdk_v1.4.0/examples/wps/gen_misc.sh
deleted
100644 → 0
View file @
c8037568
#!/bin/bash
echo
"gen_misc.sh version 20150511"
echo
""
echo
"Please follow below steps(1-5) to generate specific bin(s):"
echo
"STEP 1: choose boot version(0=boot_v1.1, 1=boot_v1.2+, 2=none)"
echo
"enter(0/1/2, default 2):"
read
input
if
[
-z
"
$input
"
]
;
then
boot
=
none
elif
[
$input
==
0
]
;
then
boot
=
old
elif
[
$input
==
1
]
;
then
boot
=
new
else
boot
=
none
fi
echo
"boot mode:
$boot
"
echo
""
echo
"STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)"
echo
"enter (0/1/2, default 0):"
read
input
if
[
-z
"
$input
"
]
;
then
if
[
$boot
!=
none
]
;
then
boot
=
none
echo
"ignore boot"
fi
app
=
0
echo
"generate bin: eagle.flash.bin+eagle.irom0text.bin"
elif
[
$input
==
1
]
;
then
if
[
$boot
==
none
]
;
then
app
=
0
echo
"choose no boot before"
echo
"generate bin: eagle.flash.bin+eagle.irom0text.bin"
else
app
=
1
echo
"generate bin: user1.bin"
fi
elif
[
$input
==
2
]
;
then
if
[
$boot
==
none
]
;
then
app
=
0
echo
"choose no boot before"
echo
"generate bin: eagle.flash.bin+eagle.irom0text.bin"
else
app
=
2
echo
"generate bin: user2.bin"
fi
else
if
[
$boot
!=
none
]
;
then
boot
=
none
echo
"ignore boot"
fi
app
=
0
echo
"generate bin: eagle.flash.bin+eagle.irom0text.bin"
fi
echo
""
echo
"STEP 3: choose spi speed(0=20MHz, 1=26.7MHz, 2=40MHz, 3=80MHz)"
echo
"enter (0/1/2/3, default 2):"
read
input
if
[
-z
"
$input
"
]
;
then
spi_speed
=
40
elif
[
$input
==
0
]
;
then
spi_speed
=
20
elif
[
$input
==
1
]
;
then
spi_speed
=
26.7
elif
[
$input
==
3
]
;
then
spi_speed
=
80
else
spi_speed
=
40
fi
echo
"spi speed:
$spi_speed
MHz"
echo
""
echo
"STEP 4: choose spi mode(0=QIO, 1=QOUT, 2=DIO, 3=DOUT)"
echo
"enter (0/1/2/3, default 0):"
read
input
if
[
-z
"
$input
"
]
;
then
spi_mode
=
QIO
elif
[
$input
==
1
]
;
then
spi_mode
=
QOUT
elif
[
$input
==
2
]
;
then
spi_mode
=
DIO
elif
[
$input
==
3
]
;
then
spi_mode
=
DOUT
else
spi_mode
=
QIO
fi
echo
"spi mode:
$spi_mode
"
echo
""
echo
"STEP 5: choose spi size and map"
echo
" 0= 512KB( 256KB+ 256KB)"
echo
" 2=1024KB( 512KB+ 512KB)"
echo
" 3=2048KB( 512KB+ 512KB)"
echo
" 4=4096KB( 512KB+ 512KB)"
echo
" 5=2048KB(1024KB+1024KB)"
echo
" 6=4096KB(1024KB+1024KB)"
echo
"enter (0/2/3/4/5/6, default 0):"
read
input
if
[
-z
"
$input
"
]
;
then
spi_size_map
=
0
echo
"spi size: 512KB"
echo
"spi ota map: 256KB + 256KB"
elif
[
$input
==
2
]
;
then
spi_size_map
=
2
echo
"spi size: 1024KB"
echo
"spi ota map: 512KB + 512KB"
elif
[
$input
==
3
]
;
then
spi_size_map
=
3
echo
"spi size: 2048KB"
echo
"spi ota map: 512KB + 512KB"
elif
[
$input
==
4
]
;
then
spi_size_map
=
4
echo
"spi size: 4096KB"
echo
"spi ota map: 512KB + 512KB"
elif
[
$input
==
5
]
;
then
spi_size_map
=
5
echo
"spi size: 2048KB"
echo
"spi ota map: 1024KB + 1024KB"
elif
[
$input
==
6
]
;
then
spi_size_map
=
6
echo
"spi size: 4096KB"
echo
"spi ota map: 1024KB + 1024KB"
else
spi_size_map
=
0
echo
"spi size: 512KB"
echo
"spi ota map: 256KB + 256KB"
fi
echo
""
touch
user/user_main.c
echo
""
echo
"start..."
echo
""
make
COMPILE
=
gcc
BOOT
=
$boot
APP
=
$app
SPI_SPEED
=
$spi_speed
SPI_MODE
=
$spi_mode
SPI_SIZE_MAP
=
$spi_size_map
sdk/esp_iot_sdk_v1.4.0/examples/wps/include/driver/key.h
deleted
100644 → 0
View file @
c8037568
#ifndef __KEY_H__
#define __KEY_H__
#include "gpio.h"
typedef
void
(
*
key_function
)(
void
);
struct
single_key_param
{
uint8
key_level
;
uint8
gpio_id
;
uint8
gpio_func
;
uint32
gpio_name
;
os_timer_t
key_5s
;
os_timer_t
key_50ms
;
key_function
short_press
;
key_function
long_press
;
};
struct
keys_param
{
uint8
key_num
;
struct
single_key_param
**
single_key
;
};
struct
single_key_param
*
key_init_single
(
uint8
gpio_id
,
uint32
gpio_name
,
uint8
gpio_func
,
key_function
long_press
,
key_function
short_press
);
void
key_init
(
struct
keys_param
*
key
);
#endif
sdk/esp_iot_sdk_v1.4.0/examples/wps/include/user_config.h
deleted
100644 → 0
View file @
c8037568
#ifndef __USER_CONFIG_H__
#define __USER_CONFIG_H__
#endif
sdk/esp_iot_sdk_v1.4.0/examples/wps/user/Makefile
deleted
100644 → 0
View file @
c8037568
#############################################################
# Required variables for each makefile
# Discard this section from all parent makefiles
# Expected variables (with automatic defaults):
# CSRCS (all "C" files in the dir)
# SUBDIRS (all subdirs with a Makefile)
# GEN_LIBS - list of libs to be generated ()
# GEN_IMAGES - list of images to be generated ()
# COMPONENTS_xxx - a list of libs/objs in the form
# subdir/lib to be extracted and rolled up into
# a generated lib/image xxx.a ()
#
ifndef
PDIR
GEN_LIBS
=
libuser.a
endif
#############################################################
# Configuration i.e. compile options etc.
# Target specific stuff (defines etc.) goes in here!
# Generally values applying to a tree are captured in the
# makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein
#
#DEFINES +=
#############################################################
# Recursion Magic - Don't touch this!!
#
# Each subtree potentially has an include directory
# corresponding to the common APIs applicable to modules
# rooted at that subtree. Accordingly, the INCLUDE PATH
# of a module can only contain the include directories up
# its parent path, and not its siblings
#
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
INCLUDES
+=
-I
../../include/ets
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
sdk/esp_iot_sdk_v1.4.0/examples/wps/user/user_main.c
deleted
100644 → 0
View file @
c8037568
/******************************************************************************
* Copyright 2013-2014 Espressif Systems (Wuxi)
*
* FileName: user_main.c
*
* Description: entry file of user application
*
* Modification history:
* 2015/7/3, v1.0 create this file.
*******************************************************************************/
#include "osapi.h"
#include "user_interface.h"
#include "driver/key.h"
#define WPS_KEY_NUM 1
#define WPS_KEY_IO_MUX PERIPHS_IO_MUX_MTCK_U
#define WPS_KEY_IO_NUM 13
#define WPS_KEY_IO_FUNC FUNC_GPIO13
LOCAL
struct
keys_param
keys
;
LOCAL
struct
single_key_param
*
single_key
;
LOCAL
void
ICACHE_FLASH_ATTR
user_wps_status_cb
(
int
status
)
{
switch
(
status
)
{
case
WPS_CB_ST_SUCCESS
:
wifi_wps_disable
();
wifi_station_connect
();
break
;
case
WPS_CB_ST_FAILED
:
case
WPS_CB_ST_TIMEOUT
:
wifi_wps_start
();
break
;
}
}
LOCAL
void
ICACHE_FLASH_ATTR
user_wps_key_short_press
(
void
)
{
wifi_wps_disable
();
wifi_wps_enable
(
WPS_TYPE_PBC
);
wifi_set_wps_cb
(
user_wps_status_cb
);
wifi_wps_start
();
}
void
ICACHE_FLASH_ATTR
user_rf_pre_init
(
void
)
{
}
void
ICACHE_FLASH_ATTR
user_init
(
void
)
{
single_key
=
key_init_single
(
WPS_KEY_IO_NUM
,
WPS_KEY_IO_MUX
,
WPS_KEY_IO_FUNC
,
NULL
,
user_wps_key_short_press
);
keys
.
key_num
=
WPS_KEY_NUM
;
keys
.
single_key
=
&
single_key
;
key_init
(
&
keys
);
wifi_set_opmode
(
STATION_MODE
);
}
sdk/esp_iot_sdk_v1.4.0/include/at_custom.h
deleted
100644 → 0
View file @
c8037568
/*
* 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
;
typedef
void
(
*
at_custom_uart_rx_intr
)(
uint8
*
data
,
int32
len
);
typedef
void
(
*
at_custom_response_func_type
)(
const
char
*
str
);
extern
uint8
at_customLinkMax
;
/**
* @brief Response "OK" to uart.
* @param None
* @retval None
*/
void
at_response_ok
(
void
);
/**
* @brief Response "ERROR" to uart.
* @param None
* @retval None
*/
void
at_response_error
(
void
);
/**
* @brief Response string.
* It is equivalent to at_port_print,if not call at_register_response_func or call at_register_response_func(NULL);
* It will run custom response function,if call at_register_response_func and parameter is not NULL.
* @param string
* @retval None
*/
void
at_response
(
const
char
*
str
);
/**
* @brief register custom response function.
* @param response_func: the function that will run when call at_response
* @retval None
*/
void
at_register_response_func
(
at_custom_response_func_type
response_func
);
/**
* @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
);
/**
* @brief print custom information when AT+GMR
* @param string
* @retval None
*/
void
at_set_custom_info
(
char
*
info
);
/**
* @brief if current at command is processing,you can call at_enter_special_state,
* then if other comamnd coming,it will return busy.
* @param None
* @retval None
*/
void
at_enter_special_state
(
void
);
/**
* @brief
* @param None
* @retval None
*/
void
at_leave_special_state
(
void
);
/**
* @brief get at version
* @param None
* @retval at version
* bit24~31: at main version
* bit23~16: at sub version
* bit15~8 : at test version
* bit7~0 : customized version
*/
uint32
at_get_version
(
void
);
/**
* @brief register custom uart rx interrupt function
* @param rx_func: custom uart rx interrupt function.
* If rx_func is non-void,when rx interrupt comming,it will call rx_func(data,len),
* data is the buffer of data,len is the length of data.Otherwise,it will run AT rx function.
* @retval None
*/
void
at_register_uart_rx_intr
(
at_custom_uart_rx_intr
rx_func
);
#endif
sdk/esp_iot_sdk_v1.4.0/include/c_types.h
deleted
100644 → 0
View file @
c8037568
/*
* Copyright (c) 2010 - 2011 Espressif System
*
*/
#ifndef _C_TYPES_H_
#define _C_TYPES_H_
typedef
unsigned
char
uint8_t
;
typedef
signed
char
sint8_t
;
typedef
signed
char
int8_t
;
typedef
unsigned
short
uint16_t
;
typedef
signed
short
sint16_t
;
typedef
signed
short
int16_t
;
typedef
unsigned
long
uint32_t
;
typedef
signed
long
sint32_t
;
typedef
signed
long
int32_t
;
typedef
signed
long
long
sint64_t
;
typedef
unsigned
long
long
uint64_t
;
typedef
unsigned
long
long
u_int64_t
;
typedef
float
real32_t
;
typedef
double
real64_t
;
typedef
unsigned
char
uint8
;
typedef
unsigned
char
u8
;
typedef
signed
char
sint8
;
typedef
signed
char
int8
;
typedef
signed
char
s8
;
typedef
unsigned
short
uint16
;
typedef
unsigned
short
u16
;
typedef
signed
short
sint16
;
typedef
signed
short
s16
;
typedef
unsigned
int
uint32
;
typedef
unsigned
int
u_int
;
typedef
unsigned
int
u32
;
typedef
signed
int
sint32
;
typedef
signed
int
s32
;
typedef
int
int32
;
typedef
signed
long
long
sint64
;
typedef
unsigned
long
long
uint64
;
typedef
unsigned
long
long
u64
;
typedef
float
real32
;
typedef
double
real64
;
#define __le16 u16
typedef
unsigned
int
size_t
;
#define __packed __attribute__((packed))
#define LOCAL static
#ifndef NULL
#define NULL (void *)0
#endif
/* NULL */
/* probably should not put STATUS here */
typedef
enum
{
OK
=
0
,
FAIL
,
PENDING
,
BUSY
,
CANCEL
,
}
STATUS
;
#define BIT(nr) (1UL << (nr))
#define REG_SET_BIT(_r, _b) (*(volatile uint32_t*)(_r) |= (_b))
#define REG_CLR_BIT(_r, _b) (*(volatile uint32_t*)(_r) &= ~(_b))
#define DMEM_ATTR __attribute__((section(".bss")))
#define SHMEM_ATTR
#ifdef ICACHE_FLASH
#define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
#define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
#else
#define ICACHE_FLASH_ATTR
#define ICACHE_RODATA_ATTR
#endif
/* ICACHE_FLASH */
#ifndef __cplusplus
typedef
unsigned
char
bool
;
#define BOOL bool
#define true (1)
#define false (0)
#define TRUE true
#define FALSE false
#endif
/* !__cplusplus */
#endif
/* _C_TYPES_H_ */
sdk/esp_iot_sdk_v1.4.0/include/eagle_soc.h
deleted
100644 → 0
View file @
c8037568
/*
* Copyright (c) Espressif System 2010 - 2012
*
*/
#ifndef _EAGLE_SOC_H_
#define _EAGLE_SOC_H_
//Register Bits{{
#define BIT31 0x80000000
#define BIT30 0x40000000
#define BIT29 0x20000000
#define BIT28 0x10000000
#define BIT27 0x08000000
#define BIT26 0x04000000
#define BIT25 0x02000000
#define BIT24 0x01000000
#define BIT23 0x00800000
#define BIT22 0x00400000
#define BIT21 0x00200000
#define BIT20 0x00100000
#define BIT19 0x00080000
#define BIT18 0x00040000
#define BIT17 0x00020000
#define BIT16 0x00010000
#define BIT15 0x00008000
#define BIT14 0x00004000
#define BIT13 0x00002000
#define BIT12 0x00001000
#define BIT11 0x00000800
#define BIT10 0x00000400
#define BIT9 0x00000200
#define BIT8 0x00000100
#define BIT7 0x00000080
#define BIT6 0x00000040
#define BIT5 0x00000020
#define BIT4 0x00000010
#define BIT3 0x00000008
#define BIT2 0x00000004
#define BIT1 0x00000002
#define BIT0 0x00000001
//}}
//Registers Operation {{
#define ETS_UNCACHED_ADDR(addr) (addr)
#define ETS_CACHED_ADDR(addr) (addr)
#define READ_PERI_REG(addr) (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr)))
#define WRITE_PERI_REG(addr, val) (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val)
#define CLEAR_PERI_REG_MASK(reg, mask) WRITE_PERI_REG((reg), (READ_PERI_REG(reg)&(~(mask))))
#define SET_PERI_REG_MASK(reg, mask) WRITE_PERI_REG((reg), (READ_PERI_REG(reg)|(mask)))
#define GET_PERI_REG_BITS(reg, hipos,lowpos) ((READ_PERI_REG(reg)>>(lowpos))&((1<<((hipos)-(lowpos)+1))-1))
#define SET_PERI_REG_BITS(reg,bit_map,value,shift) (WRITE_PERI_REG((reg),(READ_PERI_REG(reg)&(~((bit_map)<<(shift))))|((value)<<(shift)) ))
//}}
//Periheral Clock {{
#define APB_CLK_FREQ 80*1000000 //unit: Hz
#define UART_CLK_FREQ APB_CLK_FREQ
#define TIMER_CLK_FREQ (APB_CLK_FREQ>>8) //divided by 256
//}}
//Peripheral device base address define{{
#define PERIPHS_DPORT_BASEADDR 0x3ff00000
#define PERIPHS_GPIO_BASEADDR 0x60000300
#define PERIPHS_TIMER_BASEDDR 0x60000600
#define PERIPHS_RTC_BASEADDR 0x60000700
#define PERIPHS_IO_MUX 0x60000800
//}}
//Interrupt remap control registers define{{
#define EDGE_INT_ENABLE_REG (PERIPHS_DPORT_BASEADDR+0x04)
#define TM1_EDGE_INT_ENABLE() SET_PERI_REG_MASK(EDGE_INT_ENABLE_REG, BIT1)
#define TM1_EDGE_INT_DISABLE() CLEAR_PERI_REG_MASK(EDGE_INT_ENABLE_REG, BIT1)
//}}
//GPIO reg {{
#define GPIO_REG_READ(reg) READ_PERI_REG(PERIPHS_GPIO_BASEADDR + reg)
#define GPIO_REG_WRITE(reg, val) WRITE_PERI_REG(PERIPHS_GPIO_BASEADDR + reg, val)
#define GPIO_OUT_ADDRESS 0x00
#define GPIO_OUT_W1TS_ADDRESS 0x04
#define GPIO_OUT_W1TC_ADDRESS 0x08
#define GPIO_ENABLE_ADDRESS 0x0c
#define GPIO_ENABLE_W1TS_ADDRESS 0x10
#define GPIO_ENABLE_W1TC_ADDRESS 0x14
#define GPIO_OUT_W1TC_DATA_MASK 0x0000ffff
#define GPIO_IN_ADDRESS 0x18
#define GPIO_STATUS_ADDRESS 0x1c
#define GPIO_STATUS_W1TS_ADDRESS 0x20
#define GPIO_STATUS_W1TC_ADDRESS 0x24
#define GPIO_STATUS_INTERRUPT_MASK 0x0000ffff
#define GPIO_RTC_CALIB_SYNC PERIPHS_GPIO_BASEADDR+0x6c
#define RTC_CALIB_START BIT31 //first write to zero, then to one to start
#define RTC_PERIOD_NUM_MASK 0x3ff //max 8ms
#define GPIO_RTC_CALIB_VALUE PERIPHS_GPIO_BASEADDR+0x70
#define RTC_CALIB_RDY_S 31 //after measure, flag to one, when start from zero to one, turn to zero
#define RTC_CALIB_VALUE_MASK 0xfffff
#define GPIO_PIN0_ADDRESS 0x28
#define GPIO_ID_PIN0 0
#define GPIO_ID_PIN(n) (GPIO_ID_PIN0+(n))
#define GPIO_LAST_REGISTER_ID GPIO_ID_PIN(15)
#define GPIO_ID_NONE 0xffffffff
#define GPIO_PIN_COUNT 16
#define GPIO_PIN_CONFIG_MSB 12
#define GPIO_PIN_CONFIG_LSB 11
#define GPIO_PIN_CONFIG_MASK 0x00001800
#define GPIO_PIN_CONFIG_GET(x) (((x) & GPIO_PIN_CONFIG_MASK) >> GPIO_PIN_CONFIG_LSB)
#define GPIO_PIN_CONFIG_SET(x) (((x) << GPIO_PIN_CONFIG_LSB) & GPIO_PIN_CONFIG_MASK)
#define GPIO_WAKEUP_ENABLE 1
#define GPIO_WAKEUP_DISABLE (~GPIO_WAKEUP_ENABLE)
#define GPIO_PIN_WAKEUP_ENABLE_MSB 10
#define GPIO_PIN_WAKEUP_ENABLE_LSB 10
#define GPIO_PIN_WAKEUP_ENABLE_MASK 0x00000400
#define GPIO_PIN_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN_WAKEUP_ENABLE_MASK) >> GPIO_PIN_WAKEUP_ENABLE_LSB)
#define GPIO_PIN_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN_WAKEUP_ENABLE_LSB) & GPIO_PIN_WAKEUP_ENABLE_MASK)
#define GPIO_PIN_INT_TYPE_MASK 0x380
#define GPIO_PIN_INT_TYPE_MSB 9
#define GPIO_PIN_INT_TYPE_LSB 7
#define GPIO_PIN_INT_TYPE_GET(x) (((x) & GPIO_PIN_INT_TYPE_MASK) >> GPIO_PIN_INT_TYPE_LSB)
#define GPIO_PIN_INT_TYPE_SET(x) (((x) << GPIO_PIN_INT_TYPE_LSB) & GPIO_PIN_INT_TYPE_MASK)
#define GPIO_PAD_DRIVER_ENABLE 1
#define GPIO_PAD_DRIVER_DISABLE (~GPIO_PAD_DRIVER_ENABLE)
#define GPIO_PIN_PAD_DRIVER_MSB 2
#define GPIO_PIN_PAD_DRIVER_LSB 2
#define GPIO_PIN_PAD_DRIVER_MASK 0x00000004
#define GPIO_PIN_PAD_DRIVER_GET(x) (((x) & GPIO_PIN_PAD_DRIVER_MASK) >> GPIO_PIN_PAD_DRIVER_LSB)
#define GPIO_PIN_PAD_DRIVER_SET(x) (((x) << GPIO_PIN_PAD_DRIVER_LSB) & GPIO_PIN_PAD_DRIVER_MASK)
#define GPIO_AS_PIN_SOURCE 0
#define SIGMA_AS_PIN_SOURCE (~GPIO_AS_PIN_SOURCE)
#define GPIO_PIN_SOURCE_MSB 0
#define GPIO_PIN_SOURCE_LSB 0
#define GPIO_PIN_SOURCE_MASK 0x00000001
#define GPIO_PIN_SOURCE_GET(x) (((x) & GPIO_PIN_SOURCE_MASK) >> GPIO_PIN_SOURCE_LSB)
#define GPIO_PIN_SOURCE_SET(x) (((x) << GPIO_PIN_SOURCE_LSB) & GPIO_PIN_SOURCE_MASK)
// }}
// TIMER reg {{
#define RTC_REG_READ(addr) READ_PERI_REG(PERIPHS_TIMER_BASEDDR + addr)
#define RTC_REG_WRITE(addr, val) WRITE_PERI_REG(PERIPHS_TIMER_BASEDDR + addr, val)
#define RTC_CLR_REG_MASK(reg, mask) CLEAR_PERI_REG_MASK(PERIPHS_TIMER_BASEDDR +reg, mask)
/* Returns the current time according to the timer timer. */
#define NOW() RTC_REG_READ(FRC2_COUNT_ADDRESS)
//load initial_value to timer1
#define FRC1_LOAD_ADDRESS 0x00
//timer1's counter value(count from initial_value to 0)
#define FRC1_COUNT_ADDRESS 0x04
#define FRC1_CTRL_ADDRESS 0x08
//clear timer1's interrupt when write this address
#define FRC1_INT_ADDRESS 0x0c
#define FRC1_INT_CLR_MASK 0x00000001
//timer2's counter value(count from initial_value to 0)
#define FRC2_COUNT_ADDRESS 0x24
// }}
//RTC reg {{
#define REG_RTC_BASE PERIPHS_RTC_BASEADDR
#define RTC_GPIO_OUT (REG_RTC_BASE + 0x068)
#define RTC_GPIO_ENABLE (REG_RTC_BASE + 0x074)
#define RTC_GPIO_IN_DATA (REG_RTC_BASE + 0x08C)
#define RTC_GPIO_CONF (REG_RTC_BASE + 0x090)
#define PAD_XPD_DCDC_CONF (REG_RTC_BASE + 0x0A0)
//}}
//PIN Mux reg {{
#define PERIPHS_IO_MUX_FUNC 0x13
#define PERIPHS_IO_MUX_FUNC_S 4
#define PERIPHS_IO_MUX_PULLUP BIT7
#define PERIPHS_IO_MUX_PULLUP2 BIT6
#define PERIPHS_IO_MUX_SLEEP_PULLUP BIT3
#define PERIPHS_IO_MUX_SLEEP_PULLUP2 BIT2
#define PERIPHS_IO_MUX_SLEEP_OE BIT1
#define PERIPHS_IO_MUX_OE BIT0
#define PERIPHS_IO_MUX_CONF_U (PERIPHS_IO_MUX + 0x00)
#define SPI0_CLK_EQU_SYS_CLK BIT8
#define SPI1_CLK_EQU_SYS_CLK BIT9
#define PERIPHS_IO_MUX_MTDI_U (PERIPHS_IO_MUX + 0x04)
#define FUNC_GPIO12 3
#define PERIPHS_IO_MUX_MTCK_U (PERIPHS_IO_MUX + 0x08)
#define FUNC_GPIO13 3
#define PERIPHS_IO_MUX_MTMS_U (PERIPHS_IO_MUX + 0x0C)
#define FUNC_GPIO14 3
#define PERIPHS_IO_MUX_MTDO_U (PERIPHS_IO_MUX + 0x10)
#define FUNC_GPIO15 3
#define FUNC_U0RTS 4
#define PERIPHS_IO_MUX_U0RXD_U (PERIPHS_IO_MUX + 0x14)
#define FUNC_GPIO3 3
#define PERIPHS_IO_MUX_U0TXD_U (PERIPHS_IO_MUX + 0x18)
#define FUNC_U0TXD 0
#define FUNC_GPIO1 3
#define PERIPHS_IO_MUX_SD_CLK_U (PERIPHS_IO_MUX + 0x1c)
#define FUNC_SDCLK 0
#define FUNC_SPICLK 1
#define PERIPHS_IO_MUX_SD_DATA0_U (PERIPHS_IO_MUX + 0x20)
#define FUNC_SDDATA0 0
#define FUNC_SPIQ 1
#define FUNC_U1TXD 4
#define PERIPHS_IO_MUX_SD_DATA1_U (PERIPHS_IO_MUX + 0x24)
#define FUNC_SDDATA1 0
#define FUNC_SPID 1
#define FUNC_U1RXD 4
#define FUNC_SDDATA1_U1RXD 7
#define PERIPHS_IO_MUX_SD_DATA2_U (PERIPHS_IO_MUX + 0x28)
#define FUNC_SDDATA2 0
#define FUNC_SPIHD 1
#define FUNC_GPIO9 3
#define PERIPHS_IO_MUX_SD_DATA3_U (PERIPHS_IO_MUX + 0x2c)
#define FUNC_SDDATA3 0
#define FUNC_SPIWP 1
#define FUNC_GPIO10 3
#define PERIPHS_IO_MUX_SD_CMD_U (PERIPHS_IO_MUX + 0x30)
#define FUNC_SDCMD 0
#define FUNC_SPICS0 1
#define PERIPHS_IO_MUX_GPIO0_U (PERIPHS_IO_MUX + 0x34)
#define FUNC_GPIO0 0
#define PERIPHS_IO_MUX_GPIO2_U (PERIPHS_IO_MUX + 0x38)
#define FUNC_GPIO2 0
#define FUNC_U1TXD_BK 2
#define FUNC_U0TXD_BK 4
#define PERIPHS_IO_MUX_GPIO4_U (PERIPHS_IO_MUX + 0x3C)
#define FUNC_GPIO4 0
#define PERIPHS_IO_MUX_GPIO5_U (PERIPHS_IO_MUX + 0x40)
#define FUNC_GPIO5 0
#define PIN_PULLUP_DIS(PIN_NAME) CLEAR_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLUP)
#define PIN_PULLUP_EN(PIN_NAME) SET_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLUP)
#define PIN_FUNC_SELECT(PIN_NAME, FUNC) do { \
WRITE_PERI_REG(PIN_NAME, \
READ_PERI_REG(PIN_NAME) \
& (~(PERIPHS_IO_MUX_FUNC<<PERIPHS_IO_MUX_FUNC_S)) \
|( (((FUNC&BIT2)<<2)|(FUNC&0x3))<<PERIPHS_IO_MUX_FUNC_S) ); \
} while (0)
//}}
#endif //_EAGLE_SOC_H_
sdk/esp_iot_sdk_v1.4.0/include/espconn.h
deleted
100644 → 0
View file @
c8037568
#ifndef __ESPCONN_H__
#define __ESPCONN_H__
typedef
sint8
err_t
;
typedef
void
*
espconn_handle
;
typedef
void
(
*
espconn_connect_callback
)(
void
*
arg
);
typedef
void
(
*
espconn_reconnect_callback
)(
void
*
arg
,
sint8
err
);
/* Definitions for error constants. */
#define ESPCONN_OK 0
/* No error, everything OK. */
#define ESPCONN_MEM -1
/* Out of memory error. */
#define ESPCONN_TIMEOUT -3
/* Timeout. */
#define ESPCONN_RTE -4
/* Routing problem. */
#define ESPCONN_INPROGRESS -5
/* Operation in progress */
#define ESPCONN_MAXNUM -7
/* Total number exceeds the set maximum*/
#define ESPCONN_ABRT -8
/* Connection aborted. */
#define ESPCONN_RST -9
/* Connection reset. */
#define ESPCONN_CLSD -10
/* Connection closed. */
#define ESPCONN_CONN -11
/* Not connected. */
#define ESPCONN_ARG -12
/* Illegal argument. */
#define ESPCONN_IF -14
/* UDP send error */
#define ESPCONN_ISCONN -15
/* Already connected. */
#define ESPCONN_HANDSHAKE -28
/* ssl handshake failed */
#define ESPCONN_SSL_INVALID_DATA -61
/* ssl application invalid */
/** Protocol family and type of the espconn */
enum
espconn_type
{
ESPCONN_INVALID
=
0
,
/* ESPCONN_TCP Group */
ESPCONN_TCP
=
0x10
,
/* ESPCONN_UDP Group */
ESPCONN_UDP
=
0x20
,
};
/** Current state of the espconn. Non-TCP espconn are always in state ESPCONN_NONE! */
enum
espconn_state
{
ESPCONN_NONE
,
ESPCONN_WAIT
,
ESPCONN_LISTEN
,
ESPCONN_CONNECT
,
ESPCONN_WRITE
,
ESPCONN_READ
,
ESPCONN_CLOSE
};
typedef
struct
_esp_tcp
{
int
remote_port
;
int
local_port
;
uint8
local_ip
[
4
];
uint8
remote_ip
[
4
];
espconn_connect_callback
connect_callback
;
espconn_reconnect_callback
reconnect_callback
;
espconn_connect_callback
disconnect_callback
;
espconn_connect_callback
write_finish_fn
;
}
esp_tcp
;
typedef
struct
_esp_udp
{
int
remote_port
;
int
local_port
;
uint8
local_ip
[
4
];
uint8
remote_ip
[
4
];
}
esp_udp
;
typedef
struct
_remot_info
{
enum
espconn_state
state
;
int
remote_port
;
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
);
typedef
void
(
*
espconn_sent_callback
)(
void
*
arg
);
/** A espconn descriptor */
struct
espconn
{
/** type of the espconn (TCP, UDP) */
enum
espconn_type
type
;
/** current state of the espconn */
enum
espconn_state
state
;
union
{
esp_tcp
*
tcp
;
esp_udp
*
udp
;
}
proto
;
/** A callback function that is informed about events for this espconn */
espconn_recv_callback
recv_callback
;
espconn_sent_callback
sent_callback
;
uint8
link_cnt
;
void
*
reverse
;
};
enum
espconn_option
{
ESPCONN_START
=
0x00
,
ESPCONN_REUSEADDR
=
0x01
,
ESPCONN_NODELAY
=
0x02
,
ESPCONN_COPY
=
0x04
,
ESPCONN_KEEPALIVE
=
0x08
,
ESPCONN_END
};
enum
espconn_level
{
ESPCONN_KEEPIDLE
,
ESPCONN_KEEPINTVL
,
ESPCONN_KEEPCNT
};
enum
{
ESPCONN_IDLE
=
0
,
ESPCONN_CLIENT
,
ESPCONN_SERVER
,
ESPCONN_BOTH
,
ESPCONN_MAX
};
struct
espconn_packet
{
uint16
sent_length
;
/* sent length successful*/
uint16
snd_buf_size
;
/* Available buffer size for sending */
uint16
snd_queuelen
;
/* Available buffer space for sending */
uint16
total_queuelen
;
/* total Available buffer space for sending */
uint32
packseqno
;
/* seqno to be sent */
uint32
packseq_nxt
;
/* seqno expected */
uint32
packnum
;
};
struct
mdns_info
{
char
*
host_name
;
char
*
server_name
;
uint16
server_port
;
unsigned
long
ipAddr
;
char
*
txt_data
[
10
];
};
/******************************************************************************
* FunctionName : espconn_connect
* Description : The function given as the connect
* Parameters : espconn -- the espconn used to listen the connection
* Returns : none
*******************************************************************************/
sint8
espconn_connect
(
struct
espconn
*
espconn
);
/******************************************************************************
* FunctionName : espconn_disconnect
* Description : disconnect with host
* Parameters : espconn -- the espconn used to disconnect the connection
* Returns : none
*******************************************************************************/
sint8
espconn_disconnect
(
struct
espconn
*
espconn
);
/******************************************************************************
* FunctionName : espconn_delete
* Description : disconnect with host
* Parameters : espconn -- the espconn used to disconnect the connection
* Returns : none
*******************************************************************************/
sint8
espconn_delete
(
struct
espconn
*
espconn
);
/******************************************************************************
* FunctionName : espconn_accept
* Description : The function given as the listen
* Parameters : espconn -- the espconn used to listen the connection
* Returns : none
*******************************************************************************/
sint8
espconn_accept
(
struct
espconn
*
espconn
);
/******************************************************************************
* FunctionName : espconn_create
* Description : sent data for client or server
* Parameters : espconn -- espconn to the data transmission
* Returns : result
*******************************************************************************/
sint8
espconn_create
(
struct
espconn
*
espconn
);
/******************************************************************************
* FunctionName : espconn_tcp_get_max_con
* Description : get the number of simulatenously active TCP connections
* Parameters : none
* Returns : none
*******************************************************************************/
uint8
espconn_tcp_get_max_con
(
void
);
/******************************************************************************
* FunctionName : espconn_tcp_set_max_con
* Description : set the number of simulatenously active TCP connections
* Parameters : num -- total number
* Returns : none
*******************************************************************************/
sint8
espconn_tcp_set_max_con
(
uint8
num
);
/******************************************************************************
* 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
* Returns : result
*******************************************************************************/
sint8
espconn_tcp_get_max_con_allow
(
struct
espconn
*
espconn
);
/******************************************************************************
* FunctionName : espconn_tcp_set_max_con_allow
* Description : set the count of simulatenously active connections on the server
* Parameters : espconn -- espconn to set the count
* num -- support the connection number
* Returns : result
*******************************************************************************/
sint8
espconn_tcp_set_max_con_allow
(
struct
espconn
*
espconn
,
uint8
num
);
/******************************************************************************
* FunctionName : espconn_regist_time
* 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
* Returns : none
*******************************************************************************/
sint8
espconn_regist_time
(
struct
espconn
*
espconn
,
uint32
interval
,
uint8
type_flag
);
/******************************************************************************
* FunctionName : espconn_get_connection_info
* 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
* Returns : none
*******************************************************************************/
sint8
espconn_get_connection_info
(
struct
espconn
*
pespconn
,
remot_info
**
pcon_info
,
uint8
typeflags
);
/******************************************************************************
* FunctionName : espconn_get_packet_info
* Description : get the packet info with host
* Parameters : espconn -- the espconn used to disconnect the connection
* infoarg -- the packet info
* Returns : the errur code
*******************************************************************************/
sint8
espconn_get_packet_info
(
struct
espconn
*
espconn
,
struct
espconn_packet
*
infoarg
);
/******************************************************************************
* FunctionName : espconn_regist_sentcb
* 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
* espconn_sent_callback sent_cb -- sent callback function to
* call for this espconn when data is successfully sent
* Returns : none
*******************************************************************************/
sint8
espconn_regist_sentcb
(
struct
espconn
*
espconn
,
espconn_sent_callback
sent_cb
);
/******************************************************************************
* FunctionName : espconn_regist_sentcb
* Description : Used to specify the function that should be called when data
* 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
* when data is successfully sent
* Returns : none
*******************************************************************************/
sint8
espconn_regist_write_finish
(
struct
espconn
*
espconn
,
espconn_connect_callback
write_finish_fn
);
/******************************************************************************
* FunctionName : espconn_send
* Description : sent data for client or server
* Parameters : espconn -- espconn to set for client or server
* psent -- data to send
* length -- length of data to send
* Returns : none
*******************************************************************************/
sint8
espconn_send
(
struct
espconn
*
espconn
,
uint8
*
psent
,
uint16
length
);
/******************************************************************************
* FunctionName : espconn_sent
* Description : sent data for client or server
* Parameters : espconn -- espconn to set for client or server
* psent -- data to send
* length -- length of data to send
* Returns : none
*******************************************************************************/
sint8
espconn_sent
(
struct
espconn
*
espconn
,
uint8
*
psent
,
uint16
length
);
/******************************************************************************
* FunctionName : espconn_sendto
* Description : send data for UDP
* Parameters : espconn -- espconn to set for UDP
* psent -- data to send
* length -- length of data to send
* Returns : error
*******************************************************************************/
sint16
espconn_sendto
(
struct
espconn
*
espconn
,
uint8
*
psent
,
uint16
length
);
/******************************************************************************
* FunctionName : espconn_regist_connectcb
* Description : used to specify the function that should be called when
* connects to host.
* Parameters : espconn -- espconn to set the connect callback
* connect_cb -- connected callback function to call when connected
* Returns : none
*******************************************************************************/
sint8
espconn_regist_connectcb
(
struct
espconn
*
espconn
,
espconn_connect_callback
connect_cb
);
/******************************************************************************
* FunctionName : espconn_regist_recvcb
* Description : used to specify the function that should be called when recv
* data from host.
* Parameters : espconn -- espconn to set the recv callback
* recv_cb -- recv callback function to call when recv data
* Returns : none
*******************************************************************************/
sint8
espconn_regist_recvcb
(
struct
espconn
*
espconn
,
espconn_recv_callback
recv_cb
);
/******************************************************************************
* FunctionName : espconn_regist_reconcb
* Description : used to specify the function that should be called when connection
* because of err disconnect.
* Parameters : espconn -- espconn to set the err callback
* recon_cb -- err callback function to call when err
* Returns : none
*******************************************************************************/
sint8
espconn_regist_reconcb
(
struct
espconn
*
espconn
,
espconn_reconnect_callback
recon_cb
);
/******************************************************************************
* FunctionName : espconn_regist_disconcb
* 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
* Returns : none
*******************************************************************************/
sint8
espconn_regist_disconcb
(
struct
espconn
*
espconn
,
espconn_connect_callback
discon_cb
);
/******************************************************************************
* FunctionName : espconn_port
* Description : access port value for client so that we don't end up bouncing
* all connections at the same time .
* Parameters : none
* Returns : access port value
*******************************************************************************/
uint32
espconn_port
(
void
);
/******************************************************************************
* FunctionName : espconn_set_opt
* Description : access port value for client so that we don't end up bouncing
* all connections at the same time .
* Parameters : none
* Returns : access port value
*******************************************************************************/
sint8
espconn_set_opt
(
struct
espconn
*
espconn
,
uint8
opt
);
/******************************************************************************
* FunctionName : espconn_clear_opt
* Description : clear the option for connections so that we don't end up bouncing
* all connections at the same time .
* Parameters : espconn -- the espconn used to set the connection
* opt -- the option for clear
* Returns : the result
*******************************************************************************/
sint8
espconn_clear_opt
(
struct
espconn
*
espconn
,
uint8
opt
);
/******************************************************************************
* FunctionName : espconn_set_keepalive
* Description : access level value for connection so that we set the value for
* keep alive
* Parameters : espconn -- the espconn used to set the connection
* level -- the connection's level
* value -- the value of time(s)
* Returns : access port value
*******************************************************************************/
sint8
espconn_set_keepalive
(
struct
espconn
*
espconn
,
uint8
level
,
void
*
optarg
);
/******************************************************************************
* FunctionName : espconn_get_keepalive
* Description : access level value for connection so that we get the value for
* keep alive
* Parameters : espconn -- the espconn used to get the connection
* level -- the connection's level
* Returns : access keep alive value
*******************************************************************************/
sint8
espconn_get_keepalive
(
struct
espconn
*
espconn
,
uint8
level
,
void
*
optarg
);
/******************************************************************************
* TypedefName : dns_found_callback
* Description : Callback which is invoked when a hostname is found.
* Parameters : name -- pointer to the name that was looked up.
* 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).
* callback_arg -- a user-specified callback argument passed to
* dns_gethostbyname
*******************************************************************************/
typedef
void
(
*
dns_found_callback
)(
const
char
*
name
,
ip_addr_t
*
ipaddr
,
void
*
callback_arg
);
/******************************************************************************
* FunctionName : espconn_gethostbyname
* Description : Resolve a hostname (string) into an IP address.
* 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
* it is already cached in the dns_table (only valid if ESPCONN_OK
* is returned!)
* found -- a callback function to be called on success, failure
* 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
* 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.
* - ESPCONN_ARG: dns client not initialized or invalid hostname
*******************************************************************************/
err_t
espconn_gethostbyname
(
struct
espconn
*
pespconn
,
const
char
*
hostname
,
ip_addr_t
*
addr
,
dns_found_callback
found
);
/******************************************************************************
* FunctionName : espconn_encry_connect
* Description : The function given as connection
* Parameters : espconn -- the espconn used to connect with the host
* Returns : none
*******************************************************************************/
sint8
espconn_secure_connect
(
struct
espconn
*
espconn
);
/******************************************************************************
* FunctionName : espconn_encry_disconnect
* Description : The function given as the disconnection
* Parameters : espconn -- the espconn used to disconnect with the host
* Returns : none
*******************************************************************************/
sint8
espconn_secure_disconnect
(
struct
espconn
*
espconn
);
/******************************************************************************
* FunctionName : espconn_secure_send
* Description : sent data for client or server
* Parameters : espconn -- espconn to set for client or server
* psent -- data to send
* length -- length of data to send
* Returns : none
*******************************************************************************/
sint8
espconn_secure_send
(
struct
espconn
*
espconn
,
uint8
*
psent
,
uint16
length
);
/******************************************************************************
* FunctionName : espconn_encry_sent
* Description : sent data for client or server
* Parameters : espconn -- espconn to set for client or server
* psent -- data to send
* length -- length of data to send
* Returns : none
*******************************************************************************/
sint8
espconn_secure_sent
(
struct
espconn
*
espconn
,
uint8
*
psent
,
uint16
length
);
/******************************************************************************
* FunctionName : espconn_secure_set_size
* Description : set the buffer size for client or server
* Parameters : level -- set for client or server
* 1: client,2:server,3:client and server
* size -- buffer size
* Returns : true or false
*******************************************************************************/
bool
espconn_secure_set_size
(
uint8
level
,
uint16
size
);
/******************************************************************************
* FunctionName : espconn_secure_get_size
* Description : get buffer size for client or server
* Parameters : level -- set for client or server
* 1: client,2:server,3:client and server
* Returns : buffer size for client or server
*******************************************************************************/
sint16
espconn_secure_get_size
(
uint8
level
);
/******************************************************************************
* FunctionName : espconn_secure_ca_enable
* Description : enable the certificate authenticate and set the flash sector
* as client or server
* Parameters : level -- set for client or server
* 1: client,2:server,3:client and server
* flash_sector -- flash sector for save certificate
* Returns : result true or false
*******************************************************************************/
bool
espconn_secure_ca_enable
(
uint8
level
,
uint8
flash_sector
);
/******************************************************************************
* FunctionName : espconn_secure_ca_disable
* Description : disable the certificate authenticate as client or server
* Parameters : level -- set for client or server
* 1: client,2:server,3:client and server
* Returns : result true or false
*******************************************************************************/
bool
espconn_secure_ca_disable
(
uint8
level
);
/******************************************************************************
* FunctionName : espconn_secure_cert_req_enable
* Description : enable the client certificate authenticate and set the flash sector
* as client or server
* Parameters : level -- set for client or server
* 1: client,2:server,3:client and server
* flash_sector -- flash sector for save certificate
* Returns : result true or false
*******************************************************************************/
bool
espconn_secure_cert_req_enable
(
uint8
level
,
uint8
flash_sector
);
/******************************************************************************
* FunctionName : espconn_secure_ca_disable
* Description : disable the client certificate authenticate as client or server
* Parameters : level -- set for client or server
* 1: client,2:server,3:client and server
* Returns : result true or false
*******************************************************************************/
bool
espconn_secure_cert_req_disable
(
uint8
level
);
/******************************************************************************
* FunctionName : espconn_secure_set_default_certificate
* Description : Load the certificates in memory depending on compile-time
* and user options.
* Parameters : certificate -- Load the certificate
* length -- Load the certificate length
* Returns : result true or false
*******************************************************************************/
bool
espconn_secure_set_default_certificate
(
const
uint8
*
certificate
,
uint16
length
);
/******************************************************************************
* FunctionName : espconn_secure_set_default_private_key
* Description : Load the key in memory depending on compile-time
* and user options.
* Parameters : private_key -- Load the key
* length -- Load the key length
* Returns : result true or false
*******************************************************************************/
bool
espconn_secure_set_default_private_key
(
const
uint8
*
private_key
,
uint16
length
);
/******************************************************************************
* FunctionName : espconn_secure_accept
* Description : The function given as the listen
* Parameters : espconn -- the espconn used to listen the connection
* Returns : none
*******************************************************************************/
sint8
espconn_secure_accept
(
struct
espconn
*
espconn
);
/******************************************************************************
* FunctionName : espconn_igmp_join
* Description : join a multicast group
* Parameters : host_ip -- the ip address of udp server
* multicast_ip -- multicast ip given by user
* Returns : none
*******************************************************************************/
sint8
espconn_igmp_join
(
ip_addr_t
*
host_ip
,
ip_addr_t
*
multicast_ip
);
/******************************************************************************
* FunctionName : espconn_igmp_leave
* Description : leave a multicast group
* Parameters : host_ip -- the ip address of udp server
* multicast_ip -- multicast ip given by user
* Returns : none
*******************************************************************************/
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
);
/******************************************************************************
* FunctionName : espconn_mdns_init
* Description : register a device with mdns
* Parameters : ipAddr -- the ip address of device
* hostname -- the hostname of device
* Returns : none
*******************************************************************************/
void
espconn_mdns_init
(
struct
mdns_info
*
info
);
/******************************************************************************
* FunctionName : espconn_mdns_close
* Description : close a device with mdns
* Parameters : a
* Returns : none
*******************************************************************************/
void
espconn_mdns_close
(
void
);
/******************************************************************************
* FunctionName : espconn_mdns_server_register
* Description : register a device with mdns
* Parameters : a
* Returns : none
*******************************************************************************/
void
espconn_mdns_server_register
(
void
);
/******************************************************************************
* FunctionName : espconn_mdns_server_unregister
* Description : unregister a device with mdns
* Parameters : a
* Returns : none
*******************************************************************************/
void
espconn_mdns_server_unregister
(
void
);
/******************************************************************************
* FunctionName : espconn_mdns_get_servername
* Description : get server name of device with mdns
* Parameters : a
* Returns : none
*******************************************************************************/
char
*
espconn_mdns_get_servername
(
void
);
/******************************************************************************
* FunctionName : espconn_mdns_set_servername
* Description : set server name of device with mdns
* Parameters : a
* Returns : none
*******************************************************************************/
void
espconn_mdns_set_servername
(
const
char
*
name
);
/******************************************************************************
* FunctionName : espconn_mdns_set_hostname
* Description : set host name of device with mdns
* Parameters : a
* Returns : none
*******************************************************************************/
void
espconn_mdns_set_hostname
(
char
*
name
);
/******************************************************************************
* FunctionName : espconn_mdns_get_hostname
* Description : get host name of device with mdns
* Parameters : a
* Returns : none
*******************************************************************************/
char
*
espconn_mdns_get_hostname
(
void
);
/******************************************************************************
* FunctionName : espconn_mdns_disable
* Description : disable a device with mdns
* Parameters : a
* Returns : none
*******************************************************************************/
void
espconn_mdns_disable
(
void
);
/******************************************************************************
* FunctionName : espconn_mdns_enable
* Description : disable a device with mdns
* Parameters : a
* Returns : none
*******************************************************************************/
void
espconn_mdns_enable
(
void
);
/******************************************************************************
* FunctionName : espconn_dns_setserver
* Description : Initialize one of the DNS servers.
* Parameters : numdns -- the index of the DNS server to set must
* be < DNS_MAX_SERVERS = 2
* dnsserver -- IP address of the DNS server to set
* Returns : none
*******************************************************************************/
void
espconn_dns_setserver
(
char
numdns
,
ip_addr_t
*
dnsserver
);
#endif
Prev
1
…
13
14
15
16
17
18
19
20
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