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 #ifndef IPADDR_H
sfjmt 3:b0a1b4b24d3c 25 #define IPADDR_H
sfjmt 3:b0a1b4b24d3c 26
sfjmt 3:b0a1b4b24d3c 27 #include "netCfg.h"
sfjmt 3:b0a1b4b24d3c 28 #if NET_LWIP_STACK
sfjmt 3:b0a1b4b24d3c 29 typedef struct ip_addr ip_addr_t;
sfjmt 3:b0a1b4b24d3c 30 #endif
sfjmt 3:b0a1b4b24d3c 31
sfjmt 3:b0a1b4b24d3c 32 #include "stdint.h"
sfjmt 3:b0a1b4b24d3c 33
sfjmt 3:b0a1b4b24d3c 34 ///IP Address container
sfjmt 3:b0a1b4b24d3c 35 /**
sfjmt 3:b0a1b4b24d3c 36 This class is a container for an IPv4 address.
sfjmt 3:b0a1b4b24d3c 37 */
sfjmt 3:b0a1b4b24d3c 38 class IpAddr //Basically a C++ frontend to ip_addr_t
sfjmt 3:b0a1b4b24d3c 39 {
sfjmt 3:b0a1b4b24d3c 40 public:
sfjmt 3:b0a1b4b24d3c 41 #if NET_LWIP_STACK
sfjmt 3:b0a1b4b24d3c 42 IpAddr(ip_addr_t* pIp);
sfjmt 3:b0a1b4b24d3c 43 #endif
sfjmt 3:b0a1b4b24d3c 44
sfjmt 3:b0a1b4b24d3c 45 ///Initializes IP address with provided values
sfjmt 3:b0a1b4b24d3c 46 IpAddr(uint8_t ip0, uint8_t ip1, uint8_t ip2, uint8_t ip3);
sfjmt 3:b0a1b4b24d3c 47
sfjmt 3:b0a1b4b24d3c 48 ///Initializes IP address with null values
sfjmt 3:b0a1b4b24d3c 49 IpAddr();
sfjmt 3:b0a1b4b24d3c 50
sfjmt 3:b0a1b4b24d3c 51 #if NET_LWIP_STACK
sfjmt 3:b0a1b4b24d3c 52 ip_addr_t getStruct() const;
sfjmt 3:b0a1b4b24d3c 53 #endif
sfjmt 3:b0a1b4b24d3c 54
sfjmt 3:b0a1b4b24d3c 55 ///Returns IP address byte #
sfjmt 3:b0a1b4b24d3c 56 uint8_t operator[](unsigned int i) const;
sfjmt 3:b0a1b4b24d3c 57
sfjmt 3:b0a1b4b24d3c 58 ///Compares too addresses
sfjmt 3:b0a1b4b24d3c 59 /**
sfjmt 3:b0a1b4b24d3c 60 @return true if the two addresses are equal
sfjmt 3:b0a1b4b24d3c 61 */
sfjmt 3:b0a1b4b24d3c 62 bool isEq(const IpAddr& b) const;
sfjmt 3:b0a1b4b24d3c 63
sfjmt 3:b0a1b4b24d3c 64 ///Compares too addresses
sfjmt 3:b0a1b4b24d3c 65 /**
sfjmt 3:b0a1b4b24d3c 66 @return true if the two addresses are equal
sfjmt 3:b0a1b4b24d3c 67 */
sfjmt 3:b0a1b4b24d3c 68 bool operator==(const IpAddr& b) const;
sfjmt 3:b0a1b4b24d3c 69
sfjmt 3:b0a1b4b24d3c 70 ///Compares too addresses
sfjmt 3:b0a1b4b24d3c 71 /**
sfjmt 3:b0a1b4b24d3c 72 @return true if the two addresses are different
sfjmt 3:b0a1b4b24d3c 73 */
sfjmt 3:b0a1b4b24d3c 74 bool operator!=(const IpAddr& b) const;
sfjmt 3:b0a1b4b24d3c 75
sfjmt 3:b0a1b4b24d3c 76 ///Checks whether the address is null
sfjmt 3:b0a1b4b24d3c 77 /**
sfjmt 3:b0a1b4b24d3c 78 @return true if the address is null
sfjmt 3:b0a1b4b24d3c 79 */
sfjmt 3:b0a1b4b24d3c 80 bool isNull() const;
sfjmt 3:b0a1b4b24d3c 81
sfjmt 3:b0a1b4b24d3c 82 ///Checks whether the address is a broadcast address
sfjmt 3:b0a1b4b24d3c 83 /**
sfjmt 3:b0a1b4b24d3c 84 @return true if the address is a broadcast address
sfjmt 3:b0a1b4b24d3c 85 */
sfjmt 3:b0a1b4b24d3c 86 bool isBroadcast() const;
sfjmt 3:b0a1b4b24d3c 87
sfjmt 3:b0a1b4b24d3c 88 ///Checks whether the address is a multicast address
sfjmt 3:b0a1b4b24d3c 89 /**
sfjmt 3:b0a1b4b24d3c 90 @return true if the address is a multicast address
sfjmt 3:b0a1b4b24d3c 91 */
sfjmt 3:b0a1b4b24d3c 92 bool isMulticast() const;
sfjmt 3:b0a1b4b24d3c 93
sfjmt 3:b0a1b4b24d3c 94 private:
sfjmt 3:b0a1b4b24d3c 95 uint8_t m_ip[4];
sfjmt 3:b0a1b4b24d3c 96 };
sfjmt 3:b0a1b4b24d3c 97
sfjmt 3:b0a1b4b24d3c 98 #endif