iain galloway / RGBLed-iain

Fork of RGBLed by Romain Berrada

rgb.cpp

Committer:
rominos2
Date:
2014-09-02
Revision:
2:3c0889914cb2
Parent:
0:0969a9e32945

File content as of revision 2:3c0889914cb2:

#include "rgb.h"

RGB::Color::Color(uint8_t r, uint8_t g, uint8_t b) : _r(r), _g(g), _b(b) {
}

RGB::RGB(PinName redPin, PinName greenPin, PinName bluePin) : _red(redPin), _green(greenPin), _blue(bluePin) {
    this->setColor(RGB::BLACK); // Clear the LED output
}

void RGB::setColor(Color& color) {
    _red = color._r;
    _green = color._g;
    _blue = color._b;
}

RGB::Color RGB::BLACK = RGB::Color(1,1,1);
RGB::Color RGB::RED = RGB::Color(0,1,1);
RGB::Color RGB::GREEN = RGB::Color(1,0,1);
RGB::Color RGB::BLUE = RGB::Color(1,1,0);
RGB::Color RGB::MAGENTA = RGB::Color(0,1,0);
RGB::Color RGB::CYAN = RGB::Color(1,0,0);
RGB::Color RGB::YELLOW = RGB::Color(0,0,1);
RGB::Color RGB::WHITE = RGB::Color(0,0,0);