Code: Select all
esp_err_t event_handler(void *ctx, system_event_t *event)
{
return ESP_OK;
}
Code: Select all
esp_err_t event_handler(void *ctx, system_event_t *event)
{
return ESP_OK;
}
Code: Select all
ESP_ERROR_CHECK( esp_wifi_start() );
Code: Select all
wifi_init_config_t initconf = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK( esp_wifi_init(&initconf) );
Code: Select all
ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) );
Code: Select all
#ifdef NDEBUG
#define ESP_ERROR_CHECK(x) do { \
esp_err_t rc = (x); \
(void) sizeof(rc); \
} while(0);
#else
#define ESP_ERROR_CHECK(x) do { \
esp_err_t rc = (x); \
if (rc != ESP_OK) { \
_esp_error_check_failed(rc, __FILE__, __LINE__, \
__ASSERT_FUNC, #x); \
} \
} while(0);
#endif
Code: Select all
tcpip_adapter_init();
wifi_event_group = xEventGroupCreate();
ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) );
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
wifi_config_t wifi_config = {
.sta = {
.ssid = EXAMPLE_WIFI_SSID,
.password = EXAMPLE_WIFI_PASS,
},
};
ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid);
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
ESP_ERROR_CHECK( esp_wifi_start() );
Code: Select all
ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) );
Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 146 guests