This is the Interface library for WIZnet W5500 chip which forked of EthernetInterfaceW5500, WIZnetInterface and WIZ550ioInterface. This library has simple name as "W5500Interface". and can be used for Wiz550io users also.
Dependents: EvrythngApi Websocket_Ethernet_HelloWorld_W5500 Websocket_Ethernet_W5500 CurrentWeatherData_W5500 ... more
Information
It has EthernetInterface class like official EthernetInterface , but uses Wiznet chip driver codes.
So this library can use only the WIZnet W5500 or WIZ550io users.
This library has referred to many project such as WIZ550ioInterface, WiflyInterface and WIZnet Library.
Thanks all.
Diff: EthernetInterface.cpp
- Revision:
- 11:5499fa2d8898
- Parent:
- 6:677dfa3984d1
--- a/EthernetInterface.cpp Thu Oct 16 06:36:16 2014 +0000 +++ b/EthernetInterface.cpp Tue Apr 28 13:52:23 2015 +0000 @@ -28,7 +28,8 @@ #include "EthernetInterface.h" #include "DHCPClient.h" - +//static char ip_string[17]; +//static uint32_t ipaddr ; EthernetInterface::EthernetInterface(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset) : WIZnet_Chip(mosi, miso, sclk, cs, reset) { @@ -124,10 +125,22 @@ return 0; } +/* +void EthernetInterface::getip(void) +{ + //ip = 0x12345678; + ipaddr = reg_rd<uint32_t>(SIPR); + //snprintf(ip_string, sizeof(ip_string), "%d.%d.%d.%d", (ipaddr>>24)&0xff, (ipaddr>>16)&0xff, (ipaddr>>8)&0xff, ipaddr&0xff); +} +*/ char* EthernetInterface::getIPAddress() { + //Suint32_t ip = inet_getip(SIPR);//reg_rd<uint32_t>(SIPR); + //static uint32_t ip = getip(); + //uint32_t ip = getip(); + uint32_t ip = reg_rd<uint32_t>(SIPR); - snprintf(ip_string, sizeof(ip_string), "%d.%d.%d.%d", (ip>>24)&0xff, (ip>>16)&0xff, (ip>>8)&0xff, ip&0xff); + snprintf(ip_string, sizeof(ip_string), "%d.%d.%d.%d", (ip>>24)&0xff, (ip>>16)&0xff, (ip>>8)&0xff, ip&0xff); return ip_string; }