Add ESP8266 example

This commit is contained in:
cpq committed 2020-12-27 01:29:42 +00:00
1 parent 7d1ef2ffe8
commit 71a22adc06
13 files changed
+194 -51

No files matched your search

+9 -8
View File
@@ -1,13 +1,13 @@
// Code taken from the ESP32 IDF WiFi station Example
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_event.h"
#include "esp_log.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "freertos/task.h"
#include "nvs_flash.h"
#include "lwip/err.h"
@@ -17,11 +17,12 @@
static EventGroupHandle_t s_wifi_event_group;
/* The event group allows multiple bits for each event, but we only care about two events:
/* The event group allows multiple bits for each event, but we only care about
* two events:
* - we are connected to the AP with an IP
* - we failed to connect after the maximum amount of retries */
#define WIFI_CONNECTED_BIT BIT0
#define WIFI_FAIL_BIT BIT1
#define WIFI_FAIL_BIT BIT1
static int s_retry_num = 0;
@@ -47,7 +48,7 @@ static void event_handler(void *arg, esp_event_base_t event_base,
}
}
void wifi_init(const char *ssid, const char *pass, void (*fn)(void)) {
void wifi_init(const char *ssid, const char *pass) {
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES ||
ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {