Skip to content

Commit eecefc1

Browse files
committed
Enabled WiFi for tcpip_adapter
1 parent 4b00d3a commit eecefc1

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

libraries/Ethernet/src/Ethernet.cpp

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
extern "C" {
44
#include "WiFiGeneric.h"
5-
//void tcpipInit();
65
};
76

87

@@ -22,23 +21,6 @@ static void ethernet_config_gpio(void){
2221
phy_rmii_smi_configure_pins(PIN_SMI_MDC, PIN_SMI_MDIO);
2322
}
2423

25-
void tcpipInit();
26-
27-
int EthernetClass::begin()
28-
{
29-
eth_config.phy_addr = ETH_PHY_ADDR;
30-
eth_config.gpio_config = ethernet_config_gpio;
31-
eth_config.tcpip_input = tcpip_adapter_eth_input;
32-
//eth_config.phy_power_enable = ethernet_power_enable;
33-
tcpipInit();
34-
esp_err_t err = esp_eth_init(&eth_config);
35-
if(!err){
36-
err = esp_eth_enable();
37-
return 1;
38-
}
39-
return 0;
40-
}
41-
4224
int EthernetClass::config(IPAddress local_ip, IPAddress subnet, IPAddress gateway)
4325
{
4426
// stop the DHCP service
@@ -64,6 +46,26 @@ int EthernetClass::config(IPAddress local_ip, IPAddress subnet, IPAddress gatewa
6446
return 1;
6547
}
6648

49+
int EthernetClass::begin()
50+
{
51+
// connect the callback function
52+
esp_event_loop_init(&WiFiGenericClass::_eventCallback, NULL);
53+
54+
// init the TCP/IP adapter
55+
tcpip_adapter_init();
56+
57+
eth_config.phy_addr = ETH_PHY_ADDR;
58+
eth_config.gpio_config = ethernet_config_gpio;
59+
eth_config.tcpip_input = tcpip_adapter_eth_input;
60+
//eth_config.phy_power_enable = ethernet_power_enable;
61+
esp_err_t err = esp_eth_init(&eth_config);
62+
if(!err){
63+
err = esp_eth_enable();
64+
return 1;
65+
}
66+
return 0;
67+
}
68+
6769
int EthernetClass::begin(IPAddress local_ip, IPAddress subnet, IPAddress gateway)
6870
{
6971
// connect the callback function

tools/sdk/lib/libtcpip_adapter.a

2.26 KB
Binary file not shown.

0 commit comments

Comments
 (0)