This is WIZnet Ethernet Interface using Hardware TCP/IP chip, W5500, W5200 and W5100. One of them can be selected by enabling it in wiznet.h.
Fork of WIZnet_Library by
Diff: WIZnetInterface/WIZnet/W5500.cpp
- Revision:
- 9:f390679a0468
- Parent:
- 6:ca8405b9564d
diff -r cb8808b47e69 -r f390679a0468 WIZnetInterface/WIZnet/W5500.cpp --- a/WIZnetInterface/WIZnet/W5500.cpp Sun May 31 10:25:40 2015 +0000 +++ b/WIZnetInterface/WIZnet/W5500.cpp Mon Jun 04 14:31:13 2018 +0000 @@ -45,20 +45,28 @@ WIZnet_Chip* WIZnet_Chip::inst; WIZnet_Chip::WIZnet_Chip(PinName mosi, PinName miso, PinName sclk, PinName _cs, PinName _reset): - cs(_cs), reset_pin(_reset) + cs(_cs) { spi = new SPI(mosi, miso, sclk); cs = 1; - reset_pin = 1; + if(_reset != NC){ + reset_pin = new DigitalOut(_reset); + *reset_pin = 1; + }else + reset_pin = NULL; inst = this; } WIZnet_Chip::WIZnet_Chip(SPI* spi, PinName _cs, PinName _reset): - cs(_cs), reset_pin(_reset) + cs(_cs) { this->spi = spi; cs = 1; - reset_pin = 1; + if(_reset != NC){ + reset_pin = new DigitalOut(_reset); + *reset_pin = 1; + }else + reset_pin = NULL; inst = this; } @@ -149,12 +157,13 @@ // Reset the chip & set the buffer void WIZnet_Chip::reset() { - reset_pin = 1; - reset_pin = 0; - wait_us(500); // 500us (w5500) - reset_pin = 1; - wait_ms(400); // 400ms (w5500) - + if(reset_pin != NULL){ + *reset_pin = 1; + *reset_pin = 0; + wait_us(500); // 500us (w5500) + *reset_pin = 1; + wait_ms(400); // 400ms (w5500) + } #if defined(USE_WIZ550IO_MAC) reg_rd_mac(SHAR, mac); // read the MAC address inside the module #endif