my version of the RGBLed library. NOTHING changed, just wanted to put into my account.

Fork of RGBLed by Romain Berrada

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RGBLed.cpp Source File

RGBLed.cpp

00001 /* 
00002     Copyright (c) 2014 Romain Berrada
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 #include "RGBLed.h"
00021 
00022 RGBLed::Color::Color(bool r, bool g, bool b) : _r(r), _g(g), _b(b) {
00023 }
00024 
00025 RGBLed::RGBLed(PinName redPin, PinName greenPin, PinName bluePin) : _red(redPin), _green(greenPin), _blue(bluePin) {
00026     this->setColor(RGBLed::BLACK); // Clear the LED output
00027 }
00028 
00029 void RGBLed::setColor(Color& color) {
00030     _red = color._r;
00031     _green = color._g;
00032     _blue = color._b;
00033 }
00034 
00035 RGBLed::Color RGBLed::BLACK = RGBLed::Color(1,1,1);
00036 RGBLed::Color RGBLed::RED = RGBLed::Color(0,1,1);
00037 RGBLed::Color RGBLed::GREEN = RGBLed::Color(1,0,1);
00038 RGBLed::Color RGBLed::BLUE = RGBLed::Color(1,1,0);
00039 RGBLed::Color RGBLed::MAGENTA = RGBLed::Color(0,1,0);
00040 RGBLed::Color RGBLed::CYAN = RGBLed::Color(1,0,0);
00041 RGBLed::Color RGBLed::YELLOW = RGBLed::Color(0,0,1);
00042 RGBLed::Color RGBLed::WHITE = RGBLed::Color(0,0,0);