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.

Dependents:   Embedded_web EmailButton EmailButton HTTPClient_Weather ... more

other drivers

for only W5500 / WIZ550io user, you could use

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.

Committer:
jbkim
Date:
Thu May 08 03:57:58 2014 +0000
Revision:
0:b72d22e10709
Child:
1:8138a268fbd2
1st commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jbkim 0:b72d22e10709 1 /* Copyright (C) 2012 mbed.org, MIT License
jbkim 0:b72d22e10709 2 *
jbkim 0:b72d22e10709 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
jbkim 0:b72d22e10709 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
jbkim 0:b72d22e10709 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
jbkim 0:b72d22e10709 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
jbkim 0:b72d22e10709 7 * furnished to do so, subject to the following conditions:
jbkim 0:b72d22e10709 8 *
jbkim 0:b72d22e10709 9 * The above copyright notice and this permission notice shall be included in all copies or
jbkim 0:b72d22e10709 10 * substantial portions of the Software.
jbkim 0:b72d22e10709 11 *
jbkim 0:b72d22e10709 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
jbkim 0:b72d22e10709 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
jbkim 0:b72d22e10709 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
jbkim 0:b72d22e10709 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
jbkim 0:b72d22e10709 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
jbkim 0:b72d22e10709 17 */
jbkim 0:b72d22e10709 18
jbkim 0:b72d22e10709 19 #pragma once
jbkim 0:b72d22e10709 20
jbkim 0:b72d22e10709 21 #include "wiznet.h"
jbkim 0:b72d22e10709 22
jbkim 0:b72d22e10709 23 /** Interface using Wiznet chip to connect to an IP-based network
jbkim 0:b72d22e10709 24 *
jbkim 0:b72d22e10709 25 */
jbkim 0:b72d22e10709 26 class WIZnetInterface: public WIZnet_Chip {
jbkim 0:b72d22e10709 27 public:
jbkim 0:b72d22e10709 28
jbkim 0:b72d22e10709 29 /**
jbkim 0:b72d22e10709 30 * Constructor
jbkim 0:b72d22e10709 31 *
jbkim 0:b72d22e10709 32 * \param mosi mbed pin to use for SPI
jbkim 0:b72d22e10709 33 * \param miso mbed pin to use for SPI
jbkim 0:b72d22e10709 34 * \param sclk mbed pin to use for SPI
jbkim 0:b72d22e10709 35 * \param cs chip select of the WIZnet_Chip
jbkim 0:b72d22e10709 36 * \param reset reset pin of the WIZnet_Chip
jbkim 0:b72d22e10709 37 */
jbkim 0:b72d22e10709 38 WIZnetInterface(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset);
jbkim 0:b72d22e10709 39 WIZnetInterface(SPI* spi, PinName cs, PinName reset);
jbkim 0:b72d22e10709 40
jbkim 0:b72d22e10709 41 /** Initialize the interface with DHCP.
jbkim 0:b72d22e10709 42 * Initialize the interface and configure it to use DHCP (no connection at this point).
jbkim 0:b72d22e10709 43 * \return 0 on success, a negative number on failure
jbkim 0:b72d22e10709 44 */
jbkim 0:b72d22e10709 45 int init(); //With DHCP
jbkim 0:b72d22e10709 46
jbkim 0:b72d22e10709 47 /** Initialize the interface with a static IP address.
jbkim 0:b72d22e10709 48 * Initialize the interface and configure it with the following static configuration (no connection at this point).
jbkim 0:b72d22e10709 49 * \param ip the IP address to use
jbkim 0:b72d22e10709 50 * \param mask the IP address mask
jbkim 0:b72d22e10709 51 * \param gateway the gateway to use
jbkim 0:b72d22e10709 52 * \return 0 on success, a negative number on failure
jbkim 0:b72d22e10709 53 */
jbkim 0:b72d22e10709 54 int init(const char* ip, const char* mask, const char* gateway);
jbkim 0:b72d22e10709 55
jbkim 0:b72d22e10709 56 /** Connect
jbkim 0:b72d22e10709 57 * Bring the interface up, start DHCP if needed.
jbkim 0:b72d22e10709 58 * \return 0 on success, a negative number on failure
jbkim 0:b72d22e10709 59 */
jbkim 0:b72d22e10709 60 int connect();
jbkim 0:b72d22e10709 61
jbkim 0:b72d22e10709 62 /** Disconnect
jbkim 0:b72d22e10709 63 * Bring the interface down
jbkim 0:b72d22e10709 64 * \return 0 on success, a negative number on failure
jbkim 0:b72d22e10709 65 */
jbkim 0:b72d22e10709 66 int disconnect();
jbkim 0:b72d22e10709 67
jbkim 0:b72d22e10709 68 /** Get IP address & MAC address
jbkim 0:b72d22e10709 69 *
jbkim 0:b72d22e10709 70 * @ returns ip address
jbkim 0:b72d22e10709 71 */
jbkim 0:b72d22e10709 72 char* getIPAddress();
jbkim 0:b72d22e10709 73 char* getNetworkMask();
jbkim 0:b72d22e10709 74 char* getGateway();
jbkim 0:b72d22e10709 75 char* getMACAddress();
jbkim 0:b72d22e10709 76
jbkim 0:b72d22e10709 77 int IPrenew(int timeout_ms = 15*1000);
jbkim 0:b72d22e10709 78
jbkim 0:b72d22e10709 79 private:
jbkim 0:b72d22e10709 80 char ip_string[20];
jbkim 0:b72d22e10709 81 char mask_string[20];
jbkim 0:b72d22e10709 82 char gw_string[20];
jbkim 0:b72d22e10709 83 char mac_string[20];
jbkim 0:b72d22e10709 84 bool ip_set;
jbkim 0:b72d22e10709 85 };
jbkim 0:b72d22e10709 86
jbkim 0:b72d22e10709 87 #include "TCPSocketConnection.h"
jbkim 0:b72d22e10709 88 #include "TCPSocketServer.h"
jbkim 0:b72d22e10709 89 #include "UDPSocket.h"