Upper Version Add PUT method Delete POST method

Dependencies:   Adafruit_GFX MbedJSONValue_v102 WIZnetInterface mbed

Fork of WIZwiki-REST-io_v102 by Lawrence Lee

Revision:
2:ca36ecca24c2
Parent:
1:728e5b5c8dae
Child:
4:0b5a199e91f3
diff -r 728e5b5c8dae -r ca36ecca24c2 main.cpp
--- a/main.cpp	Tue Apr 05 11:40:33 2016 +0000
+++ b/main.cpp	Tue May 03 02:15:59 2016 +0000
@@ -6,6 +6,8 @@
 
 #define SERVER_PORT 80
 
+#define DHCP
+
 EthernetInterface eth;
 HTTPServer WIZwikiWebSvr;
 MbedJSONValue WIZwikiREST;
@@ -228,14 +230,62 @@
 
 int main(void)
 {
-    
+
     sprintf(mac_str, "%02X:%02X:%02X:%02X:%02X:%02X",mac_addr[0],mac_addr[1],
                                                      mac_addr[2],mac_addr[3], 
                                                      mac_addr[4],mac_addr[5]);
     //GPIO Set
     GP05.output();
-    GP05.write(0);
-    GP06.input();
+    GP05.write(1);
+    GP06.output();
+    GP06.write(1);
+    GP07.output();
+    GP07.write(1);
+    GP08.output();
+    GP08.write(1);
+    GP09.output();
+    GP09.write(1);
+    GP10.output();
+    GP10.write(1);
+    GP11.output();
+    GP11.write(1);
+    GP12.output();
+    GP12.write(1);
+    GP13.output();
+    GP13.write(1);
+    GP14.output();
+    GP14.write(1);
+    GP15.output();
+    GP15.write(1);
+    GP16.output();
+    GP16.write(1);
+    GP17.output();
+    GP17.write(1);
+    GP18.output();
+    GP18.write(1);
+    GP19.output();
+    GP19.write(1);
+    GP20.output();
+    GP20.write(1);
+    GP21.output();
+    GP21.write(1);
+    GP22.output();
+    GP22.write(1);
+    GP23.output();
+    GP23.write(1);
+    GP24.output();
+    GP24.write(1);
+    GP25.output();
+    GP25.write(1);
+    GP26.output();
+    GP26.write(1);
+    GP27.output();
+    GP27.write(1);
+    GP28.output();
+    GP28.write(1);
+    GP29.output();
+    GP29.write(1);
+
 
     //LED Setbit
     LED_1.write(0); // LED On
@@ -266,13 +316,30 @@
         eth.init(mac_addr, ip_addr, subnet_mask, gateway_addr); //Not Use DHCP
     #endif
     
+    
     printf("Check Ethernet Link\r\n");
-    
-    while(1) //Wait link up
+    //Add
+    do{
+        printf("   Link - Wait... \r\n");
+        wait(1);
+    }while(!eth.ethernet_link());
+    printf("-- Ethetnet PHY Link - Done -- \r\n");
+        
+    if (eth.connect() < 0 )
+        printf("-- EThernet Connect - Fail -- \r\n");
+    else
     {
-        if(eth.link() == true) 
-        break;
+        printf("-- Assigned Network Information -- \r\n");
+        printf("   IP   : %s\r\n\r\n", eth.getIPAddress()); 
+        printf("   MASK : %s\r\n\r\n", eth.getNetworkMask());
+        printf("   GW   : %s\r\n\r\n", eth.getGateway());
     }
+        
+    //while(1) //Wait link up
+    //{
+    //    if(eth.link() == true) 
+    //    break;
+    //}
     
     printf("Link up\r\n");
     printf("IP Address is %s\r\n", eth.getIPAddress());
@@ -394,6 +461,7 @@
     WIZwikiREST["GPIOs"]["P29"] = GP29.read();
     WIZwikiREST["GPIOs"]["P29"].accessible = true;
     WIZwikiREST["GPIOs"]["P29"].cb_action = p29_set;
+/*    
     WIZwikiREST["GPIOs"]["P30"] = GP30.read();
     WIZwikiREST["GPIOs"]["P30"].accessible = true;
     WIZwikiREST["GPIOs"]["P30"].cb_action = p30_set;
@@ -403,6 +471,6 @@
     WIZwikiREST["GPIOs"]["P32"] = GP32.read();
     WIZwikiREST["GPIOs"]["P32"].accessible = true;
     WIZwikiREST["GPIOs"]["P32"].cb_action = p32_set;
-
+*/
     debug_info();
 }