LineLedControl

Dependencies:   LPD8806 mbed

Fork of LPD8806_Test by Jelmer Tiete

Committer:
sfjmt
Date:
Mon Aug 19 12:14:37 2013 +0000
Revision:
3:b0a1b4b24d3c
LPD8806 control

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sfjmt 3:b0a1b4b24d3c 1
sfjmt 3:b0a1b4b24d3c 2 /*
sfjmt 3:b0a1b4b24d3c 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
sfjmt 3:b0a1b4b24d3c 4
sfjmt 3:b0a1b4b24d3c 5 Permission is hereby granted, free of charge, to any person obtaining a copy
sfjmt 3:b0a1b4b24d3c 6 of this software and associated documentation files (the "Software"), to deal
sfjmt 3:b0a1b4b24d3c 7 in the Software without restriction, including without limitation the rights
sfjmt 3:b0a1b4b24d3c 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
sfjmt 3:b0a1b4b24d3c 9 copies of the Software, and to permit persons to whom the Software is
sfjmt 3:b0a1b4b24d3c 10 furnished to do so, subject to the following conditions:
sfjmt 3:b0a1b4b24d3c 11
sfjmt 3:b0a1b4b24d3c 12 The above copyright notice and this permission notice shall be included in
sfjmt 3:b0a1b4b24d3c 13 all copies or substantial portions of the Software.
sfjmt 3:b0a1b4b24d3c 14
sfjmt 3:b0a1b4b24d3c 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
sfjmt 3:b0a1b4b24d3c 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
sfjmt 3:b0a1b4b24d3c 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
sfjmt 3:b0a1b4b24d3c 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
sfjmt 3:b0a1b4b24d3c 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
sfjmt 3:b0a1b4b24d3c 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
sfjmt 3:b0a1b4b24d3c 21 THE SOFTWARE.
sfjmt 3:b0a1b4b24d3c 22 */
sfjmt 3:b0a1b4b24d3c 23
sfjmt 3:b0a1b4b24d3c 24 /** \file
sfjmt 3:b0a1b4b24d3c 25 Ethernet network interface header file
sfjmt 3:b0a1b4b24d3c 26 */
sfjmt 3:b0a1b4b24d3c 27
sfjmt 3:b0a1b4b24d3c 28 #ifndef ETHERNETNETIF_H
sfjmt 3:b0a1b4b24d3c 29 #define ETHERNETNETIF_H
sfjmt 3:b0a1b4b24d3c 30
sfjmt 3:b0a1b4b24d3c 31 struct netif;
sfjmt 3:b0a1b4b24d3c 32
sfjmt 3:b0a1b4b24d3c 33 #include "mbed.h"
sfjmt 3:b0a1b4b24d3c 34
sfjmt 3:b0a1b4b24d3c 35 #include "if/lwip/LwipNetIf.h"
sfjmt 3:b0a1b4b24d3c 36
sfjmt 3:b0a1b4b24d3c 37 ///Ethernet network interface return codes
sfjmt 3:b0a1b4b24d3c 38 enum EthernetErr
sfjmt 3:b0a1b4b24d3c 39 {
sfjmt 3:b0a1b4b24d3c 40 __ETH_MIN = -0xFFFF,
sfjmt 3:b0a1b4b24d3c 41 ETH_TIMEOUT, ///<Timeout during setup
sfjmt 3:b0a1b4b24d3c 42 ETH_OK = 0 ///<Success
sfjmt 3:b0a1b4b24d3c 43 };
sfjmt 3:b0a1b4b24d3c 44
sfjmt 3:b0a1b4b24d3c 45 ///Ethernet network interface
sfjmt 3:b0a1b4b24d3c 46 /**
sfjmt 3:b0a1b4b24d3c 47 This class provides Ethernet connectivity to the stack
sfjmt 3:b0a1b4b24d3c 48 */
sfjmt 3:b0a1b4b24d3c 49 class EthernetNetIf : public LwipNetIf
sfjmt 3:b0a1b4b24d3c 50 {
sfjmt 3:b0a1b4b24d3c 51 public:
sfjmt 3:b0a1b4b24d3c 52 ///Instantiates the Interface and register it against the stack, DHCP will be used
sfjmt 3:b0a1b4b24d3c 53 EthernetNetIf(); //W/ DHCP
sfjmt 3:b0a1b4b24d3c 54
sfjmt 3:b0a1b4b24d3c 55 ///Instantiates the Interface and register it against the stack, DHCP will not be used
sfjmt 3:b0a1b4b24d3c 56 /**
sfjmt 3:b0a1b4b24d3c 57 IpAddr is a container class that can be constructed with either 4 bytes or no parameters for a null IP address.
sfjmt 3:b0a1b4b24d3c 58 */
sfjmt 3:b0a1b4b24d3c 59 EthernetNetIf(IpAddr ip, IpAddr netmask, IpAddr gateway, IpAddr dns); //W/o DHCP
sfjmt 3:b0a1b4b24d3c 60 virtual ~EthernetNetIf();
sfjmt 3:b0a1b4b24d3c 61
sfjmt 3:b0a1b4b24d3c 62 ///Brings the interface up
sfjmt 3:b0a1b4b24d3c 63 /**
sfjmt 3:b0a1b4b24d3c 64 Uses DHCP if necessary
sfjmt 3:b0a1b4b24d3c 65 @param timeout_ms : You can set the timeout parameter in milliseconds, if not it defaults to 15s
sfjmt 3:b0a1b4b24d3c 66 @return : ETH_OK on success or ETH_TIMEOUT on timeout
sfjmt 3:b0a1b4b24d3c 67 */
sfjmt 3:b0a1b4b24d3c 68 EthernetErr setup(int timeout_ms = 15000);
sfjmt 3:b0a1b4b24d3c 69
sfjmt 3:b0a1b4b24d3c 70 virtual void poll();
sfjmt 3:b0a1b4b24d3c 71
sfjmt 3:b0a1b4b24d3c 72 private:
sfjmt 3:b0a1b4b24d3c 73 Timer m_ethArpTimer;
sfjmt 3:b0a1b4b24d3c 74 Timer m_dhcpCoarseTimer;
sfjmt 3:b0a1b4b24d3c 75 Timer m_dhcpFineTimer;
sfjmt 3:b0a1b4b24d3c 76 Timer m_igmpTimer;
sfjmt 3:b0a1b4b24d3c 77
sfjmt 3:b0a1b4b24d3c 78 bool m_useDhcp;
sfjmt 3:b0a1b4b24d3c 79
sfjmt 3:b0a1b4b24d3c 80 netif* m_pNetIf;
sfjmt 3:b0a1b4b24d3c 81
sfjmt 3:b0a1b4b24d3c 82 IpAddr m_netmask;
sfjmt 3:b0a1b4b24d3c 83 IpAddr m_gateway;
sfjmt 3:b0a1b4b24d3c 84
sfjmt 3:b0a1b4b24d3c 85 const char* m_hostname;
sfjmt 3:b0a1b4b24d3c 86
sfjmt 3:b0a1b4b24d3c 87 };
sfjmt 3:b0a1b4b24d3c 88
sfjmt 3:b0a1b4b24d3c 89 #endif
sfjmt 3:b0a1b4b24d3c 90