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

Fork of RGBLed by Romain Berrada

Committer:
igalloway
Date:
Mon Dec 29 03:03:56 2014 +0000
Revision:
6:050081bc1393
Parent:
4:176363412797
trying to add self-documentation to code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rominos2 4:176363412797 1 /*
rominos2 4:176363412797 2 Copyright (c) 2014 Romain Berrada
rominos2 4:176363412797 3
rominos2 4:176363412797 4 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
rominos2 4:176363412797 5 and associated documentation files (the "Software"), to deal in the Software without restriction,
rominos2 4:176363412797 6 including without limitation the rights to use, copy, modify, merge, publish, distribute,
rominos2 4:176363412797 7 sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
rominos2 4:176363412797 8 furnished to do so, subject to the following conditions:
rominos2 4:176363412797 9
rominos2 4:176363412797 10 The above copyright notice and this permission notice shall be included in all copies or
rominos2 4:176363412797 11 substantial portions of the Software.
rominos2 4:176363412797 12
rominos2 4:176363412797 13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
rominos2 4:176363412797 14 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
rominos2 4:176363412797 15 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
rominos2 4:176363412797 16 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
rominos2 4:176363412797 17 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
rominos2 4:176363412797 18 */
rominos2 4:176363412797 19
rominos2 3:be0a3c2ec426 20 #include "RGBLed.h"
rominos2 3:be0a3c2ec426 21
rominos2 3:be0a3c2ec426 22 RGBLed::Color::Color(bool r, bool g, bool b) : _r(r), _g(g), _b(b) {
rominos2 3:be0a3c2ec426 23 }
rominos2 3:be0a3c2ec426 24
rominos2 3:be0a3c2ec426 25 RGBLed::RGBLed(PinName redPin, PinName greenPin, PinName bluePin) : _red(redPin), _green(greenPin), _blue(bluePin) {
rominos2 3:be0a3c2ec426 26 this->setColor(RGBLed::BLACK); // Clear the LED output
rominos2 3:be0a3c2ec426 27 }
rominos2 3:be0a3c2ec426 28
rominos2 3:be0a3c2ec426 29 void RGBLed::setColor(Color& color) {
rominos2 3:be0a3c2ec426 30 _red = color._r;
rominos2 3:be0a3c2ec426 31 _green = color._g;
rominos2 3:be0a3c2ec426 32 _blue = color._b;
rominos2 3:be0a3c2ec426 33 }
rominos2 3:be0a3c2ec426 34
rominos2 3:be0a3c2ec426 35 RGBLed::Color RGBLed::BLACK = RGBLed::Color(1,1,1);
rominos2 3:be0a3c2ec426 36 RGBLed::Color RGBLed::RED = RGBLed::Color(0,1,1);
rominos2 3:be0a3c2ec426 37 RGBLed::Color RGBLed::GREEN = RGBLed::Color(1,0,1);
rominos2 3:be0a3c2ec426 38 RGBLed::Color RGBLed::BLUE = RGBLed::Color(1,1,0);
rominos2 3:be0a3c2ec426 39 RGBLed::Color RGBLed::MAGENTA = RGBLed::Color(0,1,0);
rominos2 3:be0a3c2ec426 40 RGBLed::Color RGBLed::CYAN = RGBLed::Color(1,0,0);
rominos2 3:be0a3c2ec426 41 RGBLed::Color RGBLed::YELLOW = RGBLed::Color(0,0,1);
rominos2 3:be0a3c2ec426 42 RGBLed::Color RGBLed::WHITE = RGBLed::Color(0,0,0);