MCPcopy Create free account
hub / github.com/DanielOgorchock/ST_Anything / begin

Method begin

Arduino/libraries/Ethernet2/src/Ethernet2.cpp:21–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19
20#if defined(WIZ550io_WITH_MACADDRESS)
21int EthernetClass::begin(void)
22{
23 byte mac_address[6] ={0,};
24 if (_dhcp != NULL) {
25 delete _dhcp;
26 }
27 _dhcp = new DhcpClass();
28
29 // Initialise the basic info
30 w5500.init(w5500_cspin);
31 w5500.setIPAddress(IPAddress(0,0,0,0).raw_address());
32 w5500.getMACAddress(mac_address);
33
34 // Now try to get our config info from a DHCP server
35 int ret = _dhcp->beginWithDHCP(mac_address);
36 if(ret == 1)
37 {
38 // We've successfully found a DHCP server and got our configuration info, so set things
39 // accordingly
40 w5500.setIPAddress(_dhcp->getLocalIp().raw_address());
41 w5500.setGatewayIp(_dhcp->getGatewayIp().raw_address());
42 w5500.setSubnetMask(_dhcp->getSubnetMask().raw_address());
43 _dnsServerAddress = _dhcp->getDnsServerIp();
44 _dnsDomainName = _dhcp->getDnsDomainName();
45 _hostName = _dhcp->getHostName();
46 }
47
48 return ret;
49}
50
51void EthernetClass::begin(IPAddress local_ip)
52{

Callers

nothing calls this directly

Calls 8

beginWithDHCPMethod · 0.80
getLocalIpMethod · 0.80
getGatewayIpMethod · 0.80
getSubnetMaskMethod · 0.80
getDnsServerIpMethod · 0.80
getDnsDomainNameMethod · 0.80
getHostNameMethod · 0.80
initMethod · 0.45

Tested by

no test coverage detected