20b-Esp8266 Rtos SDK API Reference
20b-Esp8266 Rtos SDK API Reference
v1.4.0
Contents
ESP8266_RTOS_SDK
Module Index
2.1
Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1
Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Module Documentation
4.1
4.1.1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AirKiss APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.2
4.2.2.1
airkiss_lan_ret_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
airkiss_version(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
Misc APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
4.3.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
4.3.2
11
4.3.2.1
IP2STR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
11
4.3.3.1
dhcp_status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
4.3.3.2
dhcps_offer_option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12
4.3.4.1
os_delay_us(uint16 us) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12
4.3.4.2
os_install_putc1(void(p)(char c)) . . . . . . . . . . . . . . . . . . . . . . . . .
12
4.3.4.3
os_putc(char c)
12
4.2
4.2.3
Detailed Description
4.2.3.1
4.2.3.2
4.2.3.3
4.3
4.3.3
4.3.4
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iv
CONTENTS
4.4
SoftAP APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
4.4.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
4.4.2
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
4.4.2.1
wifi_softap_dhcps_start(void) . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
4.4.2.2
wifi_softap_dhcps_status(void) . . . . . . . . . . . . . . . . . . . . . . . . . .
14
4.4.2.3
wifi_softap_dhcps_stop(void) . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
4.4.2.4
wifi_softap_free_station_info(void) . . . . . . . . . . . . . . . . . . . . . . . . .
14
4.4.2.5
. . . . . . . . . . . . . . .
15
4.4.2.6
15
4.4.2.7
15
4.4.2.8
wifi_softap_get_dhcps_lease_time(void)
. . . . . . . . . . . . . . . . . . . . .
15
4.4.2.9
wifi_softap_get_station_info(void) . . . . . . . . . . . . . . . . . . . . . . . . .
16
4.4.2.10 wifi_softap_get_station_num(void) . . . . . . . . . . . . . . . . . . . . . . . . .
16
4.4.2.11 wifi_softap_reset_dhcps_lease_time(void)
16
. . . . . . . . . . . . . . . . . . . .
4.5
4.6
4.7
. . . . . . . . . . . . . . .
17
17
17
. . . . . . . . . . . . . . . .
18
18
Spiffs APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
4.5.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
4.5.2
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
4.5.2.1
esp_spiffs_deinit(uint8 format) . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
4.5.2.2
19
SSC APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
4.6.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
4.6.2
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
4.6.2.1
ssc_attach(SscBaudRate bandrate) . . . . . . . . . . . . . . . . . . . . . . . .
20
4.6.2.2
ssc_param_len(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
4.6.2.3
ssc_param_str(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
4.6.2.4
21
4.6.2.5
21
Station APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
4.7.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
4.7.2
Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
4.7.2.1
scan_done_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
23
4.7.3.1
STATION_STATUS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
4.7.4.1
24
4.7.3
4.7.4
wifi_station_ap_change(uint8 current_ap_id) . . . . . . . . . . . . . . . . . . .
CONTENTS
4.8
4.7.4.2
wifi_station_ap_number_set(uint8 ap_number) . . . . . . . . . . . . . . . . . .
24
4.7.4.3
wifi_station_connect(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
4.7.4.4
wifi_station_dhcpc_start(void) . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
4.7.4.5
wifi_station_dhcpc_status(void) . . . . . . . . . . . . . . . . . . . . . . . . . .
25
4.7.4.6
wifi_station_dhcpc_stop(void) . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
4.7.4.7
wifi_station_disconnect(void)
. . . . . . . . . . . . . . . . . . . . . . . . . . .
25
4.7.4.8
26
4.7.4.9
wifi_station_get_auto_connect(void) . . . . . . . . . . . . . . . . . . . . . . . .
26
26
26
4.7.4.12 wifi_station_get_connect_status(void) . . . . . . . . . . . . . . . . . . . . . . .
27
4.7.4.13 wifi_station_get_current_ap_id(void)
. . . . . . . . . . . . . . . . . . . . . . .
27
4.7.4.14 wifi_station_get_hostname(void) . . . . . . . . . . . . . . . . . . . . . . . . . .
27
4.7.4.15 wifi_station_get_reconnect_policy(void) . . . . . . . . . . . . . . . . . . . . . .
27
4.7.4.16 wifi_station_get_rssi(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
28
28
29
29
. . . . . . . . . . . . . . . . . . . . .
30
31
System APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
32
4.8.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33
4.8.2
33
4.8.2.1
rst_reason . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33
4.8.3.1
system_adc_read(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33
4.8.3.2
system_deep_sleep(uint32 time_in_us) . . . . . . . . . . . . . . . . . . . . . .
34
4.8.3.3
system_deep_sleep_set_option(uint8 option) . . . . . . . . . . . . . . . . . . .
34
4.8.3.4
system_get_chip_id(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
4.8.3.5
system_get_free_heap_size(void) . . . . . . . . . . . . . . . . . . . . . . . . .
35
4.8.3.6
system_get_rst_info(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
4.8.3.7
system_get_rtc_time(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
4.8.3.8
system_get_sdk_version(void) . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
4.8.3.9
system_get_time(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
4.8.3.10 system_get_vdd33(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
36
37
37
38
4.8.3
. . . . . . . . . . . . . . . . . . . . . .
vi
CONTENTS
38
4.8.3.16 system_print_meminfo(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
4.8.3.17 system_restart(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
4.8.3.18 system_restore(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
4.8.3.19 system_rtc_clock_cali_proc(void) . . . . . . . . . . . . . . . . . . . . . . . . .
39
40
. . . . . . . . . . .
40
4.8.3.22 system_uart_de_swap(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
4.8.3.23 system_uart_swap(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
Boot APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
4.9.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
4.9.2
42
4.9.2.1
SYS_BOOT_ENHANCE_MODE
. . . . . . . . . . . . . . . . . . . . . . . . .
42
4.9.2.2
SYS_BOOT_NORMAL_BIN . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
4.9.2.3
SYS_BOOT_NORMAL_MODE . . . . . . . . . . . . . . . . . . . . . . . . . .
43
4.9.2.4
SYS_BOOT_TEST_BIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
43
4.9.3.1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
4.9.4.1
system_get_boot_mode(void) . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
4.9.4.2
system_get_boot_version(void) . . . . . . . . . . . . . . . . . . . . . . . . . .
43
4.9.4.3
system_get_cpu_freq(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
4.9.4.4
system_get_flash_size_map(void) . . . . . . . . . . . . . . . . . . . . . . . . .
44
4.9.4.5
system_get_userbin_addr(void) . . . . . . . . . . . . . . . . . . . . . . . . . .
44
4.9.4.6
44
4.9.4.7
system_update_cpu_freq(uint8 freq)
. . . . . . . . . . . . . . . . . . . . . . .
45
46
4.9
4.9.3
4.9.4
flash_size_map
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
46
46
46
46
47
48
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
50
50
4.11.2.1 freedom_outside_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
50
4.11.2.2 rfid_locp_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
50
4.11.2.3 wifi_event_handler_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
50
50
4.11.3.1 AUTH_MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
50
CONTENTS
vii
4.11.3.2 SYSTEM_EVENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
4.11.3.3 WIFI_INTERFACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
4.11.3.4 WIFI_MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
4.11.3.5 WIFI_PHY_MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
51
51
52
4.11.4.3 wifi_get_opmode(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
52
4.11.4.4 wifi_get_opmode_default(void)
. . . . . . . . . . . . . . . . . . . . . . . . . .
52
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
53
4.11.4.6 wifi_get_sleep_type(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
54
. . . . . . . . . . . . . . . .
54
54
4.11.4.9 wifi_rfid_locp_recv_close(void)
. . . . . . . . . . . . . . . . . . . . . . . . . .
54
4.11.4.10 wifi_rfid_locp_recv_open(void) . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
55
55
56
56
. . . . . . . . . . . . . . . . . . . . .
57
57
. . . . . . . . . . . . . . . . . .
57
58
58
4.11.4.20 wifi_status_led_uninstall(void) . . . . . . . . . . . . . . . . . . . . . . . . . . .
58
4.11.4.21 wifi_unregister_rfid_locp_recv_cb(void) . . . . . . . . . . . . . . . . . . . . . .
58
4.11.4.22 wifi_unregister_send_pkt_freedom_cb(void)
. . . . . . . . . . . . . . . . . . .
59
60
4.11.4.5 wifi_get_phy_mode(void)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
60
4.12.2.1 wifi_fpm_close(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
60
4.12.2.3 wifi_fpm_do_wakeup(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
4.12.2.4 wifi_fpm_get_sleep_type(void) . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
4.12.2.5 wifi_fpm_open(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
. . . . . . . . . . . . . . . . . . . .
62
62
63
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
64
viii
CONTENTS
4.13.2.1 wifi_get_user_fixed_rate(uint8 enable_mask, uint8 rate) . . . . . . . . . . . .
64
4.13.2.2 wifi_get_user_limit_rate_mask(void) . . . . . . . . . . . . . . . . . . . . . . . .
64
64
65
65
66
67
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
67
67
4.14.2.1 user_ie_manufacturer_recv_cb_t . . . . . . . . . . . . . . . . . . . . . . . . .
67
68
69
4.14.3.3 wifi_unregister_user_ie_manufacturer_recv_cb(void) . . . . . . . . . . . . . . .
69
70
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
70
70
4.15.2.1 wifi_promiscuous_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
70
70
4.15.3.1 wifi_get_channel(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
70
71
. . . . . . . . . . . . . . .
71
71
72
73
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
73
73
4.16.2.1 wps_st_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
73
74
4.16.3.1 wps_cb_status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
74
74
74
4.16.4.2 wifi_wps_disable(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
74
74
4.16.4.4 wifi_wps_start(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
75
76
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
78
78
4.17.2.1 ESPCONN_ABRT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
78
CONTENTS
ix
4.17.2.2 ESPCONN_ARG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
78
4.17.2.3 ESPCONN_CLSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
78
4.17.2.4 ESPCONN_CONN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
78
4.17.2.5 ESPCONN_IF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
78
4.17.2.6 ESPCONN_INPROGRESS . . . . . . . . . . . . . . . . . . . . . . . . . . . .
78
4.17.2.7 ESPCONN_ISCONN
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
78
4.17.2.8 ESPCONN_MAXNUM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
4.17.2.9 ESPCONN_MEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
4.17.2.10 ESPCONN_OK
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
4.17.2.11 ESPCONN_RST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
4.17.2.12 ESPCONN_RTE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
4.17.2.13 ESPCONN_TIMEOUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
79
4.17.3.1 dns_found_callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
4.17.3.2 espconn_connect_callback . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
4.17.3.3 espconn_reconnect_callback . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
4.17.3.4 espconn_recv_callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
80
4.17.4.1 espconn_level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
4.17.4.2 espconn_option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81
4.17.4.3 espconn_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81
4.17.4.4 espconn_type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81
81
81
82
82
82
83
83
83
84
84
4.17.5.10 espconn_gethostbyname(struct espconn pespconn, const char hostname, ip_addr_t addr, dns_found_callback found) . . . . . . . . . . . . . . . . . . . .
84
85
85
4.17.5.13 espconn_init(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
86
4.17.5.14 espconn_port(void)
86
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
86
CONTENTS
4.17.5.16 espconn_recv_unhold(struct espconn pespconn) . . . . . . . . . . . . . . . .
86
87
87
87
88
88
88
89
89
90
90
91
91
4.17.5.29 espconn_tcp_get_max_con(void) . . . . . . . . . . . . . . . . . . . . . . . . .
92
92
92
93
94
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
95
95
4.18.2.1 esp_now_recv_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
95
4.18.2.2 esp_now_send_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
95
97
4.18.3.1 esp_now_add_peer(uint8 mac_addr, uint8 role, uint8 channel, uint8 key, uint8
key_len) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
97
4.18.3.2 esp_now_deinit(void)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
97
97
98
. . . . . . . . . . . .
98
98
98
99
4.18.3.9 esp_now_get_self_role(void)
. . . . . . . . . . . . . . . . . . . . . . . . . . .
99
4.18.3.10 esp_now_init(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
99
99
. . . . . . . . . . . . . . . . . . . .
CONTENTS
xi
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
xii
CONTENTS
4.21.2.3 pwm_init(uint32 period, uint32 duty, uint32 pwm_channel_num, uint32(pin_info_list)[3]) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
4.21.2.4 pwm_set_duty(uint32 duty, uint8 channel) . . . . . . . . . . . . . . . . . . . . . 113
4.21.2.5 pwm_set_period(uint32 period) . . . . . . . . . . . . . . . . . . . . . . . . . . 113
4.21.2.6 pwm_start(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
4.22 Smartconfig APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
4.22.1 Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
. . . . . . . . . . . . . . . 121
. . . . . . . . . 121
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
CONTENTS
xiii
4.24.2.4 UPGRADE_FLAG_START
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
. . . . . . . . . . . 127
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
xiv
CONTENTS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
. . . . . . . . . . 135
5.2
event_id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5.1.1.2
event_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5.3
141
connect_callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
5.2.1.2
disconnect_callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
5.2.1.3
local_ip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
5.2.1.4
local_port
5.2.1.5
reconnect_callback
5.2.1.6
remote_ip
5.2.1.7
remote_port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
5.2.1.8
write_finish_fn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
CONTENTS
xv
5.3.1.1
local_ip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
5.3.1.2
local_port
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
5.3.1.3
remote_ip
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
5.3.1.4
remote_port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
5.4
5.5
remote_ip
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
5.5.1.2
remote_port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
5.5.1.3
state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
5.6
5.7
5.7.2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
authmode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.7.2.2
bssid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.7.2.3
channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.7.2.4
freq_offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.7.2.5
is_hidden . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.7.2.6
rssi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.7.2.7
ssid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.7.2.8
ssid_len . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.8
5.9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
5.9.1.2
end_ip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
5.9.1.3
start_ip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
xvi
CONTENTS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
. . . . . . . . . . . . . . . . . . . . . . . 149
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
CONTENTS
xvii
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
xviii
CONTENTS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Chapter 1
ESP8266_RTOS_SDK
Misc APIs : misc APIs
WiFi APIs : WiFi related APIs
SoftAP APIs : ESP8266 Soft-AP APIs
Station APIs : ESP8266 station APIs
Common APIs : WiFi common APIs
Force Sleep APIs : WiFi Force Sleep APIs
Rate Control APIs : WiFi Rate Control APIs
User IE APIs : WiFi User IE APIs
Sniffer APIs : WiFi sniffer APIs
WPS APIs : WiFi WPS APIs
Smartconfig APIs : SmartConfig APIs
AirKiss APIs : AirKiss APIs
Spiffs APIs : Spiffs APIs
SSC APIs : Simple Serial Command APIs
System APIs : System APIs
Boot APIs : Boot mode APIs
Upgrade APIs : Firmware upgrade (FOTA) APIs
Software timer APIs : Software timer APIs
Network Espconn APIs : Network espconn APIs
ESP-NOW APIs : ESP-NOW APIs
Mesh APIs : Mesh APIs
Driver APIs : Driver APIs
PWM Driver APIs : PWM driver APIs
UART Driver APIs : UART driver APIs
GPIO Driver APIs : GPIO driver APIs
SPI Driver APIs : SPI Flash APIs
Hardware timer APIs : Hardware timer APIs
void user_init(void) is the entrance function of the application.
ESP8266_RTOS_SDK
Attention
1. It is recommended that users set the timer to the periodic mode for periodic checks.
(1). In freeRTOS timer or os_timer, do not delay by while(1) or in the manner that will block the thread.
(2). The timer callback should not occupy CPU more than 15ms.
(3). os_timer_t should not define a local variable, it has to be global varialbe or memory got by malloc.
2. Since esp_iot_rtos_sdk_v1.0.4, functions are stored in CACHE by default, need not be added ICACHE_FLASH_ATTR any more. The interrupt functions can also be stored in CACHE. If users want to store some
frequently called functions in RAM, please add IRAM_ATTR before functions' name.
3. Network programming use socket, please do not bind to the same port.
(1). If users want to create 3 or more than 3 TCP connections, please add "TCP_WND = 2 x TCP_MSS;" in
"user_init".
4. Priority of the RTOS SDK is 15. xTaskCreate is an interface of freeRTOS. For details of the freeRTOS and
APIs of the system, please visit http://www.freertos.org
(1). When using xTaskCreate to create a task, the task stack range is [176, 512].
(2). If an array whose length is over 60 bytes is used in a task, it is suggested that users use malloc and free
rather than local variable to allocate array. Large local variables could lead to task stack overflow.
(3). The RTOS SDK takes some priorities. Priority of the pp task is 13; priority of precise timer(ms) thread is
12; priority of the TCP/IP task is 10; priority of the freeRTOS timer is 2; priority of the idle task is 0.
(4). Users can use tasks with priorities from 1 to 9.
(5). Do not revise FreeRTOSConfig.h, configurations are decided by source code inside the RTOS SDK, users
can not change it.
Chapter 2
Module Index
2.1
Modules
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 8
. 13
. 22
. 48
. 60
. 63
. 67
. 70
. 73
. 115
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11
19
20
32
Boot APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Upgrade APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Software timer APIs . .
Network Espconn APIs
ESP-NOW APIs . . . .
Mesh APIs . . . . . . .
Driver APIs . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 46
. 76
. 94
. 104
. 111
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 112
. 119
. 128
. 133
. 135
Module Index
Chapter 3
Data Structures
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
141
141
142
143
143
144
144
145
146
146
147
148
149
149
150
150
151
151
152
153
153
154
154
155
155
156
157
157
157
158
158
159
Chapter 4
Module Documentation
4.1
WiFi APIs.
Modules
AirKiss APIs
AirKiss APIs.
SoftAP APIs
ESP8266 Soft-AP APIs.
Station APIs
ESP8266 station APIs.
Common APIs
WiFi common APIs.
User IE APIs
WiFi User IE APIs.
Sniffer APIs
WiFi sniffer APIs.
WPS APIs
ESP8266 WPS APIs.
Smartconfig APIs
SmartConfig APIs.
4.1.1
Detailed Description
WiFi APIs.
Module Documentation
4.2
AirKiss APIs
AirKiss APIs.
Enumerations
enum airkiss_lan_ret_t {
AIRKISS_LAN_ERR_OVERFLOW = -5, AIRKISS_LAN_ERR_CMD = -4, AIRKISS_LAN_ERR_PAKE = -3,
AIRKISS_LAN_ERR_PARA = -2,
AIRKISS_LAN_ERR_PKG = -1, AIRKISS_LAN_CONTINUE = 0, AIRKISS_LAN_SSDP_REQ = 1, AIRKISS_LAN_PAKE_READY = 2 }
enum airkiss_lan_cmdid_t { AIRKISS_LAN_SSDP_REQ_CMD = 0x1, AIRKISS_LAN_SSDP_RESP_CMD = 0x1001, AIRKISS_LAN_SSDP_NOTIFY_CMD = 0x1002 }
Functions
const char airkiss_version (void)
Get the version information of AirKiss lib.
int airkiss_lan_recv (const void body, unsigned short length, const airkiss_config_t config)
Parse the UDP packet sent by AirKiss.
int airkiss_lan_pack (airkiss_lan_cmdid_t ak_lan_cmdid, void appid, void deviceid, void _datain, unsigned
short inlength, void _dataout, unsigned short outlength, const airkiss_config_t config)
Packaging the UDP packet.
4.2.1
Detailed Description
AirKiss APIs.
API airkiss_lan_recv and airkiss_lan_pack are provided for the function that AirKiss can detect the ESP8266 devices
in LAN, more details about AirKiss please refer to WeChat : http://iot.weixin.qq.com.
Workflow : Create a UDP transmission. When UDP data is received, call API airkiss_lan_recv and input the UDP data, if the airkiss_lan_recv returns AIRKISS_LAN_SSDP_REQ, airkiss_lan_pack can be called to make a
response packet.
4.2.2
4.2.2.1
enum airkiss_lan_ret_t
Enumerator
AIRKISS_LAN_ERR_OVERFLOW the length of the data buffer is lack
AIRKISS_LAN_ERR_CMD Do not support the type of instruction
AIRKISS_LAN_ERR_PAKE Error reading data package
AIRKISS_LAN_ERR_PARA Error function passing parameters
AIRKISS_LAN_ERR_PKG Packet data error
AIRKISS_LAN_CONTINUE Message format is correct
AIRKISS_LAN_SSDP_REQ Find equipment request packet is received
AIRKISS_LAN_PAKE_READY Packet packaging complete
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
4.2.3
Function Documentation
4.2.3.1
int airkiss_lan_pack ( airkiss_lan_cmdid_t ak_lan_cmdid, void appid, void deviceid, void _datain, unsigned
short inlength, void _dataout, unsigned short outlength, const airkiss_config_t config )
10
Module Documentation
Parameters
airkiss_lan_cmdid_t
void
void
void
unsigned
void
unsigned
const
Returns
4.2.3.2
int airkiss_lan_recv ( const void body, unsigned short length, const airkiss_config_t config )
void body : the start of the UDP message body data pointer.
short length : the effective length of data.
airkiss_config_t config : input struct airkiss_config_t
Returns
4.2.3.3
Returns
the version information of AirKiss lib
4.3
Misc APIs
misc APIs
Data Structures
struct dhcps_lease
Macros
Enumerations
enum dhcp_status { DHCP_STOPPED, DHCP_STARTED }
enum dhcps_offer_option { OFFER_START = 0x00, OFFER_ROUTER = 0x01, OFFER_END }
Functions
void os_delay_us (uint16 us)
Delay function, maximum value: 65535 us.
4.3.1
Detailed Description
misc APIs
4.3.2
4.3.2.1
Value:
ip4_addr1_16(ipaddr), \
ip4_addr2_16(ipaddr), \
ip4_addr3_16(ipaddr), \
ip4_addr4_16(ipaddr)
4.3.3
4.3.3.1
enum dhcp_status
Enumerator
DHCP_STOPPED disable DHCP
DHCP_STARTED enable DHCP
11
12
Module Documentation
4.3.3.2
enum dhcps_offer_option
Enumerator
OFFER_START DHCP offer option start
OFFER_ROUTER DHCP offer router, only support this option now
OFFER_END DHCP offer option start
4.3.4
Function Documentation
4.3.4.1
Returns
null
4.3.4.2
Returns
null
4.3.4.3
c - character to be printed
Returns
null
4.4
SoftAP APIs
Data Structures
struct softap_config
struct station_info
Functions
bool wifi_softap_get_config (struct softap_config config)
Get the current configuration of the ESP8266 WiFi soft-AP.
4.4.1
Detailed Description
13
14
Module Documentation
4.4.2
Function Documentation
4.4.2.1
Returns
true : succeed
false : fail
4.4.2.2
Returns
enum dhcp_status
4.4.2.3
Disable the ESP8266 soft-AP DHCP server. The DHCP is enabled by default.
Parameters
null
Returns
true : succeed
false : fail
4.4.2.4
15
Parameters
null
Returns
null
4.4.2.5
Returns
true : succeed
false : fail
4.4.2.6
Get the configuration of the ESP8266 WiFi soft-AP saved in the flash.
Parameters
struct
Returns
true : succeed
false : fail
4.4.2.7
Query the IP range that can be got from the ESP8266 soft-AP DHCP server.
Attention
This API can only be called during ESP8266 soft-AP DHCP server enabled.
Parameters
struct
Returns
true : succeed
false : fail
4.4.2.8
16
Module Documentation
Parameters
null
Returns
lease time, uint: minute.
4.4.2.9
Get the information of stations connected to the ESP8266 soft-AP, including MAC and IP.
Attention
wifi_softap_get_station_info depends on DHCP, it can only be used when DHCP is enabled, so it can not get
the static IP.
Parameters
null
Returns
struct station_info : station information structure
4.4.2.10
Returns
the number of stations connected to the ESP8266 soft-AP
4.4.2.11
Reset ESP8266 soft-AP DHCP server lease time which is 120 minutes by default.
Attention
This API can only be called during ESP8266 soft-AP DHCP server enabled.
Parameters
17
null
Returns
true : succeed
false : fail
4.4.2.12
Set the configuration of the WiFi soft-AP and save it to the Flash.
Attention
1. This configuration will be saved in flash system parameter area if changed
2. The ESP8266 is limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust
its channel automatically to be the same as the channel of the ESP8266 station.
Parameters
struct
Returns
true : succeed
false : fail
4.4.2.13
Set the configuration of the WiFi soft-AP; the configuration will not be saved to the Flash.
Attention
The ESP8266 is limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust its
channel automatically to be the same as the channel of the ESP8266 station.
Parameters
struct
Returns
true : succeed
false : fail
4.4.2.14
18
Module Documentation
Parameters
struct
Returns
true : succeed
false : fail
4.4.2.15
Set ESP8266 soft-AP DHCP server lease time, default is 120 minutes.
Attention
This API can only be called during ESP8266 soft-AP DHCP server enabled.
Parameters
uint32
Returns
true : succeed
false : fail
4.4.2.16
uint8 mode = 0;
wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode);
Parameters
uint8
void
Returns
true : succeed
false : fail
4.5
19
Spiffs APIs
Spiffs APIs.
Data Structures
struct esp_spiffs_config
Functions
sint32 esp_spiffs_init (struct esp_spiffs_config config)
Initialize spiffs.
4.5.1
Detailed Description
Spiffs APIs.
More details about spiffs on https://github.com/pellepl/spiffs
4.5.2
Function Documentation
4.5.2.1
Deinitialize spiffs.
Parameters
uint8
Returns
null
4.5.2.2
Initialize spiffs.
Parameters
struct
Returns
0 : succeed
otherwise : fail
20
Module Documentation
4.6
SSC APIs
SSC APIs.
Functions
void ssc_attach (SscBaudRate bandrate)
Initial the ssc function.
4.6.1
Detailed Description
SSC APIs.
SSC means simple serial command. SSC APIs allows users to define their own command, users can refer to
spiffs_test/test_main.c.
4.6.2
Function Documentation
4.6.2.1
Returns
null
4.6.2.2
Returns
length of the command.
4.6.2.3
21
Parameters
null
Returns
the command.
4.6.2.4
Returns
the number of parameters.
4.6.2.5
Returns
null
22
4.7
Module Documentation
Station APIs
Data Structures
struct station_config
struct scan_config
struct bss_info
Typedefs
typedef void( scan_done_cb_t) (void arg, STATUS status)
Callback function for wifi_station_scan.
Enumerations
enum STATION_STATUS {
STATION_IDLE = 0, STATION_CONNECTING, STATION_WRONG_PASSWORD, STATION_NO_AP_FOUND,
STATION_CONNECT_FAIL, STATION_GOT_IP }
Functions
bool wifi_station_get_config (struct station_config config)
Get the current configuration of the ESP8266 WiFi station.
23
4.7.1
Detailed Description
4.7.2
Typedef Documentation
4.7.2.1
arg : information of APs that are found; save them as linked list; refer to struct bss_info
status : status of scanning
Returns
null
4.7.3
4.7.3.1
enum STATION_STATUS
Enumerator
STATION_IDLE ESP8266 station idle
STATION_CONNECTING ESP8266 station is connecting to AP
STATION_WRONG_PASSWORD the password is wrong
STATION_NO_AP_FOUND ESP8266 station can not find the target AP
STATION_CONNECT_FAIL ESP8266 station fail to connect to AP
STATION_GOT_IP ESP8266 station got IP address from AP
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
24
Module Documentation
4.7.4
Function Documentation
4.7.4.1
Returns
true : succeed
false : fail
4.7.4.2
Set the number of APs that can be recorded in the ESP8266 station. When the ESP8266 station is connected to
an AP, the SSID and password of the AP will be recorded.
Attention
This configuration will be saved in the Flash system parameter area if changed.
Parameters
uint8
Returns
true : succeed
false : fail
4.7.4.3
Returns
true : succeed
false : fail
4.7.4.4
25
Attention
1. The DHCP is enabled by default.
2. The DHCP and the static IP API ((wifi_set_ip_info)) influence each other, and if the DHCP is enabled,
the static IP will be disabled; if the static IP is enabled, the DHCP will be disabled. It depends on the latest
configuration.
Parameters
null
Returns
true : succeed
false : fail
4.7.4.5
Returns
enum dhcp_status
4.7.4.6
Returns
true : succeed
false : fail
4.7.4.7
26
Module Documentation
Parameters
null
Returns
true : succeed
false : fail
4.7.4.8
Returns
The number of APs recorded.
4.7.4.9
Check if the ESP8266 station will connect to the recorded AP automatically when the power is on.
Parameters
null
Returns
true : connect to the AP automatically
false : not connect to the AP automatically
4.7.4.10
Returns
true : succeed
false : fail
4.7.4.11
Get the configuration parameters saved in the Flash of the ESP8266 WiFi station.
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
27
Parameters
struct
Returns
true : succeed
false : fail
Returns
the status of connection
4.7.4.13
Returns
The number of APs recorded.
4.7.4.14
Returns
the hostname of ESP8266 station
4.7.4.15
Check whether the ESP8266 station will reconnect to the AP after disconnection.
Parameters
null
Returns
true : succeed
false : fail
28
4.7.4.16
Module Documentation
29
Parameters
null
Returns
31 : fail, invalid value.
others : succeed, value of rssi. In general, rssi value < 10
4.7.4.17
Returns
true : succeed
false : fail
4.7.4.18
Set whether the ESP8266 station will connect to the recorded AP automatically when the power is on. It will do so
by default.
Attention
1. If this API is called in user_init, it is effective immediately after the power is on. If it is called in other places,
it will be effective the next time when the power is on.
2. This configuration will be saved in Flash system parameter area if changed.
Parameters
bool
Returns
true : succeed
false : fail
4.7.4.19
Set the configuration of the ESP8266 station and save it to the Flash.
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
30
Module Documentation
Attention
1. This API can be called only when the ESP8266 station is enabled.
2. If wifi_station_set_config is called in user_init , there is no need to call wifi_station_connect. The ESP8266
station will automatically connect to the AP (router) after the system initialization. Otherwise, wifi_station_connect should be called.
3. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the
MAC address of the AP.
4. This configuration will be saved in the Flash system parameter area if changed.
Parameters
struct
Returns
true : succeed
false : fail
4.7.4.20
Set the configuration of the ESP8266 station. And the configuration will not be saved to the Flash.
Attention
1. This API can be called only when the ESP8266 station is enabled.
2. If wifi_station_set_config_current is called in user_init , there is no need to call wifi_station_connect. The
ESP8266 station will automatically connect to the AP (router) after the system initialization. Otherwise, wifi_station_connect should be called.
3. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the
MAC address of the AP.
Parameters
struct
Returns
true : succeed
false : fail
4.7.4.21
Returns
true : succeed
false : fail
4.7.4.22
31
Set whether the ESP8266 station will reconnect to the AP after disconnection. It will do so by default.
Attention
If users want to call this API, it is suggested that users call this API in user_init.
Parameters
bool
set : if it's true, it will enable reconnection; if it's false, it will disable reconnection.
Returns
true : succeed
false : fail
32
4.8
Module Documentation
System APIs
System APIs.
Modules
Boot APIs
boot APIs
Upgrade APIs
Firmware upgrade (FOTA) APIs.
Data Structures
struct rst_info
Enumerations
enum rst_reason {
REASON_DEFAULT_RST = 0, REASON_WDT_RST, REASON_EXCEPTION_RST, REASON_SOFT_WDT_RST,
REASON_SOFT_RESTART, REASON_DEEP_SLEEP_AWAKE, REASON_EXT_SYS_RST }
Functions
struct rst_info system_get_rst_info (void)
Get the reason of restart.
33
bool system_param_load (uint16 start_sec, uint16 offset, void param, uint16 len)
Read the data saved into flash with the read/write protection.
4.8.1
Detailed Description
System APIs.
4.8.2
4.8.2.1
enum rst_reason
Enumerator
REASON_DEFAULT_RST normal startup by power on
REASON_WDT_RST hardware watch dog reset
REASON_EXCEPTION_RST exception reset, GPIO status won't change
REASON_SOFT_WDT_RST software watch dog reset, GPIO status won't change
REASON_SOFT_RESTART software restart ,system_restart , GPIO status won't change
REASON_DEEP_SLEEP_AWAKE wake up from deep-sleep
REASON_EXT_SYS_RST external system reset
4.8.3
Function Documentation
4.8.3.1
34
Module Documentation
Parameters
null
Returns
Input voltage of TOUT pin 6, unit : 1/1024 V
4.8.3.2
Returns
null
4.8.3.3
Call this API before system_deep_sleep to set the activity after the next deep-sleep wakeup.
If this API is not called, default to be system_deep_sleep_set_option(1).
Parameters
uint8
0
1
2
4
option :
: Radio calibration after the deep-sleep wakeup is decided by byte 108 of esp_init_data_default.bin (0127byte).
: Radio calibration will be done after the deep-sleep wakeup. This will lead to stronger current.
: Radio calibration will not be done after the deep-sleep wakeup. This will lead to weaker
current.
: Disable radio calibration after the deep-sleep wakeup (the same as modem-sleep). This will
lead to the weakest current, but the device can't receive or transmit data after waking up.
Returns
true : succeed
false : fail
4.8.3.4
35
Parameters
null
Returns
The chip ID.
4.8.3.5
Returns
Available heap size.
4.8.3.6
Returns
struct rst_info : information of the system restart
4.8.3.7
Returns
RTC time.
36
4.8.3.8
Module Documentation
const char system_get_sdk_version ( void )
37
Parameters
null
Returns
Information of the SDK version.
4.8.3.9
4.8.3.10
4.8.3.11
bool system_param_load ( uint16 start_sec, uint16 offset, void param, uint16 len )
Read the data saved into flash with the read/write protection.
Flash read/write has to be 4-bytes aligned.
Read/write protection of flash: use 3 sectors (4KB per sector) to save 4KB data with protect, sector 0 and sector 1
are data sectors, back up each other, save data alternately, sector 2 is flag sector, point out which sector is keeping
the latest data, sector 0 or sector 1.
Parameters
uint16
start_sec : start sector (sector 0) of the 3 sectors used for flash read/write protection. It
cannot be sector 1 or sector 2.
For example, in IOT_Demo, the 3 sectors (3 4KB) starting from flash 0x3D000 can
be used for flash read/write protection. The parameter start_sec is 0x3D, and it cannot
be 0x3E or 0x3F.
uint16
void
uint16
38
Module Documentation
Returns
true : succeed
false : fail
4.8.3.12
start_sec : start sector (sector 0) of the 3 sectors which are used for flash read/write protection.
For example, in IOT_Demo we can use the 3 sectors (3 4KB) starting from flash
0x3D000 for flash read/write protection, so the parameter start_sec should be 0x3D
void
uint16
Returns
true : succeed
false : fail
4.8.3.13
max_tpw : the maximum value of RF Tx Power, unit : 0.25dBm, range [0, 82]. It can be set
refer to the 34th byte (target_power_qdb_0) of esp_init_data_default.bin(0127byte)
Returns
null
4.8.3.14
39
Parameters
uint8
option :
0 : Radio calibration after deep-sleep wake up depends on esp_init_data_default.bin
(0127byte) byte 108.
1 : Radio calibration is done after deep-sleep wake up; this increases the current
consumption.
2 : No radio calibration after deep-sleep wake up; this reduces the current consumption.
4 : Disable RF after deep-sleep wake up, just like modem sleep; this has the least
current consumption; the device is not able to transmit or receive data after wake up.
Returns
null
4.8.3.15
Returns
null
4.8.3.16
Returns
null
4.8.3.17
Restart system.
40
Module Documentation
Parameters
null
Returns
null
4.8.3.18
Returns
null
4.8.3.19
Returns
RTC clock period (unit: microsecond), bit11 bit0 are decimal.
4.8.3.20
41
Parameters
uint8
void
uint16
Returns
true : succeed
false : fail
4.8.3.21
Returns
true : succeed
false : fail
4.8.3.22
Returns
null
4.8.3.23
UART0 swap.
Use MTCK as UART0 RX, MTDO as UART0 TX, so ROM log will not output from this new UART0. We also need
to use MTDO (U0RTS) and MTCK (U0CTS) as UART0 in hardware.
42
Module Documentation
Parameters
null
Returns
null
4.9
43
Boot APIs
boot APIs
Macros
#define SYS_BOOT_ENHANCE_MODE 0
#define SYS_BOOT_NORMAL_MODE 1
#define SYS_BOOT_NORMAL_BIN 0
#define SYS_BOOT_TEST_BIN 1
#define SYS_CPU_80MHZ 80
#define SYS_CPU_160MHZ 160
Enumerations
enum flash_size_map {
FLASH_SIZE_4M_MAP_256_256 = 0, FLASH_SIZE_2M, FLASH_SIZE_8M_MAP_512_512, FLASH_SIZE_16M_MAP_512_512,
FLASH_SIZE_32M_MAP_512_512, FLASH_SIZE_16M_MAP_1024_1024, FLASH_SIZE_32M_MAP_1024_1024 }
Functions
uint8 system_get_boot_version (void)
Get information of the boot version.
4.9.1
Detailed Description
boot APIs
4.9.2
4.9.2.1
#define SYS_BOOT_ENHANCE_MODE 0
It can load and run firmware at any address, for Espressif factory test bin
4.9.2.2
#define SYS_BOOT_NORMAL_BIN 0
user1.bin or user2.bin
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
44
Module Documentation
4.9.2.3
#define SYS_BOOT_NORMAL_MODE 1
It can only load and run at some addresses of user1.bin (or user2.bin)
4.9.2.4
#define SYS_BOOT_TEST_BIN 1
4.9.3
4.9.3.1
enum flash_size_map
Enumerator
FLASH_SIZE_4M_MAP_256_256 Flash size : 4Mbits. Map : 256KBytes + 256KBytes
FLASH_SIZE_2M Flash size : 2Mbits. Map : 256KBytes
FLASH_SIZE_8M_MAP_512_512 Flash size : 8Mbits. Map : 512KBytes + 512KBytes
FLASH_SIZE_16M_MAP_512_512 Flash size : 16Mbits. Map : 512KBytes + 512KBytes
FLASH_SIZE_32M_MAP_512_512 Flash size : 32Mbits. Map : 512KBytes + 512KBytes
FLASH_SIZE_16M_MAP_1024_1024 Flash size : 16Mbits. Map : 1024KBytes + 1024KBytes
FLASH_SIZE_32M_MAP_1024_1024 Flash size : 32Mbits. Map : 1024KBytes + 1024KBytes
4.9.4
Function Documentation
4.9.4.1
4.9.4.2
4.9.4.3
45
Parameters
null
Returns
CPU frequency, unit : MHz.
Returns
enum flash_size_map
4.9.4.5
Get the address of the current running user bin (user1.bin or user2.bin).
Parameters
null
Returns
The address of the current running user bin.
4.9.4.6
46
Module Documentation
uint32
Returns
true : succeed
false : fail
4.9.4.7
Returns
true : succeed
false : fail
4.10
47
Functions
void os_timer_setfn (os_timer_t ptimer, os_timer_func_t pfunction, void parg)
Set the timer callback function.
4.10.1
Detailed Description
4.10.2
Function Documentation
4.10.2.1
Returns
null
4.10.2.2
Returns
null
48
Module Documentation
4.10.2.3
Returns
null
4.11
49
Common APIs
Data Structures
struct ip_info
struct Event_StaMode_ScanDone_t
struct Event_StaMode_Connected_t
struct Event_StaMode_Disconnected_t
struct Event_StaMode_AuthMode_Change_t
struct Event_StaMode_Got_IP_t
struct Event_SoftAPMode_StaConnected_t
struct Event_SoftAPMode_StaDisconnected_t
struct Event_SoftAPMode_ProbeReqRecved_t
union Event_Info_u
struct _esp_event
Typedefs
typedef struct _esp_event System_Event_t
typedef void( wifi_event_handler_cb_t) (System_Event_t event)
The Wi-Fi event handler.
Enumerations
enum WIFI_MODE {
NULL_MODE = 0, STATION_MODE, SOFTAP_MODE, STATIONAP_MODE,
MAX_MODE }
enum AUTH_MODE {
AUTH_OPEN = 0, AUTH_WEP, AUTH_WPA_PSK, AUTH_WPA2_PSK,
AUTH_WPA_WPA2_PSK, AUTH_MAX }
enum WIFI_INTERFACE { STATION_IF = 0, SOFTAP_IF, MAX_IF }
enum WIFI_PHY_MODE { PHY_MODE_11B = 1, PHY_MODE_11G = 2, PHY_MODE_11N = 3 }
enum SYSTEM_EVENT {
EVENT_STAMODE_SCAN_DONE = 0, EVENT_STAMODE_CONNECTED, EVENT_STAMODE_DISCONNECTED, EVENT_STAMODE_AUTHMODE_CHANGE,
EVENT_STAMODE_GOT_IP, EVENT_STAMODE_DHCP_TIMEOUT, EVENT_SOFTAPMODE_STACONNECTED, EVENT_SOFTAPMODE_STADISCONNECTED,
EVENT_SOFTAPMODE_PROBEREQRECVED, EVENT_MAX }
enum {
REASON_UNSPECIFIED = 1, REASON_AUTH_EXPIRE = 2, REASON_AUTH_LEAVE = 3, REASON_ASSOC_EXPIRE = 4,
REASON_ASSOC_TOOMANY = 5, REASON_NOT_AUTHED = 6, REASON_NOT_ASSOCED = 7, REASON_ASSOC_LEAVE = 8,
REASON_ASSOC_NOT_AUTHED = 9, REASON_DISASSOC_PWRCAP_BAD = 10, REASON_DISASSOC_SUPCHAN_BAD = 11, REASON_IE_INVALID = 13,
REASON_MIC_FAILURE = 14, REASON_4WAY_HANDSHAKE_TIMEOUT = 15, REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, REASON_IE_IN_4WAY_DIFFERS = 17,
REASON_GROUP_CIPHER_INVALID = 18, REASON_PAIRWISE_CIPHER_INVALID = 19, REASON_Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
50
Module Documentation
Functions
WIFI_MODE wifi_get_opmode (void)
Get the current operating mode of the WiFi.
4.11.1
51
Detailed Description
4.11.2
Typedef Documentation
4.11.2.1
Returns
null
4.11.2.2
Returns
null
4.11.2.3
Returns
null
4.11.3
4.11.3.1
enum AUTH_MODE
Enumerator
AUTH_OPEN authenticate mode : open
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
52
Module Documentation
4.11.3.2
enum SYSTEM_EVENT
Enumerator
EVENT_STAMODE_SCAN_DONE ESP8266 station finish scanning AP
EVENT_STAMODE_CONNECTED ESP8266 station connected to AP
EVENT_STAMODE_DISCONNECTED ESP8266 station disconnected to AP
EVENT_STAMODE_AUTHMODE_CHANGE the auth mode of AP connected by ESP8266 station changed
EVENT_STAMODE_GOT_IP ESP8266 station got IP from connected AP
EVENT_STAMODE_DHCP_TIMEOUT ESP8266 station dhcp client got IP timeout
EVENT_SOFTAPMODE_STACONNECTED a station connected to ESP8266 soft-AP
EVENT_SOFTAPMODE_STADISCONNECTED a station disconnected to ESP8266 soft-AP
EVENT_SOFTAPMODE_PROBEREQRECVED Receive probe request packet in soft-AP interface
4.11.3.3
enum WIFI_INTERFACE
Enumerator
STATION_IF ESP8266 station interface
SOFTAP_IF ESP8266 soft-AP interface
4.11.3.4
enum WIFI_MODE
Enumerator
NULL_MODE null mode
STATION_MODE WiFi station mode
SOFTAP_MODE WiFi soft-AP mode
STATIONAP_MODE WiFi station + soft-AP mode
4.11.3.5
enum WIFI_PHY_MODE
Enumerator
PHY_MODE_11B 802.11b
PHY_MODE_11G 802.11g
PHY_MODE_11N 802.11n
4.11.4
Function Documentation
4.11.4.1
Get the IP address of the ESP8266 WiFi station or the soft-AP interface.
Attention
Users need to enable the target interface (station or soft-AP) by wifi_set_opmode first.
53
Parameters
WIFI_INTERFACE
struct
if_index : get the IP address of the station or the soft-AP interface, 0x00 for STATION_IF,
0x01 for SOFTAP_IF.
ip_info info : the IP information obtained.
Returns
true : succeed
false : fail
4.11.4.2
Get MAC address of the ESP8266 WiFi station or the soft-AP interface.
Parameters
WIFI_INTERFACE
uint8
if_index : get the IP address of the station or the soft-AP interface, 0x00 for STATION_IF,
0x01 for SOFTAP_IF.
macaddr : the MAC address.
Returns
true : succeed
false : fail
Returns
WiFi operating modes:
0x01: station mode;
0x02: soft-AP mode
0x03: station+soft-AP mode
Returns
WiFi operating modes:
0x01: station mode;
0x02: soft-AP mode
0x03: station+soft-AP mode
54
Module Documentation
55
Parameters
null
Returns
enum WIFI_PHY_MODE
4.11.4.6
4.11.4.7
cb : callback
Returns
0, succeed;
otherwise, fail.
4.11.4.8
cb : sent callback
Returns
0, succeed;
-1, fail.
4.11.4.9
56
Module Documentation
Parameters
null
Returns
null
4.11.4.10
Returns
0, succeed;
otherwise, fail.
4.11.4.11
Returns
0, succeed;
-1, fail.
4.11.4.12
57
Parameters
wifi_event_handler_cb_t
cb : callback function
Returns
true : succeed
false : fail
4.11.4.13
Set the IP address of the ESP8266 WiFi station or the soft-AP interface.
Attention
1. Users need to enable the target interface (station or soft-AP) by wifi_set_opmode first.
2. To set static IP, users need to disable DHCP first (wifi_station_dhcpc_stop or wifi_softap_dhcps_stop):
If the DHCP is enabled, the static IP will be disabled; if the static IP is enabled, the DHCP will be disabled.
It depends on the latest configuration.
Parameters
WIFI_INTERFACE
struct
if_index : get the IP address of the station or the soft-AP interface, 0x00 for STATION_IF,
0x01 for SOFTAP_IF.
ip_info info : the IP information obtained.
Returns
true : succeed
false : fail
4.11.4.14
Set MAC address of the ESP8266 WiFi station or the soft-AP interface.
Attention
1. This API can only be called in user_init.
2. Users need to enable the target interface (station or soft-AP) by wifi_set_opmode first.
3. ESP8266 soft-AP and station have different MAC addresses, do not set them to be the same.
The bit0 of the first byte of ESP8266 MAC address can not be 1. For example, the MAC address can set
to be "1a:XX:XX:XX:XX:XX", but can not be "15:XX:XX:XX:XX:XX".
Parameters
WIFI_INTERFACE
uint8
if_index : get the IP address of the station or the soft-AP interface, 0x00 for STATION_IF,
0x01 for SOFTAP_IF.
macaddr : the MAC address.
Returns
true : succeed
false : fail
58
Module Documentation
4.11.4.15
Returns
true : succeed
false : fail
4.11.4.16
Set the WiFi operating mode, and will not save it to Flash.
Set the WiFi operating mode as station, soft-AP or station+soft-AP, and the mode won't be saved to the Flash.
Parameters
uint8
Returns
true : succeed
false : fail
4.11.4.17
59
Parameters
WIFI_PHY_MODE
Returns
true : succeed
false : fail
4.11.4.18
Returns
true : succeed
false : fail
4.11.4.19
gpio_id : GPIO ID
gpio_name : GPIO mux name
gpio_func : GPIO function
Returns
null
4.11.4.20
4.11.4.21
60
Module Documentation
Parameters
null
Returns
null
4.11.4.22
Returns
null
4.12
61
Typedefs
typedef void( fpm_wakeup_cb) (void)
Functions
void wifi_fpm_open (void)
Enable force sleep function.
4.12.1
Detailed Description
4.12.2
Function Documentation
4.12.2.1
4.12.2.2
Force ESP8266 enter sleep mode, and it will wake up automatically when time out.
Attention
1. This API can only be called when force sleep function is enabled, after calling wifi_fpm_open. This API can
not be called after calling wifi_fpm_close.
2. If this API returned 0 means that the configuration is set successfully, but the ESP8266 will not enter sleep
mode immediately, it is going to sleep in the system idle task. Please do not call other WiFi related function
right after calling this API.
62
Module Documentation
Parameters
uint32
sleep_time_in_us : sleep time, ESP8266 will wake up automatically when time out. Unit: us.
Range: 10000 268435455(0xFFFFFFF).
If sleep_time_in_us is 0xFFFFFFF, the ESP8266 will sleep till
if wifi_fpm_set_sleep_type is set to be LIGHT_SLEEP_T, ESP8266 can wake up by
GPIO.
if wifi_fpm_set_sleep_type is set to be MODEM_SLEEP_T, ESP8266 can wake up by
wifi_fpm_do_wakeup.
Returns
0, setting succeed;
-1, fail to sleep, sleep status error;
-2, fail to sleep, force sleep function is not enabled.
4.12.2.3
Returns
null
4.12.2.4
Returns
sleep type
4.12.2.5
63
Parameters
null
Returns
null
4.12.2.6
Returns
null
4.12.2.7
Returns
null
64
Module Documentation
4.13
Macros
Enumerations
enum FIXED_RATE {
PHY_RATE_48 = 0x8, PHY_RATE_24 = 0x9, PHY_RATE_12 = 0xA, PHY_RATE_6 = 0xB,
PHY_RATE_54 = 0xC, PHY_RATE_36 = 0xD, PHY_RATE_18 = 0xE, PHY_RATE_9 = 0xF }
enum support_rate {
RATE_11B5M = 0, RATE_11B11M = 1, RATE_11B1M = 2, RATE_11B2M = 3,
RATE_11G6M = 4, RATE_11G12M = 5, RATE_11G24M = 6, RATE_11G48M = 7,
RATE_11G54M = 8, RATE_11G9M = 9, RATE_11G18M = 10, RATE_11G36M = 11 }
enum RATE_11B_ID { RATE_11B_B11M = 0, RATE_11B_B5M = 1, RATE_11B_B2M = 2, RATE_11B_B1M = 3 }
enum RATE_11G_ID {
RATE_11G_G54M = 0, RATE_11G_G48M = 1, RATE_11G_G36M = 2, RATE_11G_G24M = 3,
RATE_11G_G18M = 4, RATE_11G_G12M = 5, RATE_11G_G9M = 6, RATE_11G_G6M = 7,
RATE_11G_B5M = 8, RATE_11G_B2M = 9, RATE_11G_B1M = 10 }
enum RATE_11N_ID {
RATE_11N_MCS7S = 0, RATE_11N_MCS7 = 1, RATE_11N_MCS6 = 2, RATE_11N_MCS5 = 3,
RATE_11N_MCS4 = 4, RATE_11N_MCS3 = 5, RATE_11N_MCS2 = 6, RATE_11N_MCS1 = 7,
RATE_11N_MCS0 = 8, RATE_11N_B5M = 9, RATE_11N_B2M = 10, RATE_11N_B1M = 11 }
Functions
sint32 wifi_set_user_fixed_rate (uint8 enable_mask, uint8 rate)
Set the fixed rate and mask of sending data from ESP8266.
bool wifi_set_user_rate_limit (uint8 mode, uint8 ifidx, uint8 max, uint8 min)
Limit the initial rate of sending data from ESP8266.
4.13.1
65
Detailed Description
4.13.2
Function Documentation
4.13.2.1
Returns
0 : succeed
otherwise : fail
4.13.2.2
Get the interfaces of ESP8266 whose rate of sending data is limited by wifi_set_user_rate_limit.
Parameters
null
Returns
LIMIT_RATE_MASK_NONE - disable the limitation on both ESP8266 station and soft-AP
LIMIT_RATE_MASK_STA - enable the limitation on ESP8266 station
LIMIT_RATE_MASK_AP - enable the limitation on ESP8266 soft-AP
LIMIT_RATE_MASK_ALL - enable the limitation on both ESP8266 station and soft-AP
4.13.2.3
Set the fixed rate and mask of sending data from ESP8266.
Attention
1. Only if the corresponding bit in enable_mask is 1, ESP8266 station or soft-AP will send data in the fixed
rate.
2. If the enable_mask is 0, both ESP8266 station and soft-AP will not send data in the fixed rate.
3. ESP8266 station and soft-AP share the same rate, they can not be set into the different rate.
Parameters
uint8
uint8
66
Module Documentation
Returns
0 : succeed
otherwise : fail
4.13.2.4
Set the interfaces of ESP8266 whose rate of sending packets is limited by wifi_set_user_rate_limit.
Parameters
uint8
enable_mask :
LIMIT_RATE_MASK_NONE - disable the limitation on both ESP8266 station and softAP
LIMIT_RATE_MASK_STA - enable the limitation on ESP8266 station
LIMIT_RATE_MASK_AP - enable the limitation on ESP8266 soft-AP
LIMIT_RATE_MASK_ALL - enable the limitation on both ESP8266 station and soft-AP
Returns
true : succeed
false : fail
4.13.2.5
bool wifi_set_user_rate_limit ( uint8 mode, uint8 ifidx, uint8 max, uint8 min )
uint8
67
max : the maximum value of the rate, according to the enum rate corresponding to the first
parameter mode.
min : the minimum value of the rate, according to the enum rate corresponding to the first
parameter mode.
Returns
0 : succeed
otherwise : fail
4.13.2.6
min : the minimum value of the support rate, according to enum support_rate.
max : the maximum value of the support rate, according to enum support_rate.
Returns
0 : succeed
otherwise : fail
68
Module Documentation
4.14
User IE APIs
Typedefs
typedef void( user_ie_manufacturer_recv_cb_t) (user_ie_type type, const uint8 sa[6], const uint8 m_oui[3],
uint8 ie, uint8 ie_len, sint32 rssi)
User IE received callback.
Enumerations
enum user_ie_type {
USER_IE_BEACON = 0, USER_IE_PROBE_REQ, USER_IE_PROBE_RESP, USER_IE_ASSOC_REQ,
USER_IE_ASSOC_RESP, USER_IE_MAX }
Functions
bool wifi_set_user_ie (bool enable, uint8 m_oui, user_ie_type type, uint8 user_ie, uint8 len)
Set user IE of ESP8266.
4.14.1
Detailed Description
4.14.2
Typedef Documentation
4.14.2.1
typedef void( user_ie_manufacturer_recv_cb_t) (user_ie_type type, const uint8 sa[6], const uint8 m_oui[3], uint8 ie,
uint8 ie_len, sint32 rssi)
Returns
null
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
4.14.3
Function Documentation
4.14.3.1
69
70
Module Documentation
Parameters
user_ie_manufacturer_recv_cb_t
cb : callback
Returns
0 : succeed
-1 : fail
4.14.3.2
bool wifi_set_user_ie ( bool enable, uint8 m_oui, user_ie_type type, uint8 user_ie, uint8 len )
enable :
true, enable the corresponding user IE function, all parameters below have to be set.
false, disable the corresponding user IE function and release the resource, only the
parameter "type" below has to be set.
uint8
user_ie_type
uint8
uint8
Returns
true : succeed
false : fail
4.14.3.3
Returns
null
4.15
71
Sniffer APIs
Typedefs
typedef void( wifi_promiscuous_cb_t) (uint8 buf, uint16 len)
The RX callback function in the promiscuous mode.
Functions
void wifi_set_promiscuous_rx_cb (wifi_promiscuous_cb_t cb)
Register the RX callback function in the promiscuous mode.
4.15.1
Detailed Description
4.15.2
Typedef Documentation
4.15.2.1
Returns
null
4.15.3
Function Documentation
4.15.3.1
72
Module Documentation
Parameters
null
Returns
channel number
4.15.3.2
promiscuous :
0: to disable the promiscuous mode
1: to enable the promiscuous mode
Returns
null
4.15.3.3
Returns
true : succeed
false : fail
4.15.3.4
73
Parameters
uint8
Returns
true : succeed
false : fail
4.15.3.5
cb : callback
Returns
null
74
Module Documentation
4.16
WPS APIs
Typedefs
typedef enum wps_type WPS_TYPE_t
typedef void( wps_st_cb_t) (int status)
WPS callback.
Enumerations
enum wps_type {
WPS_TYPE_DISABLE = 0, WPS_TYPE_PBC, WPS_TYPE_PIN, WPS_TYPE_DISPLAY,
WPS_TYPE_MAX }
enum wps_cb_status {
WPS_CB_ST_SUCCESS = 0, WPS_CB_ST_FAILED, WPS_CB_ST_TIMEOUT, WPS_CB_ST_WEP,
WPS_CB_ST_SCAN_ERR }
Functions
bool wifi_wps_enable (WPS_TYPE_t wps_type)
Enable Wi-Fi WPS function.
4.16.1
Detailed Description
4.16.2
Typedef Documentation
4.16.2.1
WPS callback.
Parameters
int
75
Returns
null
4.16.3
4.16.3.1
enum wps_cb_status
Enumerator
WPS_CB_ST_SUCCESS WPS succeed
WPS_CB_ST_FAILED WPS fail
WPS_CB_ST_TIMEOUT WPS timeout, fail
WPS_CB_ST_WEP WPS failed because that WEP is not supported
WPS_CB_ST_SCAN_ERR can not find the target WPS AP
4.16.4
Function Documentation
4.16.4.1
cb : callback.
Returns
true : WPS starts to work successfully, but does not mean WPS succeed.
false : fail
4.16.4.2
Returns
true : succeed
false : fail
4.16.4.3
76
Module Documentation
Parameters
WPS_TYPE_t
Returns
true : succeed
false : fail
4.16.4.4
Returns
true : WPS starts to work successfully, but does not mean WPS succeed.
false : fail
4.17
77
Data Structures
struct _esp_tcp
struct _esp_udp
struct _remot_info
struct espconn
Macros
#define ESPCONN_OK 0
#define ESPCONN_MEM -1
#define ESPCONN_TIMEOUT -3
#define ESPCONN_RTE -4
#define ESPCONN_INPROGRESS -5
#define ESPCONN_MAXNUM -7
#define ESPCONN_ABRT -8
#define ESPCONN_RST -9
#define ESPCONN_CLSD -10
#define ESPCONN_CONN -11
#define ESPCONN_ARG -12
#define ESPCONN_IF -14
#define ESPCONN_ISCONN -15
Typedefs
typedef void( espconn_connect_callback) (void arg)
Connect callback.
Enumerations
enum espconn_type { ESPCONN_INVALID = 0, ESPCONN_TCP = 0x10, ESPCONN_UDP = 0x20 }
enum espconn_state {
ESPCONN_NONE, ESPCONN_WAIT, ESPCONN_LISTEN, ESPCONN_CONNECT,
ESPCONN_WRITE, ESPCONN_READ, ESPCONN_CLOSE }
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 }
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
78
Module Documentation
Functions
void espconn_init (void)
espconn initialization.
79
err_t espconn_gethostbyname (struct espconn pespconn, const char hostname, ip_addr_t addr, dns_found_callback found)
DNS function.
4.17.1
Detailed Description
4.17.2
4.17.2.1
#define ESPCONN_ABRT -8
Connection aborted.
4.17.2.2
Illegal argument.
4.17.2.3
Connection closed.
4.17.2.4
Not connected.
4.17.2.5
4.17.2.6
#define ESPCONN_INPROGRESS -5
Operation in progress.
4.17.2.7
Already connected.
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
80
Module Documentation
4.17.2.8
#define ESPCONN_MAXNUM -7
4.17.2.9
#define ESPCONN_MEM -1
Out of memory.
4.17.2.10
#define ESPCONN_OK 0
4.17.2.11
#define ESPCONN_RST -9
Connection reset.
4.17.2.12
#define ESPCONN_RTE -4
Routing problem.
4.17.2.13
#define ESPCONN_TIMEOUT -3
Timeout.
4.17.3
Typedef Documentation
4.17.3.1
typedef void( dns_found_callback) (const char name, ip_addr_t ipaddr, void callback_arg)
Returns
null
4.17.3.2
Connect callback.
Callback which will be called if successful listening (ESP8266 as TCP server) or connection (ESP8266 as TCP
client) callback, register by espconn_regist_connectcb.
Attention
The pointer "void arg" may be different in different callbacks, please don't use this pointer directly to distinguish one from another in multiple connections, use remote_ip and remote_port in espconn instead.
81
Parameters
void
Returns
null
4.17.3.3
Reconnect callback.
Enter this callback when error occurred, TCP connection broke. This callback is registered by espconn_regist_reconcb.
Attention
The pointer "void arg" may be different in different callbacks, please don't use this pointer directly to distinguish one from another in multiple connections, use remote_ip and remote_port in espconn instead.
Parameters
void
sint8
Returns
null
4.17.3.4
typedef void( espconn_recv_callback) (void arg, char pdata, unsigned short len)
4.17.4
4.17.4.1
enum espconn_level
Enumerator
ESPCONN_KEEPIDLE TCP keep-alive interval, unit : second.
ESPCONN_KEEPINTVL packet interval during TCP keep-alive, unit : second.
ESPCONN_KEEPCNT maximum packet retry count of TCP keep-alive.
82
Module Documentation
4.17.4.2
enum espconn_option
Enumerator
ESPCONN_START no option, start enum.
ESPCONN_REUSEADDR free memory after TCP disconnection happen, need not wait 2 minutes.
ESPCONN_NODELAY disable nagle algorithm during TCP data transmission, quicken the data transmission.
ESPCONN_COPY enable espconn_regist_write_finish, enter write_finish_callback means that the data
espconn_send sending was written into 2920 bytes write-buffer waiting for sending or already sent.
ESPCONN_KEEPALIVE enable TCP keep alive.
ESPCONN_END no option, end enum.
4.17.4.3
enum espconn_state
4.17.4.4
enum espconn_type
4.17.5
Function Documentation
4.17.5.1
Returns
0 : succeed
Non-0 : error code
ESPCONN_MEM - Out of memory
ESPCONN_ISCONN - Already connected
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.2
83
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.3
espconn espconn : the network connection structure, the espconn to listen to the connection
Returns
0 : succeed
Non-0 : error code
ESPCONN_RTE - Routing Problem
ESPCONN_MEM - Out of memory
ESPCONN_ISCONN - Already connected
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.4
Returns
0 : succeed
Non-0 : error code
ESPCONN_MEM - Out of memory
ESPCONN_ISCONN - Already connected
ESPCONN_ARG - illegal argument, can't find the corresponding UDP transmission according to structure espconn
84
Module Documentation
4.17.5.5
Delete a transmission.
Attention
Corresponding creation API :
TCP: espconn_accept,
UDP: espconn_create
Parameters
struct
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding network according to structure espconn
ESPCONN_INPROGRESS - the connection is still in progress, please call espconn_disconnect to disconnect before delete it.
4.17.5.6
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.7
85
Returns
null
4.17.5.8
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding transmission according to structure
espconn
4.17.5.9
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.10
err_t espconn_gethostbyname ( struct espconn pespconn, const char hostname, ip_addr_t addr,
dns_found_callback found )
DNS function.
Parse a hostname (string) to an IP address.
Parameters
struct
86
Module Documentation
const
ip_addr_t
dns_found_callback
Returns
err_t :
ESPCONN_OK - succeed
ESPCONN_INPROGRESS - error code : already connected
ESPCONN_ARG - error code : illegal argument, can't find network transmission according to structure
espconn
4.17.5.11
Returns
0 : succeed
Non-0 : error code
ESPCONN_MEM - Out of memory
4.17.5.12
Returns
0 : succeed
Non-0 : error code
ESPCONN_MEM - Out of memory
4.17.5.13
87
espconn initialization.
Attention
Please call this API in user_init, if you need to use espconn functions.
Parameters
null
Returns
null
4.17.5.14
Returns
Port number.
4.17.5.15
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn.
4.17.5.16
88
Module Documentation
Parameters
struct
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn.
4.17.5.17
Register connection function which will be called back under successful TCP connection.
Parameters
struct
espconn_connect_callback
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.18
Register disconnection function which will be called back under successful TCP disconnection.
Parameters
struct
espconn_connect_callback
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.19
89
Parameters
struct
espconn_reconnect_callback
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.20
register data receive function which will be called back when data are received.
Parameters
struct
espconn_recv_callback
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.21
Register data sent callback which will be called back when data are successfully sent.
Parameters
struct
espconn_sent_callback
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding transmission according to structure
espconn
4.17.5.22
90
Module Documentation
Parameters
struct
uint32
uint8
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.23
Register a callback which will be called when all sending TCP data is completely write into write-buffer or sent.
Need to call espconn_set_opt to enable write-buffer first.
Attention
1. write-buffer is used to keep TCP data that waiting to be sent, queue number of the write-buffer is 8 which
means that it can keep 8 packets at most. The size of write-buffer is 2920 bytes.
2. Users can enable it by using espconn_set_opt.
3. Users can call espconn_send to send the next packet in write_finish_callback instead of using espconn_sent_callback.
Parameters
struct
espconn_connect_callback
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.24
91
Parameters
struct
uint8
uint16
Returns
0 : succeed
Non-0 : error code
ESPCONN_MEM - Out of memory
ESPCONN_ARG - illegal argument, can't find the corresponding network transmission according to
structure espconn
ESPCONN_MAXNUM - buffer of sending data is full
ESPCONN_IF - send UDP data fail
4.17.5.25
Returns
0 : succeed
Non-0 : error code
ESPCONN_MEM - Out of memory
ESPCONN_MAXNUM - buffer of sending data is full
ESPCONN_IF - send UDP data fail
4.17.5.26
92
Module Documentation
uint16
Returns
0 : succeed
Non-0 : error code
ESPCONN_MEM - Out of memory
ESPCONN_ARG - illegal argument, can't find the corresponding network transmission according to
structure espconn
ESPCONN_MAXNUM - buffer of sending data is full
ESPCONN_IF - send UDP data fail
4.17.5.27
Parameters
struct
uint8
void
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.28
93
Attention
In general, we need not call this API. If call espconn_set_opt, please call it in espconn_connect_callback.
Parameters
struct
uint8
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.29
Returns
Maximum number of how many TCP connections are allowed.
4.17.5.30
Get the maximum number of TCP clients which are allowed to connect to ESP8266 TCP server.
Parameters
struct
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.31
94
Module Documentation
Parameters
uint8
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.17.5.32
Set the maximum number of TCP clients allowed to connect to ESP8266 TCP server.
Parameters
struct
uint8
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.18
95
ESP-NOW APIs
ESP-NOW APIs.
Typedefs
typedef void( esp_now_recv_cb_t) (uint8 mac_addr, uint8 data, uint8 len)
ESP-NOW send callback.
Enumerations
enum esp_now_role { ESP_NOW_ROLE_IDLE = 0, ESP_NOW_ROLE_CONTROLLER, ESP_NOW_ROLE_SLAVE, ESP_NOW_ROLE_MAX }
Functions
sint32 esp_now_init (void)
ESP-NOW initialization.
sint32 esp_now_add_peer (uint8 mac_addr, uint8 role, uint8 channel, uint8 key, uint8 key_len)
Add an ESP-NOW peer, store MAC address of target device into ESP-NOW MAC list.
96
Module Documentation
sint32 esp_now_get_peer_key (uint8 mac_addr, uint8 key, uint8 key_len)
Get ESP-NOW key of a target device.
4.18.1
Detailed Description
ESP-NOW APIs.
Attention
1. ESP-NOW do not support broadcast and multicast.
2. ESP-NOW is targeted to Smart-Light project, so it is suggested that slave role corresponding to soft-AP or
soft-AP+station mode, controller role corresponding to station mode.
3. When ESP8266 is in soft-AP+station mode, it will communicate through station interface if it is in slave role,
and communicate through soft-AP interface if it is in controller role.
4. ESP-NOW can not wake ESP8266 up from sleep, so if the target ESP8266 station is in sleep, ESP-NOW
communication will fail.
5. In station mode, ESP8266 supports 10 encrypt ESP-NOW peers at most, with the unencrypted peers, it
can be 20 peers in total at most.
6. In the soft-AP mode or soft-AP + station mode, the ESP8266 supports 6 encrypt ESP-NOW peers at most,
with the unencrypted peers, it can be 20 peers in total at most.
4.18.2
Typedef Documentation
4.18.2.1
Returns
null
4.18.2.2
97
Attention
The status will be OK, if ESP-NOW send packet successfully. But users need to make sure by themselves
that key of communication is correct.
98
Module Documentation
Parameters
uint8
uint8
Returns
null
4.18.3
Function Documentation
4.18.3.1
sint32 esp_now_add_peer ( uint8 mac_addr, uint8 role, uint8 channel, uint8 key, uint8 key_len )
Add an ESP-NOW peer, store MAC address of target device into ESP-NOW MAC list.
Parameters
uint8
uint8
uint8
uint8
uint8
Returns
0 : succeed
Non-0 : fail
4.18.3.2
Deinitialize ESP-NOW.
Parameters
null
Returns
0 : succeed
Non-0 : fail
4.18.3.3
Delete an ESP-NOW peer, delete MAC address of the device from ESP-NOW MAC list.
Parameters
u8
Returns
0 : succeed
Non-0 : fail
4.18.3.4
99
restart : true, move pointer to the first one in ESP-NOW MAC list; false, move pointer to the
next one in ESP-NOW MAC list
Returns
NULL, no ESP-NOW devices exist
Otherwise, MAC address of ESP-NOW device which is pointed now
4.18.3.5
Get the total number of ESP-NOW devices which are associated, and the number count of encrypted devices.
Parameters
uint8
uint8
Returns
0 : succeed
Non-0 : fail
4.18.3.6
Returns
1 13 (some area may get 14) : channel number
Non-0 : fail
4.18.3.7
100
Module Documentation
Parameters
uint8
uint8
uint8
Returns
0 : succeed
> 0 : find target device but can't get key
< 0 : fail
4.18.3.8
Returns
ESP_NOW_ROLE_CONTROLLER, role type : controller
ESP_NOW_ROLE_SLAVE, role type : slave
otherwise : fail
4.18.3.9
Returns
0 : succeed
Non-0 : fail
4.18.3.10
ESP-NOW initialization.
Parameters
null
Returns
0 : succeed
Non-0 : fail
4.18.3.11
101
Parameters
uint8
Returns
0 : device does not exist
< 0 : error occur, check fail
> 0 : device exists
4.18.3.12
cb : receive callback
Returns
0 : succeed
Non-0 : fail
4.18.3.13
cb : send callback
Returns
0 : succeed
Non-0 : fail
4.18.3.14
da : destination MAC address. If it's NULL, send packet to all MAC addresses recorded by
uint8
uint8
Returns
0 : succeed
Non-0 : fail
102
4.18.3.15
Module Documentation
sint32 esp_now_set_kok ( uint8 key, uint8 len )
103
Parameters
uint8
uint8
Returns
0 : succeed
Non-0 : fail
4.18.3.16
Returns
0 : succeed
Non-0 : fail
4.18.3.17
uint8
Returns
0 : succeed
Non-0 : fail
4.18.3.18
Set ESP-NOW role for a target device. If it is set multiple times, new role will cover the old one.
104
Module Documentation
Parameters
uint8
uint8
Returns
0 : succeed
Non-0 : fail
4.18.3.19
Returns
0 : succeed
Non-0 : fail
4.18.3.20
Returns
0 : succeed
Non-0 : fail
4.18.3.21
Returns
0 : succeed
Non-0 : fail
4.19
Mesh APIs
Mesh APIs.
Enumerations
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 }
Functions
bool espconn_mesh_local_addr (struct ip_addr ip)
Check whether the IP address is mesh local IP address or not.
sint8 espconn_mesh_get_status ()
Get current mesh status.
uint8 espconn_mesh_get_max_hops ()
Get max hop of mesh network.
void espconn_mesh_init ()
To print version of mesh.
4.19.1
Detailed Description
Mesh APIs.
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
105
106
Module Documentation
4.19.2
4.19.2.1
enum mesh_node_type
Enumerator
MESH_NODE_PARENT get information of parent node
MESH_NODE_CHILD get information of child node(s)
MESH_NODE_ALL get information of all nodes
4.19.2.2
enum mesh_status
Enumerator
MESH_DISABLE mesh disabled
MESH_WIFI_CONN WiFi connected
MESH_NET_CONN TCP connection OK
MESH_LOCAL_AVAIL local mesh is avaliable
MESH_ONLINE_AVAIL online mesh is avaliable
4.19.3
Function Documentation
4.19.3.1
espconn usr_esp : the network connection structure, the usr_esp to listen to the connection
Returns
0 : succeed
Non-0 : error code
ESPCONN_RTE - Routing Problem
ESPCONN_MEM - Out of memory
ESPCONN_ISCONN - Already connected
ESPCONN_ARG - Illegal argument, can't find the corresponding connection according to structure espconn
4.19.3.2
107
Parameters
espconn_mesh_callback
enum
Returns
null
4.19.3.3
Returns
0 : succeed
Non-0 : error code
ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to structure
espconn
4.19.3.4
Returns
null
4.19.3.5
108
Module Documentation
Parameters
AUTH_MODE
uint8_t
uint8_t
Returns
true : succeed
false : fail
4.19.3.6
uint8 espconn_mesh_get_max_hops ( )
4.19.3.7
Returns
true : succeed
false : fail
4.19.3.8
sint8 espconn_mesh_get_status ( )
4.19.3.9
109
Parameters
uint8_t
uint16_t
Returns
true : succeed
false : fail
4.19.3.10
void espconn_mesh_init ( )
Returns
null
4.19.3.11
ip_addr ip : IP address
Returns
true : the IP address is mesh local IP address
false : the IP address is not mesh local IP address
4.19.3.12
110
Module Documentation
uint8
uint16
Returns
0 : succeed
Non-0 : error code
ESPCONN_MEM - out of memory
ESPCONN_ARG - illegal argument, can't find the corresponding network transmission according to
structure espconn
ESPCONN_MAXNUM - buffer of sending data is full
ESPCONN_IF - send UDP data fail
4.19.3.13
Returns
true : succeed
false : fail
4.19.3.14
max_hops : max hop of mesh network (1 <= max_hops < 10, 4 is recommended).
Returns
true : succeed
false : fail
4.19.3.15
111
Parameters
uint8_t
uint8_t
Returns
true : succeed
false : fail
112
Module Documentation
4.20
Driver APIs
Driver APIs.
Modules
PWM Driver APIs
PWM driver APIs.
4.20.1
Detailed Description
Driver APIs.
4.21
Data Structures
struct pwm_param
Macros
#define PWM_DEPTH 1023
Functions
void pwm_init (uint32 period, uint32 duty, uint32 pwm_channel_num, uint32(pin_info_list)[3])
PWM function initialization, including GPIO, frequency and duty cycle.
4.21.1
Detailed Description
4.21.2
Function Documentation
4.21.2.1
Returns
Duty cycle of PWM output.
4.21.2.2
113
114
Module Documentation
Parameters
null
Returns
PWM period, unit : us.
4.21.2.3
void pwm_init ( uint32 period, uint32 duty, uint32 pwm_channel_num, uint32() pin_info_list[3] )
Returns
null
4.21.2.4
Returns
null
4.21.2.5
Returns
null
4.21.2.6
Starts PWM.
Attention
This function needs to be called after PWM configuration is changed.
Parameters
null
Returns
null
115
116
Module Documentation
4.22
Smartconfig APIs
SmartConfig APIs.
Typedefs
typedef void( sc_callback_t) (sc_status status, void pdata)
The callback of SmartConfig, executed when smart-config status changed.
Enumerations
enum sc_status {
SC_STATUS_WAIT = 0, SC_STATUS_FIND_CHANNEL, SC_STATUS_GETTING_SSID_PSWD, SC_STATUS_LINK,
SC_STATUS_LINK_OVER }
enum sc_type { SC_TYPE_ESPTOUCH = 0, SC_TYPE_AIRKISS, SC_TYPE_ESPTOUCH_AIRKISS }
Functions
const char smartconfig_get_version (void)
Get the version of SmartConfig.
4.22.1
Detailed Description
SmartConfig APIs.
SmartConfig can only be enabled in station only mode. Please make sure the target AP is enabled before enable
SmartConfig.
4.22.2
Typedef Documentation
4.22.2.1
117
Parameters
sc_status
void
Returns
null
4.22.3
4.22.3.1
enum sc_status
Enumerator
SC_STATUS_WAIT waiting, do not start connection in this phase
SC_STATUS_FIND_CHANNEL find target channel, start connection by APP in this phase
SC_STATUS_GETTING_SSID_PSWD getting SSID and password of target AP
SC_STATUS_LINK connecting to target AP
SC_STATUS_LINK_OVER got IP, connect to AP successfully
4.22.3.2
enum sc_type
Enumerator
SC_TYPE_ESPTOUCH protocol: ESPTouch
SC_TYPE_AIRKISS protocol: AirKiss
SC_TYPE_ESPTOUCH_AIRKISS protocol: ESPTouch and AirKiss
4.22.4
Function Documentation
4.22.4.1
118
Module Documentation
Parameters
uint8
Returns
true : succeed
false : fail
4.22.4.2
Returns
SmartConfig version
4.22.4.3
Returns
true : succeed
false : fail
4.22.4.4
119
Parameters
sc_callback_t
uint8
Returns
true : succeed
false : fail
4.22.4.5
Returns
true : succeed
false : fail
120
Module Documentation
4.23
Data Structures
struct SpiFlashChip
Macros
#define SPI_FLASH_SEC_SIZE 4096
Typedefs
typedef SpiFlashOpResult( user_spi_flash_read) (SpiFlashChip spi, uint32 src_addr, uint32 des_addr,
uint32 size)
Registered function for spi_flash_set_read_func.
Enumerations
enum SpiFlashOpResult { SPI_FLASH_RESULT_OK, SPI_FLASH_RESULT_ERR, SPI_FLASH_RESULT_TIMEOUT }
Functions
uint32 spi_flash_get_id (void)
Get ID info of SPI Flash.
4.23.1
Detailed Description
4.23.2
4.23.2.1
121
4.23.3
Typedef Documentation
4.23.3.1
typedef SpiFlashOpResult( user_spi_flash_read) (SpiFlashChip spi, uint32 src_addr, uint32 des_addr, uint32
size)
Returns
SpiFlashOpResult
4.23.4
4.23.4.1
enum SpiFlashOpResult
Enumerator
SPI_FLASH_RESULT_OK SPI Flash operating OK
SPI_FLASH_RESULT_ERR SPI Flash operating fail
SPI_FLASH_RESULT_TIMEOUT SPI Flash operating time out
4.23.5
Function Documentation
sec : Sector number, the count starts at sector 0, 4KB per sector.
Returns
SpiFlashOpResult
4.23.5.2
Returns
SPI Flash ID
122
Module Documentation
123
Parameters
uint32
uint32
uint32
Returns
SpiFlashOpResult
Returns
SpiFlashOpResult
4.23.5.5
Returns
none
Returns
SpiFlashOpResult
124
Module Documentation
Parameters
uint32
Returns
SpiFlashOpResult
4.24
Upgrade APIs
Data Structures
struct upgrade_server_info
Macros
#define SPI_FLASH_SEC_SIZE 4096
#define USER_BIN1 0x00
#define USER_BIN2 0x01
#define UPGRADE_FLAG_IDLE 0x00
#define UPGRADE_FLAG_START 0x01
#define UPGRADE_FLAG_FINISH 0x02
#define UPGRADE_FW_BIN1 0x00
#define UPGRADE_FW_BIN2 0x01
Typedefs
typedef void( upgrade_states_check_callback) (void arg)
Callback of upgrading firmware through WiFi.
Functions
uint8 system_upgrade_userbin_check (void)
Check the user bin.
uint8 system_upgrade_flag_check ()
Check the upgrade status flag.
void system_upgrade_init ()
Upgrade function initialization.
void system_upgrade_deinit ()
Upgrade function de-initialization.
4.24.1
Detailed Description
125
126
Module Documentation
4.24.2
4.24.2.1
4.24.2.2
4.24.2.3
4.24.2.4
4.24.2.5
firmware, user1.bin
4.24.2.6
firmware, user2.bin
4.24.2.7
firmware, user1.bin
4.24.2.8
firmware, user2.bin
4.24.3
Typedef Documentation
4.24.3.1
Returns
null
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
4.24.4
Function Documentation
4.24.4.1
127
128
Module Documentation
Parameters
uint8
uint32
Returns
null
4.24.4.2
void system_upgrade_deinit ( )
Returns
null
4.24.4.3
uint8 system_upgrade_flag_check ( )
Returns
#define UPGRADE_FLAG_IDLE 0x00
#define UPGRADE_FLAG_START 0x01
#define UPGRADE_FLAG_FINISH 0x02
4.24.4.4
flag:
UPGRADE_FLAG_IDLE 0x00
UPGRADE_FLAG_START 0x01
UPGRADE_FLAG_FINISH 0x02
Returns
null
4.24.4.5
void system_upgrade_init ( )
129
130
Module Documentation
Parameters
null
Returns
null
4.24.4.6
Returns
null
4.24.4.7
Returns
true : succeed
false : fail
4.24.4.8
Returns
0x00 : UPGRADE_FW_BIN1, i.e. user1.bin
0x01 : UPGRADE_FW_BIN2, i.e. user2.bin
4.25
131
GPIO APIs.
Macros
#define GPIO_OUTPUT_SET(gpio_no, bit_value)
value)&0x01)<<gpio_no, 1<<gpio_no, 0)
gpio_output_conf(bit_value<<gpio_no,
((bit_-
Functions
void gpio16_output_conf (void)
Enable GPIO16 output.
void gpio_output_conf (uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
Configure Gpio pins out or input.
void gpio_pin_wakeup_disable ()
Disable GPIO wake up to light sleep.
4.25.1
Detailed Description
GPIO APIs.
4.25.2
4.25.2.1
132
Module Documentation
Parameters
gpio_bits
Returns
null
4.25.2.2
Returns
null
4.25.2.3
Returns
null
4.25.2.4
Returns
the level of GPIO input
4.25.2.5
Value:
if(bit_value) gpio_output_conf(gpio_bits, 0, gpio_bits, 0);\
else gpio_output_conf(0, gpio_bits, gpio_bits, 0)
Returns
null
4.25.2.6
Returns
null
4.25.3
Function Documentation
4.25.3.1
Returns
null
4.25.3.2
Returns
the level of GPIO16 input.
4.25.3.3
133
134
Module Documentation
Parameters
null
Returns
null
4.25.3.4
Returns
null
4.25.3.5
Returns
bitmask of GPIO pins input
4.25.3.6
Returns
null
4.25.3.7
void gpio_output_conf ( uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask )
set_mask : Set the output for the high bit, the corresponding bit is 1, the output of high, the
corresponding bit is 0, do not change the state.
set_mask : Set the output for the high bit, the corresponding bit is 1, the output of low, the
corresponding bit is 0, do not change the state.
enable_mask : Enable Output
disable_mask : Enable Input
Returns
null
4.25.3.8
Returns
null
4.25.3.9
void gpio_pin_wakeup_disable ( )
Returns
null
4.25.3.10
135
Returns
null
136
Module Documentation
4.26
Functions
void hw_timer_init (uint8 req)
Initialize the hardware ISR timer.
4.26.1
Detailed Description
4.26.2
Function Documentation
4.26.2.1
val : Timing
In autoload mode, range : 50 0x7fffff
In non-autoload mode, range : 10 0x7fffff
Returns
null
4.26.2.2
Returns
null
4.26.2.3
val : Timing
In autoload mode, range : 50 0x7fffff
In non-autoload mode, range : 10 0x7fffff
Returns
null
137
138
Module Documentation
4.27
Functions
void UART_WaitTxFifoEmpty (UART_Port uart_no)
Wait uart tx fifo empty, do not use it if tx flow control enabled.
4.27.1
Detailed Description
4.27.2
Function Documentation
4.27.2.1
Returns
null
4.27.2.2
Returns
null
4.27.2.3
Returns
null
4.27.2.4
Returns
null
4.27.2.5
139
140
Module Documentation
Parameters
UART_Port
UART_ConfigTypeDef
Returns
null
4.27.2.6
Returns
null
4.27.2.7
Returns
null
4.27.2.8
Returns
null
4.27.2.9
Returns
null
4.27.2.10
Returns
null
4.27.2.11
Returns
null
4.27.2.12
Returns
null
4.27.2.13
141
142
Module Documentation
Parameters
UART_Port
UART_StopBits
Returns
null
4.27.2.14
Returns
null
4.27.2.15
uart_no:UART0 or UART1
Returns
null
Chapter 5
Data Fields
SYSTEM_EVENT event_id
Event_Info_u event_info
5.1.1
Field Documentation
5.2
Data Fields
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
144
5.2.1
Field Documentation
5.2.1.3
uint8 local_ip[4]
local IP of ESP8266
5.2.1.4
int local_port
5.2.1.6
uint8 remote_ip[4]
5.2.1.7
int remote_port
5.3
Data Fields
int remote_port
int local_port
uint8 local_ip [4]
uint8 remote_ip [4]
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
5.3.1
Field Documentation
5.3.1.1
uint8 local_ip[4]
local IP of ESP8266
5.3.1.2
int local_port
5.3.1.3
uint8 remote_ip[4]
5.3.1.4
int remote_port
5.4
Data Fields
The documentation for this struct was generated from the following file:
include/espressif/esp_timer.h
5.5
Data Fields
enum espconn_state state
int remote_port
uint8 remote_ip [4]
5.5.1
Field Documentation
5.5.1.1
uint8 remote_ip[4]
remote IP address
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
145
146
5.5.1.2
int remote_port
remote port
5.5.1.3
state of espconn
The documentation for this struct was generated from the following file:
include/espressif/espconn.h
5.6
Data Fields
airkiss_memset_fn memset
airkiss_memcpy_fn memcpy
airkiss_memcmp_fn memcmp
airkiss_printf_fn printf
The documentation for this struct was generated from the following file:
include/espressif/airkiss.h
5.7
Data Fields
uint8 bssid [6]
uint8 ssid [32]
uint8 ssid_len
uint8 channel
sint8 rssi
AUTH_MODE authmode
uint8 is_hidden
sint16 freq_offset
sint16 freqcal_val
uint8 esp_mesh_ie
5.7.1
5.7.1.1
STAILQ_ENTRY ( bss_info )
information of next AP
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
5.7.2
Field Documentation
5.7.2.2
uint8 bssid[6]
MAC address of AP
5.7.2.3
uint8 channel
channel of AP
5.7.2.4
sint16 freq_offset
frequency offset
5.7.2.5
uint8 is_hidden
5.7.2.6
sint8 rssi
single strength of AP
5.7.2.7
uint8 ssid[32]
SSID of AP
5.7.2.8
uint8 ssid_len
SSID length
The documentation for this struct was generated from the following file:
include/espressif/esp_sta.h
5.8
Data Fields
char cmd_str
uint8 flag
uint8 id
void( cmd_func )(void)
void( cmd_callback )(void arg)
The documentation for this struct was generated from the following file:
include/espressif/esp_ssc.h
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
147
148
5.9
Data Fields
bool enable
struct ip_addr start_ip
struct ip_addr end_ip
5.9.1
Field Documentation
5.9.1.1
bool enable
5.9.1.2
end IP of IP range
5.9.1.3
start IP of IP range
The documentation for this struct was generated from the following file:
include/espressif/esp_misc.h
5.10
Data Fields
uint32 phys_size
uint32 phys_addr
uint32 phys_erase_block
uint32 log_block_size
uint32 log_page_size
uint32 fd_buf_size
uint32 cache_buf_size
5.10.1
Field Documentation
5.10.1.1
uint32 cache_buf_size
5.10.1.2
uint32 fd_buf_size
5.10.1.3
uint32 log_block_size
logical size of a block, must be on physical block size boundary and must never be less than a physical block
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
5.10.1.4
uint32 log_page_size
5.10.1.5
uint32 phys_addr
physical offset in spi flash used for spiffs, must be on block boundary
5.10.1.6
uint32 phys_erase_block
5.10.1.7
uint32 phys_size
5.11
#include <espconn.h>
Data Fields
enum espconn_type type
enum espconn_state state
union {
esp_tcp tcp
esp_udp udp
} proto
espconn_recv_callback recv_callback
espconn_sent_callback sent_callback
uint8 link_cnt
void reserve
5.11.1
Detailed Description
A espconn descriptor
5.11.2
Field Documentation
5.11.2.1
uint8 link_cnt
link count
149
150
5.11.2.3
void reserve
5.11.2.4
espconn_sent_callback sent_callback
5.11.2.5
5.11.2.6
5.12
Data Fields
5.12.1
Event_StaMode_ScanDone_t scan_done
Event_StaMode_Connected_t connected
Event_StaMode_Disconnected_t disconnected
Event_StaMode_AuthMode_Change_t auth_change
Event_StaMode_Got_IP_t got_ip
Event_SoftAPMode_StaConnected_t sta_connected
Event_SoftAPMode_StaDisconnected_t sta_disconnected
Event_SoftAPMode_ProbeReqRecved_t ap_probereqrecved
Field Documentation
5.13
Data Fields
int rssi
uint8 mac [6]
5.13.1
Field Documentation
5.13.1.1
uint8 mac[6]
5.13.1.2
int rssi
5.14
Data Fields
uint8 mac [6]
uint8 aid
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
151
152
5.14.1
Field Documentation
5.14.1.1
uint8 aid
5.14.1.2
uint8 mac[6]
5.15
Data Fields
uint8 mac [6]
uint8 aid
5.15.1
Field Documentation
5.15.1.1
uint8 aid
5.15.1.2
uint8 mac[6]
5.16
Data Fields
uint8 old_mode
uint8 new_mode
5.16.1
Field Documentation
5.16.1.1
uint8 new_mode
5.16.1.2
uint8 old_mode
5.17
Data Fields
uint8 ssid [32]
uint8 ssid_len
uint8 bssid [6]
uint8 channel
5.17.1
Field Documentation
5.17.1.1
uint8 bssid[6]
BSSID of connected AP
5.17.1.2
uint8 channel
channel of connected AP
5.17.1.3
uint8 ssid[32]
SSID of connected AP
5.17.1.4
uint8 ssid_len
5.18
Data Fields
uint8 ssid [32]
uint8 ssid_len
uint8 bssid [6]
uint8 reason
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
153
154
5.18.1
Field Documentation
5.18.1.1
uint8 bssid[6]
BSSID of disconnected AP
5.18.1.2
uint8 reason
reason of disconnection
5.18.1.3
uint8 ssid[32]
SSID of disconnected AP
5.18.1.4
uint8 ssid_len
5.19
Data Fields
struct ip_addr ip
struct ip_addr mask
struct ip_addr gw
5.19.1
Field Documentation
5.19.1.1
struct ip_addr gw
5.19.1.2
struct ip_addr ip
5.19.1.3
5.20
Data Fields
uint32 status
struct bss_info bss
5.20.1
Field Documentation
5.20.1.1
5.20.1.2
uint32 status
5.21
Data Fields
uint16 GPIO_Pin
GPIOMode_TypeDef GPIO_Mode
GPIO_Pullup_IF GPIO_Pullup
GPIO_INT_TYPE GPIO_IntrType
5.21.1
Field Documentation
5.21.1.1
GPIO_INT_TYPE GPIO_IntrType
5.21.1.2
GPIOMode_TypeDef GPIO_Mode
GPIO mode
5.21.1.3
uint16 GPIO_Pin
GPIO pin
5.21.1.4
GPIO_Pullup_IF GPIO_Pullup
GPIO pullup
The documentation for this struct was generated from the following file:
examples/driver_lib/include/gpio.h
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
155
156
5.22
Data Fields
struct ip_addr ip
struct ip_addr netmask
struct ip_addr gw
5.22.1
Field Documentation
5.22.1.1
struct ip_addr gw
gateway
5.22.1.2
struct ip_addr ip
IP address
5.22.1.3
netmask
The documentation for this struct was generated from the following file:
include/espressif/esp_wifi.h
5.23
Data Fields
uint32 period
uint32 freq
uint32 duty [8]
5.23.1
Field Documentation
5.23.1.1
uint32 duty[8]
PWM duty
5.23.1.2
uint32 freq
PWM frequency
5.23.1.3
uint32 period
PWM period
The documentation for this struct was generated from the following file:
include/espressif/pwm.h
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
5.24
Data Fields
rst_reason reason
uint32 exccause
uint32 epc1
uint32 epc2
uint32 epc3
uint32 excvaddr
uint32 depc
uint32 rtn_addr
5.24.1
Field Documentation
5.25
Data Fields
uint8 ssid
uint8 bssid
uint8 channel
uint8 show_hidden
5.25.1
Field Documentation
5.25.1.1
uint8 bssid
MAC address of AP
5.25.1.2
uint8 channel
5.25.1.3
uint8 show_hidden
5.25.1.4
uint8 ssid
SSID of AP
The documentation for this struct was generated from the following file:
include/espressif/esp_sta.h
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
157
158
5.26
Data Fields
5.26.1
Field Documentation
5.26.1.2
uint16 beacon_interval
5.26.1.3
uint8 channel
5.26.1.4
uint8 max_connection
5.26.1.5
uint8 password[64]
5.26.1.6
uint8 ssid[32]
5.26.1.7
uint8 ssid_hidden
5.26.1.8
uint8 ssid_len
Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set
the SSID length according to softap_config.ssid_len.
The documentation for this struct was generated from the following file:
include/espressif/esp_softap.h
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
5.27
159
Data Fields
uint32 deviceId
uint32 chip_size
uint32 block_size
uint32 sector_size
uint32 page_size
uint32 status_mask
The documentation for this struct was generated from the following file:
include/espressif/spi_flash.h
5.28
Data Fields
5.28.1
Field Documentation
5.28.1.1
uint8 bssid[6]
5.28.1.2
uint8 bssid_set
whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be
1 only when users need to check the MAC address of the AP.
5.28.1.3
uint8 password[64]
password of target AP
5.28.1.4
uint8 ssid[32]
SSID of target AP
The documentation for this struct was generated from the following file:
include/espressif/esp_sta.h
5.29
160
Data Fields
uint8 bssid [6]
struct ip_addr ip
5.29.1
5.29.1.1
STAILQ_ENTRY ( station_info )
Information of next AP
5.29.2
Field Documentation
5.29.2.1
uint8 bssid[6]
BSSID of AP
5.29.2.2
struct ip_addr ip
IP address of AP
The documentation for this struct was generated from the following file:
include/espressif/esp_softap.h
5.30
Data Fields
UART_BautRate baud_rate
UART_WordLength data_bits
UART_ParityMode parity
UART_StopBits stop_bits
UART_HwFlowCtrl flow_ctrl
uint8 UART_RxFlowThresh
uint32 UART_InverseMask
The documentation for this struct was generated from the following file:
examples/driver_lib/include/uart.h
5.31
Data Fields
uint32 UART_IntrEnMask
uint8 UART_RX_TimeOutIntrThresh
uint8 UART_TX_FifoEmptyIntrThresh
uint8 UART_RX_FifoFullIntrThresh
The documentation for this struct was generated from the following file:
examples/driver_lib/include/uart.h
Generated on Tue Mar 1 2016 10:19:27 for ESP8266_RTOS_SDK by Doxygen
5.32
Data Fields
5.32.1
Field Documentation
5.32.1.2
uint32 check_times
5.32.1.3
uint8 pre_version[16]
5.32.1.4
socket of upgrading
5.32.1.5
uint8 upgrade_flag
5.32.1.6
uint8 upgrade_version[16]
5.32.1.7
uint8 url
161
162