No more update~~ please use W5500Interface.

Fork of EthernetInterfaceW5500 by Bongjun Hur


Bongjun Hur wrote:

NO more update for this library.

Please move to this page W5500Interface for newer version.

Import libraryW5500Interface

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.

This Library for W5500 users. no need to use lwIP(or S/W TCP/IP) Some update & code clean for W5500 only refer from WIZ550ioInterface, WIZnetLibrary and WiflyInterface.

Thanks for ban4jp. This library forks of WIZ550ioInterface.

Committer:
ppo
Date:
Fri Aug 29 12:00:38 2014 +0000
Revision:
15:fe68ac753657
Parent:
11:274fda7476d0
bug fixed in close(), now socket is really closed

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Bongjun 10:cadac6bcd169 1 // EthernetInterfaceW5500.h 2014/7/17
va009039 5:fb15c35d1e28 2
va009039 5:fb15c35d1e28 3 #pragma once
Bongjun 10:cadac6bcd169 4 #include "wiznet.h"
mbed_official 0:302ec35139ec 5
Bongjun 10:cadac6bcd169 6 /** Interface using Wiznet chip to connect to an IP-based network
samux 1:fb4494783863 7 *
samux 1:fb4494783863 8 */
Bongjun 10:cadac6bcd169 9 class EthernetInterfaceW5500: public WIZnet_Chip {
samux 1:fb4494783863 10 public:
samux 1:fb4494783863 11
samux 1:fb4494783863 12 /**
samux 1:fb4494783863 13 * Constructor
samux 1:fb4494783863 14 *
va009039 5:fb15c35d1e28 15 * \param mosi mbed pin to use for SPI
va009039 5:fb15c35d1e28 16 * \param miso mbed pin to use for SPI
va009039 5:fb15c35d1e28 17 * \param sclk mbed pin to use for SPI
Bongjun 10:cadac6bcd169 18 * \param cs chip select of the WIZnet_Chip
Bongjun 10:cadac6bcd169 19 * \param reset reset pin of the WIZnet_Chip
samux 1:fb4494783863 20 */
Bongjun 10:cadac6bcd169 21 EthernetInterfaceW5500(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset);
Bongjun 10:cadac6bcd169 22 EthernetInterfaceW5500(SPI* spi, PinName cs, PinName reset);
samux 1:fb4494783863 23
Bongjun 10:cadac6bcd169 24 /** Initialize the interface with DHCP w/o MAC address
samux 1:fb4494783863 25 * Initialize the interface and configure it to use DHCP (no connection at this point).
samux 1:fb4494783863 26 * \return 0 on success, a negative number on failure
samux 1:fb4494783863 27 */
samux 1:fb4494783863 28 int init(); //With DHCP
Bongjun 10:cadac6bcd169 29 /** Initialize the interface with DHCP.
Bongjun 10:cadac6bcd169 30 * Initialize the interface and configure it to use DHCP (no connection at this point).
Bongjun 10:cadac6bcd169 31 * \param mac the MAC address to use
Bongjun 10:cadac6bcd169 32 * \return 0 on success, a negative number on failure
Bongjun 10:cadac6bcd169 33 */
Bongjun 10:cadac6bcd169 34 int init(uint8_t * mac); //With DHCP
samux 1:fb4494783863 35
Bongjun 10:cadac6bcd169 36 /** Initialize the interface with a static IP address without MAC.
samux 1:fb4494783863 37 * Initialize the interface and configure it with the following static configuration (no connection at this point).
samux 1:fb4494783863 38 * \param ip the IP address to use
samux 1:fb4494783863 39 * \param mask the IP address mask
samux 1:fb4494783863 40 * \param gateway the gateway to use
samux 1:fb4494783863 41 * \return 0 on success, a negative number on failure
samux 1:fb4494783863 42 */
Bongjun 10:cadac6bcd169 43
samux 1:fb4494783863 44 int init(const char* ip, const char* mask, const char* gateway);
Bongjun 10:cadac6bcd169 45 /** Initialize the interface with a static IP address.
Bongjun 10:cadac6bcd169 46 * Initialize the interface and configure it with the following static configuration (no connection at this point).
Bongjun 10:cadac6bcd169 47 * \param mac the MAC address to use
Bongjun 10:cadac6bcd169 48 * \param ip the IP address to use
Bongjun 10:cadac6bcd169 49 * \param mask the IP address mask
Bongjun 10:cadac6bcd169 50 * \param gateway the gateway to use
Bongjun 10:cadac6bcd169 51 * \return 0 on success, a negative number on failure
Bongjun 10:cadac6bcd169 52 */
Bongjun 10:cadac6bcd169 53 int init(uint8_t * mac, const char* ip, const char* mask, const char* gateway);
samux 1:fb4494783863 54
samux 1:fb4494783863 55 /** Connect
samux 1:fb4494783863 56 * Bring the interface up, start DHCP if needed.
samux 1:fb4494783863 57 * \return 0 on success, a negative number on failure
samux 1:fb4494783863 58 */
samux 1:fb4494783863 59 int connect();
samux 1:fb4494783863 60
samux 1:fb4494783863 61 /** Disconnect
samux 1:fb4494783863 62 * Bring the interface down
samux 1:fb4494783863 63 * \return 0 on success, a negative number on failure
samux 1:fb4494783863 64 */
samux 1:fb4494783863 65 int disconnect();
samux 1:fb4494783863 66
samux 1:fb4494783863 67 /** Get IP address
samux 1:fb4494783863 68 *
samux 1:fb4494783863 69 * @ returns ip address
samux 1:fb4494783863 70 */
samux 1:fb4494783863 71 char* getIPAddress();
ban4jp 6:c466db1cd20b 72 char* getNetworkMask();
ban4jp 6:c466db1cd20b 73 char* getGateway();
ban4jp 6:c466db1cd20b 74 char* getMACAddress();
va009039 5:fb15c35d1e28 75
va009039 5:fb15c35d1e28 76 int IPrenew(int timeout_ms = 15*1000);
va009039 5:fb15c35d1e28 77
samux 1:fb4494783863 78 private:
samux 1:fb4494783863 79 char ip_string[20];
ban4jp 6:c466db1cd20b 80 char mask_string[20];
ban4jp 6:c466db1cd20b 81 char gw_string[20];
ban4jp 6:c466db1cd20b 82 char mac_string[20];
samux 1:fb4494783863 83 bool ip_set;
samux 1:fb4494783863 84 };
samux 1:fb4494783863 85
samux 1:fb4494783863 86 #include "TCPSocketConnection.h"
samux 1:fb4494783863 87 #include "TCPSocketServer.h"
samux 1:fb4494783863 88 #include "UDPSocket.h"