Esp32 Rtos SDK API Reference
Esp32 Rtos SDK API Reference
V3.0.0
1 ESP32_RTOS_SDK 1
2 Module Index 3
2.1 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4 Module Documentation 7
4.1.2.1 IP2STR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.1.2.2 os_printf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.1.2.3 os_printf_isr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.1.3.1 dhcp_status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.1.3.2 dhcps_offer_option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.3.2.1 phy_2nd_chan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.3.2.2 phy_bw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
iv CONTENTS
4.3.2.3 phy_mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.5.2.1 temperature_sensor_read(void) . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.6.2.1 wifi_softap_dhcps_start(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.6.2.2 wifi_softap_dhcps_status(void) . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.6.2.3 wifi_softap_dhcps_stop(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.6.2.4 wifi_softap_free_station_info(void) . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.6.2.8 wifi_softap_get_dhcps_lease_time(void) . . . . . . . . . . . . . . . . . . . . . 21
4.6.2.9 wifi_softap_get_station_info(void) . . . . . . . . . . . . . . . . . . . . . . . . . 21
Generated by Doxygen
CONTENTS v
4.6.2.10 wifi_softap_get_station_num(void) . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.6.2.11 wifi_softap_reset_dhcps_lease_time(void) . . . . . . . . . . . . . . . . . . . . 22
4.7.2.2 ssc_param_len(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.7.2.3 ssc_param_str(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.8.2.1 scan_done_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.8.3.1 STATION_STATUS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.8.4.3 wifi_station_connect(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.8.4.4 wifi_station_dhcpc_start(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.8.4.5 wifi_station_dhcpc_status(void) . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.8.4.6 wifi_station_dhcpc_stop(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.8.4.7 wifi_station_disconnect(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Generated by Doxygen
vi CONTENTS
4.8.4.9 wifi_station_get_auto_connect(void) . . . . . . . . . . . . . . . . . . . . . . . . 33
4.8.4.12 wifi_station_get_connect_status(void) . . . . . . . . . . . . . . . . . . . . . . . 33
4.8.4.13 wifi_station_get_current_ap_id(void) . . . . . . . . . . . . . . . . . . . . . . . 34
4.8.4.14 wifi_station_get_reconnect_policy(void) . . . . . . . . . . . . . . . . . . . . . . 34
4.8.4.15 wifi_station_get_rssi(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.9.2.4 system_get_free_heap_size(void) . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.9.2.5 system_get_rtc_time(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.9.2.6 system_get_sdk_version(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.9.2.7 system_get_time(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.9.2.8 system_get_vdd33(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.9.2.11 system_print_meminfo(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.9.2.12 system_restart(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.9.2.13 system_restore(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Generated by Doxygen
CONTENTS vii
4.10.2.1 flash_size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.10.3.2 system_get_cpu_freq(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.10.3.3 system_get_current_bin_id(void) . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.10.3.4 system_get_flash_size(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.11.2.1 mac_group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.11.2.2 mac_type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.11.3.1 system_efuse_get_mac_group(void) . . . . . . . . . . . . . . . . . . . . . . . 48
Generated by Doxygen
viii CONTENTS
4.13.2.1 wifi_event_handler_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.13.3.1 AUTH_MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.13.3.2 SYSTEM_EVENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.13.3.3 WIFI_INTERFACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.13.3.4 WIFI_MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.13.4.4 wifi_get_opmode(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.13.4.5 wifi_get_opmode_default(void) . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4.14.2.1 wifi_promiscuous_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
4.14.3.1 wifi_get_channel(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
4.15.2.1 wps_st_cb_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Generated by Doxygen
CONTENTS ix
4.15.3.1 wps_cb_status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.15.4.2 wifi_wps_disable(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.15.4.4 wifi_wps_start(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.16.2.1 sc_callback_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4.16.3.1 sc_status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.16.3.2 sc_type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.16.4.2 smartconfig_get_version(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.16.4.5 smartconfig_stop(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.18.2.1 SPI_FLASH_SEC_SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.18.3.1 SpiFlashOpResult . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Generated by Doxygen
x CONTENTS
4.19.2.1 upgrade_states_check_callback . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.19.3.2 ota_error_id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.19.4.1 system_upgrade_deinit(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.19.4.2 system_upgrade_get_error_id(void) . . . . . . . . . . . . . . . . . . . . . . . . 75
4.19.4.5 upgrade_get_process_rate(void) . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.20.2.1 GPIO_AS_INPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.20.2.2 GPIO_AS_INPUT_HIGH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.20.2.3 GPIO_AS_OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.20.2.4 GPIO_AS_OUTPUT_HIGH . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4.20.2.5 GPIO_DIS_OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4.20.2.6 GPIO_INPUT_GET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4.20.2.7 GPIO_OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.20.2.8 GPIO_OUTPUT_HIGH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.20.2.9 GPIO_OUTPUT_SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Generated by Doxygen
CONTENTS xi
4.20.3.2 gpio_input_get(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.20.3.3 gpio_input_get_high(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.20.3.6 gpio_intr_process(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.20.3.14 gpio_pin_wakeup_disable(void) . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4.21.2.1 CONF_RXLINK_ADDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4.21.2.2 CONF_TXLINK_ADDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.21.3.1 create_one_link(uint8 own, uint8 eof, uint8 sub_sof, uint16 size, uint16 length,
uint32 ∗buf_ptr, struct sdio_queue ∗nxt_ptr, struct sdio_queue ∗i2s_queue) . . . 88
4.21.3.3 i2s_init(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.21.3.4 i2s_test(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.21.3.5 slc_init(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Generated by Doxygen
xii CONTENTS
4.22.2.20 pwm_get_period(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
4.22.2.24 pwm_start(void) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Generated by Doxygen
CONTENTS xiii
Generated by Doxygen
xiv CONTENTS
Generated by Doxygen
CONTENTS xv
5.14.1.1 gw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Generated by Doxygen
xvi CONTENTS
5.14.1.2 ip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
5.17.1.1 gw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
5.17.1.2 ip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Generated by Doxygen
CONTENTS xvii
Generated by Doxygen
xviii CONTENTS
5.28.2.2 ip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Generated by Doxygen
Chapter 1
ESP32_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. Functions are stored in CACHE by default, need not 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. 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.
Generated by Doxygen
Chapter 2
Module Index
2.1 Modules
Misc APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
WiFi Related APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Phy APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Regdomain APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
SoftAP APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Station APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Common APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Sniffer APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
WPS APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Smartconfig APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Sensor APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
SSC APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
System APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Boot APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Hardware MAC APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Software timer APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Driver APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
SPI Driver APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
GPIO Driver APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
I2S Driver APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
PWM Driver APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
UART Driver APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
OTA APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4 Module Index
Generated by Doxygen
Chapter 3
_esp_event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
_os_timer_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
b_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
bss_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
cmd_s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
dhcps_lease . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Event_Info_u . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Event_SoftAPMode_ProbeReqRecved_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Event_SoftAPMode_StaConnected_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Event_SoftAPMode_StaDisconnected_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Event_StaMode_AuthMode_Change_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Event_StaMode_Connected_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Event_StaMode_Disconnected_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Event_StaMode_Got_IP_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Event_StaMode_ScanDone_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
GPIO_ConfigTypeDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
ip_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
phy_config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
pwm_param . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
regdomain_info::regdomain_chan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
regdomain_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
remote_bin_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
scan_config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
sdio_queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
server_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
softap_config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
station_config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
station_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
UART_ConfigTypeDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
UART_IntrConfTypeDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
upgrade_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
6 Data Structure Index
Generated by Doxygen
Chapter 4
Module Documentation
misc APIs
Data Structures
• struct dhcps_lease
Macros
Enumerations
Functions
Variables
• SemaphoreHandle_t stdio_mutex_tx
misc APIs
Value:
ip4_addr1_16(ipaddr), \
ip4_addr2_16(ipaddr), \
ip4_addr3_16(ipaddr), \
ip4_addr4_16(ipaddr)
Value:
do { \
xSemaphoreTake(stdio_mutex_tx, portMAX_DELAY); \
printf_call(fmt, ##__VA_ARGS__); \
xSemaphoreGive(stdio_mutex_tx); \
} while(0)
Value:
do { \
static const char ram_str[] DRAM_ATTR STORE_ATTR = fmt; \
ets_printf(ram_str, ##__VA_ARGS__); \
} while(0)
Enumerator
Enumerator
Generated by Doxygen
4.2 WiFi Related APIs 9
WiFi APIs.
Modules
• Phy APIs
ESP32 phy layer related APIs.
• Regdomain APIs
ESP32 Regdomain APIs.
• SoftAP APIs
ESP32 Soft-AP APIs.
• Station APIs
ESP32 station APIs.
• Common APIs
WiFi common APIs.
• Sniffer APIs
WiFi sniffer APIs.
• WPS APIs
ESP32 WPS APIs.
• Smartconfig APIs
SmartConfig APIs.
WiFi APIs.
Generated by Doxygen
10 Module Documentation
Data Structures
• struct phy_config
Macros
Enumerations
Functions
Enumerator
Generated by Doxygen
4.3 Phy APIs 11
Enumerator
Enumerator
Get the phy configuration of ESP32 station/softap and save it to the Flash.
Parameters
Returns
true : success
false : failure
Set the phy configuration of ESP32 station/softap and save it to the Flash.
Attention
1. This API can be called only when the opmode is correctly configured, e.g. if you try to configure softap phy
while the opmode is station, it returns false.
2. If call this API when station/softap is started(connected), it will firstly stop/disconnect the station/softap,
configure phy, then start/connect station/softap.
3. If you change the phy mode from 11N HT40 to 11b/g, the bandwith will be switched to HT20 since the HT40
is for 11N only.
4. You can configure phy mode/bw/2nd_chan by mask the cfg_mask correctly, e.g. if (cfg_mask & CFG_M←-
ASK_PHY_MODE) is true, the phy mode will be configued, otherwise, it has no impact on the phy mode.
5. Since wifi_set_phy_mode/wifi_set_phy_bw/wifi_set_2nd_chan will stop station/softap and then start sta-
tion/softap. So if you don't want station/softap stop/start several times, please use wifi_set_phy since it only
stop/start once. Of course, if you only want to configure phy mode, you can use the one you prefer.
6. The default sdk phy configuration: 11N/HT40
Generated by Doxygen
12 Module Documentation
Parameters
Returns
true : success
false : failure
Set the phy second channel of ESP32 softap and save it to the flash.
Attention
Refer to wifi_set_phy()
Parameters
Returns
true : success
false : failure
Set the phy bandwidth of ESP32 station/softap and save it to the flash.
Attention
See wifi_set_phy()
Parameters
Returns
true : success
false : failure
Generated by Doxygen
4.3 Phy APIs 13
Set the phy mode of ESP32 station/softap and save it to the flash.
Attention
Refer to wifi_set_phy()
Parameters
Returns
true : success
false : failure
Generated by Doxygen
14 Module Documentation
Data Structures
• struct regdomain_info
Macros
• #define REGDOMAIN_CHANGROUP_MAX 1
Functions
Parameters
Returns
true : success
false : failure
Generated by Doxygen
4.4 Regdomain APIs 15
Attention
1. If the regodmain of station is enable, the station will use passive scan to scan channel 1∼14, NO PROBE
REQUEST will send out, this is also the behavior specified in 80211-2012 standard. However, this may impact
the scan performance, e.g. it can't find the hidden AP etc. If you think this not what you expected, pls contact
espressif.
2. For softap, if regdomain is enable, the regodmain info will be added into beacon.
3. If current channel of softap is not in [schan, schan+nchan-1], then softap will switch to the channel schan
automatically
4. In stationap mode, if the regdomain information of softap is conflicted with the regodmain information of the
external AP that sta is conneted, then the external AP's regodmain information is prefered.
Parameters
Returns
true : success
false : failure
Generated by Doxygen
16 Module Documentation
Enumerations
• enum touch_sensor_pad {
TOUCH_SENSOR_PAD0 = BIT0, TOUCH_SENSOR_PAD1 = BIT1, TOUCH_SENSOR_PAD2 = BIT2, T←-
OUCH_SENSOR_PAD3 = BIT3,
TOUCH_SENSOR_PAD4 = BIT4, TOUCH_SENSOR_PAD5 = BIT5, TOUCH_SENSOR_PAD6 = BIT6, T←-
OUCH_SENSOR_PAD7 = BIT7,
TOUCH_SENSOR_PAD8 = BIT8, TOUCH_SENSOR_PAD9 = BIT9 }
Functions
Parameters
null
Returns
Generated by Doxygen
4.5 Sensor APIs 17
Parameters
touch_sensor_pad pad : enable the corresponding touch_pad[9:0]
Returns
null
Example:
uint16 pad_out[10];
uint16 sample_num = 10000;
rtc_touch_read(pad_out, sample_num);
Parameters
uint16 ∗pad_out : pointer of the start address of uint16 pad_out[10], to get the value from touch pad sensor
(touch_pad[9:0]).
uint16 sample_num : range [0, 65535], meaturing time of touch pad = sample_num∗(1/RTC_CLK)
Returns
null
Generated by Doxygen
18 Module Documentation
Data Structures
• struct softap_config
• struct station_info
Functions
• bool wifi_softap_get_config (struct softap_config ∗config)
Get the current configuration of the ESP32 WiFi soft-AP.
• bool wifi_softap_get_config_default (struct softap_config ∗config)
Get the configuration of the ESP32 WiFi soft-AP saved in the flash.
• bool wifi_softap_set_config (struct softap_config ∗config)
Set the configuration of the WiFi soft-AP and save it to the Flash.
• bool wifi_softap_set_config_current (struct softap_config ∗config)
Set the configuration of the WiFi soft-AP; the configuration will not be saved to the Flash.
• uint8 wifi_softap_get_station_num (void)
Get the number of stations connected to the ESP32 soft-AP.
• struct station_info ∗ wifi_softap_get_station_info (void)
Get the information of stations connected to the ESP32 soft-AP, including MAC and IP.
• void wifi_softap_free_station_info (void)
Free the space occupied by station_info when wifi_softap_get_station_info is called.
• bool wifi_softap_dhcps_start (void)
Enable the ESP32 soft-AP DHCP server.
• bool wifi_softap_dhcps_stop (void)
Disable the ESP32 soft-AP DHCP server. The DHCP is enabled by default.
• enum dhcp_status wifi_softap_dhcps_status (void)
Get the ESP32 soft-AP DHCP server status.
• bool wifi_softap_get_dhcps_lease (struct dhcps_lease ∗please)
Query the IP range that can be got from the ESP32 soft-AP DHCP server.
• bool wifi_softap_set_dhcps_lease (struct dhcps_lease ∗please)
Set the IP range of the ESP32 soft-AP DHCP server.
• uint32 wifi_softap_get_dhcps_lease_time (void)
Get ESP32 soft-AP DHCP server lease time.
• bool wifi_softap_set_dhcps_lease_time (uint32 minute)
Set ESP32 soft-AP DHCP server lease time, default is 120 minutes.
• bool wifi_softap_reset_dhcps_lease_time (void)
Reset ESP32 soft-AP DHCP server lease time which is 120 minutes by default.
• bool wifi_softap_set_dhcps_offer_option (uint8 level, void ∗optarg)
Set the ESP32 soft-AP DHCP server option.
Attention
To call APIs related to ESP32 soft-AP has to enable soft-AP mode first (wifi_set_opmode)
Generated by Doxygen
4.6 SoftAP APIs 19
Attention
Parameters
null
Returns
true : succeed
false : fail
Parameters
null
Returns
enum dhcp_status
Disable the ESP32 soft-AP DHCP server. The DHCP is enabled by default.
Parameters
null
Returns
true : succeed
false : fail
Generated by Doxygen
20 Module Documentation
Attention
The ESP32 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 ESP32 station.
Parameters
null
Returns
null
Parameters
Returns
true : succeed
false : fail
Get the configuration of the ESP32 WiFi soft-AP saved in the flash.
Parameters
Returns
true : succeed
false : fail
Query the IP range that can be got from the ESP32 soft-AP DHCP server.
Generated by Doxygen
4.6 SoftAP APIs 21
Attention
This API can only be called during ESP32 soft-AP DHCP server enabled.
Parameters
Returns
true : succeed
false : fail
Attention
This API can only be called during ESP32 soft-AP DHCP server enabled.
Parameters
null
Returns
Get the information of stations connected to the ESP32 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
Generated by Doxygen
22 Module Documentation
Attention
The ESP32 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 ESP32 station.
Parameters
null
Returns
Reset ESP32 soft-AP DHCP server lease time which is 120 minutes by default.
Attention
This API can only be called during ESP32 soft-AP DHCP server enabled.
Parameters
null
Returns
true : succeed
false : fail
Set the configuration of the WiFi soft-AP and save it to the Flash.
Attention
Parameters
Generated by Doxygen
4.6 SoftAP APIs 23
Returns
true : succeed
false : fail
Set the configuration of the WiFi soft-AP; the configuration will not be saved to the Flash.
Attention
The ESP32 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 ESP32 station.
Parameters
Returns
true : succeed
false : fail
Attention
1. The IP range should be in the same sub-net with the ESP32 soft-AP IP address.
2. This API should only be called when the DHCP server is disabled (wifi_softap_dhcps_stop).
3. This configuration will only take effect the next time when the DHCP server is enabled (wifi_softap_dhcps←-
_start).
• If the DHCP server is disabled again, this API should be called to set the IP range.
• Otherwise, when the DHCP server is enabled later, the default IP range will be used.
Parameters
Returns
true : succeed
false : fail
Set ESP32 soft-AP DHCP server lease time, default is 120 minutes.
Generated by Doxygen
24 Module Documentation
Attention
This API can only be called during ESP32 soft-AP DHCP server enabled.
Parameters
uint32 minute : lease time, uint: minute, range:[1, 2880].
Returns
true : succeed
false : fail
Example:
uint8 mode = 0;
wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode);
Parameters
Returns
true : succeed
false : fail
Generated by Doxygen
4.7 SSC APIs 25
SSC APIs.
Functions
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.
Attention
Parameters
Returns
null
Generated by Doxygen
26 Module Documentation
Parameters
null
Returns
Parameters
null
Returns
the command.
Parameters
char ∗pLine : [input] the ssc string
char ∗argv[] : [output] parameters of the ssc
Returns
Parameters
ssc_←- ∗cmdset : the ssc set
cmd_t
uint8 cmdnum : number of commands
void (∗ help)(void) : callback of user-guide
Generated by Doxygen
4.7 SSC APIs 27
Returns
null
Generated by Doxygen
28 Module Documentation
Data Structures
• struct station_config
• struct scan_config
• struct bss_info
Typedefs
Enumerations
• enum STATION_STATUS {
STATION_IDLE = 0, STATION_CONNECTING, STATION_WRONG_PASSWORD, STATION_NO_AP_F←-
OUND,
STATION_CONNECT_FAIL, STATION_GOT_IP }
Functions
Generated by Doxygen
4.8 Station APIs 29
Attention
To call APIs related to ESP32 station has to enable station mode first (wifi_set_opmode)
Parameters
void ∗arg : information of APs that are found; save them as linked list; refer to struct bss_info
STATUS status : status of scanning
Returns
null
Enumerator
Generated by Doxygen
30 Module Documentation
Parameters
Returns
true : succeed
false : fail
Set the number of APs that can be recorded in the ESP32 station. When the ESP32 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
Returns
true : succeed
false : fail
Attention
1. This API should be called when the ESP32 station is enabled, and the system initialization is completed.
Do not call this API in user_init.
2. If the ESP32 is connected to an AP, call wifi_station_disconnect to disconnect.
Generated by Doxygen
4.8 Station APIs 31
Parameters
null
Returns
true : succeed
false : fail
Attention
Parameters
null
Returns
true : succeed
false : fail
Parameters
null
Returns
enum dhcp_status
Generated by Doxygen
32 Module Documentation
Attention
Parameters
null
Returns
true : succeed
false : fail
Attention
This API should be called when the ESP32 station is enabled, and the system initialization is completed. Do
not call this API in user_init.
Parameters
null
Returns
true : succeed
false : fail
Example:
Parameters
struct station_config config[] : information of the APs, the array size should be 5.
Generated by Doxygen
4.8 Station APIs 33
Returns
Check if the ESP32 station will connect to the recorded AP automatically when the power is on.
Parameters
null
Returns
Parameters
Returns
true : succeed
false : fail
Get the configuration parameters saved in the Flash of the ESP32 WiFi station.
Parameters
Returns
true : succeed
false : fail
Generated by Doxygen
34 Module Documentation
Parameters
null
Returns
Parameters
struct station_config config[] : information of the APs, the array size should be 5.
Returns
Check whether the ESP32 station will reconnect to the AP after disconnection.
Parameters
null
Returns
true : succeed
false : fail
Parameters
null
Returns
Generated by Doxygen
4.8 Station APIs 35
Attention
This API should be called when the ESP32 station is enabled, and the system initialization is completed. Do
not call this API in user_init.
Parameters
Returns
true : succeed
false : fail
Set whether the ESP32 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
Returns
true : succeed
false : fail
Set the configuration of the ESP32 station and save it to the Flash.
Generated by Doxygen
36 Module Documentation
Attention
1. This API can be called only when the ESP32 station is enabled.
2. If wifi_station_set_config is called in user_init , there is no need to call wifi_station_connect. The ESP32
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
Returns
true : succeed
false : fail
Set the configuration of the ESP32 station. And the configuration will not be saved to the Flash.
Attention
1. This API can be called only when the ESP32 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
ESP32 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
Returns
true : succeed
false : fail
Set whether the ESP32 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.
Generated by Doxygen
4.8 Station APIs 37
Parameters
bool set : if it's true, it will enable reconnection; if it's false, it will disable reconnection.
Returns
true : succeed
false : fail
Generated by Doxygen
38 Module Documentation
System APIs.
Modules
• Boot APIs
boot APIs
• Hardware MAC APIs
Hardware MAC address APIs.
Enumerations
• enum adc1_read_pad {
ADC1_PAD_GPIO36 = 0, ADC1_PAD_GPIO37, ADC1_PAD_GPIO38, ADC1_PAD_GPIO39,
ADC1_PAD_GPIO32, ADC1_PAD_GPIO33, ADC1_PAD_GPIO34, ADC1_PAD_GPIO35 }
• enum adc1_read_atten { ADC1_ATTEN_0DB = 0, ADC1_ATTEN_3DB, ADC1_ATTEN_6DB, ADC1_A←-
TTEN_12DB }
Functions
• const char ∗ system_get_sdk_version (void)
Get information of the SDK version.
• void system_restore (void)
Reset to default settings.
• void system_restart (void)
Restart system.
• void system_deep_sleep (uint64 time_in_us)
Set the chip to deep-sleep mode.
• uint32 system_get_time (void)
Get system time, unit: microsecond.
• void system_print_meminfo (void)
Print the system memory distribution, including data/rodata/bss/heap.
• uint32 system_get_free_heap_size (void)
Get the size of available heap.
• bool system_get_chip_id (uint8 ∗chip_id)
Get the chip ID.
• uint64 system_get_rtc_time (void)
Get RTC time, unit: RTC clock cycle.
• bool system_rtc_mem_read (uint16 src, void ∗dst, uint16 n)
Read user data from the RTC memory.
• bool system_rtc_mem_write (uint16 dst, const void ∗src, uint16 n)
Write user data to the RTC memory.
• uint16 system_adc1_read (adc1_read_pad pad, adc1_read_atten atten)
Read ADC1.
• uint16 system_get_vdd33 (void)
Measure the power voltage of VDD3P3 pin 3 and 4, unit : 1/1024 V.
• bool system_param_save_with_protect (uint16 start_sec, void ∗param, uint16 len)
Write data into flash with protection.
• bool system_param_load (uint16 start_sec, uint16 offset, void ∗param, uint16 len)
Read the data saved into flash with the read/write protection.
Generated by Doxygen
4.9 System APIs 39
System APIs.
Read ADC1.
Parameters
Returns
The device will automatically wake up after the deep-sleep time set by the users. Upon waking up, the device boots
up from user_init.
Attention
The parameter time_in_us to be "uint64" is for further development. Only the low 32 bits of parameter time←-
_in_us are avalable now.
Parameters
uint64 time_in_us : deep-sleep time, only the low 32bits are avalable now. unit: microsecond
Returns
null
Generated by Doxygen
40 Module Documentation
Example:
uint8 chip_id[6];
system_get_chip_id(chip_id);
Parameters
uint8 ∗chip_id : the chip ID
Returns
true : succeed
false : fail
Parameters
null
Returns
Parameters
null
Returns
RTC time.
Parameters
null
Generated by Doxygen
4.9 System APIs 41
Returns
Parameters
null
Returns
Attention
Parameters
null
Returns
4.9.2.9 bool system_param_load ( uint16 start_sec, uint16 offset, void ∗ param, uint16 len )
Read the data saved into flash with the read/write protection.
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.
Generated by Doxygen
42 Module Documentation
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.
Returns
true : succeed
false : fail
Protection of flash read/write : use 3 sectors (4KBytes 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 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
Returns
true : succeed
false : fail
Parameters
null
Generated by Doxygen
4.9 System APIs 43
Returns
null
Restart system.
Parameters
null
Returns
null
Parameters
null
Returns
null
The user data segment (1024 bytes, as shown below) is used to store user data.
Attention
Read and write unit for data stored in the RTC memory is 4 bytes.
src_addr is the block number (4 bytes per block). So when reading data at the beginning of the user data
segment, src_addr will be 512/4 = 128, n will be data length.
Generated by Doxygen
44 Module Documentation
Parameters
Returns
true : succeed
false : fail
During deep-sleep, only RTC is working. So users can store their data in RTC memory if it is needed. The user
data segment below (1024 bytes) is used to store the user data.
Attention
Read and write unit for data stored in the RTC memory is 4 bytes.
src_addr is the block number (4 bytes per block). So when storing data at the beginning of the user data
segment, src_addr will be 512/4 = 128, n will be data length.
Parameters
Returns
true : succeed
false : fail
Generated by Doxygen
4.10 Boot APIs 45
boot APIs
Data Structures
• struct b_info
Enumerations
• enum flash_size {
FLASH_SIZE_1MB = 0, FLASH_SIZE_2MB, FLASH_SIZE_4MB, FLASH_SIZE_8MB,
FLASH_SIZE_16MB, FLASH_SIZE_MAX }
Functions
• enum flash_size system_get_flash_size (void)
Get the current Flash size.
• uint8 system_get_cpu_freq (void)
Get CPU frequency.
• bool system_get_bin_info (uint8 bin_id, struct b_info ∗b_if)
Get bin info named by b_id.
• bool system_set_bin_info (uint8 bin_id, struct b_info ∗b_if)
Set bin info named by b_id.
• uint8 system_get_current_bin_id (void)
Get current bin's bin_id.
• bool system_reboot_to_userbin (uint8 bin_id)
reboot and jump to bin named by bin_id
boot APIs
Enumerator
Generated by Doxygen
46 Module Documentation
Parameters
uint8 bin_id : b_id number, must < 5
struct b_info ∗b_if : bin info of bin named by b_id
Returns
true : succeed
false : fail
Parameters
null
Returns
Parameters
uint8 bin_id : b_id number, must < 5
Returns
Parameters
null
Returns
enum flash_size
Generated by Doxygen
4.10 Boot APIs 47
Parameters
uint8 bin_id : b_id number, must < 5
Returns
true : succeed
false : fail
Parameters
uint8 bin_id : b_id number, must < 5
struct b_info ∗b_if : bin info of bin named by b_id
Returns
true : succeed
false : fail
Generated by Doxygen
48 Module Documentation
Enumerations
• enum mac_group { DEFAULT_MAC = 0, USER_MAC }
• enum mac_type { WIFI_MAC = 0, BT_MAC }
Functions
• int system_efuse_program_user_mac (mac_type type, uint8 ∗mac)
Set user-define hardware MAC address.
• bool system_efuse_read_mac (mac_group group, mac_type type, uint8 ∗mac)
Read hardware MAC address.
• bool system_efuse_set_mac_group (mac_group group)
Set hardware MAC group, default MAC or user-defined MAC.
• mac_group system_efuse_get_mac_group (void)
Get hardware MAC group, default MAC or user-defined MAC.
In WiFi MAC, only ESP32 station MAC is the hardware MAC, ESP32 softAP MAC is a software MAC calculated
from ESP32 station MAC. So users need to call wifi_get_macaddr to query the ESP32 softAP MAC if ESP32 station
MAC changed.
Enumerator
Enumerator
Generated by Doxygen
4.11 Hardware MAC APIs 49
Parameters
null
Returns
Attention
Hardware MAC address can only be set ONCE for each ESP32 chip.
Parameters
Returns
0: succeed to set.
1: the hardware MAC has been set once, users can not set it any more.
2: fail to set.
3: invalid parameter.
Parameters
Returns
true : succeed
false : fail
Generated by Doxygen
50 Module Documentation
Attention
Parameters
Returns
true : succeed
false : fail
Generated by Doxygen
4.12 Software timer APIs 51
Functions
Timers of the following interfaces are software timers. Functions of the timers are executed during the tasks. Since
a task can be stopped, or be delayed because there are other tasks with higher priorities, the following os_timer
interfaces cannot guarantee the precise execution of the timers.
• For the same timer, os_timer_arm (or os_timer_arm_us) cannot be invoked repeatedly. os_timer_disarm
should be invoked first.
• os_timer_setfn can only be invoked when the timer is not enabled, i.e., after os_timer_disarm or before os←-
_timer_arm (or os_timer_arm_us).
Parameters
os_←- ∗ptimer : timer structure
timer_t
uint32_t milliseconds : Timing, unit: millisecond, the maximum value allowed is 0x41893
bool repeat_flag : Whether the timer will be invoked repeatedly or not
Returns
null
Generated by Doxygen
52 Module Documentation
Parameters
os_←- ∗ptimer : Timer structure
timer_t
Returns
null
Attention
Parameters
os_timer_t ∗ptimer : Timer structure
os_timer_←- ∗pfunction : timer callback function
func_t
void ∗parg : callback function parameter
Returns
null
Generated by Doxygen
4.13 Common APIs 53
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
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 SYSTEM_EVENT {
EVENT_STAMODE_SCAN_DONE = 0, EVENT_STAMODE_CONNECTED, EVENT_STAMODE_DISCO←-
NNECTED, EVENT_STAMODE_AUTHMODE_CHANGE,
EVENT_STAMODE_GOT_IP, EVENT_STAMODE_DHCP_TIMEOUT, EVENT_SOFTAPMODE_STACO←-
NNECTED, 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, RE←-
ASON_ASSOC_LEAVE = 8,
REASON_ASSOC_NOT_AUTHED = 9, REASON_DISASSOC_PWRCAP_BAD = 10, REASON_DISAS←-
SOC_SUPCHAN_BAD = 11, REASON_IE_INVALID = 13,
REASON_MIC_FAILURE = 14, REASON_4WAY_HANDSHAKE_TIMEOUT = 15, REASON_GROUP_K←-
EY_UPDATE_TIMEOUT = 16, REASON_IE_IN_4WAY_DIFFERS = 17,
REASON_GROUP_CIPHER_INVALID = 18, REASON_PAIRWISE_CIPHER_INVALID = 19, REASON_←-
AKMP_INVALID = 20, REASON_UNSUPP_RSN_IE_VERSION = 21,
REASON_INVALID_RSN_IE_CAP = 22, REASON_802_1X_AUTH_FAILED = 23, REASON_CIPHER_S←-
UITE_REJECTED = 24, REASON_BEACON_TIMEOUT = 200,
REASON_NO_AP_FOUND = 201, REASON_AUTH_FAIL = 202, REASON_ASSOC_FAIL = 203, REAS←-
ON_HANDSHAKE_TIMEOUT = 204 }
Generated by Doxygen
54 Module Documentation
Functions
The Flash system parameter area is the last 16KB of the Flash.
Attention
No complex operations are allowed in callback. If users want to execute any complex operations, please post
message to another task instead.
Parameters
Returns
null
Generated by Doxygen
4.13 Common APIs 55
Enumerator
Enumerator
Enumerator
Enumerator
Generated by Doxygen
56 Module Documentation
Returns
WIFI_INTERFACE
Get the IP address of the ESP32 WiFi station or the soft-AP interface.
Attention
Users need to enable the target interface (station or soft-AP) by wifi_set_opmode first.
Parameters
WIFI_INTERFACE if_index : get the IP address of the station or the soft-AP interface, 0x00 for STATION_IF,
0x01 for SOFTAP_IF.
struct ip_info ∗info : the IP information obtained.
Returns
true : succeed
false : fail
Get MAC address of the ESP32 WiFi station or the soft-AP interface.
Parameters
WIFI_INTERFACE if_index : get the IP address of the station or the soft-AP interface, 0x00 for STATION_IF,
0x01 for SOFTAP_IF.
uint8 ∗macaddr : the MAC address.
Returns
true : succeed
false : fail
Generated by Doxygen
4.13 Common APIs 57
Parameters
null
Returns
Parameters
null
Returns
Parameters
Returns
true : succeed
false : fail
Set the IP address of the ESP32 WiFi station or the soft-AP interface.
Generated by Doxygen
58 Module Documentation
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 if_index : get the IP address of the station or the soft-AP interface, 0x00 for STATION_IF,
0x01 for SOFTAP_IF.
struct ip_info ∗info : the IP information obtained.
Returns
true : succeed
false : fail
Set MAC address of the ESP32 WiFi station or the soft-AP interface.
Attention
Parameters
WIFI_INTERFACE if_index : get the IP address of the station or the soft-AP interface, 0x00 for STATION_IF,
0x01 for SOFTAP_IF.
uint8 ∗macaddr : the MAC address.
Returns
true : succeed
false : fail
Set the WiFi operating mode as station, soft-AP or station+soft-AP, and save it to Flash. The default mode is soft-AP
mode.
Attention
This configuration will be saved in the Flash system parameter area if changed.
Generated by Doxygen
4.13 Common APIs 59
Parameters
uint8 opmode : WiFi operating modes:
Returns
true : succeed
false : fail
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 opmode : WiFi operating modes:
Returns
true : succeed
false : fail
Generated by Doxygen
60 Module Documentation
Typedefs
Functions
Parameters
Returns
null
Generated by Doxygen
4.14 Sniffer APIs 61
Parameters
null
Returns
channel number
Attention
1. The promiscuous mode can only be enabled in the ESP32 station mode.
2. When in the promiscuous mode, the ESP32 station and soft-AP are disabled.
3. Call wifi_station_disconnect to disconnect before enabling the promiscuous mode.
4. Don't call any other APIs when in the promiscuous mode. Call wifi_promiscuous_enable(0) to quit sniffer
before calling other APIs.
Parameters
uint8 promiscuous :
Returns
null
Parameters
uint8 channel : channel number
Returns
true : succeed
false : fail
Generated by Doxygen
62 Module Documentation
Each time a packet is received, the registered callback function will be called.
Parameters
wifi_promiscuous_←- cb : callback
cb_t
Returns
null
Generated by Doxygen
4.15 WPS APIs 63
Typedefs
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
WPS callback.
Generated by Doxygen
64 Module Documentation
Parameters
• Otherwise, it means that WPS fail, user can create a timer to retry WPS by wifi_wps_start after a
while, or call wifi_wps_disable to disable WPS and release resource.
Returns
null
Enumerator
Attention
Parameters
wps_st_←- cb : callback.
cb_t
Returns
true : WPS starts to work successfully, but does not mean WPS succeed.
false : fail
Generated by Doxygen
4.15 WPS APIs 65
Parameters
null
Returns
true : succeed
false : fail
Attention
Parameters
Returns
true : succeed
false : fail
Attention
Parameters
null
Returns
true : WPS starts to work successfully, but does not mean WPS succeed.
false : fail
Generated by Doxygen
66 Module Documentation
SmartConfig APIs.
Typedefs
Enumerations
• enum sc_status {
SC_STATUS_WAIT = 0, SC_STATUS_FIND_CHANNEL, SC_STATUS_GETTING_SSID_PSWD, SC_S←-
TATUS_LINK,
SC_STATUS_LINK_OVER }
• enum sc_type { SC_TYPE_ESPTOUCH = 0, SC_TYPE_AIRKISS, SC_TYPE_ESPTOUCH_AIRKISS }
Functions
SmartConfig APIs.
SmartConfig can only be enabled in station only mode. Please make sure the target AP is enabled before enable
SmartConfig.
Generated by Doxygen
4.16 Smartconfig APIs 67
Parameters
Returns
null
Enumerator
Enumerator
Attention
Generated by Doxygen
68 Module Documentation
Parameters
Returns
true : succeed
false : fail
Parameters
null
Returns
SmartConfig version
Attention
If users need to set the SmartConfig type, please set it before calling smartconfig_start.
Parameters
Returns
true : succeed
false : fail
Start SmartConfig mode, to connect ESP32 station to AP, by sniffing for special packets from the air, containing
SSID and password of desired AP. You need to broadcast the SSID and password (e.g. from mobile device or
computer) with the SSID and password encoded.
Generated by Doxygen
4.16 Smartconfig APIs 69
Attention
Parameters
Returns
true : succeed
false : fail
Attention
Whether connect to AP succeed or not, this API should be called to free memory taken by smartconfig_start.
Parameters
null
Returns
true : succeed
false : fail
Generated by Doxygen
70 Module Documentation
Driver APIs.
Modules
Driver APIs.
Generated by Doxygen
4.18 SPI Driver APIs 71
Macros
• #define SPI_FLASH_SEC_SIZE 4096
Enumerations
• enum SpiFlashOpResult { SPI_FLASH_RESULT_OK, SPI_FLASH_RESULT_ERR, SPI_FLASH_RESUL←-
T_TIMEOUT }
Functions
• SpiFlashOpResult spi_flash_erase_sector (uint16 sec)
Erase the Flash sector.
• SpiFlashOpResult spi_flash_write (uint32 des_addr, uint32 ∗src_addr, uint32 size)
Write data to Flash.
• SpiFlashOpResult spi_flash_read (uint32 src_addr, uint32 ∗des_addr, uint32 size)
Read data from Flash.
Enumerator
Generated by Doxygen
72 Module Documentation
Parameters
uint16 sec : Sector number, the count starts at sector 0, 4KB per sector.
Returns
SpiFlashOpResult
Parameters
Returns
SpiFlashOpResult
Parameters
uint32 des_addr : destination address in Flash.
uint32 ∗src_addr : source address of the data.
uint32 size : length of data
Returns
SpiFlashOpResult
Generated by Doxygen
4.19 OTA APIs 73
OTA APIs.
Data Structures
• struct remote_bin_info
• struct server_info
• struct upgrade_info
Macros
Typedefs
Enumerations
• enum ota_error_id {
UPGRADE_OK, UPGRADE_FLAG_ERROR = 10000, NO_STATION_IP_ERROR = 10001, UPGRADE_←-
MEM_ERROR = 10002,
CREATE_SOCKET_ERROR = 10003, SEND_QUEUE_ERROR = 10004, SERVER_CONNECT_ERROR =
10005, SEND_URL_ERROR = 10006,
HTTP_HEAD_ERROR = 10007, DOWNLOAD_TIMEOUT_ERROR = 10008, GET_BIN_LENGTH_ERROR
= 10009, ERASE_FLASH_ERROR = 10010,
RECV_DATA_ERROR = 10011, BIN_MAGIC_ERROR = 10012, USER_ID_CONFLICT_ERROR = 10013,
FLASH_ID_CONFLICT_ERROR = 10014,
CRC_CHECK_FAILED_ERROR = 10015 }
• enum { NO_READY = 1, TENTATIVE, READY }
Functions
Generated by Doxygen
74 Module Documentation
OTA APIs.
Parameters
void ∗ arg : call back parameter
Returns
void
Enumerator
Enumerator
Generated by Doxygen
4.19 OTA APIs 75
Attention
this API should be called in upgrade check call back function or called after it
Parameters
void
Returns
void
Parameters
void
Returns
Parameters
uint8 b_id : b_id number, must < 5
uint8 start_flash_id : define a block in flash is 256KB, a block correspond a flash id start flash id means bin
file's start flash id
Returns
true : succeed
false : fail
Generated by Doxygen
76 Module Documentation
Attention
Parameters
struct upgrade_info ∗server : upgrade info contains remote server and callback func
Returns
true : succeed
false : fail
Parameters
void
Returns
get bin's sum length and lenth of irom1 part in remote server
Parameters
Returns
true : succeed
false : fail
Generated by Doxygen
4.20 GPIO Driver APIs 77
GPIO APIs.
Macros
Functions
Generated by Doxygen
78 Module Documentation
GPIO APIs.
Parameters
Returns
null
Parameters
Returns
null
Generated by Doxygen
4.20 GPIO Driver APIs 79
Parameters
Returns
null
Parameters
Returns
null
Value:
Parameters
Returns
null
Value:
Generated by Doxygen
80 Module Documentation
Parameters
Returns
Value:
Parameters
Returns
null
Value:
Parameters
Returns
null
Generated by Doxygen
4.20 GPIO Driver APIs 81
Value:
Parameters
Returns
null
GPIO init .
Parameters
Returns
null
Sample the value of GPIO input pins and returns a bitmask. This function only get the level GPIO0-GPIO31.
Parameters
null
Returns
Generated by Doxygen
82 Module Documentation
Sample the value of GPIO input pins and returns a bitmask. This function only get the level GPIO32-GPIO39.
Parameters
null
Returns
Parameters
Returns
null
Parameters
Returns
null
Generated by Doxygen
4.20 GPIO Driver APIs 83
Parameters
null
Returns
null
Parameters
Returns
null
Parameters
Returns
null
4.20.3.9 void gpio_output_conf ( uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask )
Parameters
uint32 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.
uint32 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.
uint32 enable_mask : Enable Output
uint32 disable_mask : Enable Input
Generated by Doxygen
84 Module Documentation
Returns
null
4.20.3.10 void gpio_output_conf_high ( uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask )
Parameters
uint32 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.
uint32 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.
uint32 enable_mask : Enable Output
uint32 disable_mask : Enable Input
Returns
null
Parameters
Returns
null
Parameters
Returns
null
Generated by Doxygen
4.20 GPIO Driver APIs 85
Parameters
Returns
null
Parameters
null
Returns
null
Parameters
Returns
null
Parameters
uint32 model_num : The mode sequence number.
uint32 intr_num : interrupt sequence number.
Generated by Doxygen
86 Module Documentation
Returns
null
Generated by Doxygen
4.21 I2S Driver APIs 87
Data Structures
• struct sdio_queue
Macros
• #define TX_MASTER 0
• #define TX_SLAVE 1
• #define RX_MASTER 2
• #define RX_SLAVE 3
• #define ETS_SLC_INTR_ENABLE() xt_ints_on(1 << ETS_SLC_INUM)
• #define CONF_RXLINK_ADDR(addr)
• #define CONF_TXLINK_ADDR(addr)
• #define START_RXLINK() SET_PERI_REG_MASK(I2SRX_LINK, I2S_I2S_RXLINK_START)
• #define START_TXLINK() SET_PERI_REG_MASK(I2STX_LINK, I2S_I2S_TXLINK_START)
Functions
Value:
CLEAR_PERI_REG_MASK(I2SRX_LINK, I2S_I2S_RXLINK_ADDR);\
SET_PERI_REG_MASK(I2SRX_LINK, ((uint32)(addr)) & I2S_I2S_RXLINK_ADDR)
Generated by Doxygen
88 Module Documentation
Value:
CLEAR_PERI_REG_MASK(I2STX_LINK, I2S_I2S_TXLINK_ADDR);\
SET_PERI_REG_MASK(I2STX_LINK, ((uint32)(addr)) & I2S_I2S_TXLINK_ADDR)
4.21.3.1 void create_one_link ( uint8 own, uint8 eof, uint8 sub_sof, uint16 size, uint16 length, uint32 ∗ buf_ptr, struct
sdio_queue ∗ nxt_ptr, struct sdio_queue ∗ i2s_queue )
Parameters
uint8 own : select the owner of the current link to be either software or hardware
uint8 eof : mark for end of file
uint8 sub_sof : mark for sub start of file
uint16 size : the actual size of the buffer
uint16 length : the total size of the buffer
uint32∗ buf_ptr : the start address of the buffer
struct sdio_queue∗ nxt_ptr : the address of the next descriptor
struct sdio_queue∗ i2s_queue : the address of the current descriptor
Returns
null
Attention
Parameters
uint8 mode : i2s mode select between TX_MASTER, TX_SLAVE, RX_MASTER, RX_SLAVE;
Returns
null
Generated by Doxygen
4.21 I2S Driver APIs 89
I2S module initialization, including FIFO, M/S mode, data format, clock frequency.
Attention
Parameters
null
Returns
null
Parameters
null
Returns
null
Attention
Parameters
null
Returns
null
Generated by Doxygen
90 Module Documentation
Attention
Parameters
void ∗para: pointer to parameter
Returns
null
Generated by Doxygen
4.22 PWM Driver APIs 91
Data Structures
• struct pwm_param
Macros
• #define PWM_CHANNEL_NUM_MAX 8
• #define TIMER0 0
• #define TIMER1 1
• #define TIMER2 2
• #define TIMER3 3
• #define CHANNEL0 0
• #define CHANNEL1 1
• #define CHANNEL2 2
• #define CHANNEL3 3
• #define CHANNEL4 4
• #define CHANNEL5 5
• #define CHANNEL6 6
• #define CHANNEL7 7
• #define OUTPUT_LOW 0
• #define OUTPUT_HIGH 1
• #define REF_TICK_CLK 0
• #define APB_CLK 1
Functions
Generated by Doxygen
92 Module Documentation
Parameters
uint8 chan_num : channel to pick
Generated by Doxygen
4.22 PWM Driver APIs 93
Returns
null
Parameters
uint8 chan_num : channel to pick
Returns
null
Parameters
uint8 timer_sel : timer to set
uint8 apb_clk_sel : pick clock source for timer
Returns
null
Parameters
uint8 timer_sel : timer to set
uint8 apb_clk_sel :pick clock source for timer
Returns
null
4.22.2.5 void ledc_set_hduty ( uint8 chan_num, uint32 hpoint_val, uint32 duty_val, uint8 increase, uint16 duty_num, uint16
duty_cycle, uint16 duty_scale )
Generated by Doxygen
94 Module Documentation
Parameters
Returns
null
frequency=base_clk_frequency∗div_num∗(2∧ timer_lim)/256
Parameters
uint8 timer_sel : timer to set
uint32 div_num : set first divider
uint8 timer_lim : set second divider
Returns
null
Parameters
uint8 chan_num : channel to pick
uint8 timer_sel : timer to set
Returns
null
Generated by Doxygen
4.22 PWM Driver APIs 95
Parameters
uint8 chan_num : channel to pick
uint8 idle_level : choose output as high or low
Returns
null
Parameters
uint8 chan_num : channel to pick
uint8 idle_level : choose output as high or low
Returns
null
4.22.2.10 void ledc_set_lduty ( uint8 chan_num, uint32 hpoint_val, uint32 duty_val, uint8 increase, uint16 duty_num, uint16
duty_cycle, uint16 duty_scale )
Parameters
Returns
null
frequency=base_clk_frequency∗div_num∗(2∧ timer_lim)/256
Generated by Doxygen
96 Module Documentation
Parameters
uint8 timer_sel : timer to set
uint32 div_num : set first divider
uint8 timer_lim : set second divider
Returns
null
Parameters
uint8 chan_num : channel to pick
uint8 timer_sel : timer to set
Returns
null
Parameters
uint8 timer_sel : timer to set
Returns
null
Parameters
uint8 timer_sel : timer to set
Generated by Doxygen
4.22 PWM Driver APIs 97
Returns
null
Parameters
uint8 timer_sel : timer to set
Returns
null
Parameters
uint8 timer_sel : timer to set
Returns
null
Parameters
uint8 timer_sel : timer to set
Returns
null
Generated by Doxygen
98 Module Documentation
Parameters
uint8 timer_sel : timer to set
Returns
null
Parameters
uint8 channel : PWM channel number
Returns
Parameters
null
Returns
4.22.2.21 void pwm_init ( uint32 period, uint32 ∗ duty, uint32 pwm_channel_num, uint32(∗) pin_info_list[3] )
Attention
Parameters
Returns
null
Set the time that high level signal will last, duty depends on period, the maximum value can be period ∗1000 / 45.
For example, 1KHz PWM, duty range is 0∼22222
Attention
Parameters
uint32 duty : duty cycle
uint8 channel : PWM channel number
Returns
null
Attention
Parameters
uint32 period : PWM period, unit : us.
Returns
null
Starts PWM.
Attention
Generated by Doxygen
100 Module Documentation
Parameters
null
Returns
null
Generated by Doxygen
4.23 UART Driver APIs 101
Functions
Generated by Doxygen
102 Module Documentation
Parameters
UART_Port uart_no : UART0 or UART1
uint32 clr_mask : To clear the interrupt bits
Returns
null
Parameters
UART_Port uart_no : UART0 or UART1
uint16 div : frequency divider
Returns
null
Parameters
null
Returns
null
Parameters
Generated by Doxygen
4.23 UART Driver APIs 103
Returns
null
Parameters
UART_Port uart_no : UART0 or UART1
UART_IntrConfTypeDef ∗pUARTIntrConf : parameters structure
Returns
null
Parameters
UART_Port uart_no : UART0 or UART1
UART_ConfigTypeDef ∗pUARTConfig : parameters structure
Returns
null
Parameters
UART_Port uart_no : UART0 or UART1
Returns
null
Generated by Doxygen
104 Module Documentation
Parameters
UART_Port uart_no : UART0 or UART1
uint32 baud_rate : the Baud rate
Returns
null
Parameters
UART_Port uart_no : UART0 or UART1
UART_HwFlowCtrl flow_ctrl : Hardware flow control mode
uint8 rx_thresh : threshold of Hardware flow control
Returns
null
Parameters
UART_Port uart_no : UART0 or UART1
uint32 ena_mask : To enable the interrupt bits
Returns
null
Parameters
UART_Port uart_no : UART0 or UART1
UART_LineLevelInverse inverse_mask : Choose need to flip the IO
Generated by Doxygen
4.23 UART Driver APIs 105
Returns
null
Parameters
UART_Port uart_no : UART0 or UART1
UART_ParityMode Parity_mode : the enum of uart parity configuration
Returns
null
Parameters
UART_Port uart_no : UART0 or UART1
Returns
null
Parameters
UART_Port uart_no : UART0 or UART1
UART_StopBits bit_num : the length uart communication stop bits
Returns
null
Generated by Doxygen
106 Module Documentation
Parameters
UART_Port uart_no : UART0 or UART1
UART_WordLength len : the length of the uart communication data bits
Returns
null
Parameters
UART_Port uart_no : UART0 or UART1
Returns
null
Generated by Doxygen
Chapter 5
Data Fields
• SYSTEM_EVENT event_id
• Event_Info_u event_info
even ID
event information
The documentation for this struct was generated from the following file:
• include/esp_wifi.h
Data Fields
• struct _os_timer_t ∗ timer_next
• void ∗ timer_handle
• uint32 timer_expire
• uint32 timer_period
• os_timer_func_t ∗ timer_func
• bool timer_repeat_flag
• void ∗ timer_arg
The documentation for this struct was generated from the following file:
• include/esp_timer.h
108 Data Structure Documentation
Data Fields
• char bin_start_flash_id
• char bin_end_flash_id
• char bin_status
• char pad
• unsigned int jump_addr
padding
The documentation for this struct was generated from the following file:
• include/esp_system.h
Generated by Doxygen
5.4 bss_info Struct Reference 109
Data Fields
information of next AP
authmode of AP
MAC address of AP
channel of AP
frequency offset
Generated by Doxygen
110 Data Structure Documentation
single strength of AP
SSID of AP
SSID length
The documentation for this struct was generated from the following file:
• include/esp_sta.h
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/esp_ssc.h
Data Fields
• bool enable
• ip4_addr_t start_ip
• ip4_addr_t end_ip
• ip4_addr_t net_mask
Generated by Doxygen
5.7 Event_Info_u Union Reference 111
end IP of IP range
start IP of IP range
The documentation for this struct was generated from the following file:
• include/esp_misc.h
Data Fields
• 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
Generated by Doxygen
112 Data Structure Documentation
The documentation for this union was generated from the following file:
• include/esp_wifi.h
Data Fields
• int rssi
• uint8 mac [6]
The documentation for this struct was generated from the following file:
• include/esp_wifi.h
Generated by Doxygen
5.9 Event_SoftAPMode_StaConnected_t Struct Reference 113
Data Fields
The documentation for this struct was generated from the following file:
• include/esp_wifi.h
Data Fields
The documentation for this struct was generated from the following file:
• include/esp_wifi.h
Generated by Doxygen
114 Data Structure Documentation
Data Fields
• uint8 old_mode
• uint8 new_mode
The documentation for this struct was generated from the following file:
• include/esp_wifi.h
Data Fields
BSSID of connected AP
channel of connected AP
SSID of connected AP
Generated by Doxygen
5.13 Event_StaMode_Disconnected_t Struct Reference 115
The documentation for this struct was generated from the following file:
• include/esp_wifi.h
Data Fields
BSSID of disconnected AP
reason of disconnection
SSID of disconnected AP
The documentation for this struct was generated from the following file:
• include/esp_wifi.h
Data Fields
• ip4_addr_t ip
• ip4_addr_t mask
• ip4_addr_t gw
Generated by Doxygen
116 Data Structure Documentation
5.14.1.1 ip4_addr_t gw
5.14.1.2 ip4_addr_t ip
The documentation for this struct was generated from the following file:
• include/esp_wifi.h
Data Fields
• uint32 status
• struct bss_info ∗ bss
The documentation for this struct was generated from the following file:
• include/esp_wifi.h
Generated by Doxygen
5.16 GPIO_ConfigTypeDef Struct Reference 117
Data Fields
• uint32 GPIO_Pin
• uint32 GPIO_Pin_high
• GPIOMode_TypeDef GPIO_Mode
• GPIO_Pullup_IF GPIO_Pullup
• GPIO_Pulldown_IF GPIO_Pulldown
• GPIO_INT_TYPE GPIO_IntrType
GPIO mode
GPIO pin
GPIO pin
GPIO pulldown
GPIO pullup
The documentation for this struct was generated from the following file:
• driver_lib/include/gpio.h
Generated by Doxygen
118 Data Structure Documentation
Data Fields
• ip4_addr_t ip
• ip4_addr_t netmask
• ip4_addr_t gw
5.17.1.1 ip4_addr_t gw
gateway
5.17.1.2 ip4_addr_t ip
IP address
netmask
The documentation for this struct was generated from the following file:
• include/esp_wifi.h
Data Fields
configuration mask
HT40 second channel, this parameter is for AP only, for sta the second channel is determined by AP
Generated by Doxygen
5.19 pwm_param Struct Reference 119
phy bandwidth
phy mode
The documentation for this struct was generated from the following file:
• include/esp_phy.h
Data Fields
• uint32 period
• uint32 freq
• uint32 duty [PWM_CHANNEL_NUM_MAX]
The documentation for this struct was generated from the following file:
• driver_lib/include/pwm.h
Data Fields
• uint8_t schan
• uint8_t nchan
• uint8_t maxtxpwr
Generated by Doxygen
120 Data Structure Documentation
< regdomain_chan indicates on operation class Start channel number, the range is from 1 to 14
The documentation for this struct was generated from the following file:
• include/esp_regdomain.h
Data Structures
• struct regdomain_chan
Data Fields
• uint8_t rd_sta_enable
• uint8_t rd_ap_enable
• uint16_t regdomain
• uint16_t country
• uint8_t location
• char isocc [2]
• uint8_t ngroup
• struct regdomain_info::regdomain_chan chan [REGDOMAIN_CHANGROUP_MAX]
Generated by Doxygen
5.22 remote_bin_info Struct Reference 121
regdomain
The documentation for this struct was generated from the following file:
• include/esp_regdomain.h
Data Fields
• uint32 b_sumlen
• uint32 b_irom1len
• uint8 flash_id_num
the number of flash id occupied by bin file ,can be calculated by b_sumlen & b_irom1len
The documentation for this struct was generated from the following file:
• include/upgrade.h
Generated by Doxygen
122 Data Structure Documentation
Data Fields
• uint8 ∗ ssid
• uint8 ∗ bssid
• uint8 channel
• uint8 show_hidden
MAC address of AP
SSID of AP
The documentation for this struct was generated from the following file:
• include/esp_sta.h
Data Fields
• uint32 blocksize: 12
• uint32 datalen: 12
• uint32 unused: 5
• uint32 sub_sof: 1
• uint32 eof: 1
• uint32 owner: 1
• uint32 buf_ptr
• uint32 next_link_ptr
The documentation for this struct was generated from the following file:
• driver_lib/include/i2s.h
Generated by Doxygen
5.25 server_info Struct Reference 123
Data Fields
The documentation for this struct was generated from the following file:
• include/upgrade.h
Data Fields
Generated by Doxygen
124 Data Structure Documentation
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/esp_softap.h
Data Fields
Generated by Doxygen
5.28 station_info Struct Reference 125
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.
password of target AP
SSID of target AP
The documentation for this struct was generated from the following file:
• include/esp_sta.h
Data Fields
Information of next AP
BSSID of AP
Generated by Doxygen
126 Data Structure Documentation
5.28.2.2 ip4_addr_t ip
IP address of AP
The documentation for this struct was generated from the following file:
• include/esp_softap.h
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:
• driver_lib/include/uart.h
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:
• driver_lib/include/uart.h
Data Fields
Generated by Doxygen
5.31 upgrade_info Struct Reference 127
check back function ,if user defined it ,it will be called whether OTA success or failed immediate
upgrade flag need be checked in upgrade check callback func ,false OTA failed ,true OTA success
The documentation for this struct was generated from the following file:
• include/upgrade.h
Generated by Doxygen
128 Data Structure Documentation
Generated by Doxygen