Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe37c261a2 | ||
|
|
cbdbb71d79 | ||
|
|
5f786e649a | ||
|
|
f76bf34d8d | ||
|
|
e799574730 | ||
|
|
1a5b12c7a0 | ||
|
|
d2acc75ba8 | ||
|
|
74bcfbd940 | ||
|
|
1db45f2cf2 | ||
|
|
6e467fe8cd | ||
|
|
441c462e59 | ||
|
|
89b4716012 | ||
|
|
e51e9a71a0 | ||
|
|
02273a3601 | ||
|
|
e0018b23aa | ||
|
|
b06f384350 | ||
|
|
7dddb9d111 | ||
|
|
0d38154134 | ||
|
|
7dd84c7ac8 | ||
|
|
ffd0088378 | ||
|
|
f0c486c30d |
@@ -82,11 +82,21 @@ AuraController::~AuraController()
|
||||
|
||||
}
|
||||
|
||||
char * AuraController::GetDeviceName()
|
||||
std::string AuraController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string AuraController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
unsigned char AuraController::GetChannel(unsigned int led)
|
||||
{
|
||||
return(config_table[channel_cfg + led]);
|
||||
@@ -245,4 +255,4 @@ void AuraController::AuraRegisterWriteBlock(aura_register reg, unsigned char * d
|
||||
//Write Aura block data
|
||||
bus->i2c_smbus_write_block_data(dev, 0x03, sz, data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
| Adam Honse (CalcProgrammer1) 8/19/2018 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
@@ -93,7 +94,8 @@ public:
|
||||
AuraController(i2c_smbus_interface* bus, aura_dev_id dev);
|
||||
~AuraController();
|
||||
|
||||
char* GetDeviceName();
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
unsigned char GetChannel(unsigned int led);
|
||||
const char* GetChannelName(unsigned int led);
|
||||
unsigned int GetLEDCount();
|
||||
@@ -120,4 +122,4 @@ private:
|
||||
i2c_smbus_interface * bus;
|
||||
aura_dev_id dev;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@@ -24,11 +24,21 @@ CorsairController::~CorsairController()
|
||||
|
||||
}
|
||||
|
||||
char * CorsairController::GetDeviceName()
|
||||
std::string CorsairController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string CorsairController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
unsigned int CorsairController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
@@ -55,4 +65,4 @@ void CorsairController::SetLEDColor(unsigned int led, unsigned char red, unsigne
|
||||
void CorsairController::SetMode(unsigned char mode)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_MODE, CORSAIR_VENGEANCE_RGB_MODE_SINGLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
| Adam Honse (CalcProgrammer1) 3/8/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
@@ -38,7 +39,8 @@ public:
|
||||
CorsairController(i2c_smbus_interface* bus, corsair_dev_id dev);
|
||||
~CorsairController();
|
||||
|
||||
char* GetDeviceName();
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
unsigned int GetLEDCount();
|
||||
void SetMode(unsigned char mode);
|
||||
|
||||
@@ -50,4 +52,4 @@ private:
|
||||
unsigned int led_count;
|
||||
i2c_smbus_interface * bus;
|
||||
corsair_dev_id dev;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
void Sleep(unsigned int milliseconds)
|
||||
static void Sleep(unsigned int milliseconds)
|
||||
{
|
||||
usleep(1000 * milliseconds);
|
||||
}
|
||||
@@ -42,11 +42,21 @@ CorsairProController::~CorsairProController()
|
||||
|
||||
}
|
||||
|
||||
char* CorsairProController::GetDeviceName()
|
||||
std::string CorsairProController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string CorsairProController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
unsigned int CorsairProController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
@@ -134,4 +144,4 @@ bool CorsairProController::WaitReady()
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
| Adam Honse (CalcProgrammer1) 6/30/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
@@ -65,7 +66,8 @@ public:
|
||||
CorsairProController(i2c_smbus_interface* bus, corsair_dev_id dev);
|
||||
~CorsairProController();
|
||||
|
||||
char* GetDeviceName();
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
unsigned int GetLEDCount();
|
||||
void SetEffect(unsigned char mode);
|
||||
void SetCustom();
|
||||
@@ -85,4 +87,4 @@ private:
|
||||
|
||||
i2c_smbus_interface* bus;
|
||||
corsair_dev_id dev;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -10,87 +10,35 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
static void Sleep(unsigned int milliseconds)
|
||||
{
|
||||
usleep(1000 * milliseconds);
|
||||
}
|
||||
#endif
|
||||
|
||||
HuePlusController::HuePlusController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
HuePlusController::~HuePlusController()
|
||||
{
|
||||
}
|
||||
|
||||
void HuePlusController::Initialize(char* ledstring)
|
||||
void HuePlusController::Initialize(char* port_name)
|
||||
{
|
||||
strcpy(led_string, ledstring);
|
||||
strcpy(led_string, port_name);
|
||||
|
||||
serialport = new serial_port(port_name, HUE_PLUS_BAUD);
|
||||
|
||||
LPSTR source = NULL;
|
||||
LPSTR channels = NULL;
|
||||
LPSTR numleds = NULL;
|
||||
LPSTR next = NULL;
|
||||
|
||||
source = strtok_s(ledstring, ",", &next);
|
||||
|
||||
//Check for selected channel 0=both, 1= Ch.1, 2= Ch.2
|
||||
if (strlen(next))
|
||||
{
|
||||
channels = strtok_s(next, ",", &next);
|
||||
}
|
||||
|
||||
switch (atoi(channels))
|
||||
{
|
||||
case 0:
|
||||
channel = 0x00;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
channel = 0x01;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
channel = 0x02;
|
||||
break;
|
||||
}
|
||||
|
||||
//Check for the number of LEDs, sets the corresponding variable with the counter for the fans
|
||||
if (strlen(next))
|
||||
{
|
||||
numleds = strtok_s(next, ",", &next);
|
||||
}
|
||||
|
||||
switch (atoi(numleds) / 8)
|
||||
{
|
||||
case 1:
|
||||
fans = 0x00;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
fans = 0x01;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
fans = 0x02;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
fans = 0x03;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
fans = 0x04;
|
||||
break;
|
||||
}
|
||||
|
||||
//Initialize with default baud rate
|
||||
source = strtok(source, "\r");
|
||||
strcpy(port_name, source);
|
||||
baud_rate = 256000;
|
||||
serialport = new serial_port(port_name, baud_rate);
|
||||
|
||||
if (numleds != NULL && strlen(numleds))
|
||||
{
|
||||
num_leds = atoi(numleds);
|
||||
}
|
||||
channel_leds[HUE_PLUS_CHANNEL_1_IDX] = GetStripsOnChannel(HUE_PLUS_CHANNEL_1) * 10;
|
||||
channel_leds[HUE_PLUS_CHANNEL_2_IDX] = GetStripsOnChannel(HUE_PLUS_CHANNEL_2) * 10;
|
||||
}
|
||||
|
||||
char* HuePlusController::GetLEDString()
|
||||
@@ -98,27 +46,57 @@ char* HuePlusController::GetLEDString()
|
||||
return(led_string);
|
||||
}
|
||||
|
||||
void HuePlusController::SetLEDs(std::vector<RGBColor> colors)
|
||||
unsigned int HuePlusController::GetStripsOnChannel(unsigned int channel)
|
||||
{
|
||||
unsigned int ret_val = 0;
|
||||
|
||||
if (serialport != NULL)
|
||||
{
|
||||
unsigned char *serial_buf;
|
||||
serial_buf = new unsigned char[5];
|
||||
|
||||
serial_buf[0] = 0x8D;
|
||||
serial_buf[1] = channel;
|
||||
|
||||
serialport->serial_flush_rx();
|
||||
serialport->serial_write((char *)serial_buf, 2);
|
||||
serialport->serial_flush_tx();
|
||||
|
||||
Sleep(50);
|
||||
|
||||
int bytes_read = serialport->serial_read((char *)serial_buf, 5);
|
||||
|
||||
if(bytes_read == 5)
|
||||
{
|
||||
ret_val = serial_buf[4];
|
||||
}
|
||||
|
||||
delete[] serial_buf;
|
||||
}
|
||||
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
void HuePlusController::SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors)
|
||||
{
|
||||
if (serialport != NULL)
|
||||
{
|
||||
unsigned char *serial_buf;
|
||||
|
||||
serial_buf = new unsigned char[hueSize]; //Size of Message always 5 XX Blocks (Mode Selection) + 3 XX for each LED (1 color)
|
||||
//-> max of 40 LEDs per Channel (or 5 Fans a 8 LEDs) -> 125 Blocks (empty LEDs are written, too
|
||||
serial_buf[0] = 0x4b;
|
||||
serial_buf = new unsigned char[HUE_PLUS_PACKET_SIZE];
|
||||
|
||||
serial_buf[0] = 0x4B;
|
||||
serial_buf[1] = channel;
|
||||
serial_buf[2] = 0x0e;
|
||||
serial_buf[3] = fans;
|
||||
serial_buf[2] = HUE_PLUS_MODE_FIXED;
|
||||
serial_buf[3] = 0x00;
|
||||
serial_buf[4] = 0x00;
|
||||
|
||||
for (int i = 5; i < hueSize; i++)
|
||||
for (int i = 5; i < HUE_PLUS_PACKET_SIZE; i++)
|
||||
{
|
||||
//clearing the buf otherwise sometimes strange things are written to the COM Port
|
||||
serial_buf[i] = 0x00;
|
||||
}
|
||||
|
||||
for (int idx = 0; idx < (num_leds * 3); idx += 3)
|
||||
for (int idx = 0; idx < (colors.size() * 3); idx += 3)
|
||||
{
|
||||
int pixel_idx = idx / 3;
|
||||
RGBColor color = colors[pixel_idx];
|
||||
@@ -127,7 +105,7 @@ void HuePlusController::SetLEDs(std::vector<RGBColor> colors)
|
||||
serial_buf[idx + 7] = RGBGetBValue(color);
|
||||
}
|
||||
|
||||
serialport->serial_write((char *)serial_buf, hueSize);
|
||||
serialport->serial_write((char *)serial_buf, HUE_PLUS_PACKET_SIZE);
|
||||
serialport->serial_flush_tx();
|
||||
|
||||
delete[] serial_buf;
|
||||
|
||||
@@ -22,24 +22,45 @@
|
||||
#define strtok_s strtok_r
|
||||
#endif
|
||||
|
||||
#define HUE_PLUS_BAUD 256000
|
||||
#define HUE_PLUS_PACKET_SIZE 125
|
||||
|
||||
enum
|
||||
{
|
||||
HUE_PLUS_CHANNEL_BOTH = 0x00, /* Both channels */
|
||||
HUE_PLUS_CHANNEL_1 = 0x01, /* Channel 1 */
|
||||
HUE_PLUS_CHANNEL_2 = 0x02, /* Channel 2 */
|
||||
HUE_PLUS_NUM_CHANNELS = 0x02 /* Number of channels */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HUE_PLUS_CHANNEL_1_IDX = 0x00, /* Channel 1 array index */
|
||||
HUE_PLUS_CHANNEL_2_IDX = 0x01, /* Channel 2 array index */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HUE_PLUS_MODE_FIXED = 0x00, /* Fixed colors mode */
|
||||
HUE_PLUS_MODE_FADING = 0x01, /* Fading mode */
|
||||
HUE_PLUS_MODE_SPECTRUM = 0x02, /* Spectrum cycle mode */
|
||||
HUE_PLUS_NUM_MODES /* Number of Hue Plus modes */
|
||||
};
|
||||
|
||||
class HuePlusController
|
||||
{
|
||||
public:
|
||||
HuePlusController();
|
||||
~HuePlusController();
|
||||
|
||||
void Initialize(char* ledstring);
|
||||
char* GetLEDString();
|
||||
void SetLEDs(std::vector<RGBColor> colors);
|
||||
void Initialize(char* port_name);
|
||||
char* GetLEDString();
|
||||
unsigned int GetStripsOnChannel(unsigned int channel);
|
||||
void SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors);
|
||||
|
||||
int num_leds;
|
||||
unsigned int channel_leds[HUE_PLUS_NUM_CHANNELS];
|
||||
|
||||
private:
|
||||
int baud_rate;
|
||||
int fans;
|
||||
int channel;
|
||||
const int hueSize = 125;
|
||||
|
||||
char led_string[1024];
|
||||
char port_name[128];
|
||||
serial_port *serialport;
|
||||
|
||||
@@ -37,7 +37,6 @@ void DetectHuePlusControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
#ifdef WIN32
|
||||
GetModuleFileName(NULL, filename, 2048);
|
||||
strcpy(filename, std::string(filename).substr(0, std::string(filename).find_last_of("\\/")).c_str());
|
||||
strcat(filename, "\\settings.txt");
|
||||
#else
|
||||
snprintf(arg1, 64, "/proc/%d/exe", getpid());
|
||||
readlink(arg1, filename, 1024);
|
||||
@@ -86,4 +85,4 @@ void DetectHuePlusControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
}
|
||||
|
||||
|
||||
} /* DetectHuePlusControllers() */
|
||||
} /* DetectHuePlusControllers() */
|
||||
|
||||
@@ -10,13 +10,25 @@
|
||||
#include "HyperXController.h"
|
||||
#include <cstring>
|
||||
|
||||
HyperXController::HyperXController(i2c_smbus_interface* bus, hyperx_dev_id dev)
|
||||
HyperXController::HyperXController(i2c_smbus_interface* bus, hyperx_dev_id dev, unsigned char slots)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
slots_valid = slots;
|
||||
|
||||
strcpy(device_name, "HyperX Predator RGB");
|
||||
led_count = 1;
|
||||
|
||||
led_count = 0;
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
if((slots_valid & (1 << i)) != 0)
|
||||
{
|
||||
led_count += 5;
|
||||
}
|
||||
}
|
||||
|
||||
mode = HYPERX_MODE_DIRECT;
|
||||
}
|
||||
|
||||
HyperXController::~HyperXController()
|
||||
@@ -24,23 +36,91 @@ HyperXController::~HyperXController()
|
||||
|
||||
}
|
||||
|
||||
char* HyperXController::GetDeviceName()
|
||||
std::string HyperXController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string HyperXController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
unsigned int HyperXController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
}
|
||||
|
||||
unsigned int HyperXController::GetSlotCount()
|
||||
{
|
||||
unsigned int slot_count = 0;
|
||||
|
||||
for(int slot = 0; slot < 4; slot++)
|
||||
{
|
||||
if((slots_valid & (1 << slot)) != 0)
|
||||
{
|
||||
slot_count++;
|
||||
}
|
||||
}
|
||||
|
||||
return(slot_count);
|
||||
}
|
||||
|
||||
unsigned int HyperXController::GetMode()
|
||||
{
|
||||
return(mode);
|
||||
}
|
||||
|
||||
void HyperXController::SetEffectColor(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_EFFECT_RED, red );
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_EFFECT_GREEN, green);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_EFFECT_BLUE, blue );
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_EFFECT_BRIGHTNESS, 0x64 );
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
|
||||
}
|
||||
|
||||
void HyperXController::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_RED, red);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_GREEN, green);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_BLUE, blue);
|
||||
/*-----------------------------------------------------*\
|
||||
| Loop through all slots and only set those which are |
|
||||
| active. |
|
||||
\*-----------------------------------------------------*/
|
||||
for(int slot = 0; slot < 4; slot++)
|
||||
{
|
||||
if((slots_valid & (1 << slot)) != 0)
|
||||
{
|
||||
unsigned char base = slot_base[slot];
|
||||
unsigned char red_base = base + 0x00;
|
||||
unsigned char green_base = base + 0x01;
|
||||
unsigned char blue_base = base + 0x02;
|
||||
unsigned char bright_base = base + 0x10;
|
||||
|
||||
if(mode == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE3, HYPERX_MODE3_DIRECT);
|
||||
}
|
||||
|
||||
for(int led = 0; led < 5; led++)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, red_base + (3 * led), red );
|
||||
bus->i2c_smbus_write_byte_data(dev, green_base + (3 * led), green);
|
||||
bus->i2c_smbus_write_byte_data(dev, blue_base + (3 * led), blue );
|
||||
bus->i2c_smbus_write_byte_data(dev, bright_base + (3 * led), 0x64 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
|
||||
@@ -48,22 +128,84 @@ void HyperXController::SetAllColors(unsigned char red, unsigned char green, unsi
|
||||
|
||||
void HyperXController::SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| led_slot - the unmapped slot ID for the given LED |
|
||||
| led - the LED ID within that slot |
|
||||
| slot_id - counts enabled slots |
|
||||
| slot - the mapped slot ID for the given LED |
|
||||
\*-----------------------------------------------------*/
|
||||
int led_slot = led / 5;
|
||||
int slot_id = -1;
|
||||
int slot;
|
||||
|
||||
led -= (led_slot * 5);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Loop through all possible slots and only count those |
|
||||
| which are active. |
|
||||
\*-----------------------------------------------------*/
|
||||
for(slot = 0; slot < 4; slot++)
|
||||
{
|
||||
if((slots_valid & ( 1 << slot)) != 0)
|
||||
{
|
||||
slot_id++;
|
||||
}
|
||||
|
||||
if(slot_id == led_slot)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char base = slot_base[slot];
|
||||
unsigned char red_base = base + 0x00;
|
||||
unsigned char green_base = base + 0x01;
|
||||
unsigned char blue_base = base + 0x02;
|
||||
unsigned char bright_base = base + 0x10;
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_RED, red);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_GREEN, green);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_BLUE, blue);
|
||||
bus->i2c_smbus_write_byte_data(dev, red_base + (3 * led), red );
|
||||
bus->i2c_smbus_write_byte_data(dev, green_base + (3 * led), green);
|
||||
bus->i2c_smbus_write_byte_data(dev, blue_base + (3 * led), blue );
|
||||
bus->i2c_smbus_write_byte_data(dev, bright_base + (3 * led), 0x64 );
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
|
||||
}
|
||||
|
||||
void HyperXController::SetMode(unsigned char mode)
|
||||
|
||||
void HyperXController::SetLEDColor(unsigned int slot, unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
unsigned char base = slot_base[slot];
|
||||
unsigned char red_base = base + 0x00;
|
||||
unsigned char green_base = base + 0x01;
|
||||
unsigned char blue_base = base + 0x02;
|
||||
unsigned char bright_base = base + 0x10;
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, red_base + (3 * led), red );
|
||||
bus->i2c_smbus_write_byte_data(dev, green_base + (3 * led), green);
|
||||
bus->i2c_smbus_write_byte_data(dev, blue_base + (3 * led), blue );
|
||||
bus->i2c_smbus_write_byte_data(dev, bright_base + (3 * led), 0x64 );
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
|
||||
}
|
||||
|
||||
void HyperXController::SetMode(unsigned char new_mode)
|
||||
{
|
||||
mode = new_mode;
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case HYPERX_MODE_DIRECT:
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE3, HYPERX_MODE3_DIRECT);
|
||||
break;
|
||||
|
||||
case HYPERX_MODE_STATIC:
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_STATIC);
|
||||
break;
|
||||
@@ -99,4 +241,4 @@ void HyperXController::SetMode(unsigned char mode)
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
| Adam Honse (CalcProgrammer1) 6/29/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
@@ -16,13 +17,98 @@ typedef unsigned short hyperx_register;
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_REG_BRIGHTNESS = 0xDD, /* Brightness control register (0-100) */
|
||||
HYPERX_REG_SLOT0_LED0_RED = 0x11, /* R color register for LED 0, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED0_GREEN = 0x12, /* G color register for LED 0, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED0_BLUE = 0x13, /* B color register for LED 0, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED1_RED = 0x14, /* R color register for LED 1, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED1_GREEN = 0x15, /* G color register for LED 1, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED1_BLUE = 0x16, /* B color register for LED 1, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED2_RED = 0x17, /* R color register for LED 2, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED2_GREEN = 0x18, /* G color register for LED 2, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED2_BLUE = 0x19, /* B color register for LED 2, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED3_RED = 0x1A, /* R color register for LED 3, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED3_GREEN = 0x1B, /* G color register for LED 3, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED3_BLUE = 0x1C, /* B color register for LED 3, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED4_RED = 0x1D, /* R color register for LED 4, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED4_GREEN = 0x1E, /* G color register for LED 4, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED4_BLUE = 0x1F, /* B color register for LED 4, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED0_BRIGHTNESS = 0x21, /* Brightness for LED 0, Slot 0 (0-100) */
|
||||
HYPERX_REG_SLOT0_LED1_BRIGHTNESS = 0x24, /* Brightness for LED 1, Slot 0 (0-100) */
|
||||
HYPERX_REG_SLOT0_LED2_BRIGHTNESS = 0x27, /* Brightness for LED 2, Slot 0 (0-100) */
|
||||
HYPERX_REG_SLOT0_LED3_BRIGHTNESS = 0x2A, /* Brightness for LED 3, Slot 0 (0-100) */
|
||||
HYPERX_REG_SLOT0_LED4_BRIGHTNESS = 0x2D, /* Brightness for LED 4, Slot 0 (0-100) */
|
||||
|
||||
HYPERX_REG_SLOT1_LED0_RED = 0x41, /* R color register for LED 0, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED0_GREEN = 0x42, /* G color register for LED 0, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED0_BLUE = 0x43, /* B color register for LED 0, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED1_RED = 0x44, /* R color register for LED 1, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED1_GREEN = 0x45, /* G color register for LED 1, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED1_BLUE = 0x46, /* B color register for LED 1, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED2_RED = 0x47, /* R color register for LED 2, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED2_GREEN = 0x48, /* G color register for LED 2, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED2_BLUE = 0x49, /* B color register for LED 2, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED3_RED = 0x4A, /* R color register for LED 3, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED3_GREEN = 0x4B, /* G color register for LED 3, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED3_BLUE = 0x4C, /* B color register for LED 3, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED4_RED = 0x4D, /* R color register for LED 4, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED4_GREEN = 0x4E, /* G color register for LED 4, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED4_BLUE = 0x4F, /* B color register for LED 4, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED0_BRIGHTNESS = 0x51, /* Brightness for LED 0, Slot 1 (0-100) */
|
||||
HYPERX_REG_SLOT1_LED1_BRIGHTNESS = 0x54, /* Brightness for LED 1, Slot 1 (0-100) */
|
||||
HYPERX_REG_SLOT1_LED2_BRIGHTNESS = 0x57, /* Brightness for LED 2, Slot 1 (0-100) */
|
||||
HYPERX_REG_SLOT1_LED3_BRIGHTNESS = 0x5A, /* Brightness for LED 3, Slot 1 (0-100) */
|
||||
HYPERX_REG_SLOT1_LED4_BRIGHTNESS = 0x5D, /* Brightness for LED 4, Slot 1 (0-100) */
|
||||
|
||||
HYPERX_REG_SLOT2_LED0_RED = 0x71, /* R color register for LED 0, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED0_GREEN = 0x72, /* G color register for LED 0, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED0_BLUE = 0x73, /* B color register for LED 0, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED1_RED = 0x74, /* R color register for LED 1, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED1_GREEN = 0x75, /* G color register for LED 1, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED1_BLUE = 0x76, /* B color register for LED 1, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED2_RED = 0x77, /* R color register for LED 2, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED2_GREEN = 0x78, /* G color register for LED 2, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED2_BLUE = 0x79, /* B color register for LED 2, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED3_RED = 0x7A, /* R color register for LED 3, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED3_GREEN = 0x7B, /* G color register for LED 3, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED3_BLUE = 0x7C, /* B color register for LED 3, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED4_RED = 0x7D, /* R color register for LED 4, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED4_GREEN = 0x7E, /* G color register for LED 4, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED4_BLUE = 0x7F, /* B color register for LED 4, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED0_BRIGHTNESS = 0x81, /* Brightness for LED 0, Slot 2 (0-100) */
|
||||
HYPERX_REG_SLOT2_LED1_BRIGHTNESS = 0x84, /* Brightness for LED 1, Slot 2 (0-100) */
|
||||
HYPERX_REG_SLOT2_LED2_BRIGHTNESS = 0x87, /* Brightness for LED 2, Slot 2 (0-100) */
|
||||
HYPERX_REG_SLOT2_LED3_BRIGHTNESS = 0x8A, /* Brightness for LED 3, Slot 2 (0-100) */
|
||||
HYPERX_REG_SLOT2_LED4_BRIGHTNESS = 0x8D, /* Brightness for LED 4, Slot 2 (0-100) */
|
||||
|
||||
HYPERX_REG_SLOT3_LED0_RED = 0xA1, /* R color register for LED 0, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED0_GREEN = 0xA2, /* G color register for LED 0, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED0_BLUE = 0xA3, /* B color register for LED 0, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED1_RED = 0xA4, /* R color register for LED 1, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED1_GREEN = 0xA5, /* G color register for LED 1, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED1_BLUE = 0xA6, /* B color register for LED 1, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED2_RED = 0xA7, /* R color register for LED 2, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED2_GREEN = 0xA8, /* G color register for LED 2, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED2_BLUE = 0xA9, /* B color register for LED 2, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED3_RED = 0xAA, /* R color register for LED 3, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED3_GREEN = 0xAB, /* G color register for LED 3, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED3_BLUE = 0xAC, /* B color register for LED 3, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED4_RED = 0xAD, /* R color register for LED 4, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED4_GREEN = 0xAE, /* G color register for LED 4, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED4_BLUE = 0xAF, /* B color register for LED 4, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED0_BRIGHTNESS = 0xB1, /* Brightness for LED 0, Slot 3 (0-100) */
|
||||
HYPERX_REG_SLOT3_LED1_BRIGHTNESS = 0xB4, /* Brightness for LED 1, Slot 3 (0-100) */
|
||||
HYPERX_REG_SLOT3_LED2_BRIGHTNESS = 0xB7, /* Brightness for LED 2, Slot 3 (0-100) */
|
||||
HYPERX_REG_SLOT3_LED3_BRIGHTNESS = 0xBA, /* Brightness for LED 3, Slot 3 (0-100) */
|
||||
HYPERX_REG_SLOT3_LED4_BRIGHTNESS = 0xBD, /* Brightness for LED 4, Slot 3 (0-100) */
|
||||
|
||||
HYPERX_REG_EFFECT_BRIGHTNESS = 0xDD, /* Brightness for effects (0-100) */
|
||||
HYPERX_REG_APPLY = 0xE1, /* Apply changes register */
|
||||
HYPERX_REG_MODE1 = 0xE3, /* Mode control register 1 */
|
||||
HYPERX_REG_MODE2 = 0xE4, /* Mode control register 2 */
|
||||
HYPERX_REG_RED = 0xEC, /* Red color register */
|
||||
HYPERX_REG_GREEN = 0xED, /* Green color register */
|
||||
HYPERX_REG_BLUE = 0xEE, /* Blue color register */
|
||||
HYPERX_REG_MODE3 = 0xE5, /* Mode control register 3 */
|
||||
HYPERX_REG_EFFECT_RED = 0xEC, /* Red color register for effects */
|
||||
HYPERX_REG_EFFECT_GREEN = 0xED, /* Green color register for effects */
|
||||
HYPERX_REG_EFFECT_BLUE = 0xEE, /* Blue color register for effects */
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -43,34 +129,54 @@ enum
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_MODE_STATIC = 0, /* Static color mode */
|
||||
HYPERX_MODE_RAINBOW = 1, /* Rainbow wave mode */
|
||||
HYPERX_MODE_COMET = 2, /* Comet (chase) mode */
|
||||
HYPERX_MODE_HEARTBEAT = 3, /* Heartbeat (pulsing) mode */
|
||||
HYPERX_MODE_CYCLE = 4, /* Spectrum cycle mode */
|
||||
HYPERX_MODE_BREATHING = 5, /* Breathing mode */
|
||||
HYPERX_MODE_BOUNCE = 6, /* Bounce mode */
|
||||
HYPERX_MODE_BLINK = 7, /* Blinking mode */
|
||||
HYPERX_MODE3_DIRECT = 0x21, /* Mode 3 direct control */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_MODE_DIRECT = 0, /* Direct control mode */
|
||||
HYPERX_MODE_STATIC = 1, /* Static color mode */
|
||||
HYPERX_MODE_RAINBOW = 2, /* Rainbow wave mode */
|
||||
HYPERX_MODE_COMET = 3, /* Comet (chase) mode */
|
||||
HYPERX_MODE_HEARTBEAT = 4, /* Heartbeat (pulsing) mode */
|
||||
HYPERX_MODE_CYCLE = 5, /* Spectrum cycle mode */
|
||||
HYPERX_MODE_BREATHING = 6, /* Breathing mode */
|
||||
HYPERX_MODE_BOUNCE = 7, /* Bounce mode */
|
||||
HYPERX_MODE_BLINK = 8, /* Blinking mode */
|
||||
HYPERX_NUMBER_MODES /* Number of HyperX modes */
|
||||
};
|
||||
|
||||
static const unsigned char slot_base[4] =
|
||||
{
|
||||
HYPERX_REG_SLOT0_LED0_RED, /* SPD 0x50 maps to slot 0 */
|
||||
HYPERX_REG_SLOT1_LED0_RED, /* SPD 0x51 maps to slot 1 */
|
||||
HYPERX_REG_SLOT2_LED0_RED, /* SPD 0x52 maps to slot 2 */
|
||||
HYPERX_REG_SLOT3_LED0_RED /* SPD 0x53 maps to slot 3 */
|
||||
};
|
||||
|
||||
class HyperXController
|
||||
{
|
||||
public:
|
||||
HyperXController(i2c_smbus_interface* bus, hyperx_dev_id dev);
|
||||
HyperXController(i2c_smbus_interface* bus, hyperx_dev_id dev, unsigned char slots);
|
||||
~HyperXController();
|
||||
|
||||
char* GetDeviceName();
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
unsigned int GetLEDCount();
|
||||
void SetMode(unsigned char mode);
|
||||
unsigned int GetSlotCount();
|
||||
unsigned int GetMode();
|
||||
void SetMode(unsigned char new_mode);
|
||||
|
||||
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetEffectColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDColor(unsigned int slot, unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
private:
|
||||
char device_name[32];
|
||||
unsigned int led_count;
|
||||
unsigned char slots_valid;
|
||||
i2c_smbus_interface* bus;
|
||||
hyperx_dev_id dev;
|
||||
};
|
||||
unsigned int mode;
|
||||
};
|
||||
|
||||
@@ -6,6 +6,17 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
static void Sleep(unsigned int milliseconds)
|
||||
{
|
||||
usleep(1000 * milliseconds);
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForHyperXController *
|
||||
@@ -58,13 +69,38 @@ void DetectHyperXControllers(std::vector<i2c_smbus_interface*> &busses, std::vec
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
unsigned char slots_valid = 0x00;
|
||||
|
||||
// Check for HyperX controller at 0x27
|
||||
if (TestForHyperXController(busses[bus], 0x27))
|
||||
{
|
||||
new_hyperx = new HyperXController(busses[bus], 0x27);
|
||||
new_controller = new RGBController_HyperX(new_hyperx);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
busses[bus]->i2c_smbus_write_byte_data(0x37, 0x00, 0xFF);
|
||||
|
||||
Sleep(1);
|
||||
|
||||
for(int slot_addr = 0x50; slot_addr <= 0x57; slot_addr++)
|
||||
{
|
||||
// Test for HyperX SPD at slot_addr
|
||||
// This test was copied from NGENUITY software
|
||||
// Tests SPD addresses in order: 0x40, 0x41, 0x68, and 0x67
|
||||
if((busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x40) == 0x01)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x41) == 0x98)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x68) == 0x10)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x67) == 0x00))
|
||||
{
|
||||
slots_valid |= (1 << (slot_addr - 0x50));
|
||||
}
|
||||
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
if(slots_valid != 0)
|
||||
{
|
||||
new_hyperx = new HyperXController(busses[bus], 0x27, slots_valid);
|
||||
new_controller = new RGBController_HyperX(new_hyperx);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectHyperXControllers() */
|
||||
} /* DetectHyperXControllers() */
|
||||
|
||||
@@ -29,11 +29,21 @@ RGBFusionController::~RGBFusionController()
|
||||
|
||||
}
|
||||
|
||||
char* RGBFusionController::GetDeviceName()
|
||||
std::string RGBFusionController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string RGBFusionController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
unsigned int RGBFusionController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
@@ -158,4 +168,4 @@ void RGBFusionController::set_mode_ch_1(unsigned char mode)
|
||||
void RGBFusionController::switch_bank(unsigned char bank)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_SWITCH_REG, bank);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
| Adam Honse (CalcProgrammer1) 12/10/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
@@ -42,7 +43,8 @@ public:
|
||||
RGBFusionController(i2c_smbus_interface* bus, rgb_fusion_dev_id dev);
|
||||
~RGBFusionController();
|
||||
|
||||
char* GetDeviceName();
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
unsigned int GetLEDCount();
|
||||
unsigned char GetMode();
|
||||
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
|
||||
@@ -66,4 +68,4 @@ private:
|
||||
i2c_smbus_interface* bus;
|
||||
rgb_fusion_dev_id dev;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
+2
-79
@@ -319,84 +319,6 @@ void DetectI2CBusses()
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectI2C *
|
||||
* *
|
||||
* Prints a list of all detected I2C addresses on the given bus *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface to scan *
|
||||
* mode - one of AUTO, QUICK, READ, FUNC - method of access *
|
||||
* *
|
||||
* Code adapted from i2cdetect.c from i2c-tools Linux package *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
#define MODE_AUTO 0
|
||||
#define MODE_QUICK 1
|
||||
#define MODE_READ 2
|
||||
#define MODE_FUNC 3
|
||||
|
||||
std::string DetectI2C(i2c_smbus_interface * bus, int mode)
|
||||
{
|
||||
int i, j;
|
||||
int res;
|
||||
int slave_addr;
|
||||
char line[128];
|
||||
std::string text;
|
||||
|
||||
sprintf(line, " 0 1 2 3 4 5 6 7 8 9 a b c d e f\r\n");
|
||||
text.append(line);
|
||||
|
||||
for (i = 0; i < 128; i += 16)
|
||||
{
|
||||
sprintf(line, "%02x: ", i);
|
||||
text.append(line);
|
||||
|
||||
for (j = 0; j < 16; j++)
|
||||
{
|
||||
/* Set slave address */
|
||||
slave_addr = i + j;
|
||||
|
||||
/* Probe this address */
|
||||
switch (mode)
|
||||
{
|
||||
case MODE_QUICK:
|
||||
res = bus->i2c_smbus_write_quick(slave_addr, I2C_SMBUS_WRITE);
|
||||
break;
|
||||
case MODE_READ:
|
||||
res = bus->i2c_smbus_read_byte(slave_addr);
|
||||
break;
|
||||
default:
|
||||
if ((i + j >= 0x30 && i + j <= 0x37)
|
||||
|| (i + j >= 0x50 && i + j <= 0x5F))
|
||||
res = bus->i2c_smbus_read_byte(slave_addr);
|
||||
else
|
||||
res = bus->i2c_smbus_write_quick(slave_addr, I2C_SMBUS_WRITE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
sprintf(line, "-- ");
|
||||
text.append(line);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(line, "%02x ", i + j);
|
||||
text.append(line);
|
||||
}
|
||||
}
|
||||
sprintf(line, "\r\n");
|
||||
text.append(line);
|
||||
}
|
||||
|
||||
return text;
|
||||
|
||||
} /* DetectI2C() */
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DumpAuraRegisters *
|
||||
@@ -437,6 +359,7 @@ void DetectCorsairProControllers(std::vector<i2c_smbus_interface*> &busses, std:
|
||||
void DetectHyperXControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectRGBFusionControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectHuePlusControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectRazerChromaSDKControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers);
|
||||
@@ -460,7 +383,7 @@ void DetectRGBControllers(void)
|
||||
DetectRGBFusionControllers(busses, rgb_controllers);
|
||||
|
||||
DetectLEDStripControllers(rgb_controllers);
|
||||
|
||||
DetectHuePlusControllers(rgb_controllers);
|
||||
#ifdef WIN32
|
||||
DetectRazerChromaSDKControllers(rgb_controllers);
|
||||
#else
|
||||
|
||||
@@ -2,11 +2,12 @@ QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = OpenAuraSDK
|
||||
TARGET = OpenRGB
|
||||
TEMPLATE = app
|
||||
|
||||
INCLUDEPATH += \
|
||||
i2c_smbus/ \
|
||||
i2c_tools/ \
|
||||
net_port/ \
|
||||
serial_port/ \
|
||||
Controllers/AuraController/ \
|
||||
@@ -22,9 +23,15 @@ INCLUDEPATH += \
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
OpenAuraSDK.cpp \
|
||||
qt/OpenAuraSDKQtDialog.cpp \
|
||||
qt/OpenRGBDeviceInfoPage.cpp \
|
||||
qt/OpenRGBDevicePage.cpp \
|
||||
qt/OpenRGBDialog.cpp \
|
||||
i2c_smbus/i2c_smbus.cpp \
|
||||
i2c_tools/i2c_tools.cpp \
|
||||
net_port/net_port.cpp \
|
||||
qt/OpenRGBDialog2.cpp \
|
||||
qt/OpenRGBSystemInfoPage.cpp \
|
||||
qt/hsv.cpp \
|
||||
serial_port/serial_port.cpp \
|
||||
Controllers/AuraController/AuraController.cpp \
|
||||
Controllers/AuraController/AuraControllerDetect.cpp \
|
||||
@@ -49,9 +56,15 @@ SOURCES += \
|
||||
RGBController/RGBController_RGBFusion.cpp
|
||||
|
||||
HEADERS += \
|
||||
qt/OpenAuraSDKQtDialog.h \
|
||||
Controllers/RGBFusionController/RGBFusionController.h \
|
||||
qt/OpenRGBDeviceInfoPage.h \
|
||||
qt/OpenRGBDevicePage.h \
|
||||
qt/OpenRGBDialog.h \
|
||||
i2c_smbus/i2c_smbus.h \
|
||||
i2c_tools/i2c_tools.h \
|
||||
net_port/net_port.h \
|
||||
qt/OpenRGBDialog2.h \
|
||||
qt/OpenRGBSystemInfoPage.h \
|
||||
serial_port/serial_port.h \
|
||||
Controllers/AuraController/AuraController.h \
|
||||
Controllers/CorsairController/CorsairController.h \
|
||||
@@ -71,7 +84,11 @@ RESOURCES += \
|
||||
qt/resources.qrc
|
||||
|
||||
FORMS += \
|
||||
qt/openaurasdk.ui
|
||||
qt/OpenRGBDeviceInfoPage.ui \
|
||||
qt/OpenRGBDevicePage.ui \
|
||||
qt/OpenRGBDialog.ui \
|
||||
qt/OpenRGBDialog2.ui \
|
||||
qt/OpenRGBSystemInfoPage.ui
|
||||
|
||||
#-----------------------------------------------
|
||||
# Windows specific project configuration
|
||||
@@ -39,6 +39,22 @@ enum
|
||||
ZONE_TYPE_MATRIX
|
||||
};
|
||||
|
||||
typedef int device_type;
|
||||
|
||||
enum
|
||||
{
|
||||
DEVICE_TYPE_MOTHERBOARD,
|
||||
DEVICE_TYPE_DRAM,
|
||||
DEVICE_TYPE_GPU,
|
||||
DEVICE_TYPE_COOLER,
|
||||
DEVICE_TYPE_LEDSTRIP,
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
DEVICE_TYPE_MOUSE,
|
||||
DEVICE_TYPE_MOUSEMAT,
|
||||
DEVICE_TYPE_HEADSET,
|
||||
DEVICE_TYPE_UNKNOWN
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::string name; /* Zone name */
|
||||
@@ -50,11 +66,16 @@ typedef struct
|
||||
class RGBController
|
||||
{
|
||||
public:
|
||||
std::string name; /* controller name */
|
||||
std::vector<led> leds; /* LEDs */
|
||||
std::vector<zone> zones; /* Zones */
|
||||
std::vector<mode> modes; /* Modes */
|
||||
std::vector<RGBColor> colors; /* Color buffer */
|
||||
std::string name; /* controller name */
|
||||
std::string description; /* controller description */
|
||||
std::string version; /* controller version */
|
||||
std::string serial; /* controller serial number */
|
||||
std::string location; /* controller location */
|
||||
std::vector<led> leds; /* LEDs */
|
||||
std::vector<zone> zones; /* Zones */
|
||||
std::vector<mode> modes; /* Modes */
|
||||
std::vector<RGBColor> colors; /* Color buffer */
|
||||
device_type type; /* device type */
|
||||
|
||||
virtual int GetMode() = 0;
|
||||
virtual void SetMode(int mode) = 0;
|
||||
@@ -63,4 +84,4 @@ public:
|
||||
virtual void SetAllZoneLEDs(int zone, RGBColor color) = 0;
|
||||
virtual void SetLED(int led, RGBColor color) = 0;
|
||||
virtual void UpdateLEDs() = 0;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -118,7 +118,18 @@ RGBController_Aura::RGBController_Aura(AuraController * aura_ptr)
|
||||
|
||||
aura = aura_ptr;
|
||||
|
||||
name = aura->GetDeviceName();
|
||||
version = aura->GetDeviceName();
|
||||
location = aura->GetDeviceLocation();
|
||||
if((version.find("DIMM_LED") != std::string::npos) || (version.find("AUDA") != std::string::npos) )
|
||||
{
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
name = "ASUS Aura DRAM";
|
||||
}
|
||||
else
|
||||
{
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
name = "ASUS Aura Motherboard";
|
||||
}
|
||||
|
||||
mode aura_modes[AURA_NUMBER_MODES + 1];
|
||||
|
||||
@@ -200,4 +211,4 @@ RGBController_Aura::RGBController_Aura(AuraController * aura_ptr)
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,9 @@ RGBController_Corsair::RGBController_Corsair(CorsairController* corsair_ptr)
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = corsair->GetDeviceName();
|
||||
location = corsair->GetDeviceLocation();
|
||||
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
|
||||
mode corsair_modes[CORSAIR_NUMBER_MODES];
|
||||
|
||||
@@ -104,4 +107,4 @@ RGBController_Corsair::RGBController_Corsair(CorsairController* corsair_ptr)
|
||||
new_zone.map.push_back(zone_row);
|
||||
|
||||
zones.push_back(new_zone);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,4 +26,4 @@ public:
|
||||
|
||||
private:
|
||||
CorsairController* corsair;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -103,6 +103,9 @@ RGBController_CorsairPro::RGBController_CorsairPro(CorsairProController* corsair
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = corsair->GetDeviceName();
|
||||
location = corsair->GetDeviceLocation();
|
||||
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
|
||||
mode corsair_modes[CORSAIR_PRO_NUMBER_MODES];
|
||||
|
||||
@@ -147,4 +150,4 @@ RGBController_CorsairPro::RGBController_CorsairPro(CorsairProController* corsair
|
||||
new_zone.map.push_back(zone_row);
|
||||
|
||||
zones.push_back(new_zone);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,31 +11,60 @@
|
||||
|
||||
RGBController_HuePlus::RGBController_HuePlus(HuePlusController* hueplus_ptr)
|
||||
{
|
||||
strip = hueplus_ptr;
|
||||
hueplus = hueplus_ptr;
|
||||
|
||||
name = "LED Strip";
|
||||
name = "NZXT Hue+";
|
||||
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
|
||||
location = hueplus->GetLEDString();
|
||||
|
||||
mode led_mode;
|
||||
led_mode.name = "Custom";
|
||||
modes.push_back(led_mode);
|
||||
|
||||
for (int i = 0; i < strip->num_leds; i++)
|
||||
{
|
||||
colors.push_back(0x00000000);
|
||||
led new_led;
|
||||
new_led.name = "LED Strip";
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
unsigned int led_idx = 0;
|
||||
|
||||
zone led_zone;
|
||||
led_zone.name = "LED Strip";
|
||||
std::vector<int> led_zone_map;
|
||||
for (int i = 0; i < strip->num_leds; i++)
|
||||
for (int channel_idx = 0; channel_idx < HUE_PLUS_NUM_CHANNELS; channel_idx++)
|
||||
{
|
||||
led_zone_map.push_back(i);
|
||||
if(hueplus->channel_leds[channel_idx] > 0)
|
||||
{
|
||||
zone* new_zone = new zone;
|
||||
|
||||
char ch_idx_string[2];
|
||||
sprintf(ch_idx_string, "%d", channel_idx + 1);
|
||||
|
||||
new_zone->name = "Hue+ Channel ";
|
||||
new_zone->name.append(ch_idx_string);
|
||||
new_zone->type = ZONE_TYPE_LINEAR;
|
||||
|
||||
std::vector<int> *new_zone_map = new std::vector<int>();
|
||||
|
||||
for (int led_ch_idx = 0; led_ch_idx < hueplus->channel_leds[channel_idx]; led_ch_idx++)
|
||||
{
|
||||
colors.push_back(0x00000000);
|
||||
|
||||
char led_idx_string[3];
|
||||
sprintf(led_idx_string, "%d", led_ch_idx + 1);
|
||||
|
||||
led new_led;
|
||||
new_led.name = "Hue+ Channel ";
|
||||
new_led.name.append(ch_idx_string);
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(led_idx_string);
|
||||
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(channel_idx + 1);
|
||||
|
||||
new_zone_map->push_back(led_idx);
|
||||
led_idx++;
|
||||
}
|
||||
|
||||
new_zone->map.push_back(*new_zone_map);
|
||||
zones.push_back(*new_zone);
|
||||
zones_channel.push_back(channel_idx + 1);
|
||||
}
|
||||
}
|
||||
led_zone.map.push_back(led_zone_map);
|
||||
zones.push_back(led_zone);
|
||||
}
|
||||
|
||||
int RGBController_HuePlus::GetMode()
|
||||
@@ -60,27 +89,52 @@ void RGBController_HuePlus::SetAllLEDs(RGBColor color)
|
||||
colors[i] = color;
|
||||
}
|
||||
|
||||
strip->SetLEDs(colors);
|
||||
hueplus->SetChannelLEDs(0, colors);
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
for (int i = 0; i < colors.size(); i++)
|
||||
int channel = zones_channel[zone];
|
||||
|
||||
for (int x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
colors[i] = color;
|
||||
for (int y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
colors[zones[zone].map[x][y]] = color;
|
||||
}
|
||||
}
|
||||
|
||||
strip->SetLEDs(colors);
|
||||
std::vector<RGBColor> channel_colors;
|
||||
|
||||
for(int color = 0; color < colors.size(); color++)
|
||||
{
|
||||
if(leds_channel[color] == channel)
|
||||
{
|
||||
channel_colors.push_back(colors[color]);
|
||||
}
|
||||
}
|
||||
|
||||
hueplus->SetChannelLEDs(channel, channel_colors);
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::SetLED(int led, RGBColor color)
|
||||
{
|
||||
int channel = leds_channel[led];
|
||||
colors[led] = color;
|
||||
|
||||
strip->SetLEDs(colors);
|
||||
std::vector<RGBColor> channel_colors;
|
||||
|
||||
for(int color = 0; color < colors.size(); color++)
|
||||
{
|
||||
if(leds_channel[color] == channel)
|
||||
{
|
||||
channel_colors.push_back(colors[color]);
|
||||
}
|
||||
}
|
||||
hueplus->SetChannelLEDs(channel, channel_colors);
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::UpdateLEDs()
|
||||
{
|
||||
strip->SetLEDs(colors);
|
||||
}
|
||||
hueplus->SetChannelLEDs(0, colors);
|
||||
}
|
||||
|
||||
@@ -24,5 +24,7 @@ public:
|
||||
void UpdateLEDs();
|
||||
|
||||
private:
|
||||
HuePlusController* strip;
|
||||
HuePlusController* hueplus;
|
||||
std::vector<unsigned int> leds_channel;
|
||||
std::vector<unsigned int> zones_channel;
|
||||
};
|
||||
@@ -21,7 +21,7 @@ void RGBController_HyperX::SetMode(int mode)
|
||||
|
||||
void RGBController_HyperX::SetCustomMode()
|
||||
{
|
||||
hyperx->SetMode(HYPERX_MODE_STATIC);
|
||||
hyperx->SetMode(HYPERX_MODE_DIRECT);
|
||||
}
|
||||
|
||||
void RGBController_HyperX::SetAllLEDs(RGBColor color)
|
||||
@@ -30,7 +30,15 @@ void RGBController_HyperX::SetAllLEDs(RGBColor color)
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
hyperx->SetAllColors(red, grn, blu);
|
||||
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
hyperx->SetAllColors(red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
hyperx->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperX::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
@@ -39,13 +47,20 @@ void RGBController_HyperX::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
for (int x = 0; x < zones[zone].map.size(); x++)
|
||||
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
for (int y = 0; y < zones[zone].map[x].size(); y++)
|
||||
for (int x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
hyperx->SetLEDColor(zones[zone].map[x][y], red, grn, blu);
|
||||
for (int y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
hyperx->SetLEDColor(zones[zone].map[x][y], red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hyperx->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HyperX::SetLED(int led, RGBColor color)
|
||||
@@ -54,7 +69,14 @@ void RGBController_HyperX::SetLED(int led, RGBColor color)
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
hyperx->SetLEDColor(led, red, grn, blu);
|
||||
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
hyperx->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
hyperx->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HyperX::UpdateLEDs()
|
||||
@@ -67,46 +89,62 @@ RGBController_HyperX::RGBController_HyperX(HyperXController* hyperx_ptr)
|
||||
hyperx = hyperx_ptr;
|
||||
|
||||
name = hyperx->GetDeviceName();
|
||||
location = hyperx->GetDeviceLocation();
|
||||
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
|
||||
mode hyperx_modes[HYPERX_NUMBER_MODES];
|
||||
|
||||
hyperx_modes[0].name = "Static";
|
||||
hyperx_modes[1].name = "Rainbow";
|
||||
hyperx_modes[2].name = "Comet";
|
||||
hyperx_modes[3].name = "Heartbeat";
|
||||
hyperx_modes[4].name = "Spectrum Cycle";
|
||||
hyperx_modes[5].name = "Breathing";
|
||||
hyperx_modes[6].name = "Bounce";
|
||||
hyperx_modes[7].name = "Blink";
|
||||
hyperx_modes[0].name = "Direct";
|
||||
hyperx_modes[1].name = "Static";
|
||||
hyperx_modes[2].name = "Rainbow";
|
||||
hyperx_modes[3].name = "Comet";
|
||||
hyperx_modes[4].name = "Heartbeat";
|
||||
hyperx_modes[5].name = "Spectrum Cycle";
|
||||
hyperx_modes[6].name = "Breathing";
|
||||
hyperx_modes[7].name = "Bounce";
|
||||
hyperx_modes[8].name = "Blink";
|
||||
|
||||
for (int i = 0; i < HYPERX_NUMBER_MODES; i++)
|
||||
{
|
||||
modes.push_back(hyperx_modes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < hyperx->GetLEDCount(); i++)
|
||||
unsigned int led_idx = 0;
|
||||
|
||||
for(int slot = 0; slot < hyperx->GetSlotCount(); slot++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
zone* new_zone = new zone;
|
||||
|
||||
new_led->name = "HyperX LED";
|
||||
char slot_idx_str[3];
|
||||
sprintf(slot_idx_str, "%d", slot);
|
||||
new_zone->name = "HyperX Slot ";
|
||||
new_zone->name.append(slot_idx_str);
|
||||
|
||||
leds.push_back(*new_led);
|
||||
colors.push_back(0x00000000);
|
||||
new_zone->type = ZONE_TYPE_LINEAR;
|
||||
|
||||
std::vector<int> *new_zone_map = new std::vector<int>();
|
||||
|
||||
for(int led_slot_idx = 0; led_slot_idx < 5; led_slot_idx++)
|
||||
{
|
||||
colors.push_back(0x00000000);
|
||||
|
||||
led* new_led = new led();
|
||||
|
||||
char led_idx_str[3];
|
||||
sprintf(led_idx_str, "%d", led_slot_idx);
|
||||
new_led->name = "HyperX Slot ";
|
||||
new_led->name.append(slot_idx_str);
|
||||
new_led->name.append(", LED ");
|
||||
new_led->name.append(led_idx_str);
|
||||
|
||||
leds.push_back(*new_led);
|
||||
|
||||
new_zone_map->push_back(led_idx);
|
||||
led_idx++;
|
||||
}
|
||||
|
||||
new_zone->map.push_back(*new_zone_map);
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
|
||||
zone new_zone;
|
||||
|
||||
new_zone.name = "HyperX Zone";
|
||||
new_zone.type = ZONE_TYPE_SINGLE;
|
||||
|
||||
std::vector<int> zone_row;
|
||||
|
||||
for (int i = 0; i < hyperx->GetLEDCount(); i++)
|
||||
{
|
||||
zone_row.push_back(i);
|
||||
}
|
||||
|
||||
new_zone.map.push_back(zone_row);
|
||||
|
||||
zones.push_back(new_zone);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ RGBController_LEDStrip::RGBController_LEDStrip(LEDStripController* ledstrip_ptr)
|
||||
|
||||
name = "LED Strip";
|
||||
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
|
||||
mode led_mode;
|
||||
led_mode.name = "Custom";
|
||||
modes.push_back(led_mode);
|
||||
@@ -84,4 +86,4 @@ void RGBController_LEDStrip::SetLED(int led, RGBColor color)
|
||||
void RGBController_LEDStrip::UpdateLEDs()
|
||||
{
|
||||
strip->SetLEDs(colors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ void RGBController_OpenRazer::SetMode(int mode)
|
||||
{
|
||||
char update_value = 1;
|
||||
|
||||
switch(type)
|
||||
switch(matrix_type)
|
||||
{
|
||||
case RAZER_TYPE_MATRIX_FRAME:
|
||||
case RAZER_TYPE_MATRIX_NOFRAME:
|
||||
@@ -92,7 +92,7 @@ void RGBController_OpenRazer::SetCustomMode()
|
||||
|
||||
void RGBController_OpenRazer::UpdateLEDs()
|
||||
{
|
||||
switch(type)
|
||||
switch(matrix_type)
|
||||
{
|
||||
case RAZER_TYPE_MATRIX_FRAME:
|
||||
case RAZER_TYPE_MATRIX_NOFRAME:
|
||||
@@ -106,7 +106,7 @@ void RGBController_OpenRazer::UpdateLEDs()
|
||||
unsigned int output_offset;
|
||||
unsigned int row_offset = (row * matrix_cols);
|
||||
|
||||
if(type == RAZER_TYPE_MATRIX_FRAME)
|
||||
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
|
||||
{
|
||||
output_array_size = 3 + (matrix_cols* 3);
|
||||
output_offset = 3;
|
||||
@@ -119,7 +119,7 @@ void RGBController_OpenRazer::UpdateLEDs()
|
||||
|
||||
char output_array[output_array_size];
|
||||
|
||||
if(type == RAZER_TYPE_MATRIX_FRAME)
|
||||
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
|
||||
{
|
||||
output_array[0] = row;
|
||||
output_array[1] = 0;
|
||||
@@ -134,12 +134,12 @@ void RGBController_OpenRazer::UpdateLEDs()
|
||||
output_array[(col * 3) + 2 + output_offset] = (char)RGBGetBValue(colors[color_idx]);
|
||||
}
|
||||
|
||||
if(type == RAZER_TYPE_MATRIX_FRAME)
|
||||
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
|
||||
{
|
||||
matrix_custom_frame.write(output_array, output_array_size);
|
||||
matrix_custom_frame.flush();
|
||||
}
|
||||
else if(type == RAZER_TYPE_MATRIX_NOFRAME)
|
||||
else if(matrix_type == RAZER_TYPE_MATRIX_NOFRAME)
|
||||
{
|
||||
matrix_effect_custom.write(output_array, output_array_size);
|
||||
matrix_effect_custom.flush();
|
||||
@@ -151,7 +151,7 @@ void RGBController_OpenRazer::UpdateLEDs()
|
||||
}
|
||||
}
|
||||
|
||||
if(type == RAZER_TYPE_MATRIX_FRAME)
|
||||
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
|
||||
{
|
||||
matrix_effect_custom.write(&update_value, 1);
|
||||
matrix_effect_custom.flush();
|
||||
@@ -231,6 +231,34 @@ static std::string GetDeviceTypeString(std::string dev_path)
|
||||
return(ret_str);
|
||||
}
|
||||
|
||||
static std::string GetFirmwareVersionString(std::string dev_path)
|
||||
{
|
||||
// Read firmware_version for firmware version string
|
||||
std::string firm_ver_path = dev_path + "/firmware_version";
|
||||
std::ifstream firm_ver_file;
|
||||
std::string ret_str;
|
||||
|
||||
firm_ver_file.open(firm_ver_path);
|
||||
std::getline(firm_ver_file, ret_str);
|
||||
firm_ver_file.close();
|
||||
|
||||
return(ret_str);
|
||||
}
|
||||
|
||||
static std::string GetSerialNumberString(std::string dev_path)
|
||||
{
|
||||
// Read device_serial for serial number string
|
||||
std::string ser_num_path = dev_path + "/device_serial";
|
||||
std::ifstream ser_num_file;
|
||||
std::string ret_str;
|
||||
|
||||
ser_num_file.open(ser_num_path);
|
||||
std::getline(ser_num_file, ret_str);
|
||||
ser_num_file.close();
|
||||
|
||||
return(ret_str);
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetupMatrixDevice(std::string dev_path, unsigned int rows, unsigned int cols)
|
||||
{
|
||||
matrix_custom_frame.open(dev_path + "/matrix_custom_frame");
|
||||
@@ -246,11 +274,11 @@ void RGBController_OpenRazer::SetupMatrixDevice(std::string dev_path, unsigned i
|
||||
{
|
||||
if(!matrix_effect_custom)
|
||||
{
|
||||
type = RAZER_TYPE_MATRIX_STATIC;
|
||||
matrix_type = RAZER_TYPE_MATRIX_STATIC;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = RAZER_TYPE_MATRIX_NOFRAME;
|
||||
matrix_type = RAZER_TYPE_MATRIX_NOFRAME;
|
||||
}
|
||||
|
||||
matrix_rows = 1;
|
||||
@@ -258,7 +286,7 @@ void RGBController_OpenRazer::SetupMatrixDevice(std::string dev_path, unsigned i
|
||||
}
|
||||
else
|
||||
{
|
||||
type = RAZER_TYPE_MATRIX_FRAME;
|
||||
matrix_type = RAZER_TYPE_MATRIX_FRAME;
|
||||
|
||||
matrix_rows = rows;
|
||||
matrix_cols = cols;
|
||||
@@ -272,7 +300,7 @@ void RGBController_OpenRazer::SetupNonMatrixDevice(std::string dev_path)
|
||||
scroll_led_effect.open(dev_path + "/scroll_led_effect");
|
||||
scroll_led_rgb.open(dev_path + "/scroll_led_rgb");
|
||||
|
||||
type = RAZER_TYPE_NOMATRIX;
|
||||
matrix_type = RAZER_TYPE_NOMATRIX;
|
||||
}
|
||||
|
||||
RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
|
||||
@@ -289,6 +317,26 @@ RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
|
||||
\*-----------------------------------------------------------------*/
|
||||
name = GetDeviceTypeString(dev_path);
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Set the description to indicate this is an OpenRazer device |
|
||||
\*-----------------------------------------------------------------*/
|
||||
description = "OpenRazer Device";
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Set the device path as the location |
|
||||
\*-----------------------------------------------------------------*/
|
||||
location = dev_path;
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Get the serial number from the dev path |
|
||||
\*-----------------------------------------------------------------*/
|
||||
serial = GetSerialNumberString(dev_path);
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Get the firmware version from the dev path |
|
||||
\*-----------------------------------------------------------------*/
|
||||
version = GetFirmwareVersionString(dev_path);
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Loop through all known devices to look for a name match |
|
||||
\*-----------------------------------------------------------------*/
|
||||
@@ -301,6 +349,11 @@ RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
|
||||
\*---------------------------------------------------------*/
|
||||
device = i;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set device type |
|
||||
\*---------------------------------------------------------*/
|
||||
type = device_list[i]->type;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize modes |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
@@ -25,6 +25,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
std::string name;
|
||||
device_type type;
|
||||
bool matrix_type;
|
||||
unsigned int rows;
|
||||
unsigned int cols;
|
||||
@@ -53,6 +54,7 @@ static const razer_zone blackwidow_chroma_zone =
|
||||
static const razer_device blackwidow_chroma_device =
|
||||
{
|
||||
"Razer BlackWidow Chroma",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
22,
|
||||
@@ -84,6 +86,7 @@ static const razer_zone blackwidow_chroma_te_zone =
|
||||
static const razer_device blackwidow_chroma_te_device =
|
||||
{
|
||||
"Razer BlackWidow Chroma Tournament Edition",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
22,
|
||||
@@ -115,6 +118,7 @@ static const razer_zone ornata_chroma_zone =
|
||||
static const razer_device ornata_chroma_device =
|
||||
{
|
||||
"Razer Ornata Chroma",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
22,
|
||||
@@ -146,6 +150,7 @@ static const razer_zone deathstalker_chroma_zone =
|
||||
static const razer_device deathstalker_chroma_device =
|
||||
{
|
||||
"Razer DeathStalker Chroma",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
1,
|
||||
12,
|
||||
@@ -181,6 +186,7 @@ static const razer_zone blade_stealth_zone =
|
||||
static const razer_device blade_stealth_device =
|
||||
{
|
||||
"Razer Blade Stealth",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
16,
|
||||
@@ -212,6 +218,7 @@ static const razer_zone blade_pro_late_2016_zone =
|
||||
static const razer_device blade_pro_late_2016_device =
|
||||
{
|
||||
"Razer Blade Pro (Late 2016)",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
25,
|
||||
@@ -243,6 +250,7 @@ static const razer_zone blade_pro_2017_zone =
|
||||
static const razer_device blade_pro_2017_device =
|
||||
{
|
||||
"Razer Blade Pro (2017)",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
25,
|
||||
@@ -314,6 +322,7 @@ static const razer_zone mamba_te_scroll_wheel_zone =
|
||||
static const razer_device mamba_te_device =
|
||||
{
|
||||
"Razer Mamba Tournament Edition",
|
||||
DEVICE_TYPE_MOUSE,
|
||||
true,
|
||||
1,
|
||||
16,
|
||||
@@ -393,6 +402,7 @@ static const razer_zone diamondback_chroma_scroll_wheel_zone =
|
||||
static const razer_device diamondback_chroma_device =
|
||||
{
|
||||
"Razer Diamondback Chroma",
|
||||
DEVICE_TYPE_MOUSE,
|
||||
true,
|
||||
1,
|
||||
21,
|
||||
@@ -436,6 +446,7 @@ static const razer_zone deathadder_chroma_scroll_wheel_zone =
|
||||
static const razer_device deathadder_chroma_device =
|
||||
{
|
||||
"Razer DeathAdder Chroma",
|
||||
DEVICE_TYPE_MOUSE,
|
||||
false,
|
||||
1,
|
||||
2,
|
||||
@@ -491,6 +502,7 @@ static const razer_zone naga_chroma_numpad_zone =
|
||||
static const razer_device naga_chroma_device =
|
||||
{
|
||||
"Razer Naga Chroma",
|
||||
DEVICE_TYPE_MOUSE,
|
||||
false,
|
||||
1,
|
||||
3,
|
||||
@@ -526,6 +538,7 @@ static const razer_zone orbweaver_chroma_zone =
|
||||
static const razer_device orbweaver_chroma_device =
|
||||
{
|
||||
"Razer Orbweaver Chroma",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
25,
|
||||
@@ -557,6 +570,7 @@ static const razer_zone tartarus_chroma_zone =
|
||||
static const razer_device tartarus_chroma_device =
|
||||
{
|
||||
"Razer Tartarus Chroma",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
1,
|
||||
1,
|
||||
@@ -592,6 +606,7 @@ static const razer_zone firefly_zone =
|
||||
static const razer_device firefly_device =
|
||||
{
|
||||
"Razer Firefly",
|
||||
DEVICE_TYPE_MOUSEMAT,
|
||||
true,
|
||||
1,
|
||||
15,
|
||||
@@ -623,6 +638,7 @@ static const razer_zone goliathus_extended_zone =
|
||||
static const razer_device goliathus_extended_device =
|
||||
{
|
||||
"Razer Goliathus Extended",
|
||||
DEVICE_TYPE_MOUSEMAT,
|
||||
true,
|
||||
1,
|
||||
1,
|
||||
@@ -658,6 +674,7 @@ static const razer_zone kraken_chroma_zone =
|
||||
static const razer_device kraken_chroma_device =
|
||||
{
|
||||
"Razer Kraken 7.1 Chroma",
|
||||
DEVICE_TYPE_HEADSET,
|
||||
true,
|
||||
1,
|
||||
1,
|
||||
@@ -689,6 +706,7 @@ static const razer_zone kraken_v2_zone =
|
||||
static const razer_device kraken_v2_device =
|
||||
{
|
||||
"Razer Kraken 7.1 V2",
|
||||
DEVICE_TYPE_HEADSET,
|
||||
true,
|
||||
1,
|
||||
1,
|
||||
@@ -736,6 +754,7 @@ static const razer_zone core_led_strip_zone =
|
||||
static const razer_device core_device =
|
||||
{
|
||||
"Razer Core",
|
||||
DEVICE_TYPE_UNKNOWN,
|
||||
true,
|
||||
1,
|
||||
9,
|
||||
@@ -767,6 +786,7 @@ static const razer_zone mug_holder_zone =
|
||||
static const razer_device mug_holder_device =
|
||||
{
|
||||
"Razer Chroma Mug Holder",
|
||||
DEVICE_TYPE_UNKNOWN,
|
||||
true,
|
||||
1,
|
||||
15,
|
||||
@@ -810,6 +830,7 @@ static const razer_zone chromahdk_zone =
|
||||
static const razer_device chromahdk_device =
|
||||
{
|
||||
"Razer Chroma HDK",
|
||||
DEVICE_TYPE_LEDSTRIP,
|
||||
true,
|
||||
4,
|
||||
16,
|
||||
@@ -913,7 +934,7 @@ private:
|
||||
void SetupMatrixDevice(std::string dev_path, unsigned int rows, unsigned int cols);
|
||||
void SetupNonMatrixDevice(std::string dev_path);
|
||||
|
||||
unsigned int type;
|
||||
unsigned int matrix_type;
|
||||
unsigned int matrix_rows;
|
||||
unsigned int matrix_cols;
|
||||
|
||||
|
||||
@@ -74,6 +74,10 @@ RGBController_RGBFusion::RGBController_RGBFusion(RGBFusionController* rgb_fusion
|
||||
rgb_fusion = rgb_fusion_ptr;
|
||||
|
||||
name = rgb_fusion->GetDeviceName();
|
||||
description = "RGB Fusion 1.0";
|
||||
location = rgb_fusion->GetDeviceLocation();
|
||||
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
|
||||
mode rgb_fusion_modes[RGB_FUSION_NUMBER_MODES];
|
||||
|
||||
@@ -110,4 +114,4 @@ RGBController_RGBFusion::RGBController_RGBFusion(RGBFusionController* rgb_fusion
|
||||
// Push new zone to zones vector
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,11 @@ RGBController_RazerChromaSDK::RGBController_RazerChromaSDK(unsigned int device_t
|
||||
|
||||
for (int i = 0; i < RAZER_NUM_DEVICES; i++)
|
||||
{
|
||||
if (device_list[i]->type == device_type)
|
||||
if (device_list[i]->razer_type == device_type)
|
||||
{
|
||||
name = device_list[i]->name;
|
||||
type = device_list[i]->type;
|
||||
location = "Razer Chroma SDK";
|
||||
|
||||
for (int zone_id = 0; zone_id < RAZER_MAX_ZONES; zone_id++)
|
||||
{
|
||||
@@ -115,7 +117,7 @@ void RGBController_RazerChromaSDK::SetLED(int led, RGBColor color)
|
||||
|
||||
void RGBController_RazerChromaSDK::UpdateLEDs()
|
||||
{
|
||||
switch (device->type)
|
||||
switch (device->razer_type)
|
||||
{
|
||||
case RAZER_GENERIC_MOUSE:
|
||||
{
|
||||
@@ -186,4 +188,4 @@ void RGBController_RazerChromaSDK::UpdateLEDs()
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
std::string name;
|
||||
unsigned int razer_type;
|
||||
unsigned int type;
|
||||
const razer_zone* zones[RAZER_MAX_ZONES];
|
||||
} razer_device;
|
||||
@@ -136,6 +137,7 @@ static const razer_device mouse_device =
|
||||
{
|
||||
"Razer Generic Mouse",
|
||||
RAZER_GENERIC_MOUSE,
|
||||
DEVICE_TYPE_MOUSE,
|
||||
{
|
||||
&mouse_left_zone,
|
||||
&mouse_right_zone,
|
||||
@@ -164,6 +166,7 @@ static const razer_device mousepad_device =
|
||||
{
|
||||
"Razer Generic Mousepad",
|
||||
RAZER_GENERIC_MOUSEPAD,
|
||||
DEVICE_TYPE_MOUSE,
|
||||
{
|
||||
&mousepad_zone,
|
||||
NULL,
|
||||
@@ -204,6 +207,7 @@ static const razer_device chromahdk_device =
|
||||
{
|
||||
"Razer Chroma HDK",
|
||||
RAZER_CHROMA_HDK,
|
||||
DEVICE_TYPE_LEDSTRIP,
|
||||
{
|
||||
&chromahdk_zone,
|
||||
&chromahdk_zone,
|
||||
@@ -242,4 +246,4 @@ private:
|
||||
static CREATEMOUSEPADEFFECT CreateMousepadEffect;
|
||||
static CREATEHEADSETEFFECT CreateHeadsetEffect;
|
||||
static CREATECHROMALINKEFFECT CreateChromaLinkEffect;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
#include "i2c_tools.h"
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* i2c_detect *
|
||||
* *
|
||||
* Prints a list of all detected I2C addresses on the given bus *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface to scan *
|
||||
* mode - one of AUTO, QUICK, READ, FUNC - method of access *
|
||||
* *
|
||||
* Code adapted from i2cdetect.c from i2c-tools Linux package *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
std::string i2c_detect(i2c_smbus_interface * bus, int mode)
|
||||
{
|
||||
int i, j;
|
||||
int first = 0x03, last = 0x77;
|
||||
int res;
|
||||
int slave_addr;
|
||||
char line[128];
|
||||
std::string text;
|
||||
|
||||
sprintf(line, " 0 1 2 3 4 5 6 7 8 9 a b c d e f\r\n");
|
||||
text.append(line);
|
||||
|
||||
for (i = 0; i < 128; i += 16)
|
||||
{
|
||||
sprintf(line, "%02x: ", i);
|
||||
text.append(line);
|
||||
|
||||
for (j = 0; j < 16; j++)
|
||||
{
|
||||
/* Skip unwanted addresses */
|
||||
if (i+j < first || i+j > last)
|
||||
{
|
||||
sprintf(line, " ");
|
||||
text.append(line);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Set slave address */
|
||||
slave_addr = i + j;
|
||||
|
||||
/* Probe this address */
|
||||
switch (mode)
|
||||
{
|
||||
case MODE_QUICK:
|
||||
res = bus->i2c_smbus_write_quick(slave_addr, I2C_SMBUS_WRITE);
|
||||
break;
|
||||
case MODE_READ:
|
||||
res = bus->i2c_smbus_read_byte(slave_addr);
|
||||
break;
|
||||
default:
|
||||
if ((i + j >= 0x30 && i + j <= 0x37)
|
||||
|| (i + j >= 0x50 && i + j <= 0x5F))
|
||||
res = bus->i2c_smbus_read_byte(slave_addr);
|
||||
else
|
||||
res = bus->i2c_smbus_write_quick(slave_addr, I2C_SMBUS_WRITE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
sprintf(line, "-- ");
|
||||
text.append(line);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(line, "%02x ", i + j);
|
||||
text.append(line);
|
||||
}
|
||||
}
|
||||
sprintf(line, "\r\n");
|
||||
text.append(line);
|
||||
}
|
||||
|
||||
return text;
|
||||
|
||||
} /* i2c_detect() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* i2c_dump *
|
||||
* *
|
||||
* Prints the values at each address of a given SMBus device *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface to scan *
|
||||
* address - SMBus device address to scan *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
std::string i2c_dump(i2c_smbus_interface * bus, unsigned char address)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
int start = 0x0000;
|
||||
|
||||
char line[128];
|
||||
std::string text;
|
||||
|
||||
sprintf(line, " 0 1 2 3 4 5 6 7 8 9 a b c d e f\r\n");
|
||||
text.append(line);
|
||||
|
||||
for (i = 0; i < 0xFF; i += 16)
|
||||
{
|
||||
sprintf(line, "%04x: ", i + start);
|
||||
text.append(line);
|
||||
|
||||
for (j = 0; j < 16; j++)
|
||||
{
|
||||
sprintf(line, "%02x ", (unsigned char )bus->i2c_smbus_read_byte_data(address, start + i + j));
|
||||
text.append(line);
|
||||
}
|
||||
|
||||
sprintf(line, "\r\n");
|
||||
text.append(line);
|
||||
}
|
||||
|
||||
return text;
|
||||
|
||||
} /* i2c_dump() */
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#define MODE_AUTO 0
|
||||
#define MODE_QUICK 1
|
||||
#define MODE_READ 2
|
||||
#define MODE_FUNC 3
|
||||
|
||||
std::string i2c_detect(i2c_smbus_interface * bus, int mode);
|
||||
|
||||
std::string i2c_dump(i2c_smbus_interface * bus, unsigned char address);
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "OpenAuraSDKQtDialog.h"
|
||||
#include "OpenRGBDialog2.h"
|
||||
|
||||
|
||||
extern std::vector<i2c_smbus_interface*> busses;
|
||||
@@ -33,23 +33,8 @@ int main(int argc, char* argv[])
|
||||
|
||||
QApplication a(argc, argv);
|
||||
|
||||
Ui::OpenAuraSDKQtDialog dlg(busses, rgb_controllers);
|
||||
Ui::OpenRGBDialog2 dlg(busses, rgb_controllers);
|
||||
dlg.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* wWinMain *
|
||||
* *
|
||||
* Entry point for Windows. Calls main(). *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
#ifdef WIN32
|
||||
//int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
|
||||
//{
|
||||
// main(0, NULL);
|
||||
//}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#include "OpenRGBDeviceInfoPage.h"
|
||||
|
||||
using namespace Ui;
|
||||
|
||||
OpenRGBDeviceInfoPage::OpenRGBDeviceInfoPage(RGBController *dev, QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::OpenRGBDeviceInfoPageUi)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
switch(dev->type)
|
||||
{
|
||||
case DEVICE_TYPE_MOTHERBOARD:
|
||||
ui->TypeValue->setText("Motherboard");
|
||||
break;
|
||||
case DEVICE_TYPE_DRAM:
|
||||
ui->TypeValue->setText("DRAM");
|
||||
break;
|
||||
case DEVICE_TYPE_GPU:
|
||||
ui->TypeValue->setText("GPU");
|
||||
break;
|
||||
case DEVICE_TYPE_COOLER:
|
||||
ui->TypeValue->setText("Cooler");
|
||||
break;
|
||||
case DEVICE_TYPE_LEDSTRIP:
|
||||
ui->TypeValue->setText("LED Strip");
|
||||
break;
|
||||
case DEVICE_TYPE_KEYBOARD:
|
||||
ui->TypeValue->setText("Keyboard");
|
||||
break;
|
||||
case DEVICE_TYPE_MOUSE:
|
||||
ui->TypeValue->setText("Mouse");
|
||||
break;
|
||||
case DEVICE_TYPE_MOUSEMAT:
|
||||
ui->TypeValue->setText("Mousemat");
|
||||
break;
|
||||
case DEVICE_TYPE_HEADSET:
|
||||
ui->TypeValue->setText("Headset");
|
||||
break;
|
||||
default:
|
||||
ui->TypeValue->setText("Unknown");
|
||||
}
|
||||
|
||||
ui->NameValue->setText(QString::fromStdString(dev->name));
|
||||
ui->DescriptionValue->setText(QString::fromStdString(dev->description));
|
||||
ui->VersionValue->setText(QString::fromStdString(dev->version));
|
||||
ui->LocationValue->setText(QString::fromStdString(dev->location));
|
||||
ui->SerialValue->setText(QString::fromStdString(dev->serial));
|
||||
}
|
||||
|
||||
OpenRGBDeviceInfoPage::~OpenRGBDeviceInfoPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef OPENRGBDEVICEINFOPAGE_H
|
||||
#define OPENRGBDEVICEINFOPAGE_H
|
||||
|
||||
#include <QFrame>
|
||||
#include "RGBController.h"
|
||||
#include "ui_OpenRGBDeviceInfoPage.h"
|
||||
|
||||
namespace Ui {
|
||||
class OpenRGBDeviceInfoPage;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBDeviceInfoPage : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBDeviceInfoPage(RGBController *dev, QWidget *parent = nullptr);
|
||||
~OpenRGBDeviceInfoPage();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBDeviceInfoPageUi *ui;
|
||||
};
|
||||
|
||||
#endif // OPENRGBDEVICEINFOPAGE_H
|
||||
@@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBDeviceInfoPageUi</class>
|
||||
<widget class="QFrame" name="OpenRGBDeviceInfoPageUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="TypeLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>80</y>
|
||||
<width>60</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="TypeValue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>80</y>
|
||||
<width>240</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Type Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="DescriptionValue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>100</y>
|
||||
<width>240</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Description Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="DescriptionLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>100</y>
|
||||
<width>60</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="VersionValue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>120</y>
|
||||
<width>240</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Version Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="VersionLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>120</y>
|
||||
<width>60</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Version:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LocationLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>140</y>
|
||||
<width>60</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Location:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LocationValue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>140</y>
|
||||
<width>240</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Location Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="NameValue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>60</y>
|
||||
<width>240</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="NameLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>60</y>
|
||||
<width>60</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="SerialValue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>160</y>
|
||||
<width>240</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Serial Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="SerialLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>160</y>
|
||||
<width>60</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Serial:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,314 @@
|
||||
#include "OpenRGBDevicePage.h"
|
||||
#include "hsv.h"
|
||||
|
||||
using namespace Ui;
|
||||
|
||||
OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::OpenRGBDevicePageUi)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Store device pointer |
|
||||
\*-----------------------------------------------------*/
|
||||
device = dev;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up the color palette buttons |
|
||||
\*-----------------------------------------------------*/
|
||||
QPalette pal;
|
||||
|
||||
pal = ui->ButtonRed->palette();
|
||||
pal.setColor(QPalette::Button, QColor(255, 0, 0));
|
||||
ui->ButtonRed->setAutoFillBackground(true);
|
||||
ui->ButtonRed->setPalette(pal);
|
||||
ui->ButtonRed->setFlat(true);
|
||||
ui->ButtonRed->update();
|
||||
|
||||
pal = ui->ButtonYellow->palette();
|
||||
pal.setColor(QPalette::Button, QColor(255, 255, 0));
|
||||
ui->ButtonYellow->setAutoFillBackground(true);
|
||||
ui->ButtonYellow->setPalette(pal);
|
||||
ui->ButtonYellow->setFlat(true);
|
||||
ui->ButtonYellow->update();
|
||||
|
||||
pal = ui->ButtonGreen->palette();
|
||||
pal.setColor(QPalette::Button, QColor(0, 255, 0));
|
||||
ui->ButtonGreen->setAutoFillBackground(true);
|
||||
ui->ButtonGreen->setPalette(pal);
|
||||
ui->ButtonGreen->setFlat(true);
|
||||
ui->ButtonGreen->update();
|
||||
|
||||
pal = ui->ButtonCyan->palette();
|
||||
pal.setColor(QPalette::Button, QColor(0, 255, 255));
|
||||
ui->ButtonCyan->setAutoFillBackground(true);
|
||||
ui->ButtonCyan->setPalette(pal);
|
||||
ui->ButtonCyan->setFlat(true);
|
||||
ui->ButtonCyan->update();
|
||||
|
||||
pal = ui->ButtonBlue->palette();
|
||||
pal.setColor(QPalette::Button, QColor(0, 0, 255));
|
||||
ui->ButtonBlue->setAutoFillBackground(true);
|
||||
ui->ButtonBlue->setPalette(pal);
|
||||
ui->ButtonBlue->setFlat(true);
|
||||
ui->ButtonBlue->update();
|
||||
|
||||
pal = ui->ButtonMagenta->palette();
|
||||
pal.setColor(QPalette::Button, QColor(255, 0, 255));
|
||||
ui->ButtonMagenta->setAutoFillBackground(true);
|
||||
ui->ButtonMagenta->setPalette(pal);
|
||||
ui->ButtonMagenta->setFlat(true);
|
||||
ui->ButtonMagenta->update();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Fill in the combo boxes with device information |
|
||||
\*-----------------------------------------------------*/
|
||||
ui->ModeBox->clear();
|
||||
|
||||
for (int i = 0; i < device->modes.size(); i++)
|
||||
{
|
||||
ui->ModeBox->addItem(device->modes[i].name.c_str());
|
||||
}
|
||||
|
||||
ui->ModeBox->setCurrentIndex(device->GetMode());
|
||||
|
||||
ui->ZoneBox->clear();
|
||||
|
||||
for (int i = 0; i < device->zones.size(); i++)
|
||||
{
|
||||
ui->ZoneBox->addItem(device->zones[i].name.c_str());
|
||||
}
|
||||
|
||||
ui->ZoneBox->setCurrentIndex(0);
|
||||
|
||||
ui->LEDBox->clear();
|
||||
|
||||
for (int i = 0; i < device->leds.size(); i++)
|
||||
{
|
||||
ui->LEDBox->addItem(device->leds[i].name.c_str());
|
||||
}
|
||||
|
||||
ui->LEDBox->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
OpenRGBDevicePage::~OpenRGBDevicePage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_ZoneBox_currentIndexChanged(int index)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_LEDBox_currentIndexChanged(int index)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_ModeBox_currentIndexChanged(int index)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Change device mode |
|
||||
\*-----------------------------------------------------*/
|
||||
device->SetMode(ui->ModeBox->currentIndex());
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::SetDevice(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
UpdatingColor = true;
|
||||
ui->RedSpinBox->setValue(red);
|
||||
ui->GreenSpinBox->setValue(green);
|
||||
ui->BlueSpinBox->setValue(blue);
|
||||
UpdatingColor = false;
|
||||
updateHSV();
|
||||
|
||||
on_SetDeviceButton_clicked();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_SetDeviceButton_clicked()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Set all device LEDs to the current color |
|
||||
\*-----------------------------------------------------*/
|
||||
RGBColor color = ToRGBColor(
|
||||
ui->RedSpinBox->text().toInt(),
|
||||
ui->GreenSpinBox->text().toInt(),
|
||||
ui->BlueSpinBox->text().toInt()
|
||||
);
|
||||
|
||||
device->SetAllLEDs(color);
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_SetZoneButton_clicked()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Set all LEDs in the selected zone to the current color|
|
||||
\*-----------------------------------------------------*/
|
||||
RGBColor color = ToRGBColor(
|
||||
ui->RedSpinBox->text().toInt(),
|
||||
ui->GreenSpinBox->text().toInt(),
|
||||
ui->BlueSpinBox->text().toInt()
|
||||
);
|
||||
|
||||
device->SetAllZoneLEDs(ui->ZoneBox->currentIndex(), color);
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_SetLEDButton_clicked()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Set the selected LED to the current color |
|
||||
\*-----------------------------------------------------*/
|
||||
RGBColor color = ToRGBColor(
|
||||
ui->RedSpinBox->text().toInt(),
|
||||
ui->GreenSpinBox->text().toInt(),
|
||||
ui->BlueSpinBox->text().toInt()
|
||||
);
|
||||
|
||||
device->SetLED(ui->LEDBox->currentIndex(), color);
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_ButtonRed_clicked()
|
||||
{
|
||||
UpdatingColor = true;
|
||||
ui->RedSpinBox->setValue(255);
|
||||
ui->GreenSpinBox->setValue(0);
|
||||
ui->BlueSpinBox->setValue(0);
|
||||
UpdatingColor = false;
|
||||
updateHSV();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_ButtonYellow_clicked()
|
||||
{
|
||||
UpdatingColor = true;
|
||||
ui->RedSpinBox->setValue(255);
|
||||
ui->GreenSpinBox->setValue(255);
|
||||
ui->BlueSpinBox->setValue(0);
|
||||
UpdatingColor = false;
|
||||
updateHSV();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_ButtonGreen_clicked()
|
||||
{
|
||||
UpdatingColor = true;
|
||||
ui->RedSpinBox->setValue(0);
|
||||
ui->GreenSpinBox->setValue(255);
|
||||
ui->BlueSpinBox->setValue(0);
|
||||
UpdatingColor = false;
|
||||
updateHSV();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_ButtonCyan_clicked()
|
||||
{
|
||||
UpdatingColor = true;
|
||||
ui->RedSpinBox->setValue(0);
|
||||
ui->GreenSpinBox->setValue(255);
|
||||
ui->BlueSpinBox->setValue(255);
|
||||
UpdatingColor = false;
|
||||
updateHSV();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_ButtonBlue_clicked()
|
||||
{
|
||||
UpdatingColor = true;
|
||||
ui->RedSpinBox->setValue(0);
|
||||
ui->GreenSpinBox->setValue(0);
|
||||
ui->BlueSpinBox->setValue(255);
|
||||
UpdatingColor = false;
|
||||
updateHSV();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_ButtonMagenta_clicked()
|
||||
{
|
||||
UpdatingColor = true;
|
||||
ui->RedSpinBox->setValue(255);
|
||||
ui->GreenSpinBox->setValue(0);
|
||||
ui->BlueSpinBox->setValue(255);
|
||||
UpdatingColor = false;
|
||||
updateHSV();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::updateRGB()
|
||||
{
|
||||
if(UpdatingColor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdatingColor = true;
|
||||
|
||||
hsv_t hsv;
|
||||
hsv.hue = ui->HueSpinBox->value();
|
||||
hsv.saturation = ui->SatSpinBox->value();
|
||||
hsv.value = ui->ValSpinBox->value();
|
||||
|
||||
RGBColor rgb = hsv2rgb(&hsv);
|
||||
|
||||
ui->RedSpinBox->setValue(RGBGetRValue(rgb));
|
||||
ui->GreenSpinBox->setValue(RGBGetGValue(rgb));
|
||||
ui->BlueSpinBox->setValue(RGBGetBValue(rgb));
|
||||
|
||||
UpdatingColor = false;
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::updateHSV()
|
||||
{
|
||||
if(UpdatingColor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdatingColor = true;
|
||||
|
||||
RGBColor rgb = ToRGBColor(ui->RedSpinBox->value(), ui->GreenSpinBox->value(), ui->BlueSpinBox->value());
|
||||
|
||||
hsv_t hsv;
|
||||
|
||||
rgb2hsv(rgb, &hsv);
|
||||
|
||||
ui->HueSpinBox->setValue(hsv.hue);
|
||||
ui->SatSpinBox->setValue(hsv.saturation);
|
||||
ui->ValSpinBox->setValue(hsv.value);
|
||||
|
||||
UpdatingColor = false;
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_RedSpinBox_valueChanged(int arg1)
|
||||
{
|
||||
updateHSV();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_HueSpinBox_valueChanged(int arg1)
|
||||
{
|
||||
updateRGB();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_GreenSpinBox_valueChanged(int arg1)
|
||||
{
|
||||
updateHSV();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_SatSpinBox_valueChanged(int arg1)
|
||||
{
|
||||
updateRGB();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_BlueSpinBox_valueChanged(int arg1)
|
||||
{
|
||||
updateHSV();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_ValSpinBox_valueChanged(int arg1)
|
||||
{
|
||||
updateRGB();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_SetAllButton_clicked()
|
||||
{
|
||||
unsigned char red = ui->RedSpinBox->value();
|
||||
unsigned char green = ui->GreenSpinBox->value();
|
||||
unsigned char blue = ui->BlueSpinBox->value();
|
||||
|
||||
emit SetAllDevices(red, green, blue);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
#ifndef OPENRGBDEVICEPAGE_H
|
||||
#define OPENRGBDEVICEPAGE_H
|
||||
|
||||
#include "ui_OpenRGBDevicePage.h"
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
namespace Ui {
|
||||
class OpenRGBDevicePage;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBDevicePage : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBDevicePage(RGBController *dev, QWidget *parent = nullptr);
|
||||
~OpenRGBDevicePage();
|
||||
|
||||
void SetDevice(unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
private slots:
|
||||
void on_ButtonRed_clicked();
|
||||
void on_ButtonYellow_clicked();
|
||||
void on_ButtonGreen_clicked();
|
||||
void on_ButtonCyan_clicked();
|
||||
void on_ButtonBlue_clicked();
|
||||
void on_ButtonMagenta_clicked();
|
||||
void on_ZoneBox_currentIndexChanged(int index);
|
||||
void on_LEDBox_currentIndexChanged(int index);
|
||||
void on_ModeBox_currentIndexChanged(int index);
|
||||
void on_SetDeviceButton_clicked();
|
||||
void on_SetZoneButton_clicked();
|
||||
void on_SetLEDButton_clicked();
|
||||
void on_RedSpinBox_valueChanged(int arg1);
|
||||
void on_HueSpinBox_valueChanged(int arg1);
|
||||
void on_GreenSpinBox_valueChanged(int arg1);
|
||||
void on_SatSpinBox_valueChanged(int arg1);
|
||||
void on_BlueSpinBox_valueChanged(int arg1);
|
||||
void on_ValSpinBox_valueChanged(int arg1);
|
||||
|
||||
void on_SetAllButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBDevicePageUi *ui;
|
||||
RGBController *device;
|
||||
|
||||
bool UpdatingColor = false;
|
||||
|
||||
void updateRGB();
|
||||
|
||||
void updateHSV();
|
||||
|
||||
signals:
|
||||
void SetAllDevices(unsigned char red, unsigned char green, unsigned char blue);
|
||||
};
|
||||
|
||||
#endif // OPENRGBDEVICEPAGE_H
|
||||
@@ -0,0 +1,387 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBDevicePageUi</class>
|
||||
<widget class="QFrame" name="OpenRGBDevicePageUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<widget class="QComboBox" name="ZoneBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>71</x>
|
||||
<y>50</y>
|
||||
<width>160</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="ZoneLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>31</x>
|
||||
<y>50</y>
|
||||
<width>40</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zone:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LEDLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>31</x>
|
||||
<y>90</y>
|
||||
<width>40</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>LED:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="LEDBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>71</x>
|
||||
<y>90</y>
|
||||
<width>160</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="ModeLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>31</x>
|
||||
<y>210</y>
|
||||
<width>40</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="ModeBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>71</x>
|
||||
<y>210</y>
|
||||
<width>160</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="SetLEDButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>140</y>
|
||||
<width>41</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>LED</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="SetZoneButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>140</y>
|
||||
<width>41</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zone</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="RedSpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>120</y>
|
||||
<width>50</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="GreenSpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>160</y>
|
||||
<width>50</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="BlueSpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>200</y>
|
||||
<width>50</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="RedLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>120</y>
|
||||
<width>20</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>R:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="GreenLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>160</y>
|
||||
<width>20</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>G:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="BlueLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>200</y>
|
||||
<width>20</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>B:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonGreen">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>350</x>
|
||||
<y>250</y>
|
||||
<width>21</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonBlue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>410</x>
|
||||
<y>250</y>
|
||||
<width>21</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonCyan">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>250</y>
|
||||
<width>21</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonMagenta">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>250</y>
|
||||
<width>21</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonRed">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>250</y>
|
||||
<width>21</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonYellow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>250</y>
|
||||
<width>21</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="HueSpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>410</x>
|
||||
<y>120</y>
|
||||
<width>50</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>359</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="HueLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<y>120</y>
|
||||
<width>20</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>H:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="SatLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<y>160</y>
|
||||
<width>20</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>S:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="SatSpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>410</x>
|
||||
<y>160</y>
|
||||
<width>50</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="ValSpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>410</x>
|
||||
<y>200</y>
|
||||
<width>50</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="ValLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<y>200</y>
|
||||
<width>20</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>V:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="SetDeviceButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>140</y>
|
||||
<width>41</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="SetLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>140</y>
|
||||
<width>40</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="SetAllButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>170</y>
|
||||
<width>80</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set All Devices</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "OpenAuraSDKQtDialog.h"
|
||||
#include "OpenRGBDialog.h"
|
||||
#include "OpenAuraSDK.h"
|
||||
|
||||
using namespace Ui;
|
||||
|
||||
OpenAuraSDKQtDialog::OpenAuraSDKQtDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, QWidget *parent) : QMainWindow(parent), busses(bus), controllers (control), ui(new OpenAuraSDKQtDialogUi)
|
||||
OpenRGBDialog::OpenRGBDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, QWidget *parent) : QMainWindow(parent), busses(bus), controllers (control), ui(new OpenRGBDialogUi)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -63,59 +63,59 @@ OpenAuraSDKQtDialog::OpenAuraSDKQtDialog(std::vector<i2c_smbus_interface *>& bus
|
||||
ui->ComboDevices->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
OpenAuraSDKQtDialog::~OpenAuraSDKQtDialog()
|
||||
OpenRGBDialog::~OpenRGBDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenAuraSDKQtDialog::show()
|
||||
void OpenRGBDialog::show()
|
||||
{
|
||||
QMainWindow::show();
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonRed_clicked()
|
||||
void Ui::OpenRGBDialog::on_ButtonRed_clicked()
|
||||
{
|
||||
ui->EditLED0R->setText("255");
|
||||
ui->EditLED0G->setText("0");
|
||||
ui->EditLED0B->setText("0");
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonYellow_clicked()
|
||||
void Ui::OpenRGBDialog::on_ButtonYellow_clicked()
|
||||
{
|
||||
ui->EditLED0R->setText("255");
|
||||
ui->EditLED0G->setText("255");
|
||||
ui->EditLED0B->setText("0");
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonGreen_clicked()
|
||||
void Ui::OpenRGBDialog::on_ButtonGreen_clicked()
|
||||
{
|
||||
ui->EditLED0R->setText("0");
|
||||
ui->EditLED0G->setText("255");
|
||||
ui->EditLED0B->setText("0");
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonCyan_clicked()
|
||||
void Ui::OpenRGBDialog::on_ButtonCyan_clicked()
|
||||
{
|
||||
ui->EditLED0R->setText("0");
|
||||
ui->EditLED0G->setText("255");
|
||||
ui->EditLED0B->setText("255");
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonBlue_clicked()
|
||||
void Ui::OpenRGBDialog::on_ButtonBlue_clicked()
|
||||
{
|
||||
ui->EditLED0R->setText("0");
|
||||
ui->EditLED0G->setText("0");
|
||||
ui->EditLED0B->setText("255");
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonMagenta_clicked()
|
||||
void Ui::OpenRGBDialog::on_ButtonMagenta_clicked()
|
||||
{
|
||||
ui->EditLED0R->setText("255");
|
||||
ui->EditLED0G->setText("0");
|
||||
ui->EditLED0B->setText("255");
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonSetAll_clicked()
|
||||
void Ui::OpenRGBDialog::on_ButtonSetAll_clicked()
|
||||
{
|
||||
RGBColor color = ToRGBColor(
|
||||
ui->EditLED0R->text().toInt(),
|
||||
@@ -130,7 +130,7 @@ void Ui::OpenAuraSDKQtDialog::on_ButtonSetAll_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonSetDevice_clicked()
|
||||
void Ui::OpenRGBDialog::on_ButtonSetDevice_clicked()
|
||||
{
|
||||
RGBColor color = ToRGBColor(
|
||||
ui->EditLED0R->text().toInt(),
|
||||
@@ -141,7 +141,7 @@ void Ui::OpenAuraSDKQtDialog::on_ButtonSetDevice_clicked()
|
||||
controllers[ui->ComboDevices->currentIndex()]->SetAllLEDs(color);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonSetZone_clicked()
|
||||
void Ui::OpenRGBDialog::on_ButtonSetZone_clicked()
|
||||
{
|
||||
RGBColor color = ToRGBColor(
|
||||
ui->EditLED0R->text().toInt(),
|
||||
@@ -152,7 +152,7 @@ void Ui::OpenAuraSDKQtDialog::on_ButtonSetZone_clicked()
|
||||
controllers[ui->ComboDevices->currentIndex()]->SetAllZoneLEDs(ui->ComboZones->currentIndex(), color);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonSetLED_clicked()
|
||||
void Ui::OpenRGBDialog::on_ButtonSetLED_clicked()
|
||||
{
|
||||
RGBColor color = ToRGBColor(
|
||||
ui->EditLED0R->text().toInt(),
|
||||
@@ -163,7 +163,7 @@ void Ui::OpenAuraSDKQtDialog::on_ButtonSetLED_clicked()
|
||||
controllers[ui->ComboDevices->currentIndex()]->SetLED(ui->ComboLEDs->currentIndex(), color);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ComboDevices_currentIndexChanged(int index)
|
||||
void Ui::OpenRGBDialog::on_ComboDevices_currentIndexChanged(int index)
|
||||
{
|
||||
ui->ComboModes->clear();
|
||||
|
||||
@@ -193,7 +193,7 @@ void Ui::OpenAuraSDKQtDialog::on_ComboDevices_currentIndexChanged(int index)
|
||||
ui->ComboLEDs->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ComboModes_currentIndexChanged(int index)
|
||||
void Ui::OpenRGBDialog::on_ComboModes_currentIndexChanged(int index)
|
||||
{
|
||||
controllers[ui->ComboDevices->currentIndex()]->SetMode(ui->ComboModes->currentIndex());
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef OPENAURASDKQTDIALOG_H
|
||||
#define OPENAURASDKQTDIALOG_H
|
||||
#ifndef OPENRGBDIALOG_H
|
||||
#define OPENRGBDIALOG_H
|
||||
|
||||
#include "ui_openaurasdk.h"
|
||||
#include "ui_OpenRGBDialog.h"
|
||||
|
||||
#include <vector>
|
||||
#include "i2c_smbus.h"
|
||||
@@ -14,16 +14,16 @@
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenAuraSDKQtDialog;
|
||||
class OpenRGBDialog;
|
||||
}
|
||||
|
||||
class Ui::OpenAuraSDKQtDialog : public QMainWindow
|
||||
class Ui::OpenRGBDialog : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenAuraSDKQtDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, QWidget *parent = 0);
|
||||
~OpenAuraSDKQtDialog();
|
||||
explicit OpenRGBDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, QWidget *parent = 0);
|
||||
~OpenRGBDialog();
|
||||
|
||||
void show();
|
||||
void setMode(unsigned char mode_val);
|
||||
@@ -53,7 +53,7 @@ private slots:
|
||||
void on_ComboModes_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::OpenAuraSDKQtDialogUi *ui;
|
||||
Ui::OpenRGBDialogUi *ui;
|
||||
};
|
||||
|
||||
#endif // OPENAURASDKQTDIALOG_H
|
||||
#endif // OPENRGBDIALOG_H
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenAuraSDKQtDialogUi</class>
|
||||
<widget class="QMainWindow" name="OpenAuraSDKQtDialogUi">
|
||||
<class>OpenRGBDialogUi</class>
|
||||
<widget class="QMainWindow" name="OpenRGBDialogUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>OpenAuraSDK</string>
|
||||
<string>OpenRGB</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<widget class="QPushButton" name="ButtonSetAll">
|
||||
@@ -0,0 +1,166 @@
|
||||
#include "OpenRGBDialog2.h"
|
||||
#include "OpenRGBDevicePage.h"
|
||||
#include "OpenRGBDeviceInfoPage.h"
|
||||
#include "OpenRGBSystemInfoPage.h"
|
||||
#include "OpenAuraSDK.h"
|
||||
#include <QLabel>
|
||||
#include <QTabBar>
|
||||
|
||||
using namespace Ui;
|
||||
|
||||
OpenRGBDialog2::OpenRGBDialog2(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, QWidget *parent) : QMainWindow(parent), busses(bus), controllers (control), ui(new OpenRGBDialog2Ui)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QIcon logo(":OpenRGB.png");
|
||||
setWindowIcon(logo);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up list of devices |
|
||||
\*-----------------------------------------------------*/
|
||||
QTabBar *DevicesTabBar = ui->DevicesTabBar->tabBar();
|
||||
|
||||
for(int dev_idx = 0; dev_idx < control.size(); dev_idx++)
|
||||
{
|
||||
OpenRGBDevicePage *NewPage = new OpenRGBDevicePage(control[dev_idx]);
|
||||
ui->DevicesTabBar->addTab(NewPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Connect the page's Set All button to the Set All slot |
|
||||
\*-----------------------------------------------------*/
|
||||
connect(NewPage,
|
||||
SIGNAL(SetAllDevices(unsigned char, unsigned char, unsigned char)),
|
||||
this,
|
||||
SLOT(on_SetAllDevices(unsigned char, unsigned char, unsigned char)));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Use Qt's HTML capabilities to display both icon and |
|
||||
| text in the tab label. Choose icon based on device |
|
||||
| type and append device name string. |
|
||||
\*-----------------------------------------------------*/
|
||||
QString NewLabelString = "<html><table><tr><td width='30'><img src='";
|
||||
switch(control[dev_idx]->type)
|
||||
{
|
||||
case DEVICE_TYPE_MOTHERBOARD:
|
||||
NewLabelString += ":/motherboard.svg";
|
||||
break;
|
||||
case DEVICE_TYPE_DRAM:
|
||||
NewLabelString += ":/ram.svg";
|
||||
break;
|
||||
case DEVICE_TYPE_GPU:
|
||||
NewLabelString += ":/graphics-card.svg";
|
||||
break;
|
||||
case DEVICE_TYPE_COOLER:
|
||||
NewLabelString += ":/fan.svg";
|
||||
break;
|
||||
case DEVICE_TYPE_LEDSTRIP:
|
||||
//break;
|
||||
case DEVICE_TYPE_KEYBOARD:
|
||||
//break;
|
||||
case DEVICE_TYPE_MOUSE:
|
||||
//break;
|
||||
case DEVICE_TYPE_HEADSET:
|
||||
//break;
|
||||
case DEVICE_TYPE_UNKNOWN:
|
||||
NewLabelString += ":/keyboard.svg";
|
||||
break;
|
||||
}
|
||||
NewLabelString += "' height='15' width='15'></td><td>" + QString::fromStdString(control[dev_idx]->name) + "</td></tr></table></html>";
|
||||
|
||||
QLabel *NewTabLabel = new QLabel();
|
||||
NewTabLabel->setText(NewLabelString);
|
||||
NewTabLabel->setIndent(20);
|
||||
NewTabLabel->setGeometry(0, 0, 200, 20);
|
||||
|
||||
DevicesTabBar->setTabButton(dev_idx, QTabBar::LeftSide, NewTabLabel);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up list of information |
|
||||
\*-----------------------------------------------------*/
|
||||
QTabBar *InformationTabBar = ui->InformationTabBar->tabBar();
|
||||
|
||||
for(int dev_idx = 0; dev_idx < control.size(); dev_idx++)
|
||||
{
|
||||
OpenRGBDeviceInfoPage *NewPage = new OpenRGBDeviceInfoPage(control[dev_idx]);
|
||||
ui->InformationTabBar->addTab(NewPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Use Qt's HTML capabilities to display both icon and |
|
||||
| text in the tab label. Choose icon based on device |
|
||||
| type and append device name string. |
|
||||
\*-----------------------------------------------------*/
|
||||
QString NewLabelString = "<html><table><tr><td width='30'><img src='";
|
||||
switch(control[dev_idx]->type)
|
||||
{
|
||||
case DEVICE_TYPE_MOTHERBOARD:
|
||||
NewLabelString += ":/motherboard.svg";
|
||||
break;
|
||||
case DEVICE_TYPE_DRAM:
|
||||
NewLabelString += ":/ram.svg";
|
||||
break;
|
||||
case DEVICE_TYPE_GPU:
|
||||
NewLabelString += ":/graphics-card.svg";
|
||||
break;
|
||||
case DEVICE_TYPE_COOLER:
|
||||
NewLabelString += ":/fan.svg";
|
||||
break;
|
||||
case DEVICE_TYPE_LEDSTRIP:
|
||||
//break;
|
||||
case DEVICE_TYPE_KEYBOARD:
|
||||
//break;
|
||||
case DEVICE_TYPE_MOUSE:
|
||||
//break;
|
||||
case DEVICE_TYPE_HEADSET:
|
||||
//break;
|
||||
case DEVICE_TYPE_UNKNOWN:
|
||||
NewLabelString += ":/keyboard.svg";
|
||||
break;
|
||||
}
|
||||
NewLabelString += "' height='15' width='15'></td><td>" + QString::fromStdString(control[dev_idx]->name) + "</td></tr></table></html>";
|
||||
|
||||
QLabel *NewTabLabel = new QLabel();
|
||||
NewTabLabel->setText(NewLabelString);
|
||||
NewTabLabel->setIndent(20);
|
||||
NewTabLabel->setGeometry(0, 0, 200, 20);
|
||||
|
||||
InformationTabBar->setTabButton(dev_idx, QTabBar::LeftSide, NewTabLabel);
|
||||
}
|
||||
|
||||
OpenRGBSystemInfoPage *SysInfoPage = new OpenRGBSystemInfoPage(bus);
|
||||
ui->InformationTabBar->addTab(SysInfoPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Use Qt's HTML capabilities to display both icon and |
|
||||
| text in the tab label. Choose icon based on device |
|
||||
| type and append device name string. |
|
||||
\*-----------------------------------------------------*/
|
||||
QString SystemLabelString = "<html><table><tr><td width='30'><img src='";
|
||||
SystemLabelString += ":/keyboard.svg";
|
||||
SystemLabelString += "' height='15' width='15'></td><td>System</td></tr></table></html>";
|
||||
|
||||
QLabel *SystemTabLabel = new QLabel();
|
||||
SystemTabLabel->setText(SystemLabelString);
|
||||
SystemTabLabel->setIndent(20);
|
||||
SystemTabLabel->setGeometry(0, 0, 200, 20);
|
||||
|
||||
InformationTabBar->setTabButton(control.size(), QTabBar::LeftSide, SystemTabLabel);
|
||||
}
|
||||
|
||||
OpenRGBDialog2::~OpenRGBDialog2()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBDialog2::show()
|
||||
{
|
||||
QMainWindow::show();
|
||||
}
|
||||
|
||||
void OpenRGBDialog2::on_SetAllDevices(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
for(int device = 0; device < ui->DevicesTabBar->count(); device++)
|
||||
{
|
||||
qobject_cast<OpenRGBDevicePage *>(ui->DevicesTabBar->widget(device))->SetDevice(red, green, blue);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef OPENRGBDIALOG2_H
|
||||
#define OPENRGBDIALOG2_H
|
||||
|
||||
#include "ui_OpenRGBDialog2.h"
|
||||
|
||||
#include <vector>
|
||||
#include "i2c_smbus.h"
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QTimer>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QMenu>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBDialog2;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBDialog2 : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBDialog2(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, QWidget *parent = 0);
|
||||
~OpenRGBDialog2();
|
||||
|
||||
void show();
|
||||
void setMode(unsigned char mode_val);
|
||||
|
||||
protected:
|
||||
std::vector<i2c_smbus_interface *>& busses;
|
||||
std::vector<RGBController *>& controllers;
|
||||
|
||||
private:
|
||||
Ui::OpenRGBDialog2Ui *ui;
|
||||
|
||||
private slots:
|
||||
void on_SetAllDevices(unsigned char red, unsigned char green, unsigned char blue);
|
||||
};
|
||||
|
||||
#endif // OPENRGBDIALOG2_H
|
||||
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBDialog2Ui</class>
|
||||
<widget class="QMainWindow" name="OpenRGBDialog2Ui">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>700</width>
|
||||
<height>350</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>OpenRGB</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<widget class="QTabWidget" name="MainTabBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>700</width>
|
||||
<height>351</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="tabShape">
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QWidget" name="TabDevices">
|
||||
<attribute name="title">
|
||||
<string>Devices</string>
|
||||
</attribute>
|
||||
<widget class="QTabWidget" name="DevicesTabBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>700</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="tabPosition">
|
||||
<enum>QTabWidget::West</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="TabEffects">
|
||||
<attribute name="title">
|
||||
<string>Synchronized Effects</string>
|
||||
</attribute>
|
||||
<widget class="QTabWidget" name="EffectsTabBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>700</width>
|
||||
<height>321</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="tabPosition">
|
||||
<enum>QTabWidget::West</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="TabInformation">
|
||||
<attribute name="title">
|
||||
<string>Information</string>
|
||||
</attribute>
|
||||
<widget class="QTabWidget" name="InformationTabBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>700</width>
|
||||
<height>321</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="tabPosition">
|
||||
<enum>QTabWidget::West</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,51 @@
|
||||
#include "OpenRGBSystemInfoPage.h"
|
||||
#include "i2c_tools.h"
|
||||
|
||||
using namespace Ui;
|
||||
|
||||
OpenRGBSystemInfoPage::OpenRGBSystemInfoPage(std::vector<i2c_smbus_interface *>& bus, QWidget *parent) :
|
||||
QFrame(parent),
|
||||
busses(bus),
|
||||
ui(new Ui::OpenRGBSystemInfoPageUi)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Use a monospace font for the text box |
|
||||
\*-----------------------------------------------------*/
|
||||
QFont MonoFont("monospace");
|
||||
MonoFont.setStyleHint(QFont::Monospace);
|
||||
ui->SMBusDataText->setFont(MonoFont);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Fill in the combo boxes with device information |
|
||||
\*-----------------------------------------------------*/
|
||||
ui->SMBusAdaptersBox->clear();
|
||||
|
||||
for (int i = 0; i < busses.size(); i++)
|
||||
{
|
||||
ui->SMBusAdaptersBox->addItem(busses[i]->device_name);
|
||||
}
|
||||
|
||||
ui->SMBusAdaptersBox->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
OpenRGBSystemInfoPage::~OpenRGBSystemInfoPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Ui::OpenRGBSystemInfoPage::on_DetectButton_clicked()
|
||||
{
|
||||
i2c_smbus_interface* bus = busses[ui->SMBusAdaptersBox->currentIndex()];
|
||||
|
||||
ui->SMBusDataText->setPlainText(i2c_detect(bus, MODE_QUICK).c_str());
|
||||
}
|
||||
|
||||
void Ui::OpenRGBSystemInfoPage::on_DumpButton_clicked()
|
||||
{
|
||||
i2c_smbus_interface* bus = busses[ui->SMBusAdaptersBox->currentIndex()];
|
||||
unsigned char address = ui->DumpAddressBox->value();
|
||||
|
||||
ui->SMBusDataText->setPlainText(i2c_dump(bus, address).c_str());
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef OPENRGBSYSTEMINFOPAGE_H
|
||||
#define OPENRGBSYSTEMINFOPAGE_H
|
||||
|
||||
#include <QFrame>
|
||||
#include "ui_OpenRGBSystemInfoPage.h"
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
namespace Ui {
|
||||
class OpenRGBSystemInfoPage;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBSystemInfoPage : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBSystemInfoPage(std::vector<i2c_smbus_interface *>& bus, QWidget *parent = nullptr);
|
||||
~OpenRGBSystemInfoPage();
|
||||
|
||||
private slots:
|
||||
void on_DetectButton_clicked();
|
||||
|
||||
void on_DumpButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBSystemInfoPageUi *ui;
|
||||
std::vector<i2c_smbus_interface *>& busses;
|
||||
};
|
||||
|
||||
#endif // OPENRGBSYSTEMINFOPAGE_H
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBSystemInfoPageUi</class>
|
||||
<widget class="QFrame" name="OpenRGBSystemInfoPageUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="SMBusAdaptersLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>10</y>
|
||||
<width>100</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SMBus Adapters:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="SMBusAdaptersBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>10</y>
|
||||
<width>200</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="SMBusDataText">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>80</y>
|
||||
<width>400</width>
|
||||
<height>210</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="DetectButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>10</y>
|
||||
<width>80</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Detect Devices</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="DumpButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>40</y>
|
||||
<width>80</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dump Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="SMBusDumpLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>40</y>
|
||||
<width>100</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SMBus Dumper:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="DumpAddressLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>40</y>
|
||||
<width>51</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="DumpAddressBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<y>40</y>
|
||||
<width>80</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>0x</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="displayIntegerBase">
|
||||
<number>16</number>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1 @@
|
||||
<svg height="512pt" viewBox="0 0 512 512" width="512pt" xmlns="http://www.w3.org/2000/svg"><path d="m462 40c-5.519531 0-10 4.480469-10 10s4.480469 10 10 10 10-4.480469 10-10-4.480469-10-10-10zm0 0"/><path d="m462 452c-5.519531 0-10 4.480469-10 10s4.480469 10 10 10 10-4.480469 10-10-4.480469-10-10-10zm0 0"/><path d="m50 60c5.519531 0 10-4.480469 10-10s-4.480469-10-10-10-10 4.480469-10 10 4.480469 10 10 10zm0 0"/><path d="m50 452c-5.519531 0-10 4.480469-10 10s4.480469 10 10 10 10-4.480469 10-10-4.480469-10-10-10zm0 0"/><path d="m56 266h.25c5.410156-.140625 9.75-4.558594 9.75-10s-4.339844-9.859375-9.75-10c-.078125 0-.171875 0-.25 0-5.519531 0-10 4.480469-10 10s4.480469 10 10 10zm0 0"/><path d="m462 0h-412c-27.570312 0-50 22.429688-50 50v412c0 27.570312 22.429688 50 50 50h412c27.570312 0 50-22.429688 50-50v-412c0-27.570312-22.429688-50-50-50zm30 462c0 16.542969-13.457031 30-30 30h-412c-16.542969 0-30-13.457031-30-30v-412c0-16.542969 13.457031-30 30-30h412c16.542969 0 30 13.457031 30 30zm0 0"/><path d="m256 46c-102.023438 0-186.207031 72.140625-205.839844 168.1875-1.101562 5.410156 2.386719 10.695312 7.796875 11.800781 5.410157 1.101563 10.695313-2.386719 11.800781-7.796875 18.023438-88.183594 96.347657-152.191406 186.242188-152.191406 104.765625 0 190 85.234375 190 190s-85.234375 190-190 190c-90.453125 0-167.050781-62.621094-186.261719-152.285156-1.15625-5.398438-6.476562-8.839844-11.875-7.683594-5.398437 1.15625-8.839843 6.472656-7.683593 11.875 20.566406 95.96875 102.238281 168.09375 205.820312 168.09375 116.34375 0 210-93.570312 210-210 0-115.792969-94.207031-210-210-210zm0 0"/><path d="m366 176c0-49.625-40.375-90-90-90h-20c-5.523438 0-10 4.476562-10 10v83.390625c-16.683594-20.613281-42.121094-33.390625-70-33.390625-49.625 0-90 40.375-90 90v20c0 5.523438 4.476562 9.988281 10 9.988281h83.390625c-20.613281 16.6875-33.390625 42.132813-33.390625 70.011719 0 49.625 40.375 90 90 90h20c5.523438 0 10-4.476562 10-10v-83.390625c16.683594 20.613281 42.121094 33.390625 70 33.390625 49.625 0 90-40.375 90-90v-20c0-5.523438-4.476562-10-10-10h-83.390625c20.613281-16.683594 33.390625-42.121094 33.390625-70zm-90-70c38.597656 0 70 31.402344 70 70 0 28.402344-17.035156 53.550781-42.503906 64.390625-5.566406-16.921875-19.910156-29.785156-37.496094-33.375v-101.015625zm-18.097656 179.9375c-16.96875 1.023438-30.847656-11.925781-31.839844-28.035156-1.054688-17.496094 12.804688-31.902344 29.9375-31.902344 16.417969 0 30 13.316406 30 30 0 15.816406-12.351562 28.96875-28.097656 29.9375zm-151.902344-49.9375c0-38.597656 31.402344-70 70-70 28.402344 0 53.550781 17.035156 64.390625 42.503906-16.921875 5.566406-29.785156 19.910156-33.375 37.496094h-101.015625zm130 170c-38.597656 0-70-31.402344-70-70 0-28.402344 17.035156-53.550781 42.503906-64.390625 5.566406 16.921875 19.910156 29.785156 37.496094 33.375v101.015625zm170-130c0 38.597656-31.402344 70-70 70-28.402344 0-53.550781-17.035156-64.390625-42.503906 16.921875-5.566406 29.785156-19.910156 33.375-37.496094h101.015625zm0 0"/></svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 7.1 KiB |
+157
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* RGB <--> HSV conversion in integer arithmetics, to be used on Windows.
|
||||
* Copyright (c) 2013 Martin Mitas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "hsv.h"
|
||||
|
||||
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
#define MIN3(a,b,c) MIN((a), MIN((b), (c)))
|
||||
#define MAX3(a,b,c) MAX((a), MAX((b), (c)))
|
||||
|
||||
#define RGBGetRValue(rgb) (rgb & 0x000000FF)
|
||||
#define RGBGetGValue(rgb) ((rgb >> 8) & 0x000000FF)
|
||||
#define RGBGetBValue(rgb) ((rgb >> 16) & 0x000000FF)
|
||||
|
||||
#define ToRGBColor(r, g, b) ((b << 16) | (g << 8) | (r))
|
||||
|
||||
void rgb2hsv(unsigned int rgb, hsv_t* hsv)
|
||||
{
|
||||
int r = RGBGetRValue(rgb);
|
||||
int g = RGBGetGValue(rgb);
|
||||
int b = RGBGetBValue(rgb);
|
||||
int m = MIN3(r, g, b);
|
||||
int M = MAX3(r, g, b);
|
||||
int delta = M - m;
|
||||
|
||||
if (delta == 0) {
|
||||
/* Achromatic case (i.e. grayscale) */
|
||||
hsv->hue = -1; /* undefined */
|
||||
hsv->saturation = 0;
|
||||
}
|
||||
else {
|
||||
int h;
|
||||
|
||||
if (r == M)
|
||||
h = ((g - b) * 60 * HUE_DEGREE) / delta;
|
||||
else if (g == M)
|
||||
h = ((b - r) * 60 * HUE_DEGREE) / delta + 120 * HUE_DEGREE;
|
||||
else /*if(b == M)*/
|
||||
h = ((r - g) * 60 * HUE_DEGREE) / delta + 240 * HUE_DEGREE;
|
||||
|
||||
if (h < 0)
|
||||
h += 360 * HUE_DEGREE;
|
||||
|
||||
hsv->hue = h;
|
||||
|
||||
/* The constatnt 8 is tuned to statistically cause as little
|
||||
* tolerated mismatches as possible in RGB -> HSV -> RGB conversion.
|
||||
* (See the unit test at the bottom of this file.)
|
||||
*/
|
||||
hsv->saturation = (256 * delta - 8) / M;
|
||||
}
|
||||
hsv->value = M;
|
||||
}
|
||||
|
||||
unsigned int hsv2rgb(hsv_t* hsv)
|
||||
{
|
||||
unsigned char r, g, b;
|
||||
|
||||
if (hsv->saturation == 0) {
|
||||
r = g = b = hsv->value;
|
||||
}
|
||||
else {
|
||||
int h = (hsv->hue)%360;
|
||||
int s = hsv->saturation;
|
||||
int v = hsv->value;
|
||||
int i = h / (60 * HUE_DEGREE);
|
||||
int p = (256 * v - s*v) / 256;
|
||||
|
||||
if (i & 1) {
|
||||
int q = (256 * 60 * HUE_DEGREE*v - h*s*v + 60 * HUE_DEGREE*s*v*i) / (256 * 60 * HUE_DEGREE);
|
||||
switch (i) {
|
||||
case 1: r = q; g = v; b = p; break;
|
||||
case 3: r = p; g = q; b = v; break;
|
||||
case 5: r = v; g = p; b = q; break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
int t = (256 * 60 * HUE_DEGREE*v + h*s*v - 60 * HUE_DEGREE*s*v*(i + 1)) / (256 * 60 * HUE_DEGREE);
|
||||
switch (i) {
|
||||
case 0: r = v; g = t; b = p; break;
|
||||
case 2: r = p; g = v; b = t; break;
|
||||
case 4: r = t; g = p; b = v; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ToRGBColor(r, g, b);
|
||||
}
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define DIFF(a,b) ((a) >= (b) ? (a) - (b) : (b) - (a))
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
int r0, g0, b0;
|
||||
hsv_t hsv;
|
||||
int r1, g1, b1;
|
||||
int ok = 0, fuzzy = 0, ko = 0, total;
|
||||
|
||||
for (r0 = 0; r0 < 256; r0++) {
|
||||
for (g0 = 0; g0 < 256; g0++) {
|
||||
for (b0 = 0; b0 < 256; b0++) {
|
||||
COLORREF tmp;
|
||||
|
||||
rgb2hsv(RGB(r0, g0, b0), &hsv);
|
||||
tmp = hsv2rgb(&hsv);
|
||||
r1 = GetRValue(tmp);
|
||||
g1 = GetGValue(tmp);
|
||||
b1 = GetBValue(tmp);
|
||||
|
||||
if (r0 == r1 && b0 == b1 && g0 == g1)
|
||||
ok++;
|
||||
else if (DIFF(r0, r1) <= 1 && DIFF(b0, b1) <= 1 && DIFF(g0, g1) <= 1)
|
||||
fuzzy++;
|
||||
else
|
||||
ko++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
total = ok + fuzzy + ko;
|
||||
|
||||
printf("Test results:\n");
|
||||
printf(" * exact matches: %8d (%5.2f%%)\n", ok, (100.0 * ok) / total);
|
||||
printf(" * fuzzy matches: %8d (%5.2f%%)\n", fuzzy, (100.0 * fuzzy) / total);
|
||||
printf(" * mismatches: %8d (%5.2f%%)\n", ko, (100.0 * ko) / total);
|
||||
|
||||
return (ko == 0 ? 0 : 1);
|
||||
}
|
||||
#endif /* TEST */
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* RGB <--> HSV conversion in integer arithmetics, to be used on Windows.
|
||||
* Copyright (c) 2013 Martin Mitas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef HSV_H
|
||||
#define HSV_H
|
||||
|
||||
#define HUE_DEGREE 1
|
||||
|
||||
typedef struct hsv_tag hsv_t;
|
||||
struct hsv_tag {
|
||||
unsigned int hue; /* 0 ... (360*HUE_DEGREE - 1) */
|
||||
unsigned char saturation; /* 0 ... 255 */
|
||||
unsigned char value; /* 0 ... 255 */
|
||||
};
|
||||
|
||||
|
||||
void rgb2hsv(unsigned int rgb, hsv_t* hsv);
|
||||
|
||||
unsigned int hsv2rgb(hsv_t* hsv);
|
||||
|
||||
|
||||
#endif /* HSV_H */
|
||||
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 463 463" style="enable-background:new 0 0 463 463;" xml:space="preserve">
|
||||
<g>
|
||||
<g>
|
||||
<g>
|
||||
<path d="M431.5,120h-400C14.131,120,0,134.131,0,151.5v160C0,328.869,14.131,343,31.5,343h400c17.369,0,31.5-14.131,31.5-31.5
|
||||
v-160C463,134.131,448.869,120,431.5,120z M448,311.5c0,9.099-7.402,16.5-16.5,16.5h-400c-9.098,0-16.5-7.401-16.5-16.5v-160
|
||||
c0-9.099,7.402-16.5,16.5-16.5h400c9.098,0,16.5,7.401,16.5,16.5V311.5z"/>
|
||||
<path d="M327.5,280h-192c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h192c4.142,0,7.5-3.357,7.5-7.5S331.642,280,327.5,280z"/>
|
||||
<path d="M103.5,280h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S107.642,280,103.5,280z"/>
|
||||
<path d="M55.5,280h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S59.642,280,55.5,280z"/>
|
||||
<path d="M423.5,280h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S427.642,280,423.5,280z"/>
|
||||
<path d="M375.5,280h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S379.642,280,375.5,280z"/>
|
||||
<path d="M423.5,248h-32c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h32c4.142,0,7.5-3.357,7.5-7.5S427.642,248,423.5,248z"/>
|
||||
<path d="M367,255.5c0-4.143-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16
|
||||
C363.642,263,367,259.643,367,255.5z"/>
|
||||
<path d="M295.5,263h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S291.358,263,295.5,263z"/>
|
||||
<path d="M247.5,263h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S243.358,263,247.5,263z"/>
|
||||
<path d="M199.5,263h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S195.358,263,199.5,263z"/>
|
||||
<path d="M151.5,263h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S147.358,263,151.5,263z"/>
|
||||
<path d="M119.5,248h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S123.642,248,119.5,248z"/>
|
||||
<path d="M71.5,248h-32c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h32c4.142,0,7.5-3.357,7.5-7.5S75.642,248,71.5,248z"/>
|
||||
<path d="M423.5,184h-32c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h32c4.142,0,7.5-3.357,7.5-7.5S427.642,184,423.5,184z"/>
|
||||
<path d="M343.5,199h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S339.358,199,343.5,199z"/>
|
||||
<path d="M295.5,199h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S291.358,199,295.5,199z"/>
|
||||
<path d="M247.5,199h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S243.358,199,247.5,199z"/>
|
||||
<path d="M199.5,199h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S195.358,199,199.5,199z"/>
|
||||
<path d="M151.5,199h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S147.358,199,151.5,199z"/>
|
||||
<path d="M103.5,199h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S99.358,199,103.5,199z"/>
|
||||
<path d="M39.5,199h32c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-32c-4.142,0-7.5,3.357-7.5,7.5S35.358,199,39.5,199z"/>
|
||||
<path d="M423.5,216h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S427.642,216,423.5,216z"/>
|
||||
<path d="M375.5,216h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S379.642,216,375.5,216z"/>
|
||||
<path d="M327.5,216h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S331.642,216,327.5,216z"/>
|
||||
<path d="M279.5,216h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S283.642,216,279.5,216z"/>
|
||||
<path d="M231.5,216h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S235.642,216,231.5,216z"/>
|
||||
<path d="M183.5,216h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S187.642,216,183.5,216z"/>
|
||||
<path d="M135.5,216h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S139.642,216,135.5,216z"/>
|
||||
<path d="M39.5,231h48c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-48c-4.142,0-7.5,3.357-7.5,7.5S35.358,231,39.5,231z"/>
|
||||
<path d="M423.5,152h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S427.642,152,423.5,152z"/>
|
||||
<path d="M375.5,152h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S379.642,152,375.5,152z"/>
|
||||
<path d="M327.5,152h-16c-4.142,0-7.5,3.357-7.5,7.5s3.358,7.5,7.5,7.5h16c4.142,0,7.5-3.357,7.5-7.5S331.642,152,327.5,152z"/>
|
||||
<path d="M263.5,167h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S259.358,167,263.5,167z"/>
|
||||
<path d="M215.5,167h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S211.358,167,215.5,167z"/>
|
||||
<path d="M167.5,167h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S163.358,167,167.5,167z"/>
|
||||
<path d="M119.5,167h16c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-16c-4.142,0-7.5,3.357-7.5,7.5S115.358,167,119.5,167z"/>
|
||||
<path d="M39.5,167h48c4.142,0,7.5-3.357,7.5-7.5s-3.358-7.5-7.5-7.5h-48c-4.142,0-7.5,3.357-7.5,7.5S35.358,167,39.5,167z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.4 KiB |
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||
<g>
|
||||
<g>
|
||||
<path d="M497,0H15C6.716,0,0,6.716,0,15v482c0,8.284,6.716,15,15,15h482c8.284,0,15-6.716,15-15V15C512,6.716,505.284,0,497,0z
|
||||
M482,482H30V30h452V482z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path d="M216.974,330.026H90c-8.284,0-15,6.716-15,15V432c0,8.284,6.716,15,15,15h126.974c8.284,0,15-6.716,15-15v-86.974
|
||||
C231.974,336.742,225.258,330.026,216.974,330.026z M138.487,417H105v-56.974h33.487V417z M201.974,417h-33.487v-56.974h33.487
|
||||
V417z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path d="M90,65c-8.284,0-15,6.716-15,15v191c0,8.284,6.716,15,15,15s15-6.716,15-15V80C105,71.716,98.284,65,90,65z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path d="M153.487,65c-8.284,0-15,6.716-15,15v191c0,8.284,6.716,15,15,15s15-6.716,15-15V80C168.487,71.716,161.771,65,153.487,65
|
||||
z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path d="M442,181.974h-35V165h35c8.284,0,15-6.716,15-15s-6.716-15-15-15h-35v-5c0-8.284-6.716-15-15-15h-5V80
|
||||
c0-8.284-6.716-15-15-15s-15,6.716-15,15v35h-16.974V80c0-8.284-6.716-15-15-15s-15,6.716-15,15v35h-5c-8.284,0-15,6.716-15,15v5
|
||||
h-35c-8.284,0-15,6.716-15,15s6.716,15,15,15h35v16.974h-35c-8.284,0-15,6.716-15,15s6.716,15,15,15h35v5c0,8.284,6.716,15,15,15
|
||||
h5v35c0,8.284,6.716,15,15,15s15-6.716,15-15v-35H357v35c0,8.284,6.716,15,15,15s15-6.716,15-15v-35h5c8.284,0,15-6.716,15-15v-5
|
||||
h35c8.284,0,15-6.716,15-15S450.284,181.974,442,181.974z M377,201.974h-56.974V145H377V201.974z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path d="M392,330.026h-86.974c-8.284,0-15,6.716-15,15s6.716,15,15,15H392c8.284,0,15-6.716,15-15S400.284,330.026,392,330.026z"
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path d="M392,393.513h-86.974c-8.284,0-15,6.716-15,15s6.716,15,15,15H392c8.284,0,15-6.716,15-15S400.284,393.513,392,393.513z"
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 401.396 401.396" xmlns:xlink="http://www.w3.org/1999/xlink" enable-background="new 0 0 401.396 401.396">
|
||||
<path d="m200.698,0c-68.997,0-125.13,56.133-125.13,125.129v151.137c0,68.997 56.133,125.129 125.13,125.129s125.129-56.133 125.129-125.129v-151.137c0-68.996-56.132-125.129-125.129-125.129zm110.129,125.129v1.973c-32.303,16.982-68.429,26.282-105.133,27.057v-41.835c10.585-2.298 18.539-11.734 18.539-22.997v-31.367c0-11.263-7.954-20.699-18.539-22.997v-19.845c58.416,2.622 105.133,50.961 105.133,110.011zm-110.129-80.705c7.463-7.10543e-15 13.536,6.072 13.536,13.536v31.368c0,7.463-6.072,13.536-13.536,13.536s-13.536-6.072-13.536-13.536v-31.368c0-7.463 6.073-13.536 13.536-13.536zm-5.003-29.305v19.846c-10.581,2.301-18.532,11.735-18.532,22.995v31.368c0,11.26 7.951,20.694 18.532,22.995v41.837c-36.699-0.775-72.823-10.076-105.126-27.059v-1.971c-0.001-59.049 46.714-107.386 105.126-110.011zm5.003,371.277c-60.726-5.68434e-14-110.13-49.404-110.13-110.129v-137.928c34.015,16.958 71.851,25.88 110.126,25.88 38.28,0 76.118-8.921 110.133-25.878v137.925c0,60.726-49.403,110.13-110.129,110.13z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 6.5 KiB |
+10
-4
@@ -1,5 +1,11 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>OpenRGB.png</file>
|
||||
</qresource>
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>OpenRGB.png</file>
|
||||
<file>motherboard.svg</file>
|
||||
<file>ram.svg</file>
|
||||
<file>graphics-card.svg</file>
|
||||
<file>fan.svg</file>
|
||||
<file>keyboard.svg</file>
|
||||
<file>mouse.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user