@@ -5,10 +5,10 @@ int EthernetClass::begin(unsigned long timeout, unsigned long responseTimeout)
55{
66 static DhcpClass s_dhcp;
77 _dhcp = &s_dhcp;
8- stm32_eth_init (MACAddressDefault () , NULL , NULL , NULL );
8+ stm32_eth_init (NULL , NULL , NULL , NULL );
99
1010 // Now try to get our config info from a DHCP server
11- int ret = _dhcp->beginWithDHCP (mac_address , timeout, responseTimeout);
11+ int ret = _dhcp->beginWithDHCP (NULL , timeout, responseTimeout);
1212 if (ret == 1 ) {
1313 _dnsServerAddress = _dhcp->getDnsServerIp ();
1414 }
@@ -39,7 +39,7 @@ void EthernetClass::begin(IPAddress local_ip, IPAddress subnet, IPAddress gatewa
3939
4040void EthernetClass::begin (IPAddress local_ip, IPAddress subnet, IPAddress gateway, IPAddress dns_server)
4141{
42- stm32_eth_init (MACAddressDefault () , local_ip.raw_address (), gateway.raw_address (), subnet.raw_address ());
42+ stm32_eth_init (NULL , local_ip.raw_address (), gateway.raw_address (), subnet.raw_address ());
4343 /* If there is a local DHCP informs it of our manual IP configuration to
4444 prevent IP conflict */
4545 stm32_DHCP_manual_config ();
@@ -58,7 +58,6 @@ int EthernetClass::begin(uint8_t *mac_address, unsigned long timeout, unsigned l
5858 if (ret == 1 ) {
5959 _dnsServerAddress = _dhcp->getDnsServerIp ();
6060 }
61- MACAddress (mac_address);
6261 return ret;
6362}
6463
@@ -86,14 +85,13 @@ void EthernetClass::begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dn
8685 begin (mac_address, local_ip, dns_server, gateway, subnet);
8786}
8887
89- void EthernetClass::begin (uint8_t *mac , IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet)
88+ void EthernetClass::begin (uint8_t *mac_address , IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet)
9089{
91- stm32_eth_init (mac , local_ip.raw_address (), gateway.raw_address (), subnet.raw_address ());
90+ stm32_eth_init (mac_address , local_ip.raw_address (), gateway.raw_address (), subnet.raw_address ());
9291 /* If there is a local DHCP informs it of our manual IP configuration to
9392 prevent IP conflict */
9493 stm32_DHCP_manual_config ();
9594 _dnsServerAddress = dns_server;
96- MACAddress (mac);
9795}
9896
9997EthernetLinkStatus EthernetClass::linkStatus ()
@@ -133,33 +131,14 @@ void EthernetClass::schedule(void)
133131 stm32_eth_scheduler ();
134132}
135133
136- uint8_t *EthernetClass::MACAddressDefault (void )
137- {
138- if ((mac_address[0 ] + mac_address[1 ] + mac_address[2 ] + mac_address[3 ] + mac_address[4 ] + mac_address[5 ]) == 0 ) {
139- uint32_t baseUID = *(uint32_t *)UID_BASE;
140- mac_address[0 ] = 0x00 ;
141- mac_address[1 ] = 0x80 ;
142- mac_address[2 ] = 0xE1 ;
143- mac_address[3 ] = (baseUID & 0x00FF0000 ) >> 16 ;
144- mac_address[4 ] = (baseUID & 0x0000FF00 ) >> 8 ;
145- mac_address[5 ] = (baseUID & 0x000000FF );
146- }
147- return mac_address;
148- }
149-
150- void EthernetClass::MACAddress (uint8_t *mac)
134+ void EthernetClass::setMACAddress (const uint8_t *mac_address)
151135{
152- mac_address[0 ] = mac[0 ];
153- mac_address[1 ] = mac[1 ];
154- mac_address[2 ] = mac[2 ];
155- mac_address[3 ] = mac[3 ];
156- mac_address[4 ] = mac[4 ];
157- mac_address[5 ] = mac[5 ];
136+ stm32_eth_set_macaddr (mac_address);
158137}
159138
160- uint8_t * EthernetClass::MACAddress (void )
139+ void EthernetClass::MACAddress (uint8_t *mac_address )
161140{
162- return mac_address;
141+ stm32_eth_get_macaddr ( mac_address) ;
163142}
164143
165144IPAddress EthernetClass::localIP ()
0 commit comments