Revised to prevent DHCPClient::discover from hanging.

Fork of WIZ820ioInterface by ban4jp -

Revision:
7:c0cd6680bcb7
Parent:
5:fb15c35d1e28
Child:
9:c1722862c13b
--- a/WIZ820io/WIZ820io.cpp	Sun Dec 01 18:40:14 2013 +0000
+++ b/WIZ820io/WIZ820io.cpp	Sun Feb 02 14:20:31 2014 +0000
@@ -137,7 +137,9 @@
     wait_us(2); // 2us
     reset_pin = 1;
     wait_ms(150); // 150ms
+    
     reg_wr<uint8_t>(MR, 1<<7);
+    
 #ifdef TARGET_LPC1114
     uint8_t mac[6] = {0x00,0x02,0xf7,0xf0,0x00,0x00};
 #else
@@ -160,6 +162,7 @@
         scmd(socket, DISCON);
     }
     scmd(socket, CLOSE);
+    sreg<uint8_t>(socket, Sn_IR, 0xff);
     return true;
 }
 
@@ -263,8 +266,7 @@
 void WIZ820io::scmd(int socket, Command cmd)
 {
     sreg<uint8_t>(socket, Sn_CR, cmd);
-    while(sreg<uint8_t>(socket, Sn_CR))
-        ;
+    while(sreg<uint8_t>(socket, Sn_CR));
 }
 
 void WIZ820io::spi_write(uint16_t addr, const uint8_t *buf, uint16_t len)