Library for led

RGB LED library

users/gimohd/code/LED/

[Not found]

Committer:
gimohd
Date:
Thu Dec 10 15:32:29 2015 +0000
Revision:
2:86c0b50796cd
Parent:
1:3d9e5b4abecf
Added docs

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gimohd 1:3d9e5b4abecf 1 /** COLOR CLASS
gimohd 1:3d9e5b4abecf 2 */
gimohd 0:5368b27ca9d0 3 #ifndef COLOR_H
gimohd 0:5368b27ca9d0 4 #define COLOR_H
gimohd 0:5368b27ca9d0 5
gimohd 0:5368b27ca9d0 6 class Color{
gimohd 0:5368b27ca9d0 7
gimohd 0:5368b27ca9d0 8
gimohd 0:5368b27ca9d0 9
gimohd 0:5368b27ca9d0 10 public:
gimohd 0:5368b27ca9d0 11 /** Create color instance
gimohd 0:5368b27ca9d0 12 *
gimohd 0:5368b27ca9d0 13 * @param red Value of red 0-255
gimohd 0:5368b27ca9d0 14 * @param green Value of green 0-255
gimohd 0:5368b27ca9d0 15 * @param blue Value of blue 0-255
gimohd 0:5368b27ca9d0 16 */
gimohd 0:5368b27ca9d0 17 Color(int red, int green, int blue);
gimohd 0:5368b27ca9d0 18 /** Create color instance
gimohd 0:5368b27ca9d0 19 *
gimohd 0:5368b27ca9d0 20 * @param color Hex or int value of a color
gimohd 0:5368b27ca9d0 21 */
gimohd 0:5368b27ca9d0 22 Color(int color);
gimohd 0:5368b27ca9d0 23 /** Create color instance
gimohd 0:5368b27ca9d0 24 *
gimohd 0:5368b27ca9d0 25 * @param red Value of red 0-1
gimohd 0:5368b27ca9d0 26 * @param green Value of green 0-1
gimohd 0:5368b27ca9d0 27 * @param blue Value of blue 0-1
gimohd 0:5368b27ca9d0 28 */
gimohd 0:5368b27ca9d0 29 Color(float red, float green, float blue);
gimohd 0:5368b27ca9d0 30 /** Returns the hex value of the color
gimohd 0:5368b27ca9d0 31 *
gimohd 0:5368b27ca9d0 32 * @param delay Print delay in milliseconds
gimohd 0:5368b27ca9d0 33 * @returns
gimohd 0:5368b27ca9d0 34 * Hex value of the color
gimohd 0:5368b27ca9d0 35 */
gimohd 0:5368b27ca9d0 36 int getHex();
gimohd 0:5368b27ca9d0 37 /** Returns the red value of the color
gimohd 0:5368b27ca9d0 38 *
gimohd 0:5368b27ca9d0 39 * @param delay Print delay in milliseconds
gimohd 0:5368b27ca9d0 40 * @returns
gimohd 0:5368b27ca9d0 41 * red value of the color
gimohd 0:5368b27ca9d0 42 */
gimohd 0:5368b27ca9d0 43 int getRed();
gimohd 0:5368b27ca9d0 44 /** Returns the green value of the color
gimohd 0:5368b27ca9d0 45 *
gimohd 0:5368b27ca9d0 46 * @param delay Print delay in milliseconds
gimohd 0:5368b27ca9d0 47 * @returns
gimohd 0:5368b27ca9d0 48 * the red value of the color
gimohd 0:5368b27ca9d0 49 */
gimohd 0:5368b27ca9d0 50 int getGreen();
gimohd 0:5368b27ca9d0 51 /** Returns the blue value of the color
gimohd 0:5368b27ca9d0 52 *
gimohd 0:5368b27ca9d0 53 * @param delay Print delay in milliseconds
gimohd 0:5368b27ca9d0 54 * @returns
gimohd 0:5368b27ca9d0 55 * the blue value of the color
gimohd 0:5368b27ca9d0 56 */
gimohd 0:5368b27ca9d0 57 int getBlue();
gimohd 0:5368b27ca9d0 58 enum colors{RED = 0xFF0000,
gimohd 0:5368b27ca9d0 59 GREEN = 0x00FF00,
gimohd 0:5368b27ca9d0 60 BLUE= 0x0000FF,
gimohd 0:5368b27ca9d0 61 CYAN = 0x00FFFF,
gimohd 0:5368b27ca9d0 62 MAGENTA = 0xFF00FF,
gimohd 0:5368b27ca9d0 63 YELLOW = 0xFFFF00,
gimohd 0:5368b27ca9d0 64 WHITE = 0xFFFFFF};
gimohd 0:5368b27ca9d0 65
gimohd 0:5368b27ca9d0 66 private:
gimohd 0:5368b27ca9d0 67 static const int MAX_COLOR_VALUE = 255;
gimohd 0:5368b27ca9d0 68 int red;
gimohd 0:5368b27ca9d0 69 int green;
gimohd 0:5368b27ca9d0 70 int blue;
gimohd 0:5368b27ca9d0 71 int floatToColorValue(float value);
gimohd 0:5368b27ca9d0 72
gimohd 0:5368b27ca9d0 73 };
gimohd 0:5368b27ca9d0 74
gimohd 0:5368b27ca9d0 75 #endif