@@ -71,18 +71,32 @@ void RGBled::setColor(RGBColors color)
71
71
_red = 0x20 ;
72
72
}
73
73
74
- setColor (_blue , _green, _red );
74
+ setColor (_red , _green, _blue );
75
75
76
76
}
77
77
78
- void RGBled::setColor (uint8_t blue, uint8_t green, uint8_t red)
78
+ void RGBled::setColorBlue (uint8_t blue) {
79
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT1, blue >> scale_factor);
80
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_COLOR_UPDATE, 0xC5 );
81
+ }
82
+
83
+ void RGBled::setColorRed (uint8_t red) {
84
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT3, red >> scale_factor);
85
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_COLOR_UPDATE, 0xC5 );
86
+ }
87
+
88
+ void RGBled::setColorGreen (uint8_t green) {
89
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT2, green >> scale_factor);
90
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_COLOR_UPDATE, 0xC5 );
91
+ }
92
+
93
+ void RGBled::setColor (uint8_t red, uint8_t green, uint8_t blue)
79
94
{
80
95
// set rgb led current
81
- writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT1, blue); // maximum current
82
- writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT2, green);
83
- writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT3, red);
96
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT1, blue >> scale_factor ); // maximum current
97
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT2, green >> scale_factor );
98
+ writeByte (IS31FL3194_ADDRESS, IS31FL3194_OUT3, red >> scale_factor );
84
99
writeByte (IS31FL3194_ADDRESS, IS31FL3194_COLOR_UPDATE, 0xC5 ); // write to color update register for changes to take effect
85
-
86
100
}
87
101
88
102
// Read the Chip ID register, this is a good test of communication
@@ -141,7 +155,7 @@ void RGBled::writeByte(uint8_t address, uint8_t subAddress, uint8_t data)
141
155
uint8_t RGBled::readByte (uint8_t address, uint8_t subAddress)
142
156
{
143
157
nicla::i2c_mutex.lock ();
144
- char response = 0xFF ;
158
+ // char response = 0xFF;
145
159
Wire1.beginTransmission (address);
146
160
Wire1.write (subAddress);
147
161
Wire1.endTransmission (false );
0 commit comments