iain galloway / RGBLed-iain

Fork of RGBLed by Romain Berrada

Committer:
rominos2
Date:
Tue Sep 02 13:05:51 2014 +0000
Revision:
0:0969a9e32945
Child:
2:3c0889914cb2
Initial Release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rominos2 0:0969a9e32945 1 #include "rgb.h"
rominos2 0:0969a9e32945 2
rominos2 0:0969a9e32945 3 RGB::Color::Color(uint8_t r, uint8_t g, uint8_t b) : _r(r), _g(g), _b(b) {
rominos2 0:0969a9e32945 4 }
rominos2 0:0969a9e32945 5
rominos2 0:0969a9e32945 6 RGB::RGB(PinName redPin, PinName greenPin, PinName bluePin) : _red(redPin), _green(greenPin), _blue(bluePin) {
rominos2 0:0969a9e32945 7 this->setColor(&RGB::BLACK); // Clear the LED output
rominos2 0:0969a9e32945 8 }
rominos2 0:0969a9e32945 9
rominos2 0:0969a9e32945 10 void RGB::setColor(Color* color) {
rominos2 0:0969a9e32945 11 _red = color->_r;
rominos2 0:0969a9e32945 12 _green = color->_g;
rominos2 0:0969a9e32945 13 _blue = color->_b;
rominos2 0:0969a9e32945 14 }
rominos2 0:0969a9e32945 15
rominos2 0:0969a9e32945 16 RGB::Color RGB::BLACK = RGB::Color(1,1,1);
rominos2 0:0969a9e32945 17 RGB::Color RGB::RED = RGB::Color(0,1,1);
rominos2 0:0969a9e32945 18 RGB::Color RGB::GREEN = RGB::Color(1,0,1);
rominos2 0:0969a9e32945 19 RGB::Color RGB::BLUE = RGB::Color(1,1,0);
rominos2 0:0969a9e32945 20 RGB::Color RGB::MAGENTA = RGB::Color(0,1,0);
rominos2 0:0969a9e32945 21 RGB::Color RGB::CYAN = RGB::Color(1,0,0);
rominos2 0:0969a9e32945 22 RGB::Color RGB::YELLOW = RGB::Color(0,0,1);
rominos2 0:0969a9e32945 23 RGB::Color RGB::WHITE = RGB::Color(0,0,0);