WIZnet WIZ820io (W5200) support

Dependencies:   NTPClient WIZ820ioInterface mbed

Fork of NTPClient_HelloWorld by Donatien Garnier

Files at this revision

API Documentation at this revision

Comitter:
ban4jp
Date:
Sun Feb 02 14:46:24 2014 +0000
Parent:
2:bf7dc5f5bca9
Commit message:
Add WIZ820io support.

Changed in this revision

EthernetInterface.lib Show diff for this revision Revisions of this file
WIZ820ioInterface.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/EthernetInterface.lib	Sun Aug 05 16:17:31 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/EthernetInterface/#2a797ba9babe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WIZ820ioInterface.lib	Sun Feb 02 14:46:24 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/ban4jp/code/WIZ820ioInterface/#c0cd6680bcb7
--- a/main.cpp	Sun Aug 05 16:17:31 2012 +0000
+++ b/main.cpp	Sun Feb 02 14:46:24 2014 +0000
@@ -1,15 +1,46 @@
 #include "mbed.h"
-#include "EthernetInterface.h"
+//#include "EthernetInterface.h"
+#include "WIZ820ioInterface.h"
 #include "NTPClient.h"
 
-EthernetInterface eth;
+//EthernetInterface eth;
+#if defined(TARGET_LPC1114)
+SPI spi(dp2, dp1, dp6); // mosi, miso, sclk
+WIZ820ioInterface eth(&spi, dp25, dp26); // spi, cs, reset
+
+#elif defined(TARGET_LPC1768)
+SPI spi(p11, p12, p13); // mosi, miso, sclk
+WIZ820ioInterface eth(&spi, p14, p15); // spi, cs, reset
+
+#endif
+
 NTPClient ntp;
 
 int main() 
 {
-    eth.init(); //Use DHCP
+    int ret = eth.init(); //Use DHCP
+    if (!ret)
+    {
+      printf("Initialized, MAC: %s\n", eth.getMACAddress());
+    }
+    else
+    {
+      printf("Error eth.init() - ret = %d\n", ret);
+      return -1;
+    }
 
-    eth.connect();
+    ret = eth.connect();
+    if (!ret)
+    {
+      printf("Connected, IP: %s, MASK: %s, GW: %s\n",
+        eth.getIPAddress(), eth.getNetworkMask(), eth.getGateway());
+    }
+    else
+    {
+      printf("Error eth.connect() - ret = %d\n", ret);
+      return -1;
+    }
+
    
     printf("Trying to update time...\r\n");
     if (ntp.setTime("0.pool.ntp.org") == 0)
--- a/mbed-rtos.lib	Sun Aug 05 16:17:31 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#9654a71f5a90
--- a/mbed.bld	Sun Aug 05 16:17:31 2012 +0000
+++ b/mbed.bld	Sun Feb 02 14:46:24 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/976df7c37ad5
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/673126e12c73
\ No newline at end of file