@@ -35,75 +35,26 @@ void Backlight::end()
35
35
powerDown ();
36
36
}
37
37
38
- void Backlight::setColor (RGBColors color )
38
+ void Backlight::on ( )
39
39
{
40
- if (color == off) {
41
- _blue = 0x00 ;
42
- _green = 0x00 ;
43
- _red = 0x00 ;
44
- }
45
-
46
- if (color == green) {
47
- _blue = 0x00 ;
48
- _green = 0xFF ;
49
- _red = 0x00 ;
50
- }
51
-
52
- if (color == blue) {
53
- _blue = 0xFF ;
54
- _green = 0x00 ;
55
- _red = 0x00 ;
56
- }
57
-
58
- if (color == red) {
59
- _blue = 0x00 ;
60
- _green = 0x00 ;
61
- _red = 0xFF ;
62
- }
63
-
64
- if (color == cyan) {
65
- _blue = 0x20 ;
66
- _green = 0x20 ;
67
- _red = 0x00 ;
68
- }
69
-
70
- if (color == magenta) {
71
- _blue = 0x20 ;
72
- _green = 0x00 ;
73
- _red = 0x20 ;
74
- }
75
-
76
- if (color == yellow) {
77
- _blue = 0x00 ;
78
- _green = 0x20 ;
79
- _red = 0x20 ;
80
- }
81
-
82
- setColor (_blue, _green, _red);
83
-
40
+ setColor (0xFF , 0xFF , 0xFF );
84
41
}
85
42
86
- void Backlight::setColor ( uint8_t blue, uint8_t green, uint8_t red )
43
+ void Backlight::off ( )
87
44
{
88
- // set rgb led current
89
- writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT1, blue); // maximum current
90
- writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT2, green);
91
- writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT3, red);
92
- writeByte (IS31FL3194_ADDRESS, IS31FL3194_COLOR_UPDATE, 0xC5 ); // write to color update register for changes to take effect
93
-
45
+ setColor (0 , 0 , 0 );
94
46
}
95
47
96
- /* *************************************************************************************
97
- * PRIVATE MEMBER FUNCTIONS
98
- **************************************************************************************/
99
-
100
48
// Read the Chip ID register, this is a good test of communication
101
49
uint8_t Backlight::getChipID ()
102
50
{
103
51
uint8_t c = readByte (IS31FL3194_ADDRESS, IS31FL3194_PRODUCT_ID); // Read PRODUCT_ID register for IS31FL3194
104
52
return c;
105
53
}
106
54
55
+ /* *************************************************************************************
56
+ * PRIVATE MEMBER FUNCTIONS
57
+ **************************************************************************************/
107
58
108
59
void Backlight::reset ()
109
60
{
@@ -134,6 +85,15 @@ void Backlight::init()// configure rgb led function
134
85
writeByte (IS31FL3194_ADDRESS, 0x32 , 0xFF ); // Max power on led R (OUT 3)
135
86
}
136
87
88
+ void Backlight::setColor (uint8_t blue, uint8_t green, uint8_t red)
89
+ {
90
+ // set rgb led current
91
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT1, blue); // maximum current
92
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT2, green);
93
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT3, red);
94
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_COLOR_UPDATE, 0xC5 ); // write to color update register for changes to take effect
95
+ }
96
+
137
97
void Backlight::writeByte (uint8_t address, uint8_t subAddress, uint8_t data)
138
98
{
139
99
Wire.beginTransmission (address);
0 commit comments