Skip to content

Commit 7b93494

Browse files
committed
Merge pull request esp8266#13 from Links2004/esp8266
pull latest SDK
2 parents add0f28 + a0f961a commit 7b93494

31 files changed

+203
-27
lines changed

hardware/esp8266com/esp8266/cores/esp8266/Arduino.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void yield(void);
4848
//GPIO FUNCTIONS
4949
#define INPUT 0x00
5050
#define INPUT_PULLUP 0x02
51-
#define INPUT_PULLDOWN 0x04
51+
#define INPUT_PULLDOWN_16 0x04 // PULLDOWN only possible for pin16
5252
#define OUTPUT 0x01
5353
#define OUTPUT_OPEN_DRAIN 0x03
5454
#define WAKEUP_PULLUP 0x05

hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,25 @@ EspClass ESP;
8181

8282
void EspClass::wdtEnable(uint32_t timeout_ms)
8383
{
84+
/// This API can only be called if software watchdog is stopped
85+
system_soft_wdt_restart();
8486
}
8587

8688
void EspClass::wdtEnable(WDTO_t timeout_ms)
8789
{
90+
wdtEnable((uint32_t) timeout_ms);
8891
}
8992

9093
void EspClass::wdtDisable(void)
9194
{
95+
/// Please don’t stop software watchdog too long (less than 6 seconds),
96+
/// otherwise it will trigger hardware watchdog reset.
97+
system_soft_wdt_stop();
9298
}
9399

94100
void EspClass::wdtFeed(void)
95101
{
102+
96103
}
97104

98105
void EspClass::deepSleep(uint32_t time_us, WakeMode mode)

hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_phy.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ static uint8_t phy_init_data[128] =
5656
[26] = 225, // spur_freq_cfg, spur_freq=spur_freq_cfg/spur_freq_cfg_div
5757
[27] = 10, // spur_freq_cfg_div
5858
// each bit for 1 channel, 1 to select the spur_freq if in band, else 40
59-
[28] = 0, // spur_freq_en_h
60-
[29] = 0, // spur_freq_en_l
59+
[28] = 0xff, // spur_freq_en_h
60+
[29] = 0xff, // spur_freq_en_l
6161

6262
[30] = 0xf8, // Reserved, do not change
6363
[31] = 0, // Reserved, do not change
@@ -86,7 +86,7 @@ static uint8_t phy_init_data[128] =
8686
// 2: 24MHz
8787
[48] = 1,
8888

89-
89+
9090

9191
// sdio_configure
9292
// 0: Auto by pin strapping
@@ -165,7 +165,7 @@ static uint8_t phy_init_data[128] =
165165
// 0x8: -14db,
166166
// 0x4: -17.5,
167167
// 0x0: -23
168-
[94] = 0x0f,
168+
[94] = 0x00,
169169

170170

171171
// lp_bb_att_ext
@@ -226,7 +226,7 @@ static uint8_t phy_init_data[128] =
226226
// 3: auto measure frequency offset and correct it, bbpll is 160M, it only can correct + frequency offset.
227227
// 5: use 113 byte force_freq_offset to correct frequency offset, bbpll is 168M, it can correct + and - frequency offset.
228228
// 7: use 113 byte force_freq_offset to correct frequency offset, bbpll is 160M , it only can correct + frequency offset.
229-
[112] = 0,
229+
[112] = 3,
230230

231231
// force_freq_offset
232232
// signed, unit is 8kHz

hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c

