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
a33e3a4a
Commit
a33e3a4a
authored
Oct 17, 2015
by
Vowstar
Browse files
Merge pull request #687 from DiUS/dev140
Major upgrade to SDK 1.4.0 & open LWIP
parents
093a8959
8fba0f47
Changes
282
Show whitespace changes
Inline
Side-by-side
sdk/esp_iot_sdk_v1.4.0/examples/wps/gen_misc.sh
0 → 100644
View file @
a33e3a4a
#!/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
0 → 100644
View file @
a33e3a4a
#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
0 → 100644
View file @
a33e3a4a
#ifndef __USER_CONFIG_H__
#define __USER_CONFIG_H__
#endif
app/ssl/ssl
/Makefile
→
sdk/esp_iot_sdk_v1.4.0/examples/wps/user
/Makefile
View file @
a33e3a4a
...
...
@@ -12,9 +12,7 @@
# a generated lib/image xxx.a ()
#
ifndef
PDIR
GEN_LIBS
=
libsslssl.a
GEN_LIBS
=
libuser.a
endif
...
...
@@ -41,6 +39,7 @@ endif
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
0 → 100644
View file @
a33e3a4a
/******************************************************************************
* 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
);
}
include/at_custom.h
→
sdk/esp_iot_sdk_v1.4.0/
include/at_custom.h
View file @
a33e3a4a
...
...
@@ -33,6 +33,12 @@ typedef struct
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
...
...
@@ -41,10 +47,24 @@ typedef struct
void
at_response_ok
(
void
);
/**
* @brief Response "ERROR" to uart.
* @param
events: no used
* @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
...
...
@@ -82,4 +102,42 @@ void at_init(void);
* @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
include/c_types.h
→
sdk/esp_iot_sdk_v1.4.0/
include/c_types.h
View file @
a33e3a4a
...
...
@@ -16,7 +16,6 @@ typedef unsigned long uint32_t;
typedef
signed
long
sint32_t
;
typedef
signed
long
int32_t
;
typedef
signed
long
long
sint64_t
;
typedef
signed
long
long
int64_t
;
typedef
unsigned
long
long
uint64_t
;
typedef
unsigned
long
long
u_int64_t
;
typedef
float
real32_t
;
...
...
@@ -45,12 +44,7 @@ typedef double real64;
#define __le16 u16
//typedef unsigned int size_t;
#if !defined(__size_t)
#define __size_t 1
typedef
unsigned
int
size_t
;
/* others (e.g. <stdio.h>) also define */
/* the unsigned integral type of the result of the sizeof operator. */
#endif
typedef
unsigned
int
size_t
;
#define __packed __attribute__((packed))
...
...
@@ -82,11 +76,9 @@ typedef enum {
#define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
#else
#define ICACHE_FLASH_ATTR
#define ICACHE_RODATA_ATTR
#endif
/* ICACHE_FLASH */
#define TEXT_SECTION_ATTR __attribute__((section(".text")))
#define RAM_CONST_ATTR __attribute__((section(".rodata")))
#ifndef __cplusplus
typedef
unsigned
char
bool
;
#define BOOL bool
...
...
include/eagle_soc.h
→
sdk/esp_iot_sdk_v1.4.0/
include/eagle_soc.h
View file @
a33e3a4a
...
...
@@ -55,8 +55,7 @@
//}}
//Periheral Clock {{
#define CPU_CLK_FREQ 80*1000000 //unit: Hz
#define APB_CLK_FREQ CPU_CLK_FREQ
#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
//}}
...
...
@@ -184,9 +183,9 @@
#define PERIPHS_IO_MUX_FUNC 0x13
#define PERIPHS_IO_MUX_FUNC_S 4
#define PERIPHS_IO_MUX_PULLUP BIT7
#define PERIPHS_IO_MUX_PULL
DWN
BIT6
#define PERIPHS_IO_MUX_PULL
UP2
BIT6
#define PERIPHS_IO_MUX_SLEEP_PULLUP BIT3
#define PERIPHS_IO_MUX_SLEEP_PULL
DWN
BIT2
#define PERIPHS_IO_MUX_SLEEP_PULL
UP2
BIT2
#define PERIPHS_IO_MUX_SLEEP_OE BIT1
#define PERIPHS_IO_MUX_OE BIT0
...
...
@@ -203,7 +202,6 @@
#define FUNC_GPIO15 3
#define FUNC_U0RTS 4
#define PERIPHS_IO_MUX_U0RXD_U (PERIPHS_IO_MUX + 0x14)
#define FUNC_U0RXD 0
#define FUNC_GPIO3 3
#define PERIPHS_IO_MUX_U0TXD_U (PERIPHS_IO_MUX + 0x18)
#define FUNC_U0TXD 0
...
...
@@ -244,11 +242,12 @@
#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_PULLDWN_DIS(PIN_NAME) CLEAR_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLDWN)
#define PIN_PULLDWN_EN(PIN_NAME) SET_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLDWN)
#define PIN_FUNC_SELECT(PIN_NAME, FUNC) do { \
CLEAR_PERI_REG_MASK(PIN_NAME, (PERIPHS_IO_MUX_FUNC<<PERIPHS_IO_MUX_FUNC_S)); \
SET_PERI_REG_MASK(PIN_NAME, (((FUNC&BIT2)<<2)|(FUNC&0x3))<<PERIPHS_IO_MUX_FUNC_S); \
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)
//}}
...
...
include/espconn.h
→
sdk/esp_iot_sdk_v1.4.0/
include/espconn.h
View file @
a33e3a4a
#ifndef __ESPCONN_H__
#define __ESPCONN_H__
#include "lwip/ip_addr.h"
typedef
sint8
err_t
;
typedef
void
*
espconn_handle
;
...
...
@@ -16,6 +14,7 @@ typedef void (* espconn_reconnect_callback)(void *arg, sint8 err);
#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. */
...
...
@@ -23,8 +22,12 @@ typedef void (* espconn_reconnect_callback)(void *arg, sint8 err);
#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
,
...
...
@@ -95,9 +98,41 @@ enum espconn_option{
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
...
...
@@ -200,6 +235,16 @@ sint8 espconn_regist_time(struct espconn *espconn, uint32 interval, uint8 type_f
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
...
...
@@ -224,6 +269,17 @@ sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callback sent_
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
...
...
@@ -235,6 +291,17 @@ sint8 espconn_regist_write_finish(struct espconn *espconn, espconn_connect_callb
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
...
...
@@ -298,6 +365,40 @@ uint32 espconn_port(void);
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.
...
...
@@ -349,6 +450,17 @@ sint8 espconn_secure_connect(struct espconn *espconn);
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
...
...
@@ -360,6 +472,94 @@ sint8 espconn_secure_disconnect(struct espconn *espconn);
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
...
...
@@ -403,5 +603,95 @@ sint8 espconn_recv_hold(struct espconn *pespconn);
*******************************************************************************/
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
sdk/esp_iot_sdk_v1.4.0/include/espnow.h
0 → 100644
View file @
a33e3a4a
/*
* Copyright (C) 2015 -2018 Espressif System
*
*/
#ifndef __ESPNOW_H__
#define __ESPNOW_H__
enum
esp_now_role
{
ESP_NOW_ROLE_IDLE
=
0
,
ESP_NOW_ROLE_CONTROLLER
,
ESP_NOW_ROLE_SLAVE
,
ESP_NOW_ROLE_MAX
,
};
typedef
void
(
*
esp_now_recv_cb_t
)(
u8
*
mac_addr
,
u8
*
data
,
u8
len
);
typedef
void
(
*
esp_now_send_cb_t
)(
u8
*
mac_addr
,
u8
status
);
int
esp_now_init
(
void
);
int
esp_now_deinit
(
void
);
int
esp_now_register_send_cb
(
esp_now_send_cb_t
cb
);
int
esp_now_unregister_send_cb
(
void
);
int
esp_now_register_recv_cb
(
esp_now_recv_cb_t
cb
);
int
esp_now_unregister_recv_cb
(
void
);
int
esp_now_send
(
u8
*
da
,
u8
*
data
,
int
len
);
int
esp_now_add_peer
(
u8
*
mac_addr
,
u8
role
,
u8
channel
,
u8
*
key
,
u8
key_len
);
int
esp_now_del_peer
(
u8
*
mac_addr
);
int
esp_now_set_self_role
(
u8
role
);
int
esp_now_get_self_role
(
void
);
int
esp_now_set_peer_role
(
u8
*
mac_addr
,
u8
role
);
int
esp_now_get_peer_role
(
u8
*
mac_addr
);
int
esp_now_set_peer_channel
(
u8
*
mac_addr
,
u8
channel
);
int
esp_now_get_peer_channel
(
u8
*
mac_addr
);
int
esp_now_set_peer_key
(
u8
*
mac_addr
,
u8
*
key
,
u8
key_len
);
int
esp_now_get_peer_key
(
u8
*
mac_addr
,
u8
*
key
,
u8
*
key_len
);
u8
*
esp_now_fetch_peer
(
bool
restart
);
int
esp_now_is_peer_exist
(
u8
*
mac_addr
);
int
esp_now_get_cnt_info
(
u8
*
all_cnt
,
u8
*
encrypt_cnt
);
int
esp_now_set_kok
(
u8
*
key
,
u8
len
);
#endif
include/ets_sys.h
→
sdk/esp_iot_sdk_v1.4.0/
include/ets_sys.h
View file @
a33e3a4a
...
...
@@ -51,6 +51,9 @@ typedef struct _ETSTIMER_ {
#define ETS_FRC_TIMER1_INTR_ATTACH(func, arg) \
ets_isr_attach(ETS_FRC_TIMER1_INUM, (func), (void *)(arg))
#define ETS_FRC_TIMER1_NMI_INTR_ATTACH(func) \
NmiTimSetFunc(func)
#define ETS_GPIO_INTR_ATTACH(func, arg) \
ets_isr_attach(ETS_GPIO_INUM, (func), (void *)(arg))
...
...
include/gpio.h
→
sdk/esp_iot_sdk_v1.4.0/
include/gpio.h
View file @
a33e3a4a
...
...
@@ -17,13 +17,13 @@ typedef enum {
GPIO_PIN_INTR_DISABLE
=
0
,
GPIO_PIN_INTR_POSEDGE
=
1
,
GPIO_PIN_INTR_NEGEDGE
=
2
,
GPIO_PIN_INTR_ANYE
G
DE
=
3
,
GPIO_PIN_INTR_ANYED
G
E
=
3
,
GPIO_PIN_INTR_LOLEVEL
=
4
,
GPIO_PIN_INTR_HILEVEL
=
5
}
GPIO_INT_TYPE
;
#define GPIO_OUTPUT_SET(gpio_no, bit_value) \
gpio_output_set(bit_value<<gpio_no, ((~bit_value)&0x01)<<gpio_no, 1<<gpio_no,0)
gpio_output_set(
(
bit_value
)
<<gpio_no, ((~
(
bit_value)
)
&0x01)<<gpio_no, 1<<gpio_no,0)
#define GPIO_DIS_OUTPUT(gpio_no) gpio_output_set(0,0,0, 1<<gpio_no)
#define GPIO_INPUT_GET(gpio_no) ((gpio_input_get()>>gpio_no)&BIT0)
...
...
include/ip_addr.h
→
sdk/esp_iot_sdk_v1.4.0/
include/ip_addr.h
View file @
a33e3a4a
...
...
@@ -15,12 +15,6 @@ struct ip_info {
struct
ip_addr
gw
;
};
#define IP4_ADDR(ipaddr, a,b,c,d) \
(ipaddr)->addr = ((uint32)((d) & 0xff) << 24) | \
((uint32)((c) & 0xff) << 16) | \
((uint32)((b) & 0xff) << 8) | \
(uint32)((a) & 0xff)
/**
* Determine if two address are on the same network.
*
...
...
include/json/json.h
→
sdk/esp_iot_sdk_v1.4.0/
include/json/json.h
View file @
a33e3a4a
include/json/jsonparse.h
→
sdk/esp_iot_sdk_v1.4.0/
include/json/jsonparse.h
View file @
a33e3a4a
include/json/jsontree.h
→
sdk/esp_iot_sdk_v1.4.0/
include/json/jsontree.h
View file @
a33e3a4a
sdk/esp_iot_sdk_v1.4.0/include/mem.h
0 → 100644
View file @
a33e3a4a
#ifndef __MEM_H__
#define __MEM_H__
#ifndef MEMLEAK_DEBUG
#define os_free(s) vPortFree(s, "", 0)
#define os_malloc(s) pvPortMalloc(s, "", 0)
#define os_calloc(s) pvPortCalloc(s, "", 0);
#define os_realloc(p, s) pvPortRealloc(p, s, "", 0)
#define os_zalloc(s) pvPortZalloc(s, "", 0)
#else
#define os_free(s) \
do
{
\
const
char
*
file
=
mem_debug_file
;
\
vPortFree
(
s
,
file
,
__LINE__
);
\
}
while
(
0
)
#define os_malloc(s) ({const char *file = mem_debug_file; pvPortMalloc(s, file, __LINE__);})
#define os_calloc(s) ({const char *file = mem_debug_file; pvPortCalloc(s, file, __LINE__);})
#define os_realloc(p, s) ({const char *file = mem_debug_file; pvPortRealloc(p, s, file, __LINE__);})
#define os_zalloc(s) ({const char *file = mem_debug_file; pvPortZalloc(s, file, __LINE__);})
#endif
#endif
sdk/esp_iot_sdk_v1.4.0/include/mesh.h
0 → 100644
View file @
a33e3a4a
#ifndef __LWIP_API_MESH_H__
#define __LWIP_API_MESH_H__
#include "ip_addr.h"
#include "user_interface.h"
#include "espconn.h"
typedef
void
(
*
espconn_mesh_callback
)();
enum
mesh_type
{
MESH_CLOSE
=
0
,
MESH_LOCAL
,
MESH_ONLINE
,
MESH_NONE
=
0xFF
};
enum
mesh_status
{
MESH_DISABLE
=
0
,
MESH_WIFI_CONN
,
MESH_NET_CONN
,
MESH_LOCAL_AVAIL
,
MESH_ONLINE_AVAIL
};
enum
mesh_node_type
{
MESH_NODE_PARENT
=
0
,
MESH_NODE_CHILD
,
MESH_NODE_ALL
};
bool
espconn_mesh_local_addr
(
struct
ip_addr
*
ip
);
bool
espconn_mesh_get_node_info
(
enum
mesh_node_type
type
,
uint8_t
**
info
,
uint8_t
*
count
);
bool
espconn_mesh_get_router
(
struct
station_config
*
router
);
bool
espconn_mesh_set_router
(
struct
station_config
*
router
);
bool
espconn_mesh_encrypt_init
(
AUTH_MODE
mode
,
uint8_t
*
passwd
,
uint8_t
passwd_len
);
bool
espconn_mesh_set_ssid_prefix
(
uint8_t
*
prefix
,
uint8_t
prefix_len
);
bool
espconn_mesh_set_max_hops
(
uint8_t
max_hops
);
char
*
espconn_json_find_section
(
const
char
*
pbuf
,
u16
len
,
const
char
*
section
);
sint8
espconn_mesh_connect
(
struct
espconn
*
usr_esp
);
sint8
espconn_mesh_disconnect
(
struct
espconn
*
usr_esp
);
sint8
espconn_mesh_get_status
();
sint8
espconn_mesh_sent
(
struct
espconn
*
usr_esp
,
uint8
*
pdata
,
uint16
len
);
uint8
espconn_mesh_get_max_hops
();
uint8
espconn_mesh_layer
(
struct
ip_addr
*
ip
);
uint32_t
user_json_get_value
(
const
char
*
pbuffer
,
uint16_t
buf_len
,
const
uint8_t
*
json_key
);
void
espconn_mesh_enable
(
espconn_mesh_callback
enable_cb
,
enum
mesh_type
type
);
void
espconn_mesh_disable
(
espconn_mesh_callback
disable_cb
);
void
espconn_mesh_init
();
void
espconn_mesh_init_group_list
(
uint8_t
*
dev_mac
,
uint16_t
dev_count
);
void
espconn_mesh_set_dev_type
(
uint8_t
dev_type
);
void
espconn_mesh_setup_timer
(
os_timer_t
*
timer
,
uint32_t
time
,
os_timer_func_t
cb
,
void
*
arg
,
bool
repeat
);
#endif
include/os_type.h
→
sdk/esp_iot_sdk_v1.4.0/
include/os_type.h
View file @
a33e3a4a
include/osapi.h
→
sdk/esp_iot_sdk_v1.4.0/
include/osapi.h
View file @
a33e3a4a
...
...
@@ -11,18 +11,11 @@
#define os_bzero ets_bzero
#define os_delay_us ets_delay_us
#define os_install_putc1 ets_install_putc1
#define os_install_putc2 ets_install_putc2
#define os_intr_lock ets_intr_lock
#define os_intr_unlock ets_intr_unlock
#define os_isr_attach ets_isr_attach
#define os_isr_mask ets_isr_mask
#define os_isr_unmask ets_isr_unmask
#define os_memcmp ets_memcmp
#define os_memcpy ets_memcpy
#define os_memmove ets_memmove
#define os_memset ets_memset
#define os_putc ets_putc
#define os_str2macaddr ets_str2macaddr
#define os_strcat strcat
#define os_strchr strchr
#define os_strcmp ets_strcmp
...
...
@@ -36,22 +29,21 @@
#endif
#define os_timer_arm(a, b, c) ets_timer_arm_new(a, b, c, 1)
#define os_timer_disarm ets_timer_disarm
#define os_timer_done ets_timer_done
#define os_timer_handler_isr ets_timer_handler_isr
#define os_timer_init ets_timer_init
#define os_timer_setfn ets_timer_setfn
#define os_sprintf ets_sprintf
#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; \
static
const
char
flash_str
[]
ICACHE_RODATA_ATTR
__attribute__
((
aligned
(
4
)))
=
fmt
;
\
os_printf_plus
(
flash_str
,
##
__VA_ARGS__
);
\
}
while
(
0
)
#else
#define os_printf os_printf_plus
#endif
unsigned
long
os_random
(
void
);
int
os_get_random
(
unsigned
char
*
buf
,
size_t
len
);
#endif
Prev
1
…
8
9
10
11
12
13
14
15
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