2
2
3
3
extern " C" {
4
4
#include " WiFiGeneric.h"
5
- // void tcpipInit();
6
5
};
7
6
8
7
@@ -22,23 +21,6 @@ static void ethernet_config_gpio(void){
22
21
phy_rmii_smi_configure_pins (PIN_SMI_MDC, PIN_SMI_MDIO);
23
22
}
24
23
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 (ð_config);
35
- if (!err){
36
- err = esp_eth_enable ();
37
- return 1 ;
38
- }
39
- return 0 ;
40
- }
41
-
42
24
int EthernetClass::config (IPAddress local_ip, IPAddress subnet, IPAddress gateway)
43
25
{
44
26
// stop the DHCP service
@@ -64,6 +46,26 @@ int EthernetClass::config(IPAddress local_ip, IPAddress subnet, IPAddress gatewa
64
46
return 1 ;
65
47
}
66
48
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 (ð_config);
62
+ if (!err){
63
+ err = esp_eth_enable ();
64
+ return 1 ;
65
+ }
66
+ return 0 ;
67
+ }
68
+
67
69
int EthernetClass::begin (IPAddress local_ip, IPAddress subnet, IPAddress gateway)
68
70
{
69
71
// connect the callback function
0 commit comments