国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

ESP32-C3入門教程 網(wǎng)絡(luò)篇①——WiFi Scan 快速掃描附近AP無線熱點(diǎn)

Simon_Zhou / 2398人閱讀

摘要:,初始化底層堆棧,創(chuàng)建默認(rèn)事件循環(huán)。,使用默認(rèn)配置創(chuàng)建對(duì)象,將連接到并注冊(cè)默認(rèn)處理程序。,為驅(qū)動(dòng)初始化分配資源,如控制結(jié)構(gòu)緩沖區(qū)結(jié)構(gòu)等,這個(gè)也啟動(dòng)任務(wù)。必須先調(diào)用此,然后才能調(diào)用所有其他,設(shè)置工作模式為或,默認(rèn)模式為模式。

一、快速運(yùn)行

  • 示例項(xiàng)目中,選擇WiFi—>scan
  • menuconfig配置ESP32C3-Specific—>Rec 0
  • 芯片選擇ESP32-C3(Built-in USB JTAG)
  • 快速運(yùn)行ESP-IDF Build, Flash and Monitor(左下角)

二、運(yùn)行效果


三、程序流程

  • nvs_flash_init,初始化默認(rèn) NVS 分區(qū)。
  • esp_netif_init,初始化底層TCP/IP堆棧
  • esp_event_loop_create_default,創(chuàng)建默認(rèn)事件循環(huán)。
  • esp_netif_create_default_wifi_sta,使用默認(rèn)WiFi Station配置創(chuàng)建esp_netif對(duì)象,將netif連接到WiFi并注冊(cè)默認(rèn)WiFi處理程序。
  • esp_wifi_init,為 WiFi 驅(qū)動(dòng)初始化 WiFi 分配資源,如 WiFi 控制結(jié)構(gòu)、RX/TX 緩沖區(qū)、WiFi NVS 結(jié)構(gòu)等,這個(gè) WiFi 也啟動(dòng) WiFi 任務(wù)。必須先調(diào)用此API,然后才能調(diào)用所有其他WiFi API
  • esp_wifi_set_mode,設(shè)置WiFi工作模式為station、soft-AP或station+soft-AP,默認(rèn)模式為soft-AP模式。本程序設(shè)置為station
  • esp_wifi_start,根據(jù)配置,啟動(dòng)WiFi
  • esp_wifi_scan_start,掃描所有有效的AP
  • esp_wifi_scan_get_ap_records,獲取上次掃描中找到的AP列表
  • esp_wifi_scan_get_ap_num,獲取上次掃描中找到的AP數(shù)

四、關(guān)鍵函數(shù)

4.1 掃描所有有效的AP

  • config,掃描的配置
  • block,是否堵塞程序運(yùn)行
/**  * @brief     Scan all available APs.  *  * @attention If this API is called, the found APs are stored in WiFi driver dynamic allocated memory and the  *            will be freed in esp_wifi_scan_get_ap_records, so generally, call esp_wifi_scan_get_ap_records to cause  *            the memory to be freed once the scan is done  * @attention The values of maximum active scan time and passive scan time per channel are limited to 1500 milliseconds.  *            Values above 1500ms may cause station to disconnect from AP and are not recommended.  *  * @param     config  configuration of scanning  * @param     block if block is true, this API will block the caller until the scan is done, otherwise  *                         it will return immediately  *  * @return  *    - ESP_OK: succeed  *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init  *    - ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start  *    - ESP_ERR_WIFI_TIMEOUT: blocking scan is timeout  *    - ESP_ERR_WIFI_STATE: wifi still connecting when invoke esp_wifi_scan_start  *    - others: refer to error code in esp_err.h  */esp_err_t esp_wifi_scan_start(const wifi_scan_config_t *config, bool block);

4.2 獲取上次掃描中找到的AP列表

  • number,返回的最大ap個(gè)數(shù)
  • ap_records,返回的app記錄數(shù)組
/**  * @brief     Get AP list found in last scan  *  * @param[inout]  number As input param, it stores max AP number ap_records can hold.  *                As output param, it receives the actual AP number this API returns.  * @param         ap_records  wifi_ap_record_t array to hold the found APs  *  * @return  *    - ESP_OK: succeed  *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init  *    - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start  *    - ESP_ERR_INVALID_ARG: invalid argument  *    - ESP_ERR_NO_MEM: out of memory  */esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records);

4.3 獲取上次掃描中找到的AP數(shù)

  • number,存儲(chǔ)上次掃描中找到的API數(shù)
/**  * @brief     Get number of APs found in last scan  *  * @param[out] number  store number of APs found in last scan  *  * @attention This API can only be called when the scan is completed, otherwise it may get wrong value.  *  * @return  *    - ESP_OK: succeed  *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init  *    - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start  *    - ESP_ERR_INVALID_ARG: invalid argument  */esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number);

覺得好,就一鍵三連唄(點(diǎn)贊+收藏+關(guān)注)

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://specialneedsforspecialkids.com/yun/121072.html

相關(guān)文章

  • ESP32-S2上使用SPI接口芯片DM9051NP轉(zhuǎn)以太網(wǎng)的無線物聯(lián)網(wǎng)網(wǎng)關(guān)開發(fā)指導(dǎo)

    摘要:前言芯片接口占用管腳數(shù)量比以太網(wǎng)的少,版線布局可更精簡。網(wǎng)卡芯片介紹接口網(wǎng)卡芯片是為方物聯(lián)網(wǎng)行業(yè)進(jìn)以太網(wǎng)通信而開發(fā)出的解決方案。此應(yīng)用可用于監(jiān)控家庭物聯(lián)網(wǎng)網(wǎng)關(guān)搭建等。 前言 ????DM9051NP芯片?SPI接口占用管腳數(shù)量比以太網(wǎng)PHY的RMII/MII少,PCBA版線布局可更精簡。...

    wangjuntytl 評(píng)論0 收藏0
  • 《安富萊嵌入式周報(bào)》第228期:2021.08.30--2021.09.05

    摘要:論壇下載由于庫是不帶中值濾波器的,需要自己實(shí)現(xiàn),所以花了點(diǎn)時(shí)間制作了一個(gè)章節(jié)。紅色線是波形高斯白噪聲均勻白噪聲。第版教程發(fā)布中文顯示章節(jié)論壇下載可以直接運(yùn)行界面效果,也可以使用可以直接編譯運(yùn)行。上位機(jī)已經(jīng)整合主機(jī),下一版發(fā)布 往期周報(bào)匯總地址:http://www.armbbs.cn/for...

    劉東 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<