Library for led

RGB LED library

users/gimohd/code/LED/

[Not found]

Files at this revision

API Documentation at this revision

Comitter:
gimohd
Date:
Thu Dec 10 15:45:22 2015 +0000
Parent:
3:18500db47a73
Commit message:
documentation not ready

Changed in this revision

Color.cpp Show diff for this revision Revisions of this file
Color.h Show diff for this revision Revisions of this file
lib/Color.cpp Show annotated file Show diff for this revision Revisions of this file
lib/Color.h Show annotated file Show diff for this revision Revisions of this file
diff -r 18500db47a73 -r dc9ce1a68604 Color.cpp
--- a/Color.cpp	Thu Dec 10 15:36:05 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-
-#include "Color.h"
-
-Color::Color(int red, int green, int blue){
-  this->red = red;
-  this->green = green;
-  this->blue = blue;
-}
-
-Color::Color(float red, float green, float blue){
-  this->red = floatToColorValue(red);
-  this->green = floatToColorValue(green);
-  this->blue = floatToColorValue(blue);
-}
-
-Color::Color(int color){
-  this->red = (color >> 16) & 0x0000FF;
-  this->green = (color >> 8 ) & 0x0000FF;
-  this->blue = (color >> 0 ) & 0x0000FF;
-}
-
-int Color::floatToColorValue(float value){
-    return (int) (value * MAX_COLOR_VALUE);
-};
-
-int Color::getHex(){
-    return (red << 16) + (green<<8) + (blue <<0);   
-}
-
-int Color::getRed(){
-    return red;   
-}
-
-int Color::getGreen(){
-    return green;   
-}
-
-int Color::getBlue(){
-    return blue;   
-}
-
diff -r 18500db47a73 -r dc9ce1a68604 Color.h
--- a/Color.h	Thu Dec 10 15:36:05 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/** COLOR CLASS
- */
-#ifndef COLOR_H
-#define COLOR_H
-
-class Color{
-  
-    
-  
-   public:
-        /** Create color instance
-         *
-         * @param red Value of red 0-255
-         * @param green Value of green 0-255
-         * @param blue Value of blue 0-255
-         */
-        Color(int red, int green, int blue);
-        /** Create color instance
-         *
-         * @param color Hex or int value of a color
-         */
-        Color(int color);
-        /** Create color instance
-         *
-         * @param red Value of red 0-1
-         * @param green Value of green 0-1
-         * @param blue Value of blue 0-1
-         */
-        Color(float red, float green, float blue);
-        /** Returns the hex value of the color
-         *
-         * @param delay Print delay in milliseconds
-         * @returns
-         *   Hex value of the color
-         */
-        int getHex();
-        /** Returns the red value of the color
-         *
-         * @param delay Print delay in milliseconds
-         * @returns
-         *  red value of the color
-         */
-        int getRed();
-        /** Returns the green value of the color
-         *
-         * @param delay Print delay in milliseconds
-         * @returns
-         *  the red value of the color
-         */
-        int getGreen();
-        /** Returns the blue value of the color
-         *
-         * @param delay Print delay in milliseconds
-         * @returns
-         *   the blue value of the color
-         */
-        int getBlue();
-        enum colors{RED = 0xFF0000, 
-                GREEN = 0x00FF00, 
-                BLUE= 0x0000FF, 
-                CYAN = 0x00FFFF, 
-                MAGENTA = 0xFF00FF, 
-                YELLOW = 0xFFFF00, 
-                WHITE = 0xFFFFFF};
-    
-    private:
-        static const int MAX_COLOR_VALUE = 255;
-        int red;  
-        int green; 
-        int blue; 
-        int floatToColorValue(float value);
-        
-};
-
-#endif
\ No newline at end of file
diff -r 18500db47a73 -r dc9ce1a68604 lib/Color.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/Color.cpp	Thu Dec 10 15:45:22 2015 +0000
@@ -0,0 +1,41 @@
+
+#include "Color.h"
+
+Color::Color(int red, int green, int blue){
+  this->red = red;
+  this->green = green;
+  this->blue = blue;
+}
+
+Color::Color(float red, float green, float blue){
+  this->red = floatToColorValue(red);
+  this->green = floatToColorValue(green);
+  this->blue = floatToColorValue(blue);
+}
+
+Color::Color(int color){
+  this->red = (color >> 16) & 0x0000FF;
+  this->green = (color >> 8 ) & 0x0000FF;
+  this->blue = (color >> 0 ) & 0x0000FF;
+}
+
+int Color::floatToColorValue(float value){
+    return (int) (value * MAX_COLOR_VALUE);
+};
+
+int Color::getHex(){
+    return (red << 16) + (green<<8) + (blue <<0);   
+}
+
+int Color::getRed(){
+    return red;   
+}
+
+int Color::getGreen(){
+    return green;   
+}
+
+int Color::getBlue(){
+    return blue;   
+}
+
diff -r 18500db47a73 -r dc9ce1a68604 lib/Color.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/Color.h	Thu Dec 10 15:45:22 2015 +0000
@@ -0,0 +1,75 @@
+/** COLOR CLASS
+ */
+#ifndef COLOR_H
+#define COLOR_H
+
+class Color{
+  
+    
+  
+   public:
+        /** Create color instance
+         *
+         * @param red Value of red 0-255
+         * @param green Value of green 0-255
+         * @param blue Value of blue 0-255
+         */
+        Color(int red, int green, int blue);
+        /** Create color instance
+         *
+         * @param color Hex or int value of a color
+         */
+        Color(int color);
+        /** Create color instance
+         *
+         * @param red Value of red 0-1
+         * @param green Value of green 0-1
+         * @param blue Value of blue 0-1
+         */
+        Color(float red, float green, float blue);
+        /** Returns the hex value of the color
+         *
+         * @param delay Print delay in milliseconds
+         * @returns
+         *   Hex value of the color
+         */
+        int getHex();
+        /** Returns the red value of the color
+         *
+         * @param delay Print delay in milliseconds
+         * @returns
+         *  red value of the color
+         */
+        int getRed();
+        /** Returns the green value of the color
+         *
+         * @param delay Print delay in milliseconds
+         * @returns
+         *  the red value of the color
+         */
+        int getGreen();
+        /** Returns the blue value of the color
+         *
+         * @param delay Print delay in milliseconds
+         * @returns
+         *   the blue value of the color
+         */
+        int getBlue();
+        enum colors{RED = 0xFF0000, 
+                GREEN = 0x00FF00, 
+                BLUE= 0x0000FF, 
+                CYAN = 0x00FFFF, 
+                MAGENTA = 0xFF00FF, 
+                YELLOW = 0xFFFF00, 
+                WHITE = 0xFFFFFF};
+    
+    private:
+        static const int MAX_COLOR_VALUE = 255;
+        int red;  
+        int green; 
+        int blue; 
+        int floatToColorValue(float value);
+        
+};
+
+#endif
\ No newline at end of file