WIZNet W5500 with additional enhancements
Fork of WIZnetInterface by
Diff: EthernetInterface.cpp
- Revision:
- 34:7d44648ec5f2
- Parent:
- 33:879cfe51e66e
- Child:
- 35:fe3028eda085
--- a/EthernetInterface.cpp Sat Oct 07 22:10:01 2017 +0200
+++ b/EthernetInterface.cpp Mon Oct 09 19:58:19 2017 +0200
@@ -41,7 +41,7 @@
return 0;
}
-int EthernetInterface::init(uint8_t * mac)
+int EthernetInterface::init(uint8_t *mac)
{
dhcp = true;
//
@@ -52,7 +52,7 @@
return 0;
}
-int EthernetInterface::init(uint8_t * mac, const char* ip, const char* mask, const char* gateway)
+int EthernetInterface::init(uint8_t * mac, const char* ip, const char* mask, const char* gateway, const char* dnsServer)
{
dhcp = false;
//
@@ -63,6 +63,8 @@
ip_set = true;
this->netmask = str_to_ip(mask);
this->gateway = str_to_ip(gateway);
+ if (dnsServer)
+ this->dnsaddr = str_to_ip(dnsServer);
reset();
// @Jul. 8. 2014 add code. should be called to write chip.
@@ -131,12 +133,12 @@
char* EthernetInterface::getDNSServer()
{
uint32_t ip = getDNSAddr();
- snprintf(gw_string, sizeof(gw_string), "%d.%d.%d.%d",
+ snprintf(dns_string, sizeof(gw_string), "%d.%d.%d.%d",
(uint8_t)((ip>>24)&0xff),
(uint8_t)((ip>>16)&0xff),
(uint8_t)((ip>>8)&0xff),
(uint8_t)(ip&0xff));
- return gw_string;
+ return dns_string;
}
char* EthernetInterface::getMACAddress()
Helmut Tschemernjak
