logo资料库

ESP8266API参考手册英文版.pdf

第1页 / 共212页
第2页 / 共212页
第3页 / 共212页
第4页 / 共212页
第5页 / 共212页
第6页 / 共212页
第7页 / 共212页
第8页 / 共212页
资料共212页,剩余部分请下载后查看
ESP8266 Non-OS SDK API Reference Version 2.0.0 Copyright © 2016 

About This Guide This document lists ESP8266_NONOS_SDK APIs. The document is structured as follows. Chapter Chapter 1 Chapter 2 Title Subject Preambles An instruction to the ESP8266EX Overview An overview of the ESP8266_NONOS_SDK Chapter 3 System APIs Important system APIs for timer control, SPI flash operations, Wi-Fi radio control and OTA firmware upgrade Chapter 4 TCP/UDP APIs APIs for TCP/UDP operation Chapter 5 Mesh APIs Mesh APIs for the ESP8266 Chapter 6 Application Related Application specific APIs (AT command set and JSON parser) Chapter 7 Definitions & Structures Important definitions and data structures Chapter 8 Peripheral Related Drivers APIs for peripheral interfacing (GPIO, UART, I2C, PWM and SDIO) Chapter 9 Appendix Other relevant information Release Notes Date 2016.01 2016.03 2016.04 2016.06 Version V1.5.2 V1.5.2 V1.5.3 V1.5.4 2016.07 V2.0.0 Release notes First Release. Updated Chapter 3.2, Chapter 9.5 and Chapter 3.3.37. Added Chapter 3.5.11 and Chapter 3.5.12. Updated Chapter 3.5.67 and Chapter 3.7.9. Added Chapter 3.3.8 and Chapter 3.7.8. Added Chapter 3.3.46, Chapter 3.3.47, and Chapter 3.3.48 Updated Chapter 3.7 Added Chapter 3.9, Chapter 3.14, Chapter 3.3.48, Chapter 3.5.72 and Chapter 3.5.73 Updated Chapter 3.8.6, Chapter 3.5.65
Table of Contents 1. Preambles ................................................................................................................................................. 14 2. Overview ................................................................................................................................................... 15 3. Application Programming Interface (APIs) 3.1. Software Timer 1. 2. 3. 4. 5. os_timer_arm os_timer_disarm os_timer_setfn system_timer_reinit os_timer_arm_us 3.2. Hardware Timer hw_timer_init hw_timer_arm hw_timer_set_func 3.3. ............................................................................................ ..................................................................................................................................................... ........................................................................................................................................................... ...................................................................................................................................................... ......................................................................................................................................................... ................................................................................................................................................ ..................................................................................................................................................... ................................................................................................................................................... ........................................................................................................................................................... .......................................................................................................................................................... ................................................................................................................................................ .................................................................................................................................... ........................................................................................................................................................... ....................................................................................................................................... ........................................................................................................................................................ ........................................................................................................................................................ ............................................................................................................................................. ................................................................................................................................................ ................................................................................................................................................ ................................................................................................................................................... ........................................................................................................................................... ............................................................................................................................................... .......................................................................................................................... ..................................................................................................................................... ..................................................................................................................... ................................................................................................................................... ........................................................................................................................ .............................................................................................................................................. ........................................................................................................................................ ................................................................................................................................. ...................................................................................................................................................... ....................................................................................................................................................... .................................................................................................................................................... ............................................................................................................................................. .................................................................................................................................. 1. 2. 3. 4. Hardware timer example System APIs 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. system_deep_sleep_set_option 11. system_phy_set_rfoption 12. system_phy_set_powerup_option 13. system_phy_set_max_tpw 14. system_phy_set_tpw_via_vdd33 15. system_set_os_print 16. system_print_meminfo 17. system_get_free_heap_size 18. system_os_task 19. system_os_post 20. system_get_time 21. 22. system_rtc_clock_cali_proc system_get_sdk_version system_restore system_restart system_init_done_cb system_get_chip_id system_get_vdd33 system_adc_read system_adc_read_fast system_deep_sleep 16 16 16 17 17 17 18 18 19 19 20 20 21 21 21 22 22 23 23 24 24 26 26 27 28 28 29 29 29 30 30 31 32 32 33 system_get_rtc_time
23. system_rtc_mem_write 24. system_rtc_mem_read 25. system_uart_swap 26. system_uart_de_swap 27. system_get_boot_version 28. system_get_userbin_addr 29. system_get_boot_mode 30. system_restart_enhance 31. system_update_cpu_freq 32. system_get_cpu_freq 33. system_get_flash_size_map 34. system_get_rst_info 35. system_soft_wdt_stop 36. system_soft_wdt_restart 37. system_soft_wdt_feed 38. system_show_malloc 39. os_memset 40. os_memcpy 41. os_strlen 42. os_printf 43. os_bzero 44. os_delay_us 45. os_install_putc1 46. os_random 47. os_get_random 48. user_rf_cal_sector_set SPI Flash Related APIs 1. 2. 3. 4. 5. 6. 7. ........................................................................................................................................ .......................................................................................................................................... ................................................................................................................................................. ........................................................................................................................................... .................................................................................................................................... .................................................................................................................................... ....................................................................................................................................... ...................................................................................................................................... ..................................................................................................................................... ............................................................................................................................................ ................................................................................................................................. .............................................................................................................................................. .......................................................................................................................................... ..................................................................................................................................... ......................................................................................................................................... ............................................................................................................................................ ............................................................................................................................................................... .............................................................................................................................................................. ................................................................................................................................................................... ................................................................................................................................................................... ................................................................................................................................................................... .............................................................................................................................................................. ....................................................................................................................................................... ............................................................................................................................................................... ....................................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................ ....................................................................................................................................................... .......................................................................................................................................... ........................................................................................................................................................ .......................................................................................................................................................... .................................................................................................................... .............................................................................................................................................. ........................................................................................................................................ .............................................................................................................................................. ................................................................................................................................................... ..................................................................................................................................... ..................................................................................................................................................... .................................................................................................................................... ......................................................................................................................................... .......................................................................................................................... spi_flash_get_id spi_flash_erase_sector spi_flash_write spi_flash_read system_param_save_with_protect system_param_load spi_flash_set_read_func 33 34 34 35 35 35 36 36 37 37 37 38 39 39 40 40 41 41 42 42 42 43 43 43 44 44 46 46 46 47 47 48 49 50 50 50 51 51 52 52 52 3.4. 3.5. Wi-Fi Related APIs 1. wifi_get_opmode 2. wifi_get_opmode_default 3. wifi_set_opmode 4. wifi_set_opmode_current 5. wifi_station_get_config 6. wifi_station_get_config_default
7. wifi_station_set_config 8. wifi_station_set_config_current 9. wifi_station_set_cert_key 10. wifi_station_clear_cert_key 11. wifi_station_set_username 12. wifi_station_clear_username 13. wifi_station_connect 14. wifi_station_disconnect 15. wifi_station_get_connect_status 16. wifi_station_scan 17. scan_done_cb_t 18. wifi_station_ap_number_set 19. wifi_station_get_ap_info 20. wifi_station_ap_change 21. wifi_station_get_current_ap_id 22. wifi_station_get_auto_connect 23. wifi_station_set_auto_connect 24. wifi_station_dhcpc_start 25. wifi_station_dhcpc_stop 26. wifi_station_dhcpc_status 27. wifi_station_dhcpc_set_maxtry 28. wifi_station_set_reconnect_policy 29. wifi_station_get_rssi 30. wifi_station_set_hostname 31. wifi_station_get_hostname 32. wifi_softap_get_config 33. wifi_softap_get_config_default 34. wifi_softap_set_config 35. wifi_softap_set_config_current 36. wifi_softap_get_station_num 37. wifi_softap_get_station_info 38. wifi_softap_free_station_info 39. wifi_softap_dhcps_start 40. wifi_softap_dhcps_stop 41. wifi_softap_set_dhcps_lease 42. wifi_softap_get_dhcps_lease 43. wifi_softap_set_dhcps_lease_time 44. wifi_softap_get_dhcps_lease_time 45. wifi_softap_reset_dhcps_lease_time 46. wifi_softap_dhcps_status 47. wifi_softap_set_dhcps_offer_option ......................................................................................................................................... .......................................................................................................................... ..................................................................................................................................... .................................................................................................................................. .................................................................................................................................. ............................................................................................................................... ............................................................................................................................................. ........................................................................................................................................ ........................................................................................................................ .................................................................................................................................................... ....................................................................................................................................................... ................................................................................................................................ ...................................................................................................................................... ........................................................................................................................................ ........................................................................................................................... ............................................................................................................................ ............................................................................................................................ ...................................................................................................................................... ....................................................................................................................................... ................................................................................................................................... .......................................................................................................................... ..................................................................................................................... .............................................................................................................................................. .................................................................................................................................. ................................................................................................................................. .......................................................................................................................................... ........................................................................................................................... .......................................................................................................................................... .......................................................................................................................... .............................................................................................................................. ................................................................................................................................ .............................................................................................................................. ....................................................................................................................................... ........................................................................................................................................ ............................................................................................................................... ............................................................................................................................... ..................................................................................................................... ...................................................................................................................... .................................................................................................................. ...................................................................................................................................... .................................................................................................................. 53 54 54 56 56 56 57 57 58 58 59 59 60 60 60 61 61 62 62 63 63 63 64 64 64 65 65 65 66 66 67 67 68 68 69 70 70 71 71 71 72
48. wifi_set_phy_mode 49. wifi_get_phy_mode 50. wifi_get_ip_info 51. wifi_set_ip_info 52. wifi_set_macaddr 53. wifi_get_macaddr 54. wifi_set_sleep_type 55. wifi_get_sleep_type 56. wifi_status_led_install 57. wifi_status_led_uninstall 58. wifi_set_broadcast_if 59. wifi_get_broadcast _if 60. wifi_set_event_handler_cb 61. wifi_wps_enable 62. wifi_wps_disable 63. wifi_wps_start 64. wifi_set_wps_cb 65. wifi_register_send_pkt_freedom_cb 66. wifi_unregister_send_pkt_freedom_cb 67. wifi_send_pkt_freedom 68. wifi_rfid_locp_recv_open 69. wifi_rfid_locp_recv_close 70. wifi_register_rfid_locp_recv_cb 71. wifi_unregister_rfid_locp_recv_cb 72. wifi_enable_gpio_wakeup 73. wifi_disable_gpio_wakeup ................................................................................................................................................ ................................................................................................................................................ ....................................................................................................................................................... ........................................................................................................................................................ .................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................ ................................................................................................................................................ ............................................................................................................................................ ....................................................................................................................................... ............................................................................................................................................. ........................................................................................................................................... ................................................................................................................................... ..................................................................................................................................................... ..................................................................................................................................................... .......................................................................................................................................................... ....................................................................................................................................................... .................................................................................................................. ............................................................................................................. ........................................................................................................................................ ...................................................................................................................................... ...................................................................................................................................... ........................................................................................................................... ...................................................................................................................... .................................................................................................................................... ................................................................................................................................... ................................................................................................................................................ ....................................................................................................................................... ....................................................................................................................................... .......................................................................................................................................... ........................................................................................................................................ .............................................................................................................................. ............................................................................................................................. .................................................................................................................................................. ........................................................................................................................................................ ........................................................................................................................................................ ............................................................................................................................................ ..................................................................................................................................... ................................................................................................................................................. ...................................................................................................................................... ...................................................................................................................................... 72 73 73 74 75 76 76 77 77 78 78 78 79 80 81 81 81 82 83 83 84 85 85 85 86 86 87 87 88 88 89 91 91 92 92 92 93 93 94 94 95 3.6. Rate Control APIs 3.7. 1. wifi_set_user_fixed_rate 2. wifi_get_user_fixed_rate 3. wifi_set_user_sup_rate 4. wifi_set_user_rate_limit 5. wifi_set_user_limit_rate_mask 6. wifi_get_user_limit_rate_mask Force Sleep APIs 1. wifi_fpm_open 2. wifi_fpm_close 3. wifi_fpm_do_wakeup 4. wifi_fpm_set_wakeup_cb 5. wifi_fpm_do_sleep 6. wifi_fpm_set_sleep_type 7. wifi_fpm_get_sleep_type
Example 3.8. 3.9. 8. wifi_fpm_auto_sleep_set_in_null_mode 9. ESP-NOW APIs 1. roles of ESP-NOW 2. esp_now_init 3. esp_now_deinit 4. esp_now_register_recv_cb 5. esp_now_unregister_recv_cb 6. esp_now_register_send_cb 7. esp_now_unregister_send_cb 8. esp_now_send 9. esp_now_add_peer 10. esp_now_del_peer 11. esp_now_set_self_role 12. esp_now_get_self_role 13. esp_now_set_peer_role 14. esp_now_get_peer_role 15. esp_now_set_peer_key 16. esp_now_get_peer_key 17. esp_now_set_peer_channel 18. esp_now_get_peer_channel 19. esp_now_is_peer_exist 20. esp_now_fetch_peer 21. esp_now_get_cnt_info 22. esp_now_set_kok Simple Pair APIs 1. status of simple pair 2. register_simple_pair_status_cb 3. unregister_simple_pair_status_cb 4. simple_pair_init 5. simple_pair_deinit 6. simple_pair_state_reset 7. simple_pair_ap_enter_announce_mode 8. simple_pair_sta_enter_scan_mode 9. simple_pair_sta_start_negotiate 10. simple_pair_ap_start_negotiate 11. 12. 13. ............................................................................................................ ................................................................................................................................................................... .................................................................................................................................................... ................................................................................................................................................ ........................................................................................................................................................... ....................................................................................................................................................... ................................................................................................................................... ........................................................................................................................... ............................................................................................................................... ............................................................................................................................ ...................................................................................................................................................... .............................................................................................................................................. ............................................................................................................................................... ........................................................................................................................................ ........................................................................................................................................ ...................................................................................................................................... ...................................................................................................................................... ....................................................................................................................................... ....................................................................................................................................... ............................................................................................................................... .............................................................................................................................. ........................................................................................................................................ ........................................................................................................................................... ......................................................................................................................................... ................................................................................................................................................. ................................................................................................................................................. .......................................................................................................................................... ........................................................................................................................ .................................................................................................................... ..................................................................................................................................................... ................................................................................................................................................ ....................................................................................................................................... .......................................................................................................... ................................................................................................................... ......................................................................................................................... .......................................................................................................................... ....................................................................................................................... ..................................................................................................................................... .................................................................................................................................... ......................................................................................................................................... ....................................................................................................................... simple_pair_ap_refuse_negotiate simple_pair_set_peer_ref simple_pair_get_peer_ref 95 96 98 98 99 99 99 100 100 101 102 102 103 103 103 104 104 104 105 105 106 106 106 107 107 108 108 108 109 109 109 110 110 110 111 111 111 112 112 113 113 3.10. Upgrade (FOTA) APIs 1. system_upgrade_userbin_check
3.11. Sniffer Related APIs 3.12. Smart Config APIs 1. 2. 3. 4. 5. 6. smartconfig_start smartconfig_stop smartconfig_set_type airkiss_version airkiss_lan_recv airkiss_lan_pack 3.13. SNTP APIs 2. 3. 4. 5. system_upgrade_flag_set system_upgrade_flag_check system_upgrade_start system_upgrade_reboot 1. wifi_promiscuous_enable 2. wifi_promiscuous_set_mac 3. wifi_set_promiscuous_rx_cb 4. wifi_get_channel 5. wifi_set_channel .................................................................................................................................... .............................................................................................................................. ......................................................................................................................................... ..................................................................................................................................... ........................................................................................................................................... .................................................................................................................................... ................................................................................................................................. ............................................................................................................................... .................................................................................................................................................... .................................................................................................................................................... ............................................................................................................................................... .................................................................................................................................................. .................................................................................................................................................. ......................................................................................................................................... ...................................................................................................................................................... ..................................................................................................................................................... ..................................................................................................................................................... ............................................................................................................................................................ ...................................................................................................................................................... ...................................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... .................................................................................................................................................................. ................................................................................................................................................................ ............................................................................................................................ ............................................................................................................................................... ............................................................................................................................................... .............................................................................................................................................. ...................................................................................................................................................... ...................................................................................................................................... ......................................................................................................... .............................................................................................................. ........................................................................................................... ................................................................................................................. ............................................................................................................. ........................................................................................................... ....................................................................................................... ............................................................................................................ ......................................................................................................... ................................................................................................... .............................................................................................. 1. wifi_station_set_wpa2_enterprise_auth 2. wifi_station_set_enterprise_cert_key 3. wifi_station_clear_enterprise_cert_key 4. wifi_station_set_enterprise_ca_cert 5. wifi_station_clear_enterprise_ca_cert 6. wifi_station_set_enterprise_username 7. wifi_station_clear_enterprise_username 8. wifi_station_set_enterprise_password 9. wifi_station_clear_enterprise_password 10. wifi_station_set_enterprise_new_password 11. wifi_station_clear_enterprise_new_password 1. sntp_setserver 2. sntp_getserver 3. sntp_setservername 4. sntp_getservername 5. sntp_init 6. sntp_stop 7. sntp_get_current_timestamp 8. sntp_get_real_time 9. sntp_set_timezone 10. sntp_get_timezone 11. SNTP Example 113 114 114 114 115 115 115 116 116 116 117 117 119 120 120 120 121 123 123 123 123 124 124 124 125 125 125 126 126 127 127 128 129 129 129 130 130 131 131 131 132 3.14. WPA2_Enterprise APIs
分享到:
收藏