network changes
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
#include "types.hpp"
|
||||
|
||||
// Project includes
|
||||
#include "network.hpp"
|
||||
#include "led.hpp"
|
||||
#include "network.hpp"
|
||||
|
||||
// Forward declarations
|
||||
#if CONFIG_CALENDINK_BLINK_IP
|
||||
@@ -47,6 +47,9 @@ internal volatile bool s_eth_link_up = false;
|
||||
internal bool s_ethernet_connected = false;
|
||||
#endif
|
||||
|
||||
void initialize_network() { ESP_ERROR_CHECK(esp_netif_init()); }
|
||||
void shutdown_network() { ESP_ERROR_CHECK(esp_netif_deinit()); }
|
||||
|
||||
void ethernet_event_handler(void *arg, esp_event_base_t event_base,
|
||||
int32_t event_id, void *event_data)
|
||||
{
|
||||
@@ -114,8 +117,6 @@ void teardown_ethernet()
|
||||
s_eth_netif = nullptr;
|
||||
s_eth_handles = nullptr;
|
||||
s_eth_count = 0;
|
||||
|
||||
esp_netif_deinit();
|
||||
}
|
||||
|
||||
esp_err_t connect_ethernet(bool blockUntilIPAcquired)
|
||||
@@ -132,10 +133,6 @@ esp_err_t connect_ethernet(bool blockUntilIPAcquired)
|
||||
{
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
// Connection is split in two steps. First we open the connection and ask for
|
||||
// an ip. Second a semaphor will block until the ip is acquired. If we dont
|
||||
// block then the user have to verify the semaphore before continuing.
|
||||
ESP_ERROR_CHECK(esp_netif_init());
|
||||
ESP_ERROR_CHECK(ethernet_init_all(&s_eth_handles, &s_eth_count));
|
||||
|
||||
esp_netif_inherent_config_t esp_netif_config =
|
||||
@@ -305,7 +302,7 @@ void teardown_wifi()
|
||||
}
|
||||
|
||||
esp_err_t connect_wifi(const char *ssid, const char *password,
|
||||
bool blockUntilIPAcquired)
|
||||
bool blockUntilIPAcquired)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
assert(!s_wifi_connected && "WiFi connect called but already connected!");
|
||||
|
||||
Reference in New Issue
Block a user