no upgrade or change at this. move to new Library for WIZ550io, W5500 -> http://mbed.org/teams/EthernetInterfaceW5500-makers/code/W5500Interface/
Dependents: LPC11U68_NTPClient_HelloWorld_WIZ550io
Fork of WIZ550ioInterface by
please get the new Library for WIZ550io, W5500 (WIZnet) http://mbed.org/teams/EthernetInterfaceW5500-makers/code/W5500Interface/
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.
WIZ550ioInterface.h@11:5a5a3f373a6b, 2014-07-08 (annotated)
- Committer:
- Bongjun
- Date:
- Tue Jul 08 03:49:33 2014 +0000
- Revision:
- 11:5a5a3f373a6b
- Parent:
- 10:4da8370d14da
update some code after comparing WIZnet Library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ban4jp | 7:93e358253dd8 | 1 | // WIZ550ioInterface.h 2013/4/10 |
mbed_official | 0:302ec35139ec | 2 | /* Copyright (C) 2012 mbed.org, MIT License |
mbed_official | 0:302ec35139ec | 3 | * |
mbed_official | 0:302ec35139ec | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
mbed_official | 0:302ec35139ec | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
mbed_official | 0:302ec35139ec | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
mbed_official | 0:302ec35139ec | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
mbed_official | 0:302ec35139ec | 8 | * furnished to do so, subject to the following conditions: |
mbed_official | 0:302ec35139ec | 9 | * |
mbed_official | 0:302ec35139ec | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
mbed_official | 0:302ec35139ec | 11 | * substantial portions of the Software. |
mbed_official | 0:302ec35139ec | 12 | * |
mbed_official | 0:302ec35139ec | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
mbed_official | 0:302ec35139ec | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
mbed_official | 0:302ec35139ec | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
mbed_official | 0:302ec35139ec | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
mbed_official | 0:302ec35139ec | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
mbed_official | 0:302ec35139ec | 18 | */ |
va009039 | 5:fb15c35d1e28 | 19 | |
va009039 | 5:fb15c35d1e28 | 20 | #pragma once |
mbed_official | 0:302ec35139ec | 21 | |
va009039 | 5:fb15c35d1e28 | 22 | #include "WIZ820io.h" |
samux | 1:fb4494783863 | 23 | |
va009039 | 5:fb15c35d1e28 | 24 | /** Interface using WIZ820io to connect to an IP-based network |
samux | 1:fb4494783863 | 25 | * |
samux | 1:fb4494783863 | 26 | */ |
ban4jp | 7:93e358253dd8 | 27 | class WIZ550ioInterface: public WIZ820io { |
samux | 1:fb4494783863 | 28 | public: |
samux | 1:fb4494783863 | 29 | |
samux | 1:fb4494783863 | 30 | /** |
samux | 1:fb4494783863 | 31 | * Constructor |
samux | 1:fb4494783863 | 32 | * |
va009039 | 5:fb15c35d1e28 | 33 | * \param mosi mbed pin to use for SPI |
va009039 | 5:fb15c35d1e28 | 34 | * \param miso mbed pin to use for SPI |
va009039 | 5:fb15c35d1e28 | 35 | * \param sclk mbed pin to use for SPI |
va009039 | 5:fb15c35d1e28 | 36 | * \param cs |
va009039 | 5:fb15c35d1e28 | 37 | * \param reset reset pin of the WIZ820io module |
samux | 1:fb4494783863 | 38 | */ |
ban4jp | 7:93e358253dd8 | 39 | WIZ550ioInterface(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset); |
ban4jp | 7:93e358253dd8 | 40 | WIZ550ioInterface(SPI* spi, PinName cs, PinName reset); |
samux | 1:fb4494783863 | 41 | |
samux | 1:fb4494783863 | 42 | /** Initialize the interface with DHCP. |
samux | 1:fb4494783863 | 43 | * Initialize the interface and configure it to use DHCP (no connection at this point). |
samux | 1:fb4494783863 | 44 | * \return 0 on success, a negative number on failure |
samux | 1:fb4494783863 | 45 | */ |
samux | 1:fb4494783863 | 46 | int init(); //With DHCP |
samux | 1:fb4494783863 | 47 | |
samux | 1:fb4494783863 | 48 | /** Initialize the interface with a static IP address. |
samux | 1:fb4494783863 | 49 | * Initialize the interface and configure it with the following static configuration (no connection at this point). |
samux | 1:fb4494783863 | 50 | * \param ip the IP address to use |
samux | 1:fb4494783863 | 51 | * \param mask the IP address mask |
samux | 1:fb4494783863 | 52 | * \param gateway the gateway to use |
samux | 1:fb4494783863 | 53 | * \return 0 on success, a negative number on failure |
samux | 1:fb4494783863 | 54 | */ |
samux | 1:fb4494783863 | 55 | int init(const char* ip, const char* mask, const char* gateway); |
samux | 1:fb4494783863 | 56 | |
Bongjun | 10:4da8370d14da | 57 | /** Initialize the interface with a static IP address with 32bit interger. |
Bongjun | 10:4da8370d14da | 58 | * Initialize the interface and configure it with the following static configuration (no connection at this point). |
Bongjun | 10:4da8370d14da | 59 | * \param ip the IP address to use |
Bongjun | 10:4da8370d14da | 60 | * \param mask the IP address mask |
Bongjun | 10:4da8370d14da | 61 | * \param gateway the gateway to use |
Bongjun | 10:4da8370d14da | 62 | * \return 0 on success, a negative number on failure |
Bongjun | 10:4da8370d14da | 63 | */ |
Bongjun | 10:4da8370d14da | 64 | int init(uint32_t ip, uint32_t mask, uint32_t gateway); |
Bongjun | 10:4da8370d14da | 65 | |
samux | 1:fb4494783863 | 66 | /** Connect |
samux | 1:fb4494783863 | 67 | * Bring the interface up, start DHCP if needed. |
samux | 1:fb4494783863 | 68 | * \return 0 on success, a negative number on failure |
samux | 1:fb4494783863 | 69 | */ |
samux | 1:fb4494783863 | 70 | int connect(); |
samux | 1:fb4494783863 | 71 | |
samux | 1:fb4494783863 | 72 | /** Disconnect |
samux | 1:fb4494783863 | 73 | * Bring the interface down |
samux | 1:fb4494783863 | 74 | * \return 0 on success, a negative number on failure |
samux | 1:fb4494783863 | 75 | */ |
samux | 1:fb4494783863 | 76 | int disconnect(); |
samux | 1:fb4494783863 | 77 | |
samux | 1:fb4494783863 | 78 | /** Get IP address |
samux | 1:fb4494783863 | 79 | * |
samux | 1:fb4494783863 | 80 | * @ returns ip address |
samux | 1:fb4494783863 | 81 | */ |
samux | 1:fb4494783863 | 82 | char* getIPAddress(); |
ban4jp | 6:c466db1cd20b | 83 | char* getNetworkMask(); |
ban4jp | 6:c466db1cd20b | 84 | char* getGateway(); |
ban4jp | 6:c466db1cd20b | 85 | char* getMACAddress(); |
va009039 | 5:fb15c35d1e28 | 86 | |
va009039 | 5:fb15c35d1e28 | 87 | int IPrenew(int timeout_ms = 15*1000); |
va009039 | 5:fb15c35d1e28 | 88 | |
samux | 1:fb4494783863 | 89 | private: |
samux | 1:fb4494783863 | 90 | char ip_string[20]; |
ban4jp | 6:c466db1cd20b | 91 | char mask_string[20]; |
ban4jp | 6:c466db1cd20b | 92 | char gw_string[20]; |
ban4jp | 6:c466db1cd20b | 93 | char mac_string[20]; |
samux | 1:fb4494783863 | 94 | bool ip_set; |
samux | 1:fb4494783863 | 95 | }; |
samux | 1:fb4494783863 | 96 | |
samux | 1:fb4494783863 | 97 | #include "TCPSocketConnection.h" |
samux | 1:fb4494783863 | 98 | #include "TCPSocketServer.h" |
samux | 1:fb4494783863 | 99 | #include "UDPSocket.h" |