Set each LED independently for Crucial effect modes
This commit is contained in:
parent
0bbef425a4
commit
25807902c9
3 changed files with 36 additions and 14 deletions
|
|
@ -52,16 +52,15 @@ void CrucialController::SetAllColorsDirect(RGBColor* colors)
|
|||
SendDirectColors(colors);
|
||||
}
|
||||
|
||||
void CrucialController::SendEffectColors(unsigned char red, unsigned char green, unsigned char blue)
|
||||
void CrucialController::SetAllColorsEffect(RGBColor* colors)
|
||||
{
|
||||
CrucialRegisterWrite(0x82E9, 0xFF);
|
||||
CrucialRegisterWrite(0x82EA, 0x00);
|
||||
CrucialRegisterWrite(0x82EB, 0x00);
|
||||
CrucialRegisterWrite(0x82EC, 0x00);
|
||||
CrucialRegisterWrite(0x82ED, red);
|
||||
CrucialRegisterWrite(0x82EE, green);
|
||||
CrucialRegisterWrite(0x82EF, blue);
|
||||
CrucialRegisterWrite(0x82F0, 0x01);
|
||||
for(int led_idx = 0; led_idx < 8; led_idx++)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[led_idx]);
|
||||
unsigned char grn = RGBGetGValue(colors[led_idx]);
|
||||
unsigned char blu = RGBGetBValue(colors[led_idx]);
|
||||
SendEffectColor(led_idx, red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void CrucialController::SendBrightness(unsigned char brightness)
|
||||
|
|
@ -131,3 +130,21 @@ void CrucialController::CrucialRegisterWrite(crucial_register reg, unsigned char
|
|||
bus->i2c_smbus_write_byte_data(dev, 0x01, val);
|
||||
|
||||
}
|
||||
|
||||
void CrucialController::SendEffectColor
|
||||
(
|
||||
unsigned int led_idx,
|
||||
unsigned int red,
|
||||
unsigned int green,
|
||||
unsigned int blue
|
||||
)
|
||||
{
|
||||
CrucialRegisterWrite(0x82E9, (1 << led_idx));
|
||||
CrucialRegisterWrite(0x82EA, 0x00);
|
||||
CrucialRegisterWrite(0x82EB, 0x00);
|
||||
CrucialRegisterWrite(0x82EC, 0x00);
|
||||
CrucialRegisterWrite(0x82ED, red);
|
||||
CrucialRegisterWrite(0x82EE, green);
|
||||
CrucialRegisterWrite(0x82EF, blue);
|
||||
CrucialRegisterWrite(0x82F0, 0x01);
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ public:
|
|||
std::string GetDeviceLocation();
|
||||
unsigned int GetLEDCount();
|
||||
void SetAllColorsDirect(RGBColor* colors);
|
||||
void SendEffectColors(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetAllColorsEffect(RGBColor* colors);
|
||||
void SetMode(unsigned char mode);
|
||||
|
||||
unsigned char CrucialRegisterRead(crucial_register reg);
|
||||
|
|
@ -56,6 +56,14 @@ private:
|
|||
i2c_smbus_interface * bus;
|
||||
crucial_dev_id dev;
|
||||
|
||||
void SendEffectColor
|
||||
(
|
||||
unsigned int led_idx,
|
||||
unsigned int red,
|
||||
unsigned int green,
|
||||
unsigned int blue
|
||||
);
|
||||
|
||||
void SendDirectColors(RGBColor* color_buf);
|
||||
void SendBrightness(unsigned char brightness);
|
||||
void SendEffectMode(unsigned char mode, unsigned char speed);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue