WIZ820io(W5200) network interface, EthernetInterface compatible.
Dependents: Seeed_Ethernet_Shield_V2_HelloWorld Seeed_Ethernet_Shield Cayenne-WIZ820ioInterface Seeed_Ethernet_Shield
Fork of WiflyInterface by
WIZ820ioInterface.h
00001 // WIZ820ioInterface.h 2013/4/10 00002 /* Copyright (C) 2012 mbed.org, MIT License 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00005 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00006 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00007 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00008 * furnished to do so, subject to the following conditions: 00009 * 00010 * The above copyright notice and this permission notice shall be included in all copies or 00011 * substantial portions of the Software. 00012 * 00013 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00014 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00015 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00016 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00017 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00018 */ 00019 00020 #pragma once 00021 00022 #include "WIZ820io.h" 00023 00024 /** Interface using WIZ820io to connect to an IP-based network 00025 * 00026 */ 00027 class WIZ820ioInterface: public WIZ820io { 00028 public: 00029 00030 /** 00031 * Constructor 00032 * 00033 * \param mosi mbed pin to use for SPI 00034 * \param miso mbed pin to use for SPI 00035 * \param sclk mbed pin to use for SPI 00036 * \param cs 00037 * \param reset reset pin of the WIZ820io module 00038 */ 00039 WIZ820ioInterface(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset); 00040 WIZ820ioInterface(SPI* spi, PinName cs, PinName reset); 00041 00042 /** Initialize the interface with DHCP. 00043 * Initialize the interface and configure it to use DHCP (no connection at this point). 00044 * \return 0 on success, a negative number on failure 00045 */ 00046 int init(); //With DHCP 00047 00048 /** Initialize the interface with a static IP address. 00049 * Initialize the interface and configure it with the following static configuration (no connection at this point). 00050 * \param ip the IP address to use 00051 * \param mask the IP address mask 00052 * \param gateway the gateway to use 00053 * \return 0 on success, a negative number on failure 00054 */ 00055 int init(const char* ip, const char* mask, const char* gateway); 00056 00057 /** Connect 00058 * Bring the interface up, start DHCP if needed. 00059 * \return 0 on success, a negative number on failure 00060 */ 00061 int connect(); 00062 00063 /** Disconnect 00064 * Bring the interface down 00065 * \return 0 on success, a negative number on failure 00066 */ 00067 int disconnect(); 00068 00069 /** Get IP address 00070 * 00071 * @ returns ip address 00072 */ 00073 char* getIPAddress(); 00074 00075 int IPrenew(int timeout_ms = 15*1000); 00076 00077 private: 00078 char ip_string[20]; 00079 bool ip_set; 00080 }; 00081 00082 #include "TCPSocketConnection.h" 00083 #include "TCPSocketServer.h" 00084 #include "UDPSocket.h"
Generated on Thu Jul 14 2022 11:02:04 by 1.7.2