+3-5
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,12 @@ extern void __pinMode(uint8_t pin, uint8_t mode) {
4444
GPC(pin) = (GPC(pin) & (0xF << GPCI)); //SOURCE(GPIO) | DRIVER(NORMAL) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)
4545
if(mode == OUTPUT_OPEN_DRAIN) GPC(pin) |= (1 << GPCD);
4646
GPES = (1 << pin); //Enable
47-
} else if(mode == INPUT || mode == INPUT_PULLUP || mode == INPUT_PULLDOWN){
47+
} else if(mode == INPUT || mode == INPUT_PULLUP){
4848
GPF(pin) = GPFFS(GPFFS_GPIO(pin));//Set mode to GPIO
4949
GPEC = (1 << pin); //Disable
5050
GPC(pin) = (GPC(pin) & (0xF << GPCI)) | (1 << GPCD); //SOURCE(GPIO) | DRIVER(OPEN_DRAIN) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)
5151
if(mode == INPUT_PULLUP) {
5252
GPF(pin) |= (1 << GPFPU); // Enable Pullup
53-
} else if(mode == INPUT_PULLDOWN) {
54-
GPF(pin) |= (1 << GPFPD); // Enable Pulldown
5553
}
5654
} else if(mode == WAKEUP_PULLUP || mode == WAKEUP_PULLDOWN){
5755
GPF(pin) = GPFFS(GPFFS_GPIO(pin));//Set mode to GPIO
@@ -67,8 +65,8 @@ extern void __pinMode(uint8_t pin, uint8_t mode) {
6765
} else if(pin == 16){
6866
GPF16 = GP16FFS(GPFFS_GPIO(pin));//Set mode to GPIO
6967
GPC16 = 0;
70-
if(mode == INPUT || mode == INPUT_PULLDOWN){
71-
if(mode == INPUT_PULLDOWN){
68+
if(mode == INPUT || mode == INPUT_PULLDOWN_16){
69+
if(mode == INPUT_PULLDOWN_16){
7270
GPF16 |= (1 << GP16FPD);//Enable Pulldown
7371
}
7472
GP16E &= ~1;

hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ void ESP8266WiFiClass::beginSmartConfig()
599599
_smartConfigDone = false;
600600

601601
//SC_TYPE_ESPTOUCH use ESPTOUCH for smartconfig, or use SC_TYPE_AIRKISS for AIRKISS
602-
smartconfig_start(SC_TYPE_ESPTOUCH, reinterpret_cast<sc_callback_t>(&ESP8266WiFiClass::_smartConfigCallback), 1);
602+
smartconfig_start(reinterpret_cast<sc_callback_t>(&ESP8266WiFiClass::_smartConfigCallback), 1);
603603
}
604604

605605
void ESP8266WiFiClass::stopSmartConfig()

hardware/esp8266com/esp8266/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <Arduino.h>
3030
#include <ESP8266WiFi.h>
3131

32-
#define DEBUG_HTTP_UPDATE(...) Serial1.printf( __VA_ARGS__ )
32+
//#define DEBUG_HTTP_UPDATE(...) Serial1.printf( __VA_ARGS__ )
3333

3434
#ifndef DEBUG_HTTP_UPDATE
3535
#define DEBUG_HTTP_UPDATE(...)

hardware/esp8266com/esp8266/platform.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ compiler.S.flags=-c -g -x assembler-with-cpp -MMD
2424
compiler.c.elf.flags=-g -Os -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{build.flash_ld}" -Wl,-wrap,system_restart_local -Wl,-wrap,register_chipv6_phy
2525

2626
compiler.c.elf.cmd=xtensa-lx106-elf-gcc
27-
compiler.c.elf.libs=-lm -lgcc -lhal -lphy -lnet80211 -llwip -lwpa -lmain -lpp -lsmartconfig
27+
compiler.c.elf.libs=-lm -lgcc -lhal -lphy -lnet80211 -llwip -lwpa -lmain -lpp -lsmartconfig -lwps
2828

2929
compiler.cpp.cmd=xtensa-lx106-elf-g++
3030
compiler.cpp.flags=-c -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD

hardware/esp8266com/esp8266/tools/sdk/changelog.txt

+59
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,62 @@
1+
esp_iot_sdk_v1.2.0_15_07_03 Release Note
2+
-------------------------------------------
3+
Resolved Issues(Bugs below are eligible for Bug Bounty Program):
4+
1.TLS server disconnect to ESP8266 may cause crash. [孙新虎]
5+
6+
Optimization:
7+
1.Update SmartConfig to version 2.4 , corresponding to ESPTOUCH APP v0.3.4 (https://github.com/EspressifApp/), delete parameter "sc_type type" in smartconfig_start, SmartConfig type can be got automatically.
8+
2.Add parameter "sint16 freq_offset; " in structure "bss_info" to get AP's frequency offset.
9+
3.Folder "ld" is updated, please use the latest one (\esp_iot_sdk_v1.2.0\ld )
10+
4.Add UDP transparent transmission example in documentation "4B-ESP8266__AT Command Examples"
11+
5.Revise the scan issue that may cause Wi-Fi connection break.
12+
6.Add ESP-NOW function, more details in "Add APIs"
13+
7.Add WPS function,more details in "Add APIs"
14+
8.Fixed a DNS fail issue with special router
15+
9.Optimize espconn,revise issues below:
16+
(1) enter sent callback late in UDP transmission
17+
(2) TCP shakehand may fail issue
18+
(3) SSL connection fail may cause crash
19+
(4) optimize SSL error handler
20+
10. Memory optimization
21+
22+
Add APIs:
23+
1.ESP-NOW APIs
24+
esp_now_init: init ESP-NOW function
25+
esp_now_deinit: deinit ESP-NOW function
26+
esp_now_register_recv_cb: register ESP-NOW receive callback
27+
esp_now_unregister_recv_cb: unregister ESP-NOW receive callback
28+
esp_now_send: send ESP-NOW packet
29+
esp_now_add_peer: add an ESP-NOW peer
30+
esp_now_del_peer: delete an ESP-NOW peer
31+
esp_now_set_self_role: set ESP-NOW role of device itself
32+
esp_now_get_self_role: get ESP-NOW role of device itself
33+
esp_now_set_peer_role: set ESP-NOW role about another device
34+
esp_now_get_peer_role: get ESP-NOW role about another device
35+
esp_now_set_peer_key: set ESP-NOW key of a device
36+
esp_now_get_peer_key: get ESP-NOW key of a device
37+
38+
2. WPS APIs
39+
wifi_wps_enable : enable WPS function
40+
wifi_wps_disable: disable WPS function
41+
wifi_wps_start: start WPS communication
42+
wifi_set_wps_cb: set WPS callback
43+
44+
3.software watchdog APIs
45+
system_soft_wdt_stop: stop software watchdog
46+
system_soft_wdt_restart: restart software watchdog
47+
48+
4.sntp_get_timezone: get SNTP timezone
49+
50+
AT_v0.30 Release Note:
51+
Note: For AT firmware to support FOTA, flash size need to be 1024KB or more than that.
52+
53+
1.Command "AT+CWSTARTSMART" need not parameter any more, SmartConfig type can be got automatically.
54+
2.AP's frequency offset can be got by command "AT+CWLAP"
55+
3.Memory optimization
56+
57+
58+
59+
160
esp_iot_sdk_1.1.2_15_06_25_p2 Release Note
261
-------------------------------------------
362

hardware/esp8266com/esp8266/tools/sdk/include/eagle_soc.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,11 @@
300300

301301
#define PIN_PULLUP_DIS(PIN_NAME) CLEAR_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLUP)
302302
#define PIN_PULLUP_EN(PIN_NAME) SET_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLUP)
303-
#define PIN_PULLDWN_DIS(PIN_NAME) CLEAR_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLDWN)
304-
#define PIN_PULLDWN_EN(PIN_NAME) SET_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLDWN)
305303
#define PIN_FUNC_SELECT(PIN_NAME, FUNC) do { \
306-
CLEAR_PERI_REG_MASK(PIN_NAME, (PERIPHS_IO_MUX_FUNC<<PERIPHS_IO_MUX_FUNC_S)); \
307-
SET_PERI_REG_MASK(PIN_NAME, (((FUNC&BIT2)<<2)|(FUNC&0x3))<<PERIPHS_IO_MUX_FUNC_S); \
304+
WRITE_PERI_REG(PIN_NAME, \
305+
READ_PERI_REG(PIN_NAME) \
306+
& (~(PERIPHS_IO_MUX_FUNC<<PERIPHS_IO_MUX_FUNC_S)) \
307+
|( (((FUNC&BIT2)<<2)|(FUNC&0x3))<<PERIPHS_IO_MUX_FUNC_S) ); \
308308
} while (0)
309309

310310
//}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (C) 2015 -2018 Espressif System
3+
*
4+
*/
5+
6+
#ifndef __ESPNOW_H__
7+
#define __ESPNOW_H__
8+
9+
enum esp_now_role {
10+
ESP_NOW_ROLE_IDLE = 0,
11+
ESP_NOW_ROLE_CONTROLLER,
12+
ESP_NOW_ROLE_SLAVE,
13+
ESP_NOW_ROLE_MAX,
14+
};
15+
16+
typedef void (*esp_now_cb_t)(u8 *mac_addr, u8 *data, u8 len);
17+
18+
int esp_now_init(void);
19+
int esp_now_deinit(void);
20+
21+
int esp_now_register_recv_cb(esp_now_cb_t cb);
22+
int esp_now_unregister_recv_cb(void);
23+
24+
int esp_now_send(u8 *da, u8 *data, int len);
25+
26+
int esp_now_add_peer(u8 *mac_addr, u8 role, u8 channel, u8 *key, u8 key_len);
27+
int esp_now_del_peer(u8 *mac_addr);
28+
29+
int esp_now_set_self_role(u8 role);
30+
int esp_now_get_self_role(void);
31+
32+
int esp_now_set_peer_role(u8 *mac_addr, u8 role);
33+
int esp_now_get_peer_role(u8 *mac_addr);
34+
35+
int esp_now_set_peer_channel(u8 *mac_addr, u8 channel);
36+
int esp_now_get_peer_channel(u8 *mac_addr);
37+
38+
int esp_now_set_peer_key(u8 *mac_addr, u8 *key, u8 key_len);
39+
int esp_now_get_peer_key(u8 *mac_addr, u8 *key, u8 *key_len);
40+
41+
u8 *esp_now_fetch_peer(bool restart);
42+
43+
int esp_now_is_peer_exist(u8 *mac_addr);
44+
45+
int esp_now_get_cnt_info(u8 *all_cnt, u8 *encrypt_cnt);
46+
47+
#endif

hardware/esp8266com/esp8266/tools/sdk/include/ets_sys.h

+6-7
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,6 @@ inline uint32_t ETS_INTR_PENDING(void)
9191
#define ETS_FRC_TIMER1_NMI_INTR_ATTACH(func) \
9292
NmiTimSetFunc(func)
9393

94-
#define ETS_FRC1_INTR_ENABLE() \
95-
ETS_INTR_ENABLE(ETS_FRC_TIMER1_INUM)
96-
97-
#define ETS_FRC1_INTR_DISABLE() \
98-
ETS_INTR_DISABLE(ETS_FRC_TIMER1_INUM)
99-
100-
10194
#define ETS_GPIO_INTR_ATTACH(func, arg) \
10295
ets_isr_attach(ETS_GPIO_INUM, (int_handler_t)(func), (void *)(arg))
10396

@@ -117,6 +110,12 @@ inline uint32_t ETS_INTR_PENDING(void)
117110
#define ETS_UART_INTR_DISABLE() \
118111
ETS_INTR_DISABLE(ETS_UART_INUM)
119112

113+
#define ETS_FRC1_INTR_ENABLE() \
114+
ETS_INTR_ENABLE(ETS_FRC_TIMER1_INUM)
115+
116+
#define ETS_FRC1_INTR_DISABLE() \
117+
ETS_INTR_DISABLE(ETS_FRC_TIMER1_INUM)
118+
120119

121120
#define ETS_SPI_INTR_ATTACH(func, arg) \
122121
ets_isr_attach(ETS_SPI_INUM, (int_handler_t)(func), (void *)(arg))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#ifndef __PWM_H__
2+
#define __PWM_H__
3+
4+
/*pwm.h: function and macro definition of PWM API , driver level */
5+
/*user_light.h: user interface for light API, user level*/
6+
/*user_light_adj: API for color changing and lighting effects, user level*/
7+
8+
9+
/*NOTE!! : DO NOT CHANGE THIS FILE*/
10+
11+
/*SUPPORT UP TO 8 PWM CHANNEL*/
12+
#define PWM_CHANNEL_NUM_MAX 8
13+
14+
struct pwm_param {
15+
uint32 period;
16+
uint32 freq;
17+
uint32 duty[PWM_CHANNEL_NUM_MAX]; //PWM_CHANNEL<=8
18+
};
19+
20+
21+
/* pwm_init should be called only once, for now */
22+
void pwm_init(uint32 period, uint32 *duty,uint32 pwm_channel_num,uint32 (*pin_info_list)[3]);
23+
void pwm_start(void);
24+
25+
void pwm_set_duty(uint32 duty, uint8 channel);
26+
uint32 pwm_get_duty(uint8 channel);
27+
void pwm_set_period(uint32 period);
28+
uint32 pwm_get_period(void);
29+
30+
uint32 get_pwm_version(void);
31+
void set_pwm_debug_en(uint8 print_en);
32+
33+
#endif
34+

hardware/esp8266com/esp8266/tools/sdk/include/smartconfig.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ typedef enum {
2222
typedef void (*sc_callback_t)(sc_status status, void *pdata);
2323

2424
const char *smartconfig_get_version(void);
25-
bool smartconfig_start(sc_type type, sc_callback_t cb, ...);
25+
bool smartconfig_start(sc_callback_t cb, ...);
2626
bool smartconfig_stop(void);
2727
bool esptouch_set_timeout(uint8 time_s); //15s~255s, offset:45s
2828

hardware/esp8266com/esp8266/tools/sdk/include/sntp.h

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ uint32 sntp_get_current_timestamp();
1515
* get real time (GTM + 8 time zone)
1616
*/
1717
char* sntp_get_real_time(long t);
18+
/**
19+
* SNTP get time_zone default GMT + 8
20+
*/
21+
sint8 sntp_get_timezone(void);
1822
/**
1923
* SNTP set time_zone (default GMT + 8)
2024
*/

hardware/esp8266com/esp8266/tools/sdk/include/user_interface.h

+28
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ void system_phy_set_rfoption(uint8 option);
135135
bool system_param_save_with_protect(uint16 start_sec, void *param, uint16 len);
136136
bool system_param_load(uint16 start_sec, uint16 offset, void *param, uint16 len);
137137

138+
void system_soft_wdt_stop(void);
139+
void system_soft_wdt_restart(void);
140+
138141
#define NULL_MODE 0x00
139142
#define STATION_MODE 0x01
140143
#define SOFTAP_MODE 0x02
@@ -165,6 +168,7 @@ struct bss_info {
165168
sint8 rssi;
166169
AUTH_MODE authmode;
167170
uint8 is_hidden;
171+
sint16 freq_offset;
168172
};
169173

170174
typedef struct _scaninfo {
@@ -235,6 +239,9 @@ bool wifi_station_dhcpc_start(void);
235239
bool wifi_station_dhcpc_stop(void);
236240
enum dhcp_status wifi_station_dhcpc_status(void);
237241

242+
char* wifi_station_get_hostname(void);
243+
bool wifi_station_set_hostname(char *name);
244+
238245
struct softap_config {
239246
uint8 ssid[32];
240247
uint8 password[64];
@@ -415,4 +422,25 @@ typedef void (* wifi_event_handler_cb_t)(System_Event_t *event);
415422

416423
void wifi_set_event_handler_cb(wifi_event_handler_cb_t cb);
417424

425+
typedef enum wps_type {
426+
WPS_TYPE_DISABLE = 0,
427+
WPS_TYPE_PBC,
428+
WPS_TYPE_PIN,
429+
WPS_TYPE_DISPLAY,
430+
WPS_TYPE_MAX,
431+
} WPS_TYPE_t;
432+
433+
enum wps_cb_status {
434+
WPS_CB_ST_SUCCESS = 0,
435+
WPS_CB_ST_FAILED,
436+
WPS_CB_ST_TIMEOUT,
437+
};
438+
439+
bool wifi_wps_enable(WPS_TYPE_t wps_type);
440+
bool wifi_wps_disable(void);
441+
bool wifi_wps_start(void);
442+
443+
typedef void (*wps_st_cb_t)(int status);
444+
bool wifi_set_wps_cb(wps_st_cb_t cb);
445+
418446
#endif
Binary file not shown.
Binary file not shown.
Binary file not shown.
116 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.2_15_06_25_p2
1+
1.2.0_15_07_03

0 commit comments

Comments
 (0)