29 lines
624 B
C
29 lines
624 B
C
#include <freertos/FreeRTOS.h>
|
|
|
|
#include <esp_event.h>
|
|
#include <esp_netif.h>
|
|
#include <protocol_examples_common.h>
|
|
#include <nvs_flash.h>
|
|
#include "example.h"
|
|
|
|
static void
|
|
initialize_nvs()
|
|
{
|
|
esp_err_t err = nvs_flash_init();
|
|
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
|
ESP_ERROR_CHECK( nvs_flash_erase() );
|
|
err = nvs_flash_init();
|
|
}
|
|
ESP_ERROR_CHECK(err);
|
|
}
|
|
|
|
void
|
|
app_main(void)
|
|
{
|
|
ESP_ERROR_CHECK(esp_netif_init());
|
|
initialize_nvs();
|
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
|
ESP_ERROR_CHECK(example_connect());
|
|
|
|
start_sshd();
|
|
} |