Two simple classes for using the RGB led

Dependencies:   mbed

Dependents:   4180-lab3-RTOS 4180-FinalProject

Files at this revision

API Documentation at this revision

Comitter:
kswanson31
Date:
Mon Oct 10 01:56:26 2016 +0000
Parent:
0:7a3ee33c0a53
Commit message:
Moved operator overload to class definition

Changed in this revision

SimpleRGB.cpp Show annotated file Show diff for this revision Revisions of this file
SimpleRGB.h Show annotated file Show diff for this revision Revisions of this file
--- a/SimpleRGB.cpp	Mon Oct 10 00:32:31 2016 +0000
+++ b/SimpleRGB.cpp	Mon Oct 10 01:56:26 2016 +0000
@@ -27,10 +27,4 @@
     _rpin = color.red;
     _gpin = color.green;
     _bpin = color.blue;
-}
-
-// alow assingment of LightColor object to the RGBLed object
-RGBLed operator = (LightColor color) {
-    write(color);
-    return *this;
 }
\ No newline at end of file
--- a/SimpleRGB.h	Mon Oct 10 00:32:31 2016 +0000
+++ b/SimpleRGB.h	Mon Oct 10 01:56:26 2016 +0000
@@ -18,6 +18,10 @@
         RGBLed(PinName rpin, PinName gpin, PinName bpin);
         void write(float red, float green, float blue);
         void write(LightColor color);
+        RGBLed operator = (LightColor color) {
+            write(color);
+            return *this;
+        };
         
     private:
         PwmOut _rpin;