ethernet:add start stop control

This commit is contained in:
morris
2019-11-28 13:42:14 +08:00
parent 37154d4c08
commit 96e6049dab
12 changed files with 142 additions and 20 deletions

View File

@@ -232,6 +232,7 @@ static void start()
#endif
esp_eth_config_t config = ETH_DEFAULT_CONFIG(s_mac, s_phy);
ESP_ERROR_CHECK(esp_eth_driver_install(&config, &s_eth_handle));
ESP_ERROR_CHECK(esp_eth_start(s_eth_handle));
s_connection_name = "Ethernet";
}
@@ -242,6 +243,7 @@ static void stop()
ESP_ERROR_CHECK(esp_event_handler_unregister(IP_EVENT, IP_EVENT_GOT_IP6, &on_got_ipv6));
ESP_ERROR_CHECK(esp_event_handler_unregister(ETH_EVENT, ETHERNET_EVENT_CONNECTED, &on_eth_event));
#endif
ESP_ERROR_CHECK(esp_eth_stop(s_eth_handle));
ESP_ERROR_CHECK(esp_eth_driver_uninstall(s_eth_handle));
ESP_ERROR_CHECK(s_phy->del(s_phy));
ESP_ERROR_CHECK(s_mac->del(s_mac));