Compare commits
49
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4982a51718 | ||
|
|
68b0dc9e2e | ||
|
|
c8a1363b35 | ||
|
|
0a61e38ee1 | ||
|
|
b5f687c402 | ||
|
|
50875fc698 | ||
|
|
802d444d9d | ||
|
|
a8c83e5688 | ||
|
|
63bf13faac | ||
|
|
5bc80cce96 | ||
|
|
3c34a659a0 | ||
|
|
efed3faaf4 | ||
|
|
155ad165b1 | ||
|
|
ef79de6c7c | ||
|
|
854d7d0ec5 | ||
|
|
727516e712 | ||
|
|
9126ded32e | ||
|
|
d5a32eb743 | ||
|
|
1bfeb59d6a | ||
|
|
fd7d956913 | ||
|
|
50942d11b1 | ||
|
|
aebffd9e48 | ||
|
|
ae77e44f73 | ||
|
|
675eb40b94 | ||
|
|
7f09b14f50 | ||
|
|
b17d87a15b | ||
|
|
9e963e5cc7 | ||
|
|
fa8f06f273 | ||
|
|
9c1d0e1a79 | ||
|
|
60b9fd08bb | ||
|
|
9c5f592618 | ||
|
|
8f96f9535d | ||
|
|
d94d6eb569 | ||
|
|
06f21865c6 | ||
|
|
18bf0ce013 | ||
|
|
af0bfde610 | ||
|
|
ab4a07244a | ||
|
|
08532dc56c | ||
|
|
c69d8c4680 | ||
|
|
e9cf421719 | ||
|
|
4887e9a11e | ||
|
|
f71f325a97 | ||
|
|
7ba607be8a | ||
|
|
4714aec6dd | ||
|
|
7554e366f4 | ||
|
|
d60936b2e5 | ||
|
|
90b57e1846 | ||
|
|
8c3acbe889 | ||
|
|
f5d7f2e537 |
@@ -17,56 +17,64 @@ AuraController::AuraController(i2c_smbus_interface* bus, aura_dev_id dev)
|
||||
|
||||
AuraUpdateDeviceName();
|
||||
|
||||
// Read the device configuration table
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
config_table[i] = AuraRegisterRead(AURA_REG_CONFIG_TABLE + i);
|
||||
}
|
||||
|
||||
// Read LED count from configuration table
|
||||
led_count = config_table[AURA_CONFIG_LED_COUNT];
|
||||
|
||||
// LED-0116 - First generation motherboard controller
|
||||
if (strcmp(device_name, "LED-0116") == 0)
|
||||
{
|
||||
direct_reg = AURA_REG_COLORS_DIRECT;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT;
|
||||
led_count = 5;
|
||||
direct_reg = AURA_REG_COLORS_DIRECT;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT;
|
||||
channel_cfg = AURA_CONFIG_CHANNEL_V1;
|
||||
}
|
||||
// DIMM_LED-0102 - First generation DRAM controller (Trident Z RGB)
|
||||
else if (strcmp(device_name, "DIMM_LED-0102") == 0)
|
||||
{
|
||||
direct_reg = AURA_REG_COLORS_DIRECT;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT;
|
||||
led_count = 5;
|
||||
direct_reg = AURA_REG_COLORS_DIRECT;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT;
|
||||
channel_cfg = AURA_CONFIG_CHANNEL_V1;
|
||||
}
|
||||
// AUDA0-E6K5-0101 - Second generation DRAM controller (Geil Super Luce)
|
||||
else if (strcmp(device_name, "AUDA0-E6K5-0101") == 0)
|
||||
{
|
||||
direct_reg = AURA_REG_COLORS_DIRECT_V2;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT_V2;
|
||||
led_count = 5;
|
||||
direct_reg = AURA_REG_COLORS_DIRECT_V2;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT_V2;
|
||||
channel_cfg = AURA_CONFIG_CHANNEL_V2;
|
||||
}
|
||||
// AUMA0-E6K5-0106 - Second generation motherboard controller
|
||||
else if (strcmp(device_name, "AUMA0-E6K5-0106") == 0)
|
||||
{
|
||||
direct_reg = AURA_REG_COLORS_DIRECT_V2;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT_V2;
|
||||
led_count = 5;
|
||||
direct_reg = AURA_REG_COLORS_DIRECT_V2;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT_V2;
|
||||
channel_cfg = AURA_CONFIG_CHANNEL_V2;
|
||||
}
|
||||
// AUMA0-E6K5-0105 - Second generation motherboard controller
|
||||
else if (strcmp(device_name, "AUMA0-E6K5-0105") == 0)
|
||||
{
|
||||
direct_reg = AURA_REG_COLORS_DIRECT_V2;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT_V2;
|
||||
led_count = 5;
|
||||
direct_reg = AURA_REG_COLORS_DIRECT_V2;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT_V2;
|
||||
channel_cfg = AURA_CONFIG_CHANNEL_V2;
|
||||
}
|
||||
// AUMA0-E6K5-0104 - Second generation motherboard controller
|
||||
else if (strcmp(device_name, "AUMA0-E6K5-0104") == 0)
|
||||
{
|
||||
direct_reg = AURA_REG_COLORS_DIRECT_V2;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT_V2;
|
||||
led_count = 5;
|
||||
channel_cfg = AURA_CONFIG_CHANNEL_V2;
|
||||
}
|
||||
// Assume first generation controller if string does not match
|
||||
else
|
||||
{
|
||||
direct_reg = AURA_REG_COLORS_DIRECT;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT;
|
||||
led_count = 5;
|
||||
direct_reg = AURA_REG_COLORS_DIRECT;
|
||||
effect_reg = AURA_REG_COLORS_EFFECT;
|
||||
channel_cfg = AURA_CONFIG_CHANNEL_V1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
AuraController::~AuraController()
|
||||
@@ -79,6 +87,61 @@ char * AuraController::GetDeviceName()
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
unsigned char AuraController::GetChannel(unsigned int led)
|
||||
{
|
||||
return(config_table[channel_cfg + led]);
|
||||
}
|
||||
|
||||
const char * AuraController::GetChannelName(unsigned int led)
|
||||
{
|
||||
switch (config_table[channel_cfg + led])
|
||||
{
|
||||
case (unsigned char)AURA_LED_CHANNEL_AUDIO:
|
||||
return(aura_channels[0]);
|
||||
break;
|
||||
|
||||
case (unsigned char)AURA_LED_CHANNEL_BACKPLATE:
|
||||
return(aura_channels[1]);
|
||||
break;
|
||||
|
||||
case (unsigned char)AURA_LED_CHANNEL_BACK_IO:
|
||||
return(aura_channels[2]);
|
||||
break;
|
||||
|
||||
case (unsigned char)AURA_LED_CHANNEL_CENTER:
|
||||
return(aura_channels[3]);
|
||||
break;
|
||||
|
||||
case (unsigned char)AURA_LED_CHANNEL_CENTER_START:
|
||||
return(aura_channels[4]);
|
||||
break;
|
||||
|
||||
case (unsigned char)AURA_LED_CHANNEL_DRAM:
|
||||
return(aura_channels[5]);
|
||||
break;
|
||||
|
||||
case (unsigned char)AURA_LED_CHANNEL_PCIE:
|
||||
return(aura_channels[6]);
|
||||
break;
|
||||
|
||||
case (unsigned char)AURA_LED_CHANNEL_RGB_HEADER:
|
||||
return(aura_channels[7]);
|
||||
break;
|
||||
|
||||
case (unsigned char)AURA_LED_CHANNEL_RGB_HEADER_2:
|
||||
return(aura_channels[8]);
|
||||
break;
|
||||
|
||||
case (unsigned char)AURA_LED_CHANNEL_RGB_HEADER_3:
|
||||
return(aura_channels[9]);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(aura_channels[10]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int AuraController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
@@ -19,6 +19,7 @@ typedef unsigned short aura_register;
|
||||
enum
|
||||
{
|
||||
AURA_REG_DEVICE_NAME = 0x1000, /* Device String 16 bytes */
|
||||
AURA_REG_CONFIG_TABLE = 0x1C00, /* Start of LED configuration bytes */
|
||||
AURA_REG_COLORS_DIRECT = 0x8000, /* Colors for Direct Mode 15 bytes */
|
||||
AURA_REG_COLORS_EFFECT = 0x8010, /* Colors for Internal Effects 15 bytes */
|
||||
AURA_REG_DIRECT = 0x8020, /* "Direct Access" Selection Register */
|
||||
@@ -46,6 +47,44 @@ enum
|
||||
AURA_MODE_SPECTRUM_CYCLE_WAVE = 11, /* Wave effect mode */
|
||||
AURA_MODE_CHASE_RAINBOW_PULSE = 12, /* Chase with Rainbow Pulse effect mode*/
|
||||
AURA_MODE_RANDOM_FLICKER = 13, /* Random flicker effect mode */
|
||||
AURA_NUMBER_MODES /* Number of Aura modes */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AURA_LED_CHANNEL_DRAM_2 = 0x05, /* DRAM LED channel */
|
||||
AURA_LED_CHANNEL_CENTER_START = 0x82, /* Center zone first LED channel */
|
||||
AURA_LED_CHANNEL_CENTER = 0x83, /* Center zone LED channel */
|
||||
AURA_LED_CHANNEL_AUDIO = 0x84, /* Audio zone LED channel */
|
||||
AURA_LED_CHANNEL_BACK_IO = 0x85, /* Back I/O zone LED channel */
|
||||
AURA_LED_CHANNEL_RGB_HEADER = 0x86, /* RGB Header LED channel */
|
||||
AURA_LED_CHANNEL_RGB_HEADER_2 = 0x87, /* RGB Header 2 LED channel */
|
||||
AURA_LED_CHANNEL_BACKPLATE = 0x88, /* Backplate zone LED channel */
|
||||
AURA_LED_CHANNEL_DRAM = 0x8A, /* DRAM LED channel */
|
||||
AURA_LED_CHANNEL_PCIE = 0x8B, /* PCIe zone LED channel */
|
||||
AURA_LED_CHANNEL_RGB_HEADER_3 = 0x91, /* RGB Header 3 LED channel */
|
||||
};
|
||||
|
||||
static const char* aura_channels[] = /* Aura channel strings */
|
||||
{
|
||||
"Audio",
|
||||
"Backplate",
|
||||
"Back I/O",
|
||||
"Center",
|
||||
"Center",
|
||||
"DRAM",
|
||||
"PCIe",
|
||||
"RGB Header",
|
||||
"RGB Header 2",
|
||||
"RGB Header",
|
||||
"Unknown",
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AURA_CONFIG_LED_COUNT = 0x02, /* LED Count configuration offset */
|
||||
AURA_CONFIG_CHANNEL_V1 = 0x13, /* LED Channel configuration offset */
|
||||
AURA_CONFIG_CHANNEL_V2 = 0x1B, /* LED Channel V2 configuration offset */
|
||||
};
|
||||
|
||||
class AuraController
|
||||
@@ -55,6 +94,8 @@ public:
|
||||
~AuraController();
|
||||
|
||||
char* GetDeviceName();
|
||||
unsigned char GetChannel(unsigned int led);
|
||||
const char* GetChannelName(unsigned int led);
|
||||
unsigned int GetLEDCount();
|
||||
void SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetAllColorsEffect(unsigned char red, unsigned char green, unsigned char blue);
|
||||
@@ -65,17 +106,18 @@ public:
|
||||
|
||||
void AuraUpdateDeviceName();
|
||||
|
||||
unsigned char AuraRegisterRead(aura_register reg);
|
||||
void AuraRegisterWrite(aura_register reg, unsigned char val);
|
||||
void AuraRegisterWriteBlock(aura_register reg, unsigned char * data, unsigned char sz);
|
||||
unsigned char AuraRegisterRead(aura_register reg);
|
||||
void AuraRegisterWrite(aura_register reg, unsigned char val);
|
||||
void AuraRegisterWriteBlock(aura_register reg, unsigned char * data, unsigned char sz);
|
||||
|
||||
private:
|
||||
char device_name[16];
|
||||
unsigned char config_table[64];
|
||||
unsigned int led_count;
|
||||
aura_register direct_reg;
|
||||
aura_register effect_reg;
|
||||
unsigned char channel_cfg;
|
||||
i2c_smbus_interface * bus;
|
||||
aura_dev_id dev;
|
||||
|
||||
|
||||
};
|
||||
@@ -0,0 +1,125 @@
|
||||
#include "AuraController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_Aura.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForAuraController *
|
||||
* *
|
||||
* Tests the given address to see if an Aura controller exists there. First does a *
|
||||
* quick write to test for a response, and if so does a simple read at 0xA0 to test *
|
||||
* for incrementing values 0...F which was observed at this location during data dump *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForAuraController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
|
||||
|
||||
if (res >= 0)
|
||||
{
|
||||
pass = true;
|
||||
|
||||
for (int i = 0xA0; i < 0xB0; i++)
|
||||
{
|
||||
res = bus->i2c_smbus_read_byte_data(address, i);
|
||||
|
||||
if (res != (i - 0xA0))
|
||||
{
|
||||
pass = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForAuraController() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectAuraControllers *
|
||||
* *
|
||||
* Detect Aura controllers on the enumerated I2C busses. Searches for Aura-enabled *
|
||||
* RAM at 0x77 and tries to initialize their slot addresses, then searches for them *
|
||||
* at their correct initialized addresses. Also looks for motherboard controller at *
|
||||
* address 0x4E. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where Aura device is connected *
|
||||
* dev - I2C address of Aura device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAuraControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
AuraController* new_aura;
|
||||
RGBController_Aura* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
// Remap Aura-enabled RAM modules on 0x77
|
||||
for (unsigned int slot = 0; slot < 8; slot++)
|
||||
{
|
||||
int res = busses[bus]->i2c_smbus_write_quick(0x77, I2C_SMBUS_WRITE);
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
AuraController temp_controller(busses[bus], 0x77);
|
||||
|
||||
temp_controller.AuraRegisterWrite(AURA_REG_SLOT_INDEX, slot);
|
||||
temp_controller.AuraRegisterWrite(AURA_REG_I2C_ADDRESS, 0xE0 + (slot << 1));
|
||||
}
|
||||
|
||||
// Add Aura-enabled controllers at their remapped addresses
|
||||
for (unsigned int slot = 0; slot < 8; slot++)
|
||||
{
|
||||
if (TestForAuraController(busses[bus], 0x70 + slot))
|
||||
{
|
||||
new_aura = new AuraController(busses[bus], 0x70 + slot);
|
||||
new_controller = new RGBController_Aura(new_aura);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for Aura controller at 0x40
|
||||
if (TestForAuraController(busses[bus], 0x40))
|
||||
{
|
||||
new_aura = new AuraController(busses[bus], 0x40);
|
||||
new_controller = new RGBController_Aura(new_aura);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Aura controller at 0x4E
|
||||
if (TestForAuraController(busses[bus], 0x4E))
|
||||
{
|
||||
new_aura = new AuraController(busses[bus], 0x4E);
|
||||
new_controller = new RGBController_Aura(new_aura);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Aura controller at 0x4F
|
||||
if (TestForAuraController(busses[bus], 0x4F))
|
||||
{
|
||||
new_aura = new AuraController(busses[bus], 0x4F);
|
||||
new_controller = new RGBController_Aura(new_aura);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Aura controller at 0x66
|
||||
if (TestForAuraController(busses[bus], 0x66))
|
||||
{
|
||||
new_aura = new AuraController(busses[bus], 0x66);
|
||||
new_controller = new RGBController_Aura(new_aura);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectAuraControllers() */
|
||||
+15
-1
@@ -34,11 +34,25 @@ unsigned int CorsairController::GetLEDCount()
|
||||
return(led_count);
|
||||
}
|
||||
|
||||
void CorsairController::SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue)
|
||||
void CorsairController::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_FADE_TIME, 0x00);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_RED_VAL, red);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_GREEN_VAL, green);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_BLUE_VAL, blue);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_MODE, CORSAIR_VENGEANCE_RGB_MODE_SINGLE);
|
||||
}
|
||||
|
||||
void CorsairController::SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_FADE_TIME, 0x00);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_RED_VAL, red);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_GREEN_VAL, green);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_BLUE_VAL, blue);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_MODE, CORSAIR_VENGEANCE_RGB_MODE_SINGLE);
|
||||
}
|
||||
|
||||
void CorsairController::SetMode(unsigned char mode)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_MODE, CORSAIR_VENGEANCE_RGB_MODE_SINGLE);
|
||||
}
|
||||
@@ -29,6 +29,7 @@ enum
|
||||
CORSAIR_VENGEANCE_RGB_MODE_SINGLE = 0x00, /* Single Color Effect Mode */
|
||||
CORSAIR_VENGEANCE_RGB_MODE_FADE = 0x01, /* Fade Through Colors */
|
||||
CORSAIR_VENGEANCE_RGB_MODE_PULSE = 0x02, /* Pulse Through Colors */
|
||||
CORSAIR_NUMBER_MODES /* Number of Corsair modes */
|
||||
};
|
||||
|
||||
class CorsairController
|
||||
@@ -37,15 +38,16 @@ public:
|
||||
CorsairController(i2c_smbus_interface* bus, corsair_dev_id dev);
|
||||
~CorsairController();
|
||||
|
||||
char* GetDeviceName();
|
||||
unsigned int GetLEDCount();
|
||||
char* GetDeviceName();
|
||||
unsigned int GetLEDCount();
|
||||
void SetMode(unsigned char mode);
|
||||
|
||||
void SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
private:
|
||||
char device_name[32];
|
||||
unsigned int led_count;
|
||||
i2c_smbus_interface * bus;
|
||||
corsair_dev_id dev;
|
||||
|
||||
};
|
||||
@@ -0,0 +1,109 @@
|
||||
#include "CorsairController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_Corsair.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForCorsairController *
|
||||
* *
|
||||
* Tests the given address to see if a Corsair controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForCorsairController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
|
||||
|
||||
if (res >= 0)
|
||||
{
|
||||
pass = true;
|
||||
|
||||
for (int i = 0xA0; i < 0xB0; i++)
|
||||
{
|
||||
res = bus->i2c_smbus_read_byte_data(address, i);
|
||||
|
||||
if (res != 0xBA)
|
||||
{
|
||||
pass = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForCorsairController() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairControllers *
|
||||
* *
|
||||
* Detect Corsair controllers on the enumerated I2C busses. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where Aura device is connected *
|
||||
* dev - I2C address of Aura device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
CorsairController* new_corsair;
|
||||
RGBController_Corsair* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
// Check for Corsair controller at 0x58
|
||||
if (TestForCorsairController(busses[bus], 0x58))
|
||||
{
|
||||
new_corsair = new CorsairController(busses[bus], 0x58);
|
||||
new_controller = new RGBController_Corsair(new_corsair);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x59
|
||||
if (TestForCorsairController(busses[bus], 0x59))
|
||||
{
|
||||
new_corsair = new CorsairController(busses[bus], 0x59);
|
||||
new_controller = new RGBController_Corsair(new_corsair);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5A
|
||||
if (TestForCorsairController(busses[bus], 0x5A))
|
||||
{
|
||||
new_corsair = new CorsairController(busses[bus], 0x5A);
|
||||
new_controller = new RGBController_Corsair(new_corsair);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5B
|
||||
if (TestForCorsairController(busses[bus], 0x5B))
|
||||
{
|
||||
new_corsair = new CorsairController(busses[bus], 0x5B);
|
||||
new_controller = new RGBController_Corsair(new_corsair);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5C
|
||||
if (TestForCorsairController(busses[bus], 0x5C))
|
||||
{
|
||||
new_corsair = new CorsairController(busses[bus], 0x5C);
|
||||
new_controller = new RGBController_Corsair(new_corsair);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5D
|
||||
if (TestForCorsairController(busses[bus], 0x5D))
|
||||
{
|
||||
new_corsair = new CorsairController(busses[bus], 0x5D);
|
||||
new_controller = new RGBController_Corsair(new_corsair);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectCorsairControllers() */
|
||||
@@ -0,0 +1,137 @@
|
||||
/*-----------------------------------------*\
|
||||
| CorsairProController.cpp |
|
||||
| |
|
||||
| Definitions and types for Corsair |
|
||||
| Vengeance Pro RGB RAM lighting controller|
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/30/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "CorsairProController.h"
|
||||
#include <cstring>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
void Sleep(unsigned int milliseconds)
|
||||
{
|
||||
usleep(1000 * milliseconds);
|
||||
}
|
||||
#endif
|
||||
|
||||
CorsairProController::CorsairProController(i2c_smbus_interface* bus, corsair_dev_id dev)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
strcpy(device_name, "Corsair Vengeance Pro RGB");
|
||||
led_count = CORSAIR_PRO_LED_COUNT;
|
||||
|
||||
for (int i = 0; i < led_count; i++)
|
||||
{
|
||||
led_red[i] = 0;
|
||||
led_green[i] = 0;
|
||||
led_blue[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CorsairProController::~CorsairProController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
char* CorsairProController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
unsigned int CorsairProController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
}
|
||||
|
||||
void CorsairProController::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
for (int i = 0; i < led_count; i++)
|
||||
{
|
||||
led_red[i] = red;
|
||||
led_green[i] = green;
|
||||
led_blue[i] = blue;
|
||||
}
|
||||
}
|
||||
|
||||
void CorsairProController::SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
led_red[led] = red;
|
||||
led_green[led] = green;
|
||||
led_blue[led] = blue;
|
||||
}
|
||||
|
||||
void CorsairProController::ApplyColors()
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, 0x26, 0x02);
|
||||
Sleep(1);
|
||||
bus->i2c_smbus_write_byte_data(dev, 0x21, 0x00);
|
||||
Sleep(1);
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, led_red[i]);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, led_green[i]);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, led_blue[i]);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0xFF);
|
||||
}
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, 0x82, 0x02);
|
||||
}
|
||||
|
||||
void CorsairProController::SetEffect(unsigned char mode)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, 0x26, 0x01);
|
||||
Sleep(1);
|
||||
bus->i2c_smbus_write_byte_data(dev, 0x21, 0x00);
|
||||
Sleep(1);
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, mode); //Mode
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, CORSAIR_PRO_SPEED_MEDIUM); //Speed
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, CORSAIR_PRO_EFFECT_RANDOM_COLORS); //Custom color
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, CORSAIR_PRO_DIRECTION_UP); //Direction
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00); // Custom color 1 red
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00); // Custom color 1 green
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00); // Custom color 1 blue
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0xFF);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00); // Custom color 2 red
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00); // Custom color 2 green
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00); // Custom color 2 blue
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0xFF);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00);
|
||||
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00);
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, 0x82, 0x01);
|
||||
WaitReady();
|
||||
}
|
||||
|
||||
void CorsairProController::SetCustom()
|
||||
{
|
||||
SetEffect(CORSAIR_PRO_MODE_STATIC);
|
||||
}
|
||||
|
||||
bool CorsairProController::WaitReady()
|
||||
{
|
||||
int i = 0;
|
||||
while (bus->i2c_smbus_read_byte_data(dev, 0x41) != 0x00)
|
||||
{
|
||||
i++;
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*-----------------------------------------*\
|
||||
| CorsairProController.h |
|
||||
| |
|
||||
| Definitions and types for Corsair |
|
||||
| Vengeance Pro RGB RAM lighting controller|
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/30/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char corsair_dev_id;
|
||||
|
||||
#define CORSAIR_PRO_LED_COUNT ( 10 )
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_PRO_REG_COMMAND = 0x20, /* Command write register */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_PRO_MODE_COLOR_SHIFT = 0x00, /* Color Shift mode */
|
||||
CORSAIR_PRO_MODE_COLOR_PULSE = 0x01, /* Color Pulse mode */
|
||||
CORSAIR_PRO_MODE_RAINBOW_WAVE = 0x03, /* Rainbow Wave mode */
|
||||
CORSAIR_PRO_MODE_COLOR_WAVE = 0x04, /* Color Wave mode */
|
||||
CORSAIR_PRO_MODE_VISOR = 0x05, /* Visor mode */
|
||||
CORSAIR_PRO_MODE_RAIN = 0x06, /* Rain mode */
|
||||
CORSAIR_PRO_MODE_MARQUEE = 0x07, /* Marquee mode */
|
||||
CORSAIR_PRO_MODE_RAINBOW = 0x08, /* Rainbow mode */
|
||||
CORSAIR_PRO_MODE_SEQUENTIAL = 0x09, /* Sequential mode */
|
||||
CORSAIR_PRO_MODE_STATIC = 0x10, /* Static mode */
|
||||
|
||||
CORSAIR_PRO_NUMBER_MODES = 10, /* Number of Corsair Pro modes */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_PRO_SPEED_SLOW = 0x00, /* Slow speed */
|
||||
CORSAIR_PRO_SPEED_MEDIUM = 0x01, /* Medium speed */
|
||||
CORSAIR_PRO_SPEED_FAST = 0x02, /* Fast speed */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_PRO_EFFECT_RANDOM_COLORS = 0x00, /* Random colors */
|
||||
CORSAIR_PRO_EFFECT_CUSTOM_COLORS = 0x01, /* Custom colors */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CORSAIR_PRO_DIRECTION_UP = 0x00, /* Up direction */
|
||||
CORSAIR_PRO_DIRECTION_DOWN = 0x01, /* Down direction */
|
||||
CORSAIR_PRO_DIRECTION_LEFT = 0x02, /* Left direction */
|
||||
CORSAIR_PRO_DIRECTION_RIGHT = 0x03, /* Right direction */
|
||||
CORSAIR_PRO_DIRECTION_VERTICAL = 0x01, /* Vertical direction */
|
||||
CORSAIR_PRO_DIRECTION_HORIZONTAL = 0x03, /* Horizontal direction */
|
||||
};
|
||||
|
||||
class CorsairProController
|
||||
{
|
||||
public:
|
||||
CorsairProController(i2c_smbus_interface* bus, corsair_dev_id dev);
|
||||
~CorsairProController();
|
||||
|
||||
char* GetDeviceName();
|
||||
unsigned int GetLEDCount();
|
||||
void SetEffect(unsigned char mode);
|
||||
void SetCustom();
|
||||
|
||||
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
void ApplyColors();
|
||||
bool WaitReady();
|
||||
|
||||
private:
|
||||
char device_name[32];
|
||||
unsigned int led_count;
|
||||
|
||||
unsigned char led_red[CORSAIR_PRO_LED_COUNT];
|
||||
unsigned char led_green[CORSAIR_PRO_LED_COUNT];
|
||||
unsigned char led_blue[CORSAIR_PRO_LED_COUNT];
|
||||
|
||||
i2c_smbus_interface* bus;
|
||||
corsair_dev_id dev;
|
||||
};
|
||||
@@ -0,0 +1,127 @@
|
||||
#include "CorsairProController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairPro.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForCorsairProController *
|
||||
* *
|
||||
* Tests the given address to see if a Corsair Pro controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForCorsairProController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
|
||||
|
||||
if (res >= 0)
|
||||
{
|
||||
pass = true;
|
||||
|
||||
res = bus->i2c_smbus_read_byte_data(address, 0x24);
|
||||
|
||||
if (res != 0x02)
|
||||
{
|
||||
pass = false;
|
||||
}
|
||||
|
||||
res = bus->i2c_smbus_read_byte_data(address, 0x25);
|
||||
|
||||
if (res != 0x02)
|
||||
{
|
||||
pass = false;
|
||||
}
|
||||
|
||||
res = bus->i2c_smbus_read_byte_data(address, 0x43);
|
||||
|
||||
if (res != 0x1C)
|
||||
{
|
||||
pass = false;
|
||||
}
|
||||
|
||||
res = bus->i2c_smbus_read_byte_data(address, 0x44);
|
||||
|
||||
if (res != 0x03)
|
||||
{
|
||||
pass = false;
|
||||
}
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForCorsairProController() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairProControllers *
|
||||
* *
|
||||
* Detect Corsair Pro controllers on the enumerated I2C busses. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where Aura device is connected *
|
||||
* dev - I2C address of Aura device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairProControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
CorsairProController* new_corsair_pro;
|
||||
RGBController_CorsairPro* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
// Check for Corsair controller at 0x58
|
||||
if (TestForCorsairProController(busses[bus], 0x58))
|
||||
{
|
||||
new_corsair_pro = new CorsairProController(busses[bus], 0x58);
|
||||
new_controller = new RGBController_CorsairPro(new_corsair_pro);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x59
|
||||
if (TestForCorsairProController(busses[bus], 0x59))
|
||||
{
|
||||
new_corsair_pro = new CorsairProController(busses[bus], 0x59);
|
||||
new_controller = new RGBController_CorsairPro(new_corsair_pro);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5A
|
||||
if (TestForCorsairProController(busses[bus], 0x5A))
|
||||
{
|
||||
new_corsair_pro = new CorsairProController(busses[bus], 0x5A);
|
||||
new_controller = new RGBController_CorsairPro(new_corsair_pro);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5B
|
||||
if (TestForCorsairProController(busses[bus], 0x5B))
|
||||
{
|
||||
new_corsair_pro = new CorsairProController(busses[bus], 0x5B);
|
||||
new_controller = new RGBController_CorsairPro(new_corsair_pro);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5C
|
||||
if (TestForCorsairProController(busses[bus], 0x5C))
|
||||
{
|
||||
new_corsair_pro = new CorsairProController(busses[bus], 0x5C);
|
||||
new_controller = new RGBController_CorsairPro(new_corsair_pro);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Corsair controller at 0x5D
|
||||
if (TestForCorsairProController(busses[bus], 0x5D))
|
||||
{
|
||||
new_corsair_pro = new CorsairProController(busses[bus], 0x5D);
|
||||
new_controller = new RGBController_CorsairPro(new_corsair_pro);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectCorsairProControllers() */
|
||||
@@ -0,0 +1,136 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Processing Code for NZXT Hue+ |
|
||||
| |
|
||||
| Adam Honse ([email protected]), 12/11/2016 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "HuePlusController.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
HuePlusController::HuePlusController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
HuePlusController::~HuePlusController()
|
||||
{
|
||||
}
|
||||
|
||||
void HuePlusController::Initialize(char* ledstring)
|
||||
{
|
||||
strcpy(led_string, ledstring);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
char* HuePlusController::GetLEDString()
|
||||
{
|
||||
return(led_string);
|
||||
}
|
||||
|
||||
void HuePlusController::SetLEDs(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[1] = channel;
|
||||
serial_buf[2] = 0x0e;
|
||||
serial_buf[3] = fans;
|
||||
serial_buf[4] = 0x00;
|
||||
|
||||
for (int i = 5; i < hueSize; 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)
|
||||
{
|
||||
int pixel_idx = idx / 3;
|
||||
RGBColor color = colors[pixel_idx];
|
||||
serial_buf[idx + 5] = RGBGetGValue(color);
|
||||
serial_buf[idx + 6] = RGBGetRValue(color);
|
||||
serial_buf[idx + 7] = RGBGetBValue(color);
|
||||
}
|
||||
|
||||
serialport->serial_write((char *)serial_buf, hueSize);
|
||||
serialport->serial_flush_tx();
|
||||
|
||||
delete[] serial_buf;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Definitions for NZXT Hue+ |
|
||||
| |
|
||||
| Adam Honse ([email protected]), 12/11/2016 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#ifndef LED_STRIP_H
|
||||
#define LED_STRIP_H
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "serial_port.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE true
|
||||
#define FALSE false
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#define LPSTR char *
|
||||
#define strtok_s strtok_r
|
||||
#endif
|
||||
|
||||
class HuePlusController
|
||||
{
|
||||
public:
|
||||
HuePlusController();
|
||||
~HuePlusController();
|
||||
|
||||
void Initialize(char* ledstring);
|
||||
char* GetLEDString();
|
||||
void SetLEDs(std::vector<RGBColor> colors);
|
||||
|
||||
int num_leds;
|
||||
|
||||
private:
|
||||
int baud_rate;
|
||||
int fans;
|
||||
int channel;
|
||||
const int hueSize = 125;
|
||||
|
||||
char led_string[1024];
|
||||
char port_name[128];
|
||||
serial_port *serialport;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,89 @@
|
||||
#include "HuePlusController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_HuePlus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectHuePlusControllers *
|
||||
* *
|
||||
* Detect devices supported by the HuePlus driver *
|
||||
* * *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectHuePlusControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
HuePlusController* new_hueplus;
|
||||
RGBController_HuePlus* new_controller;
|
||||
|
||||
//Get file path in executable directory
|
||||
std::ifstream infile;
|
||||
char filename[2048];
|
||||
char arg1[64];
|
||||
|
||||
#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);
|
||||
strcpy(filename, std::string(filename).substr(0, std::string(filename).find_last_of("\\/")).c_str());
|
||||
#endif
|
||||
|
||||
strcat(filename, "/settings.txt");
|
||||
|
||||
//Open settings file
|
||||
infile.open(filename);
|
||||
|
||||
if (infile.good())
|
||||
{
|
||||
for (std::string line; std::getline(infile, line); )
|
||||
{
|
||||
if (line == "")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((line[0] != ';') && (line[0] != '#') && (line[0] != '/'))
|
||||
{
|
||||
char * argument;
|
||||
char * value;
|
||||
|
||||
value = (char *)line.c_str();
|
||||
|
||||
argument = strtok_s(value, "=", &value);
|
||||
|
||||
//Strip off new line characters if present
|
||||
argument = strtok(argument, "\r\n");
|
||||
value = strtok(value, "\r\n");
|
||||
|
||||
if(argument)
|
||||
{
|
||||
if (strcmp(argument, "hueplus") == 0)
|
||||
{
|
||||
new_hueplus = new HuePlusController();
|
||||
new_hueplus->Initialize(value);
|
||||
|
||||
new_controller = new RGBController_HuePlus(new_hueplus);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} /* DetectHuePlusControllers() */
|
||||
@@ -0,0 +1,102 @@
|
||||
/*-----------------------------------------*\
|
||||
| HyperXController.cpp |
|
||||
| |
|
||||
| Definitions and types for HyperX Predator|
|
||||
| RGB RAM lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/29/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "HyperXController.h"
|
||||
#include <cstring>
|
||||
|
||||
HyperXController::HyperXController(i2c_smbus_interface* bus, hyperx_dev_id dev)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
strcpy(device_name, "HyperX Predator RGB");
|
||||
led_count = 1;
|
||||
}
|
||||
|
||||
HyperXController::~HyperXController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
char* HyperXController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
unsigned int HyperXController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
|
||||
}
|
||||
|
||||
void HyperXController::SetLEDColor(unsigned int led, 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);
|
||||
|
||||
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)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case HYPERX_MODE_STATIC:
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_STATIC);
|
||||
break;
|
||||
|
||||
case HYPERX_MODE_RAINBOW:
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE1, HYPERX_MODE1_RAINBOW);
|
||||
break;
|
||||
|
||||
case HYPERX_MODE_COMET:
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_COMET);
|
||||
break;
|
||||
|
||||
case HYPERX_MODE_HEARTBEAT:
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_HEARTBEAT);
|
||||
break;
|
||||
|
||||
case HYPERX_MODE_CYCLE:
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE1, HYPERX_MODE1_CYCLE);
|
||||
break;
|
||||
|
||||
case HYPERX_MODE_BREATHING:
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_BREATHING);
|
||||
break;
|
||||
|
||||
case HYPERX_MODE_BOUNCE:
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_BOUNCE);
|
||||
break;
|
||||
|
||||
case HYPERX_MODE_BLINK:
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_BLINK);
|
||||
break;
|
||||
}
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*-----------------------------------------*\
|
||||
| HyperXController.h |
|
||||
| |
|
||||
| Definitions and types for HyperX Predator|
|
||||
| RGB RAM lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/29/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char hyperx_dev_id;
|
||||
typedef unsigned short hyperx_register;
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_REG_BRIGHTNESS = 0xDD, /* Brightness control register (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 */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_MODE1_RAINBOW = 0x05, /* Mode 1 rainbow effect */
|
||||
HYPERX_MODE1_CYCLE = 0x04, /* Mode 1 cycle effect */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_MODE2_BOUNCE = 0x02, /* Mode 2 bounce effect */
|
||||
HYPERX_MODE2_BREATHING = 0x03, /* Mode 2 breathing effect */
|
||||
HYPERX_MODE2_BLINK = 0x06, /* Mode 2 blink effect */
|
||||
HYPERX_MODE2_HEARTBEAT = 0x07, /* Mode 2 heartbeat effect */
|
||||
HYPERX_MODE2_COMET = 0x08, /* Mode 2 comet effect */
|
||||
HYPERX_MODE2_STATIC = 0x09, /* Mode 2 static effect */
|
||||
};
|
||||
|
||||
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_NUMBER_MODES /* Number of HyperX modes */
|
||||
};
|
||||
|
||||
|
||||
class HyperXController
|
||||
{
|
||||
public:
|
||||
HyperXController(i2c_smbus_interface* bus, hyperx_dev_id dev);
|
||||
~HyperXController();
|
||||
|
||||
char* GetDeviceName();
|
||||
unsigned int GetLEDCount();
|
||||
void SetMode(unsigned char mode);
|
||||
|
||||
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
private:
|
||||
char device_name[32];
|
||||
unsigned int led_count;
|
||||
i2c_smbus_interface* bus;
|
||||
hyperx_dev_id dev;
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
#include "HyperXController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_HyperX.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForHyperXController *
|
||||
* *
|
||||
* Tests the given address to see if a HyperX controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForHyperXController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
|
||||
|
||||
if (res >= 0)
|
||||
{
|
||||
pass = true;
|
||||
|
||||
for (int i = 0xA0; i < 0xB0; i++)
|
||||
{
|
||||
res = bus->i2c_smbus_read_byte_data(address, i);
|
||||
|
||||
if (res != i)
|
||||
{
|
||||
pass = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForHyperXController() */
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectHyperXControllers *
|
||||
* *
|
||||
* Detect HyperX controllers on the enumerated I2C busses. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where Aura device is connected *
|
||||
* dev - I2C address of Aura device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectHyperXControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
HyperXController* new_hyperx;
|
||||
RGBController_HyperX* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectHyperXControllers() */
|
||||
@@ -0,0 +1,147 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Processing Code for Generic LED Strip Interface |
|
||||
| |
|
||||
| Adam Honse ([email protected]), 12/11/2016 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "LEDStripController.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
LEDStripController::LEDStripController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
LEDStripController::~LEDStripController()
|
||||
{
|
||||
}
|
||||
|
||||
void LEDStripController::Initialize(char* ledstring)
|
||||
{
|
||||
LPSTR numleds = NULL;
|
||||
LPSTR source = NULL;
|
||||
LPSTR udpport_baud = NULL;
|
||||
LPSTR next = NULL;
|
||||
|
||||
//Assume serial device unless a different protocol is specified
|
||||
bool serial = TRUE;
|
||||
|
||||
source = strtok_s(ledstring, ",", &next);
|
||||
|
||||
//Check if we are setting up a Keyboard Visualizer UDP protocol device
|
||||
if (strncmp(source, "udp:", 4) == 0)
|
||||
{
|
||||
source = source + 4;
|
||||
serial = FALSE;
|
||||
}
|
||||
|
||||
//Check for either the UDP port or the serial baud rate
|
||||
if (strlen(next))
|
||||
{
|
||||
udpport_baud = strtok_s(next, ",", &next);
|
||||
}
|
||||
|
||||
//Check for the number of LEDs
|
||||
if (strlen(next))
|
||||
{
|
||||
numleds = strtok_s(next, ",", &next);
|
||||
}
|
||||
|
||||
if (serial)
|
||||
{
|
||||
if (udpport_baud == NULL)
|
||||
{
|
||||
//Initialize with default baud rate
|
||||
InitializeSerial(source, 115200);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Initialize with custom baud rate
|
||||
InitializeSerial(source, atoi(udpport_baud));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (udpport_baud == NULL)
|
||||
{
|
||||
//Do something
|
||||
}
|
||||
else
|
||||
{
|
||||
//Initialize UDP port
|
||||
InitializeUDP(source, udpport_baud);
|
||||
}
|
||||
}
|
||||
|
||||
if (numleds != NULL && strlen(numleds))
|
||||
{
|
||||
num_leds = atoi(numleds);
|
||||
}
|
||||
}
|
||||
|
||||
void LEDStripController::InitializeSerial(char* portname, int baud)
|
||||
{
|
||||
portname = strtok(portname, "\r");
|
||||
strcpy(port_name, portname);
|
||||
baud_rate = baud;
|
||||
serialport = new serial_port(port_name, baud_rate);
|
||||
udpport = NULL;
|
||||
}
|
||||
|
||||
void LEDStripController::InitializeUDP(char * clientname, char * port)
|
||||
{
|
||||
strcpy(client_name, clientname);
|
||||
strcpy(port_name, port);
|
||||
|
||||
udpport = new net_port(client_name, port_name);
|
||||
serialport = NULL;
|
||||
}
|
||||
|
||||
char* LEDStripController::GetLEDString()
|
||||
{
|
||||
return(led_string);
|
||||
}
|
||||
|
||||
void LEDStripController::SetLEDs(std::vector<RGBColor> colors)
|
||||
{
|
||||
unsigned char *serial_buf;
|
||||
|
||||
serial_buf = new unsigned char[(num_leds * 3) + 3];
|
||||
|
||||
serial_buf[0] = 0xAA;
|
||||
|
||||
for (int idx = 0; idx < (num_leds * 3); idx += 3)
|
||||
{
|
||||
int pixel_idx = idx / 3;
|
||||
RGBColor color = colors[pixel_idx];
|
||||
serial_buf[idx + 1] = RGBGetRValue(color);
|
||||
serial_buf[idx + 2] = RGBGetGValue(color);
|
||||
serial_buf[idx + 3] = RGBGetBValue(color);
|
||||
}
|
||||
|
||||
unsigned short sum = 0;
|
||||
|
||||
for (int i = 0; i < (num_leds * 3) + 1; i++)
|
||||
{
|
||||
sum += serial_buf[i];
|
||||
}
|
||||
|
||||
serial_buf[(num_leds * 3) + 1] = sum >> 8;
|
||||
serial_buf[(num_leds * 3) + 2] = sum & 0x00FF;
|
||||
|
||||
if (serialport != NULL)
|
||||
{
|
||||
serialport->serial_write((char *)serial_buf, (num_leds * 3) + 3);
|
||||
serialport->serial_flush_tx();
|
||||
}
|
||||
else if (udpport != NULL)
|
||||
{
|
||||
udpport->udp_write((char *)serial_buf, (num_leds * 3) + 3);
|
||||
}
|
||||
|
||||
delete[] serial_buf;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Definitions for Generic LED Strip Interface |
|
||||
| |
|
||||
| Adam Honse ([email protected]), 12/11/2016 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#ifndef LED_STRIP_H
|
||||
#define LED_STRIP_H
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "serial_port.h"
|
||||
#include "net_port.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE true
|
||||
#define FALSE false
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#define LPSTR char *
|
||||
#define strtok_s strtok_r
|
||||
#endif
|
||||
|
||||
class LEDStripController
|
||||
{
|
||||
public:
|
||||
LEDStripController();
|
||||
~LEDStripController();
|
||||
|
||||
void Initialize(char* ledstring);
|
||||
void InitializeSerial(char* portname, int baud);
|
||||
void InitializeUDP(char* clientname, char* port);
|
||||
char* GetLEDString();
|
||||
void SetLEDs(std::vector<RGBColor> colors);
|
||||
|
||||
int num_leds;
|
||||
|
||||
private:
|
||||
int baud_rate;
|
||||
|
||||
char led_string[1024];
|
||||
char port_name[128];
|
||||
char client_name[1024];
|
||||
serial_port *serialport;
|
||||
net_port *udpport;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,88 @@
|
||||
#include "LEDStripController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_LEDStrip.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectLEDStripControllers *
|
||||
* *
|
||||
* Detect devices supported by the LEDStrip driver *
|
||||
* * *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
LEDStripController* new_ledstrip;
|
||||
RGBController_LEDStrip* new_controller;
|
||||
|
||||
//Get file path in executable directory
|
||||
std::ifstream infile;
|
||||
char filename[2048];
|
||||
char arg1[64];
|
||||
|
||||
#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);
|
||||
strcpy(filename, std::string(filename).substr(0, std::string(filename).find_last_of("\\/")).c_str());
|
||||
strcat(filename, "/settings.txt");
|
||||
#endif
|
||||
|
||||
//Open settings file
|
||||
infile.open(filename);
|
||||
|
||||
if (infile.good())
|
||||
{
|
||||
for (std::string line; std::getline(infile, line); )
|
||||
{
|
||||
if (line == "")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((line[0] != ';') && (line[0] != '#') && (line[0] != '/'))
|
||||
{
|
||||
char * argument;
|
||||
char * value;
|
||||
|
||||
value = (char *)line.c_str();
|
||||
|
||||
argument = strtok_s(value, "=", &value);
|
||||
|
||||
//Strip off new line characters if present
|
||||
argument = strtok(argument, "\r\n");
|
||||
value = strtok(value, "\r\n");
|
||||
|
||||
if(argument)
|
||||
{
|
||||
if (strcmp(argument, "ledstrip") == 0)
|
||||
{
|
||||
new_ledstrip = new LEDStripController();
|
||||
new_ledstrip->Initialize(value);
|
||||
|
||||
new_controller = new RGBController_LEDStrip(new_ledstrip);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} /* DetectLEDStripControllers() */
|
||||
@@ -7,6 +7,8 @@
|
||||
\******************************************************************************************/
|
||||
|
||||
#include "AuraController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AorusGPU.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
@@ -14,29 +16,26 @@
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#include <tchar.h>
|
||||
#include <regex>
|
||||
#include "OpenAuraSDKDialog.h"
|
||||
#include "I2CDetectDialog.h"
|
||||
#include "i2c_smbus_piix4.h"
|
||||
#include "i2c_smbus_i801.h"
|
||||
#include "i2c_smbus_nuvoton_nct6793d.h"
|
||||
#include "i2c_smbus_nct6775.h"
|
||||
#include "wmi.h"
|
||||
#include "inpout32.h"
|
||||
|
||||
#pragma comment(lib, "inpout32.lib")
|
||||
#else /* WIN32 */
|
||||
|
||||
#include "OpenAuraSDKQtDialog.h"
|
||||
#include "i2c_smbus_linux.h"
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
std::vector<AuraController *> controllers;
|
||||
std::vector<i2c_smbus_interface *> busses;
|
||||
std::vector<i2c_smbus_interface*> busses;
|
||||
std::vector<RGBController*> rgb_controllers;
|
||||
|
||||
#ifdef WIN32
|
||||
/******************************************************************************************\
|
||||
@@ -49,7 +48,6 @@ std::vector<i2c_smbus_interface *> busses;
|
||||
#define SIO_NCT6102_ID 0x1060 /* Device ID for NCT6102D/6106D (1061) */
|
||||
#define SIO_NCT6793_ID 0xd120 /* Device ID for NCT6793D (D121) */
|
||||
#define SIO_NCT6796_ID 0xd420 /* Device ID for NCT6796D (D421) */
|
||||
#define SIO_NCT6798_ID 0xd428 /* Device ID for NCT6798D (D428) */
|
||||
#define SIO_REG_LOGDEV 0x07 /* Logical Device Register */
|
||||
#define SIO_REG_DEVID 0x20 /* Device ID Register */
|
||||
#define SIO_REG_SMBA 0x62 /* SMBus Base Address Register */
|
||||
@@ -125,15 +123,14 @@ void DetectNuvotonI2CBusses()
|
||||
case SIO_NCT6102_ID:
|
||||
case SIO_NCT6793_ID:
|
||||
case SIO_NCT6796_ID:
|
||||
case SIO_NCT6798_ID:
|
||||
bus = new i2c_smbus_nuvoton_nct6793d();
|
||||
bus = new i2c_smbus_nct6775();
|
||||
|
||||
// Set logical device register to get SMBus base address
|
||||
superio_outb(sioaddr, SIO_REG_LOGDEV, SIO_LOGDEV_SMBUS);
|
||||
|
||||
// Get SMBus base address from configuration register
|
||||
int smba = (superio_inb(sioaddr, SIO_REG_SMBA) << 8) | superio_inb(sioaddr, SIO_REG_SMBA + 1);
|
||||
((i2c_smbus_nuvoton_nct6793d*)bus)->nuvoton_nct6793d_smba = smba;
|
||||
((i2c_smbus_nct6775*)bus)->nct6775_smba = smba;
|
||||
|
||||
// Set device name string
|
||||
switch (val & SIO_ID_MASK)
|
||||
@@ -150,9 +147,6 @@ void DetectNuvotonI2CBusses()
|
||||
case SIO_NCT6796_ID:
|
||||
sprintf(bus->device_name, "Nuvoton NCT6796D SMBus at %X", smba);
|
||||
break;
|
||||
case SIO_NCT6798_ID:
|
||||
sprintf(bus->device_name, "Nuvoton NCT6798D SMBus at %X", smba);
|
||||
break;
|
||||
}
|
||||
|
||||
busses.push_back(bus);
|
||||
@@ -265,8 +259,8 @@ void DetectI2CBusses()
|
||||
struct dirent * ent;
|
||||
int test_fd;
|
||||
|
||||
// Start looking for I2C adapters in /sys/bus/i2c/devices/
|
||||
strcpy(driver_path, "/sys/bus/i2c/devices/");
|
||||
// Start looking for I2C adapters in /sys/class/i2c-adapter/
|
||||
strcpy(driver_path, "/sys/class/i2c-adapter/");
|
||||
dir = opendir(driver_path);
|
||||
|
||||
if(dir == NULL)
|
||||
@@ -325,119 +319,6 @@ void DetectI2CBusses()
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForAuraController *
|
||||
* *
|
||||
* Tests the given address to see if an Aura controller exists there. First does a *
|
||||
* quick write to test for a response, and if so does a simple read at 0xA0 to test *
|
||||
* for incrementing values 0...F which was observed at this location during data dump *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForAuraController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
|
||||
|
||||
if (res >= 0)
|
||||
{
|
||||
pass = true;
|
||||
|
||||
for (int i = 0xA0; i < 0xB0; i++)
|
||||
{
|
||||
res = bus->i2c_smbus_read_byte_data(address, i);
|
||||
|
||||
if (res != (i - 0xA0))
|
||||
{
|
||||
pass = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForAuraController() */
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectAuraControllers *
|
||||
* *
|
||||
* Detect Aura controllers on the enumerated I2C busses. Searches for Aura-enabled *
|
||||
* RAM at 0x77 and tries to initialize their slot addresses, then searches for them *
|
||||
* at their correct initialized addresses. Also looks for motherboard controller at *
|
||||
* address 0x4E. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where Aura device is connected *
|
||||
* dev - I2C address of Aura device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAuraControllers()
|
||||
{
|
||||
AuraController* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
// Remap Aura-enabled RAM modules on 0x77
|
||||
for (unsigned int slot = 0; slot < 8; slot++)
|
||||
{
|
||||
int res = busses[bus]->i2c_smbus_write_quick(0x77, I2C_SMBUS_WRITE);
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
AuraController temp_controller(busses[bus], 0x77);
|
||||
|
||||
temp_controller.AuraRegisterWrite(AURA_REG_SLOT_INDEX, slot);
|
||||
temp_controller.AuraRegisterWrite(AURA_REG_I2C_ADDRESS, 0xE0 + (slot << 1));
|
||||
}
|
||||
|
||||
// Add Aura-enabled controllers at their remapped addresses
|
||||
for (unsigned int slot = 0; slot < 8; slot++)
|
||||
{
|
||||
if (TestForAuraController(busses[bus], 0x70 + slot))
|
||||
{
|
||||
new_controller = new AuraController(busses[bus], 0x70 + slot);
|
||||
controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for Aura controller at 0x40
|
||||
if (TestForAuraController(busses[bus], 0x40))
|
||||
{
|
||||
new_controller = new AuraController(busses[bus], 0x40);
|
||||
controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Aura controller at 0x4E
|
||||
if (TestForAuraController(busses[bus], 0x4E))
|
||||
{
|
||||
new_controller = new AuraController(busses[bus], 0x4E);
|
||||
controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Aura controller at 0x4F
|
||||
if (TestForAuraController(busses[bus], 0x4F))
|
||||
{
|
||||
new_controller = new AuraController(busses[bus], 0x4F);
|
||||
controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
// Check for Aura controller at 0x66
|
||||
if (TestForAuraController(busses[bus], 0x66))
|
||||
{
|
||||
new_controller = new AuraController(busses[bus], 0x66);
|
||||
controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectAuraControllers() */
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
@@ -465,8 +346,6 @@ std::string DetectI2C(i2c_smbus_interface * bus, int mode)
|
||||
char line[128];
|
||||
std::string text;
|
||||
|
||||
freopen("i2cdetect.txt", "a", stdout);
|
||||
|
||||
sprintf(line, " 0 1 2 3 4 5 6 7 8 9 a b c d e f\r\n");
|
||||
text.append(line);
|
||||
|
||||
@@ -552,33 +431,44 @@ void DumpAuraRegisters(AuraController * controller)
|
||||
|
||||
} /* DumpAuraRegisters() */
|
||||
|
||||
void DetectAuraControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectCorsairControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectCorsairProControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectHyperXControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectRazerChromaSDKControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* main *
|
||||
* DetectRGBConrollers *
|
||||
* *
|
||||
* Main function. Detects busses and Aura controllers, then opens the main window *
|
||||
* Detect and populate RGB Controllers vector *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
void DetectRGBControllers(void)
|
||||
{
|
||||
DetectI2CBusses();
|
||||
|
||||
DetectAuraControllers();
|
||||
DetectAuraControllers(busses, rgb_controllers);
|
||||
DetectCorsairControllers(busses, rgb_controllers);
|
||||
DetectCorsairProControllers(busses, rgb_controllers);
|
||||
DetectHyperXControllers(busses, rgb_controllers);
|
||||
|
||||
#if WIN32
|
||||
OpenAuraSDKDialog dlg(busses, controllers);
|
||||
dlg.DoModal();
|
||||
|
||||
return 0;
|
||||
DetectLEDStripControllers(rgb_controllers);
|
||||
|
||||
#ifdef WIN32
|
||||
DetectRazerChromaSDKControllers(rgb_controllers);
|
||||
#else
|
||||
QApplication a(argc, argv);
|
||||
|
||||
Ui::OpenAuraSDKQtDialog dlg(busses, controllers);
|
||||
dlg.show();
|
||||
|
||||
return a.exec();
|
||||
DetectOpenRazerControllers(rgb_controllers);
|
||||
#endif
|
||||
|
||||
//This is for testing Aorus GPU
|
||||
#if 0
|
||||
RGBController_AorusGPU * aorus_rgb = new RGBController_AorusGPU();
|
||||
|
||||
rgb_controllers.push_back(aorus_rgb);
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -8,4 +8,5 @@
|
||||
#define MODE_FUNC 3
|
||||
|
||||
std::string DetectI2C(i2c_smbus_interface * bus, int mode);
|
||||
void DumpAuraRegisters(AuraController * controller);
|
||||
void DumpAuraRegisters(AuraController * controller);
|
||||
void DetectRGBControllers();
|
||||
@@ -0,0 +1,685 @@
|
||||
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
|
||||
index 09367fc014c3..25c0e02b3344 100644
|
||||
--- a/drivers/i2c/busses/Kconfig
|
||||
+++ b/drivers/i2c/busses/Kconfig
|
||||
@@ -216,6 +216,15 @@ config I2C_CHT_WC
|
||||
combined with a FUSB302 Type-C port-controller as such it is advised
|
||||
to also select CONFIG_TYPEC_FUSB302=m.
|
||||
|
||||
+config I2C_NCT6775
|
||||
+ tristate "Nuvoton NCT6775 and compatible SMBus controller"
|
||||
+ help
|
||||
+ If you say yes to this option, support will be included for the
|
||||
+ Nuvoton NCT6775 and compatible SMBus controllers.
|
||||
+
|
||||
+ This driver can also be built as a module. If so, the module
|
||||
+ will be called i2c-nct6775.
|
||||
+
|
||||
config I2C_NFORCE2
|
||||
tristate "Nvidia nForce2, nForce3 and nForce4"
|
||||
depends on PCI
|
||||
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
|
||||
index 80c23895eaaf..57a2daf0b94e 100644
|
||||
--- a/drivers/i2c/busses/Makefile
|
||||
+++ b/drivers/i2c/busses/Makefile
|
||||
@@ -17,6 +17,7 @@ obj-$(CONFIG_I2C_CHT_WC) += i2c-cht-wc.o
|
||||
obj-$(CONFIG_I2C_I801) += i2c-i801.o
|
||||
obj-$(CONFIG_I2C_ISCH) += i2c-isch.o
|
||||
obj-$(CONFIG_I2C_ISMT) += i2c-ismt.o
|
||||
+obj-$(CONFIG_I2C_NCT6775) += i2c-nct6775.o
|
||||
obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o
|
||||
obj-$(CONFIG_I2C_NFORCE2_S4985) += i2c-nforce2-s4985.o
|
||||
obj-$(CONFIG_I2C_NVIDIA_GPU) += i2c-nvidia-gpu.o
|
||||
diff --git a/drivers/i2c/busses/i2c-nct6775.c b/drivers/i2c/busses/i2c-nct6775.c
|
||||
new file mode 100644
|
||||
index 000000000000..e2b491a4b9f6
|
||||
--- /dev/null
|
||||
+++ b/drivers/i2c/busses/i2c-nct6775.c
|
||||
@@ -0,0 +1,617 @@
|
||||
+/*
|
||||
+ * i2c-nct6775 - Driver for the SMBus master functionality of
|
||||
+ * Nuvoton NCT677x Super-I/O chips
|
||||
+ *
|
||||
+ * Copyright (C) 2019 Adam Honse <[email protected]>
|
||||
+ *
|
||||
+ * Derived from nct6775 hwmon driver
|
||||
+ * Copyright (C) 2012 Guenter Roeck <[email protected]>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/jiffies.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/hwmon.h>
|
||||
+#include <linux/hwmon-sysfs.h>
|
||||
+#include <linux/hwmon-vid.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/mutex.h>
|
||||
+#include <linux/ioport.h>
|
||||
+#include <linux/i2c.h>
|
||||
+#include <linux/acpi.h>
|
||||
+#include <linux/bitops.h>
|
||||
+#include <linux/dmi.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/nospec.h>
|
||||
+
|
||||
+#define DRVNAME "i2c-nct6775"
|
||||
+
|
||||
+/* Nuvoton SMBus address offsets */
|
||||
+#define SMBHSTDAT (0 + nuvoton_nct6793d_smba)
|
||||
+#define SMBBLKSZ (1 + nuvoton_nct6793d_smba)
|
||||
+#define SMBHSTCMD (2 + nuvoton_nct6793d_smba)
|
||||
+#define SMBHSTIDX (3 + nuvoton_nct6793d_smba) //Index field is the Command field on other controllers
|
||||
+#define SMBHSTCTL (4 + nuvoton_nct6793d_smba)
|
||||
+#define SMBHSTADD (5 + nuvoton_nct6793d_smba)
|
||||
+#define SMBHSTERR (9 + nuvoton_nct6793d_smba)
|
||||
+#define SMBHSTSTS (0xE + nuvoton_nct6793d_smba)
|
||||
+
|
||||
+/* Command register */
|
||||
+#define NCT6793D_READ_BYTE 0
|
||||
+#define NCT6793D_READ_WORD 1
|
||||
+#define NCT6793D_READ_BLOCK 2
|
||||
+#define NCT6793D_BLOCK_WRITE_READ_PROC_CALL 3
|
||||
+#define NCT6793D_PROC_CALL 4
|
||||
+#define NCT6793D_WRITE_BYTE 8
|
||||
+#define NCT6793D_WRITE_WORD 9
|
||||
+#define NCT6793D_WRITE_BLOCK 10
|
||||
+
|
||||
+/* Control register */
|
||||
+#define NCT6793D_MANUAL_START 128
|
||||
+#define NCT6793D_SOFT_RESET 64
|
||||
+
|
||||
+/* Error register */
|
||||
+#define NCT6793D_NO_ACK 32
|
||||
+
|
||||
+/* Status register */
|
||||
+#define NCT6793D_FIFO_EMPTY 1
|
||||
+#define NCT6793D_FIFO_FULL 2
|
||||
+#define NCT6793D_MANUAL_ACTIVE 4
|
||||
+
|
||||
+#define NCT6775_LD_SMBUS 0x0B
|
||||
+
|
||||
+enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793,
|
||||
+ nct6795, nct6796, nct6798 };
|
||||
+
|
||||
+struct nct6775_sio_data {
|
||||
+ int sioreg;
|
||||
+ enum kinds kind;
|
||||
+};
|
||||
+
|
||||
+/* used to set data->name = nct6775_device_names[data->sio_kind] */
|
||||
+static const char * const nct6775_device_names[] = {
|
||||
+ "nct6106",
|
||||
+ "nct6775",
|
||||
+ "nct6776",
|
||||
+ "nct6779",
|
||||
+ "nct6791",
|
||||
+ "nct6792",
|
||||
+ "nct6793",
|
||||
+ "nct6795",
|
||||
+ "nct6796",
|
||||
+ "nct6798",
|
||||
+};
|
||||
+
|
||||
+static const char * const nct6775_sio_names[] __initconst = {
|
||||
+ "NCT6106D",
|
||||
+ "NCT6775F",
|
||||
+ "NCT6776D/F",
|
||||
+ "NCT6779D",
|
||||
+ "NCT6791D",
|
||||
+ "NCT6792D",
|
||||
+ "NCT6793D",
|
||||
+ "NCT6795D",
|
||||
+ "NCT6796D",
|
||||
+ "NCT6798D",
|
||||
+};
|
||||
+
|
||||
+#define SIO_REG_LDSEL 0x07 /* Logical device select */
|
||||
+#define SIO_REG_DEVID 0x20 /* Device ID (2 bytes) */
|
||||
+#define SIO_REG_SMBA 0x62 /* SMBus base address register */
|
||||
+
|
||||
+#define SIO_NCT6106_ID 0xc450
|
||||
+#define SIO_NCT6775_ID 0xb470
|
||||
+#define SIO_NCT6776_ID 0xc330
|
||||
+#define SIO_NCT6779_ID 0xc560
|
||||
+#define SIO_NCT6791_ID 0xc800
|
||||
+#define SIO_NCT6792_ID 0xc910
|
||||
+#define SIO_NCT6793_ID 0xd120
|
||||
+#define SIO_NCT6795_ID 0xd350
|
||||
+#define SIO_NCT6796_ID 0xd420
|
||||
+#define SIO_NCT6798_ID 0xd428
|
||||
+#define SIO_ID_MASK 0xFFF0
|
||||
+
|
||||
+static inline void
|
||||
+superio_outb(int ioreg, int reg, int val)
|
||||
+{
|
||||
+ outb(reg, ioreg);
|
||||
+ outb(val, ioreg + 1);
|
||||
+}
|
||||
+
|
||||
+static inline int
|
||||
+superio_inb(int ioreg, int reg)
|
||||
+{
|
||||
+ outb(reg, ioreg);
|
||||
+ return inb(ioreg + 1);
|
||||
+}
|
||||
+
|
||||
+static inline void
|
||||
+superio_select(int ioreg, int ld)
|
||||
+{
|
||||
+ outb(SIO_REG_LDSEL, ioreg);
|
||||
+ outb(ld, ioreg + 1);
|
||||
+}
|
||||
+
|
||||
+static inline int
|
||||
+superio_enter(int ioreg)
|
||||
+{
|
||||
+ /*
|
||||
+ * Try to reserve <ioreg> and <ioreg + 1> for exclusive access.
|
||||
+ */
|
||||
+ if (!request_muxed_region(ioreg, 2, DRVNAME))
|
||||
+ return -EBUSY;
|
||||
+
|
||||
+ outb(0x87, ioreg);
|
||||
+ outb(0x87, ioreg);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static inline void
|
||||
+superio_exit(int ioreg)
|
||||
+{
|
||||
+ outb(0xaa, ioreg);
|
||||
+ outb(0x02, ioreg);
|
||||
+ outb(0x02, ioreg + 1);
|
||||
+ release_region(ioreg, 2);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * ISA constants
|
||||
+ */
|
||||
+
|
||||
+#define IOREGION_ALIGNMENT (~7)
|
||||
+#define IOREGION_LENGTH 2
|
||||
+#define ADDR_REG_OFFSET 0
|
||||
+#define DATA_REG_OFFSET 1
|
||||
+
|
||||
+#define NCT6775_REG_BANK 0x4E
|
||||
+#define NCT6775_REG_CONFIG 0x40
|
||||
+
|
||||
+static struct i2c_adapter *nct6775_adapter;
|
||||
+
|
||||
+struct i2c_nct6775_adapdata {
|
||||
+ unsigned short smba;
|
||||
+};
|
||||
+
|
||||
+/* Return negative errno on error. */
|
||||
+static s32 nct6775_access(struct i2c_adapter * adap, u16 addr,
|
||||
+ unsigned short flags, char read_write,
|
||||
+ u8 command, int size, union i2c_smbus_data * data)
|
||||
+{
|
||||
+ struct i2c_nct6775_adapdata *adapdata = i2c_get_adapdata(adap);
|
||||
+ unsigned short nuvoton_nct6793d_smba = adapdata->smba;
|
||||
+ int i, len, cnt;
|
||||
+
|
||||
+ cnt = 0;
|
||||
+ len = 0;
|
||||
+
|
||||
+ outb_p(NCT6793D_SOFT_RESET, SMBHSTCTL);
|
||||
+
|
||||
+ switch (size) {
|
||||
+ case I2C_SMBUS_QUICK:
|
||||
+ outb_p((addr << 1) | read_write,
|
||||
+ SMBHSTADD);
|
||||
+ break;
|
||||
+ case I2C_SMBUS_BYTE:
|
||||
+ case I2C_SMBUS_BYTE_DATA:
|
||||
+ outb_p((addr << 1) | read_write,
|
||||
+ SMBHSTADD);
|
||||
+ outb_p(command, SMBHSTIDX);
|
||||
+ if (read_write == I2C_SMBUS_WRITE) {
|
||||
+ outb_p(data->byte, SMBHSTDAT);
|
||||
+ outb_p(NCT6793D_WRITE_BYTE, SMBHSTCMD);
|
||||
+ }
|
||||
+ else {
|
||||
+ outb_p(NCT6793D_READ_BYTE, SMBHSTCMD);
|
||||
+ }
|
||||
+ break;
|
||||
+ case I2C_SMBUS_WORD_DATA:
|
||||
+ outb_p((addr << 1) | read_write,
|
||||
+ SMBHSTADD);
|
||||
+ outb_p(command, SMBHSTIDX);
|
||||
+ if (read_write == I2C_SMBUS_WRITE) {
|
||||
+ outb_p(data->word & 0xff, SMBHSTDAT);
|
||||
+ outb_p((data->word & 0xff00) >> 8, SMBHSTDAT);
|
||||
+ outb_p(NCT6793D_WRITE_WORD, SMBHSTCMD);
|
||||
+ }
|
||||
+ else {
|
||||
+ outb_p(NCT6793D_READ_WORD, SMBHSTCMD);
|
||||
+ }
|
||||
+ break;
|
||||
+ case I2C_SMBUS_BLOCK_DATA:
|
||||
+ outb_p((addr << 1) | read_write,
|
||||
+ SMBHSTADD);
|
||||
+ outb_p(command, SMBHSTIDX);
|
||||
+ if (read_write == I2C_SMBUS_WRITE) {
|
||||
+ len = data->block[0];
|
||||
+ if (len == 0 || len > I2C_SMBUS_BLOCK_MAX)
|
||||
+ return -EINVAL;
|
||||
+ outb_p(len, SMBBLKSZ);
|
||||
+
|
||||
+ cnt = 1;
|
||||
+ if (len >= 4) {
|
||||
+ for (i = cnt; i <= 4; i++) {
|
||||
+ outb_p(data->block[i], SMBHSTDAT);
|
||||
+ }
|
||||
+
|
||||
+ len -= 4;
|
||||
+ cnt += 4;
|
||||
+ }
|
||||
+ else {
|
||||
+ for (i = cnt; i <= len; i++ ) {
|
||||
+ outb_p(data->block[i], SMBHSTDAT);
|
||||
+ }
|
||||
+
|
||||
+ len = 0;
|
||||
+ }
|
||||
+
|
||||
+ outb_p(NCT6793D_WRITE_BLOCK, SMBHSTCMD);
|
||||
+ }
|
||||
+ else {
|
||||
+ return -ENOTSUPP;
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
|
||||
+ return -EOPNOTSUPP;
|
||||
+ }
|
||||
+
|
||||
+ outb_p(NCT6793D_MANUAL_START, SMBHSTCTL);
|
||||
+
|
||||
+ while ((size == I2C_SMBUS_BLOCK_DATA) && (len > 0)) {
|
||||
+ if (read_write == I2C_SMBUS_WRITE) {
|
||||
+ while ((inb_p(SMBHSTSTS) & NCT6793D_FIFO_EMPTY) == 0);
|
||||
+
|
||||
+ //Load more bytes into FIFO
|
||||
+ if (len >= 4) {
|
||||
+ for (i = cnt; i <= (cnt + 4); i++) {
|
||||
+ outb_p(data->block[i], SMBHSTDAT);
|
||||
+ }
|
||||
+
|
||||
+ len -= 4;
|
||||
+ cnt += 4;
|
||||
+ }
|
||||
+ else {
|
||||
+ for (i = cnt; i <= (cnt + len); i++) {
|
||||
+ outb_p(data->block[i], SMBHSTDAT);
|
||||
+ }
|
||||
+
|
||||
+ len = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ //wait for manual mode to complete
|
||||
+ while ((inb_p(SMBHSTSTS) & NCT6793D_MANUAL_ACTIVE) != 0);
|
||||
+
|
||||
+ if ((inb_p(SMBHSTERR) & NCT6793D_NO_ACK) != 0) {
|
||||
+ return -ENXIO;
|
||||
+ }
|
||||
+ else if ((read_write == I2C_SMBUS_WRITE) || (size == I2C_SMBUS_QUICK)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ switch (size) {
|
||||
+ case I2C_SMBUS_QUICK:
|
||||
+ case I2C_SMBUS_BYTE_DATA:
|
||||
+ data->byte = inb_p(SMBHSTDAT);
|
||||
+ break;
|
||||
+ case I2C_SMBUS_WORD_DATA:
|
||||
+ data->word = inb_p(SMBHSTDAT) + (inb_p(SMBHSTDAT) << 8);
|
||||
+ break;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static u32 nct6775_func(struct i2c_adapter *adapter)
|
||||
+{
|
||||
+ return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
|
||||
+ I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
|
||||
+ I2C_FUNC_SMBUS_BLOCK_DATA;
|
||||
+}
|
||||
+
|
||||
+static const struct i2c_algorithm smbus_algorithm = {
|
||||
+ .smbus_xfer = nct6775_access,
|
||||
+ .functionality = nct6775_func,
|
||||
+};
|
||||
+
|
||||
+static int nct6775_add_adapter(unsigned short smba, const char *name, struct i2c_adapter **padap)
|
||||
+{
|
||||
+ struct i2c_adapter *adap;
|
||||
+ struct i2c_nct6775_adapdata *adapdata;
|
||||
+ int retval;
|
||||
+
|
||||
+ adap = kzalloc(sizeof(*adap), GFP_KERNEL);
|
||||
+ if (adap == NULL) {
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ adap->owner = THIS_MODULE;
|
||||
+ adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
|
||||
+ adap->algo = &smbus_algorithm;
|
||||
+
|
||||
+ adapdata = kzalloc(sizeof(*adapdata), GFP_KERNEL);
|
||||
+ if (adapdata == NULL) {
|
||||
+ kfree(adap);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ adapdata->smba = smba;
|
||||
+
|
||||
+ snprintf(adap->name, sizeof(adap->name),
|
||||
+ "SMBus NCT67xx adapter%s at %04x", name, smba);
|
||||
+
|
||||
+ i2c_set_adapdata(adap, adapdata);
|
||||
+
|
||||
+ retval = i2c_add_adapter(adap);
|
||||
+ if (retval) {
|
||||
+ kfree(adapdata);
|
||||
+ kfree(adap);
|
||||
+ return retval;
|
||||
+ }
|
||||
+
|
||||
+ *padap = adap;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void nct6775_remove_adapter(struct i2c_adapter *adap)
|
||||
+{
|
||||
+ struct i2c_nct6775_adapdata *adapdata = i2c_get_adapdata(adap);
|
||||
+
|
||||
+ if (adapdata->smba) {
|
||||
+ i2c_del_adapter(adap);
|
||||
+ kfree(adapdata);
|
||||
+ kfree(adap);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+//static SIMPLE_DEV_PM_OPS(nct6775_dev_pm_ops, nct6775_suspend, nct6775_resume);
|
||||
+
|
||||
+/*
|
||||
+ * when Super-I/O functions move to a separate file, the Super-I/O
|
||||
+ * bus will manage the lifetime of the device and this module will only keep
|
||||
+ * track of the nct6775 driver. But since we use platform_device_alloc(), we
|
||||
+ * must keep track of the device
|
||||
+ */
|
||||
+static struct platform_device *pdev[2];
|
||||
+
|
||||
+static int nct6775_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct nct6775_sio_data *sio_data = dev_get_platdata(dev);
|
||||
+ struct resource *res;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_IO, 0);
|
||||
+ if (!devm_request_region(&pdev->dev, res->start, IOREGION_LENGTH,
|
||||
+ DRVNAME))
|
||||
+ return -EBUSY;
|
||||
+
|
||||
+ switch (sio_data->kind) {
|
||||
+ case nct6791:
|
||||
+ case nct6792:
|
||||
+ case nct6793:
|
||||
+ case nct6795:
|
||||
+ case nct6796:
|
||||
+ case nct6798:
|
||||
+ nct6775_add_adapter(res->start, "", &nct6775_adapter);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+/*
|
||||
+static void nct6791_enable_io_mapping(int sioaddr)
|
||||
+{
|
||||
+ int val;
|
||||
+
|
||||
+ val = superio_inb(sioaddr, NCT6791_REG_HM_IO_SPACE_LOCK_ENABLE);
|
||||
+ if (val & 0x10) {
|
||||
+ pr_info("Enabling hardware monitor logical device mappings.\n");
|
||||
+ superio_outb(sioaddr, NCT6791_REG_HM_IO_SPACE_LOCK_ENABLE,
|
||||
+ val & ~0x10);
|
||||
+ }
|
||||
+}*/
|
||||
+
|
||||
+static struct platform_driver i2c_nct6775_driver = {
|
||||
+ .driver = {
|
||||
+ .name = DRVNAME,
|
||||
+// .pm = &nct6775_dev_pm_ops,
|
||||
+ },
|
||||
+ .probe = nct6775_probe,
|
||||
+};
|
||||
+
|
||||
+static void __exit i2c_nct6775_exit(void)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ if(nct6775_adapter)
|
||||
+ nct6775_remove_adapter(nct6775_adapter);
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(pdev); i++) {
|
||||
+ if (pdev[i])
|
||||
+ platform_device_unregister(pdev[i]);
|
||||
+ }
|
||||
+ platform_driver_unregister(&i2c_nct6775_driver);
|
||||
+}
|
||||
+
|
||||
+/* nct6775_find() looks for a '627 in the Super-I/O config space */
|
||||
+static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data)
|
||||
+{
|
||||
+ u16 val;
|
||||
+ int err;
|
||||
+ int addr;
|
||||
+
|
||||
+ err = superio_enter(sioaddr);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8) |
|
||||
+ superio_inb(sioaddr, SIO_REG_DEVID + 1);
|
||||
+
|
||||
+ switch (val & SIO_ID_MASK) {
|
||||
+ case SIO_NCT6106_ID:
|
||||
+ sio_data->kind = nct6106;
|
||||
+ break;
|
||||
+ case SIO_NCT6775_ID:
|
||||
+ sio_data->kind = nct6775;
|
||||
+ break;
|
||||
+ case SIO_NCT6776_ID:
|
||||
+ sio_data->kind = nct6776;
|
||||
+ break;
|
||||
+ case SIO_NCT6779_ID:
|
||||
+ sio_data->kind = nct6779;
|
||||
+ break;
|
||||
+ case SIO_NCT6791_ID:
|
||||
+ sio_data->kind = nct6791;
|
||||
+ break;
|
||||
+ case SIO_NCT6792_ID:
|
||||
+ sio_data->kind = nct6792;
|
||||
+ break;
|
||||
+ case SIO_NCT6793_ID:
|
||||
+ sio_data->kind = nct6793;
|
||||
+ break;
|
||||
+ case SIO_NCT6795_ID:
|
||||
+ sio_data->kind = nct6795;
|
||||
+ break;
|
||||
+ case SIO_NCT6796_ID:
|
||||
+ sio_data->kind = nct6796;
|
||||
+ break;
|
||||
+ case SIO_NCT6798_ID:
|
||||
+ sio_data->kind = nct6798;
|
||||
+ break;
|
||||
+ default:
|
||||
+ if (val != 0xffff)
|
||||
+ pr_debug("unsupported chip ID: 0x%04x\n", val);
|
||||
+ superio_exit(sioaddr);
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ /* We have a known chip, find the SMBus I/O address */
|
||||
+ superio_select(sioaddr, NCT6775_LD_SMBUS);
|
||||
+ val = (superio_inb(sioaddr, SIO_REG_SMBA) << 8)
|
||||
+ | superio_inb(sioaddr, SIO_REG_SMBA + 1);
|
||||
+ addr = val & IOREGION_ALIGNMENT;
|
||||
+ if (addr == 0) {
|
||||
+ pr_err("Refusing to enable a Super-I/O device with a base I/O port 0\n");
|
||||
+ superio_exit(sioaddr);
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ //if (sio_data->kind == nct6791 || sio_data->kind == nct6792 ||
|
||||
+ // sio_data->kind == nct6793 || sio_data->kind == nct6795 ||
|
||||
+ // sio_data->kind == nct6796)
|
||||
+ // nct6791_enable_io_mapping(sioaddr);
|
||||
+
|
||||
+ superio_exit(sioaddr);
|
||||
+ pr_info("Found %s or compatible chip at %#x:%#x\n",
|
||||
+ nct6775_sio_names[sio_data->kind], sioaddr, addr);
|
||||
+ sio_data->sioreg = sioaddr;
|
||||
+
|
||||
+ return addr;
|
||||
+}
|
||||
+
|
||||
+static int __init i2c_nct6775_init(void)
|
||||
+{
|
||||
+ int i, err;
|
||||
+ bool found = false;
|
||||
+ int address;
|
||||
+ struct resource res;
|
||||
+ struct nct6775_sio_data sio_data;
|
||||
+ int sioaddr[2] = { 0x2e, 0x4e };
|
||||
+
|
||||
+ err = platform_driver_register(&i2c_nct6775_driver);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ /*
|
||||
+ * initialize sio_data->kind and sio_data->sioreg.
|
||||
+ *
|
||||
+ * when Super-I/O functions move to a separate file, the Super-I/O
|
||||
+ * driver will probe 0x2e and 0x4e and auto-detect the presence of a
|
||||
+ * nct6775 hardware monitor, and call probe()
|
||||
+ */
|
||||
+ for (i = 0; i < ARRAY_SIZE(pdev); i++) {
|
||||
+ address = nct6775_find(sioaddr[i], &sio_data);
|
||||
+ if (address <= 0)
|
||||
+ continue;
|
||||
+
|
||||
+ found = true;
|
||||
+
|
||||
+ pdev[i] = platform_device_alloc(DRVNAME, address);
|
||||
+ if (!pdev[i]) {
|
||||
+ err = -ENOMEM;
|
||||
+ goto exit_device_unregister;
|
||||
+ }
|
||||
+
|
||||
+ err = platform_device_add_data(pdev[i], &sio_data,
|
||||
+ sizeof(struct nct6775_sio_data));
|
||||
+ if (err)
|
||||
+ goto exit_device_put;
|
||||
+
|
||||
+ memset(&res, 0, sizeof(res));
|
||||
+ res.name = DRVNAME;
|
||||
+ res.start = address;
|
||||
+ res.end = address + IOREGION_LENGTH - 1;
|
||||
+ res.flags = IORESOURCE_IO;
|
||||
+
|
||||
+ err = acpi_check_resource_conflict(&res);
|
||||
+ if (err) {
|
||||
+ platform_device_put(pdev[i]);
|
||||
+ pdev[i] = NULL;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ err = platform_device_add_resources(pdev[i], &res, 1);
|
||||
+ if (err)
|
||||
+ goto exit_device_put;
|
||||
+
|
||||
+ /* platform_device_add calls probe() */
|
||||
+ err = platform_device_add(pdev[i]);
|
||||
+ if (err)
|
||||
+ goto exit_device_put;
|
||||
+ }
|
||||
+ if (!found) {
|
||||
+ err = -ENODEV;
|
||||
+ goto exit_unregister;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+exit_device_put:
|
||||
+ platform_device_put(pdev[i]);
|
||||
+exit_device_unregister:
|
||||
+ while (--i >= 0) {
|
||||
+ if (pdev[i])
|
||||
+ platform_device_unregister(pdev[i]);
|
||||
+ }
|
||||
+exit_unregister:
|
||||
+ platform_driver_unregister(&i2c_nct6775_driver);
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+MODULE_AUTHOR("Adam Honse <[email protected]>");
|
||||
+MODULE_DESCRIPTION("SMBus driver for NCT6775F and compatible chips");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+
|
||||
+module_init(i2c_nct6775_init);
|
||||
+module_exit(i2c_nct6775_exit);
|
||||
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
|
||||
index c46c4bddc7ca..8565d08178a2 100644
|
||||
--- a/drivers/i2c/busses/i2c-piix4.c
|
||||
+++ b/drivers/i2c/busses/i2c-piix4.c
|
||||
@@ -468,11 +468,11 @@ static int piix4_transaction(struct i2c_adapter *piix4_adapter)
|
||||
if (srvrworks_csb5_delay) /* Extra delay for SERVERWORKS_CSB5 */
|
||||
usleep_range(2000, 2100);
|
||||
else
|
||||
- usleep_range(250, 500);
|
||||
+ usleep_range(25, 50);
|
||||
|
||||
while ((++timeout < MAX_TIMEOUT) &&
|
||||
((temp = inb_p(SMBHSTSTS)) & 0x01))
|
||||
- usleep_range(250, 500);
|
||||
+ usleep_range(25, 50);
|
||||
|
||||
/* If the SMBus is still busy, we give up */
|
||||
if (timeout == MAX_TIMEOUT) {
|
||||
@@ -963,6 +963,11 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
retval = piix4_setup_sb800(dev, id, 1);
|
||||
}
|
||||
|
||||
+ if (dev->vendor == PCI_VENDOR_ID_AMD &&
|
||||
+ dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS) {
|
||||
+ retval = piix4_setup_sb800(dev, id, 1);
|
||||
+ }
|
||||
+
|
||||
if (retval > 0) {
|
||||
/* Try to add the aux adapter if it exists,
|
||||
* piix4_add_adapter will clean up if this fails */
|
||||
+60
-11
@@ -5,18 +5,67 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
TARGET = OpenAuraSDK.bin
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += \
|
||||
OpenAuraSDK/i2c_smbus.cpp \
|
||||
OpenAuraSDK/AuraController.cpp \
|
||||
OpenAuraSDK/OpenAuraSDK.cpp \
|
||||
OpenAuraSDK/i2c_smbus_linux.cpp \
|
||||
OpenAuraSDK/OpenAuraSDKQtDialog.cpp
|
||||
INCLUDEPATH += \
|
||||
i2c_smbus/ \
|
||||
net_port/ \
|
||||
serial_port/ \
|
||||
Controllers/AuraController/ \
|
||||
Controllers/CorsairController/ \
|
||||
Controllers/CorsairProController/ \
|
||||
Controllers/HuePlusController/ \
|
||||
Controllers/HyperXController/ \
|
||||
Controllers/LEDStripController/ \
|
||||
RGBController/ \
|
||||
qt/
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
OpenAuraSDK.cpp \
|
||||
qt/OpenAuraSDKQtDialog.cpp \
|
||||
i2c_smbus/i2c_smbus.cpp \
|
||||
i2c_smbus/i2c_smbus_linux.cpp \
|
||||
net_port/net_port.cpp \
|
||||
serial_port/serial_port.cpp \
|
||||
Controllers/AuraController/AuraController.cpp \
|
||||
Controllers/AuraController/AuraControllerDetect.cpp \
|
||||
Controllers/CorsairController/CorsairController.cpp \
|
||||
Controllers/CorsairController/CorsairControllerDetect.cpp \
|
||||
Controllers/CorsairProController/CorsairProController.cpp \
|
||||
Controllers/CorsairProController/CorsairProControllerDetect.cpp \
|
||||
Controllers/HuePlusController/HuePlusController.cpp \
|
||||
Controllers/HuePlusController/HuePlusControllerDetect.cpp \
|
||||
Controllers/HyperXController/HyperXController.cpp \
|
||||
Controllers/HyperXController/HyperXControllerDetect.cpp \
|
||||
Controllers/LEDStripController/LEDStripController.cpp \
|
||||
Controllers/LEDStripController/LEDStripControllerDetect.cpp \
|
||||
RGBController/OpenRazerDetect.cpp \
|
||||
RGBController/RGBController_Aura.cpp \
|
||||
RGBController/RGBController_Corsair.cpp \
|
||||
RGBController/RGBController_CorsairPro.cpp \
|
||||
RGBController/RGBController_HuePlus.cpp \
|
||||
RGBController/RGBController_HyperX.cpp \
|
||||
RGBController/RGBController_LEDStrip.cpp \
|
||||
RGBController/RGBController_OpenRazer.cpp
|
||||
|
||||
HEADERS += \
|
||||
OpenAuraSDK/i2c_smbus.h \
|
||||
OpenAuraSDK/i2c_smbus_linux.h \
|
||||
OpenAuraSDK/AuraController.h \
|
||||
OpenAuraSDK/OpenAuraSDKQtDialog.h
|
||||
qt/OpenAuraSDKQtDialog.h \
|
||||
i2c_smbus/i2c_smbus.h \
|
||||
i2c_smbus/i2c_smbus_linux.h \
|
||||
net_port/net_port.h \
|
||||
serial_port/serial_port.h \
|
||||
Controllers/AuraController/AuraController.h \
|
||||
Controllers/CorsairController/CorsairController.h \
|
||||
Controllers/CorsairProController/CorsairProController.h \
|
||||
Controllers/HuePlusController/HuePlusController.h \
|
||||
Controllers/HyperXController/HyperXController.h \
|
||||
Controllers/LEDStripController/LEDStripController.h \
|
||||
RGBController/RGBController.h \
|
||||
RGBController/RGBController_Aura.h \
|
||||
RGBController/RGBController_Corsair.h \
|
||||
RGBController/RGBController_CorsairPro.h \
|
||||
RGBController/RGBController_HuePlus.h \
|
||||
RGBController/RGBController_HyperX.h \
|
||||
RGBController/RGBController_OpenRazer.h
|
||||
|
||||
FORMS += \
|
||||
OpenAuraSDK/openaurasdk.ui
|
||||
qt/openaurasdk.ui
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27703.2026
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28803.452
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenAuraSDK", "OpenAuraSDK\OpenAuraSDK.vcxproj", "{6D22BFF3-C1DF-407A-8816-05D63919A991}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenAuraSDK", "OpenAuraSDK.vcxproj", "{6D22BFF3-C1DF-407A-8816-05D63919A991}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
@@ -96,18 +96,18 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32_LEAN_AND_MEAN</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\dependencies\inpout32_1501\Win32;.\dependencies\razer-chroma-2.9.0\inc;.\Controllers\AuraController;.\Controllers\CorsairController;.\Controllers\CorsairProController;.\Controllers\HuePlusController;.\Controllers\HyperXController;.\Controllers\LEDStripController;.\RGBController;.\i2c_smbus;.\net_port;.\serial_port;.\vc;.\wmi;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<PrecompiledHeaderFile />
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>.\dependencies\inpout32_1501\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
@@ -116,17 +116,18 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32_LEAN_AND_MEAN</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeaderFile />
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<AdditionalIncludeDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\dependencies\inpout32_1501\Win32;.\dependencies\razer-chroma-2.9.0\inc;.\Controllers\AuraController;.\Controllers\CorsairController;.\Controllers\CorsairProController;.\Controllers\HuePlusController;.\Controllers\HyperXController;.\Controllers\LEDStripController;.\RGBController;.\i2c_smbus;.\net_port;.\serial_port;.\vc;.\wmi;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>.\dependencies\inpout32_1501\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
@@ -137,20 +138,20 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32_LEAN_AND_MEAN</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\dependencies\inpout32_1501\Win32;.\dependencies\razer-chroma-2.9.0\inc;.\Controllers\AuraController;.\Controllers\CorsairController;.\Controllers\CorsairProController;.\Controllers\HuePlusController;.\Controllers\HyperXController;.\Controllers\LEDStripController;.\RGBController;.\i2c_smbus;.\net_port;.\serial_port;.\vc;.\wmi;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<PrecompiledHeaderFile />
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>.\dependencies\inpout32_1501\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
@@ -161,47 +162,86 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32_LEAN_AND_MEAN</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeaderFile />
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<AdditionalIncludeDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\dependencies\inpout32_1501\Win32;.\dependencies\razer-chroma-2.9.0\inc;.\Controllers\AuraController;.\Controllers\CorsairController;.\Controllers\CorsairProController;.\Controllers\HuePlusController;.\Controllers\HyperXController;.\Controllers\LEDStripController;.\RGBController;.\i2c_smbus;.\net_port;.\serial_port;.\vc;.\wmi;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>.\dependencies\inpout32_1501\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AuraController.h" />
|
||||
<ClInclude Include="I2CDetectDialog.h" />
|
||||
<ClInclude Include="i2c_smbus.h" />
|
||||
<ClInclude Include="i2c_smbus_i801.h" />
|
||||
<ClInclude Include="i2c_smbus_nuvoton_nct6793d.h" />
|
||||
<ClInclude Include="i2c_smbus_piix4.h" />
|
||||
<ClInclude Include="OpenAuraSDK.h" />
|
||||
<ClInclude Include="OpenAuraSDKDialog.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="wmi.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AuraController.cpp" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="I2CDetectDialog.cpp" />
|
||||
<ClCompile Include="i2c_smbus.cpp" />
|
||||
<ClCompile Include="i2c_smbus_i801.cpp" />
|
||||
<ClCompile Include="i2c_smbus_nuvoton_nct6793d.cpp" />
|
||||
<ClCompile Include="i2c_smbus_piix4.cpp" />
|
||||
<ClCompile Include="OpenAuraSDKDialog.cpp" />
|
||||
<ClCompile Include="wmi.cpp" />
|
||||
<ClCompile Include="Controllers\AuraController\AuraController.cpp" />
|
||||
<ClCompile Include="Controllers\AuraController\AuraControllerDetect.cpp" />
|
||||
<ClCompile Include="Controllers\CorsairController\CorsairController.cpp" />
|
||||
<ClCompile Include="Controllers\CorsairController\CorsairControllerDetect.cpp" />
|
||||
<ClCompile Include="Controllers\CorsairProController\CorsairProController.cpp" />
|
||||
<ClCompile Include="Controllers\CorsairProController\CorsairProControllerDetect.cpp" />
|
||||
<ClCompile Include="Controllers\HuePlusController\HuePlusController.cpp" />
|
||||
<ClCompile Include="Controllers\HuePlusController\HuePlusControllerDetect.cpp" />
|
||||
<ClCompile Include="Controllers\HyperXController\HyperXController.cpp" />
|
||||
<ClCompile Include="Controllers\HyperXController\HyperXControllerDetect.cpp" />
|
||||
<ClCompile Include="Controllers\LEDStripController\LEDStripController.cpp" />
|
||||
<ClCompile Include="Controllers\LEDStripController\LEDStripControllerDetect.cpp" />
|
||||
<ClCompile Include="i2c_smbus\i2c_smbus.cpp" />
|
||||
<ClCompile Include="i2c_smbus\i2c_smbus_i801.cpp" />
|
||||
<ClCompile Include="i2c_smbus\i2c_smbus_nct6775.cpp" />
|
||||
<ClCompile Include="i2c_smbus\i2c_smbus_piix4.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="net_port\net_port.cpp" />
|
||||
<ClCompile Include="OpenAuraSDK.cpp" />
|
||||
<ClCompile Include="RGBController\RazerChromaSDKDetect.cpp" />
|
||||
<ClCompile Include="RGBController\RGBController_AorusGPU.cpp" />
|
||||
<ClCompile Include="RGBController\RGBController_Aura.cpp" />
|
||||
<ClCompile Include="RGBController\RGBController_Corsair.cpp" />
|
||||
<ClCompile Include="RGBController\RGBController_CorsairPro.cpp" />
|
||||
<ClCompile Include="RGBController\RGBController_HuePlus.cpp" />
|
||||
<ClCompile Include="RGBController\RGBController_HyperX.cpp" />
|
||||
<ClCompile Include="RGBController\RGBController_LEDStrip.cpp" />
|
||||
<ClCompile Include="RGBController\RGBController_RazerChromaSDK.cpp" />
|
||||
<ClCompile Include="serial_port\serial_port.cpp" />
|
||||
<ClCompile Include="vc\I2CDetectDialog.cpp" />
|
||||
<ClCompile Include="vc\OpenAuraSDKDialog.cpp" />
|
||||
<ClCompile Include="wmi\wmi.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resource.rc" />
|
||||
<ResourceCompile Include="vc\Resource.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Controllers\AuraController\AuraController.h" />
|
||||
<ClInclude Include="Controllers\CorsairController\CorsairController.h" />
|
||||
<ClInclude Include="Controllers\CorsairProController\CorsairProController.h" />
|
||||
<ClInclude Include="Controllers\HuePlusController\HuePlusController.h" />
|
||||
<ClInclude Include="Controllers\HyperXController\HyperXController.h" />
|
||||
<ClInclude Include="Controllers\LEDStripController\LEDStripController.h" />
|
||||
<ClInclude Include="i2c_smbus\i2c_smbus.h" />
|
||||
<ClInclude Include="i2c_smbus\i2c_smbus_i801.h" />
|
||||
<ClInclude Include="i2c_smbus\i2c_smbus_nct6775.h" />
|
||||
<ClInclude Include="i2c_smbus\i2c_smbus_piix4.h" />
|
||||
<ClInclude Include="net_port\net_port.h" />
|
||||
<ClInclude Include="OpenAuraSDK.h" />
|
||||
<ClInclude Include="RGBController\RGBController.h" />
|
||||
<ClInclude Include="RGBController\RGBController_AorusGPU.h" />
|
||||
<ClInclude Include="RGBController\RGBController_Aura.h" />
|
||||
<ClInclude Include="RGBController\RGBController_Corsair.h" />
|
||||
<ClInclude Include="RGBController\RGBController_CorsairPro.h" />
|
||||
<ClInclude Include="RGBController\RGBController_HuePlus.h" />
|
||||
<ClInclude Include="RGBController\RGBController_HyperX.h" />
|
||||
<ClInclude Include="RGBController\RGBController_LEDStrip.h" />
|
||||
<ClInclude Include="RGBController\RGBController_RazerChromaSDK.h" />
|
||||
<ClInclude Include="serial_port\serial_port.h" />
|
||||
<ClInclude Include="vc\I2CDetectDialog.h" />
|
||||
<ClInclude Include="vc\OpenAuraSDKDialog.h" />
|
||||
<ClInclude Include="vc\resource.h" />
|
||||
<ClInclude Include="wmi\wmi.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
@@ -0,0 +1,221 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Controllers">
|
||||
<UniqueIdentifier>{192d5e34-581a-40c4-bc69-f4b61632fd81}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Application">
|
||||
<UniqueIdentifier>{d64d74dd-f822-4617-a88c-00dca03f70d9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\RGBController">
|
||||
<UniqueIdentifier>{ee7c811d-9bd1-43a8-9d42-62801332ab30}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\i2c_smbus">
|
||||
<UniqueIdentifier>{fa28cfae-d8a7-4194-8f25-e35827dd0145}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Controllers">
|
||||
<UniqueIdentifier>{a50a158e-81a1-45c3-a300-67e869afcc2f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\i2c_smbus">
|
||||
<UniqueIdentifier>{8eae9b90-7558-4b0b-9f03-d3a651cb6624}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\RGBController">
|
||||
<UniqueIdentifier>{02dd848e-6106-4f74-a58c-4a7547498ac3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="OpenAuraSDK.cpp">
|
||||
<Filter>Source Files\Application</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files\Application</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wmi\wmi.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="serial_port\serial_port.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controllers\AuraController\AuraController.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controllers\AuraController\AuraControllerDetect.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controllers\CorsairController\CorsairController.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controllers\CorsairController\CorsairControllerDetect.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controllers\CorsairProController\CorsairProController.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controllers\CorsairProController\CorsairProControllerDetect.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controllers\HyperXController\HyperXController.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controllers\HyperXController\HyperXControllerDetect.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="i2c_smbus\i2c_smbus.cpp">
|
||||
<Filter>Source Files\i2c_smbus</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="i2c_smbus\i2c_smbus_i801.cpp">
|
||||
<Filter>Source Files\i2c_smbus</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="i2c_smbus\i2c_smbus_nct6775.cpp">
|
||||
<Filter>Source Files\i2c_smbus</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="i2c_smbus\i2c_smbus_piix4.cpp">
|
||||
<Filter>Source Files\i2c_smbus</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RGBController\RGBController_AorusGPU.cpp">
|
||||
<Filter>Source Files\RGBController</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RGBController\RGBController_Aura.cpp">
|
||||
<Filter>Source Files\RGBController</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RGBController\RGBController_Corsair.cpp">
|
||||
<Filter>Source Files\RGBController</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RGBController\RGBController_CorsairPro.cpp">
|
||||
<Filter>Source Files\RGBController</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RGBController\RGBController_HyperX.cpp">
|
||||
<Filter>Source Files\RGBController</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RGBController\RGBController_LEDStrip.cpp">
|
||||
<Filter>Source Files\RGBController</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vc\I2CDetectDialog.cpp">
|
||||
<Filter>Source Files\Application</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controllers\LEDStripController\LEDStripController.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controllers\LEDStripController\LEDStripControllerDetect.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vc\OpenAuraSDKDialog.cpp">
|
||||
<Filter>Source Files\Application</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controllers\HuePlusController\HuePlusController.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controllers\HuePlusController\HuePlusControllerDetect.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="net_port\net_port.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RGBController\RGBController_HuePlus.cpp">
|
||||
<Filter>Source Files\RGBController</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RGBController\RGBController_RazerChromaSDK.cpp">
|
||||
<Filter>Source Files\RGBController</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RGBController\RazerChromaSDKDetect.cpp">
|
||||
<Filter>Source Files\RGBController</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="vc\Resource.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="wmi\wmi.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="serial_port\serial_port.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Controllers\AuraController\AuraController.h">
|
||||
<Filter>Header Files\Controllers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Controllers\CorsairController\CorsairController.h">
|
||||
<Filter>Header Files\Controllers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Controllers\CorsairProController\CorsairProController.h">
|
||||
<Filter>Header Files\Controllers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Controllers\HyperXController\HyperXController.h">
|
||||
<Filter>Header Files\Controllers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Controllers\LEDStripController\LEDStripController.h">
|
||||
<Filter>Header Files\Controllers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RGBController\RGBController.h">
|
||||
<Filter>Header Files\RGBController</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RGBController\RGBController_AorusGPU.h">
|
||||
<Filter>Header Files\RGBController</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RGBController\RGBController_Aura.h">
|
||||
<Filter>Header Files\RGBController</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RGBController\RGBController_Corsair.h">
|
||||
<Filter>Header Files\RGBController</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RGBController\RGBController_CorsairPro.h">
|
||||
<Filter>Header Files\RGBController</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RGBController\RGBController_HyperX.h">
|
||||
<Filter>Header Files\RGBController</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RGBController\RGBController_LEDStrip.h">
|
||||
<Filter>Header Files\RGBController</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="i2c_smbus\i2c_smbus.h">
|
||||
<Filter>Header Files\i2c_smbus</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="i2c_smbus\i2c_smbus_i801.h">
|
||||
<Filter>Header Files\i2c_smbus</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="i2c_smbus\i2c_smbus_nct6775.h">
|
||||
<Filter>Header Files\i2c_smbus</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="i2c_smbus\i2c_smbus_piix4.h">
|
||||
<Filter>Header Files\i2c_smbus</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vc\I2CDetectDialog.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenAuraSDK.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vc\OpenAuraSDKDialog.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vc\resource.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Controllers\HuePlusController\HuePlusController.h">
|
||||
<Filter>Header Files\Controllers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="net_port\net_port.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RGBController\RGBController_HuePlus.h">
|
||||
<Filter>Header Files\RGBController</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RGBController\RGBController_RazerChromaSDK.h">
|
||||
<Filter>Header Files\RGBController</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,86 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="i2c_smbus.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="i2c_smbus_piix4.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AuraController.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="i2c_smbus_i801.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wmi.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenAuraSDKDialog.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenAuraSDK.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="I2CDetectDialog.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="i2c_smbus_nuvoton_nct6793d.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="OpenAuraSDK.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="i2c_smbus_piix4.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AuraController.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="i2c_smbus_i801.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="i2c_smbus.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wmi.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenAuraSDKDialog.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="I2CDetectDialog.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="i2c_smbus_nuvoton_nct6793d.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resource.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,441 +0,0 @@
|
||||
#include "OpenAuraSDKDialog.h"
|
||||
#include "OpenAuraSDK.h"
|
||||
#include "I2CDetectDialog.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC(OpenAuraSDKDialog, CDialogEx)
|
||||
|
||||
OpenAuraSDKDialog::OpenAuraSDKDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<AuraController *>& control, CWnd* pParent)
|
||||
: CDialogEx(IDD_DIALOG_OPENAURASDK, pParent), busses(bus), controllers (control)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
OpenAuraSDKDialog::~OpenAuraSDKDialog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OpenAuraSDKDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(OpenAuraSDKDialog, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BUTTON_OPENAURASDK_I2CDETECT, &OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkI2cdetect)
|
||||
ON_BN_CLICKED(IDC_RADIO_OPENAURASDK_DIRECT_MODE, &OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkDirectMode)
|
||||
ON_BN_CLICKED(IDC_RADIO_OPENAURASDK_EFFECT_MODE, &OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectMode)
|
||||
ON_BN_CLICKED(IDC_RADIO_OPENAURASDK_EFFECT_OFF, &OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectOff)
|
||||
ON_BN_CLICKED(IDC_RADIO_OPENAURASDK_EFFECT_STATIC, &OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectStatic)
|
||||
ON_BN_CLICKED(IDC_RADIO_OPENAURASDK_EFFECT_BREATHING, &OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectBreathing)
|
||||
ON_BN_CLICKED(IDC_RADIO_OPENAURASDK_EFFECT_FLASHING, &OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectFlashing)
|
||||
ON_BN_CLICKED(IDC_RADIO_OPENAURASDK_EFFECT_SPECTRUM_CYCLE, &OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectSpectrumCycle)
|
||||
ON_BN_CLICKED(IDC_RADIO_OPENAURASDK_EFFECT_RAINBOW, &OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectRainbow)
|
||||
ON_BN_CLICKED(IDC_RADIO_OPENAURASDK_BREATHING_SPECTRUM, &OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkBreathingSpectrum)
|
||||
ON_BN_CLICKED(IDC_RADIO_OPENAURASDK_EFFECT_CHASE_FADE, &OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectChaseFade)
|
||||
ON_BN_CLICKED(IDC_BUTTON_OPENAURASDK_SET_COLORS, &OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetColors)
|
||||
ON_CBN_CLOSEUP(IDC_COMBO_OPENAURASDK_DEVICE, &OpenAuraSDKDialog::OnCbnCloseupComboOpenaurasdkDevice)
|
||||
ON_BN_CLICKED(IDC_BUTTON_OPENAURASDK_SET_COLORS_ALL, &OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetColorsAll)
|
||||
ON_BN_CLICKED(IDC_BUTTON_OPENAURASDK_DUMP, &OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkDump)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
BOOL OpenAuraSDKDialog::OnInitDialog()
|
||||
{
|
||||
CComboBox* aura_device_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE);
|
||||
|
||||
aura_device_box->AddString("All Devices");
|
||||
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
aura_device_box->AddString(controllers[i]->GetDeviceName());
|
||||
}
|
||||
|
||||
aura_device_box->SetCurSel(0);
|
||||
|
||||
CFont* myFont = new CFont();
|
||||
myFont->CreateFontA(16, 0, 0, 0, FW_DONTCARE, false, false, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, _T("Consolas"));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkI2cdetect()
|
||||
{
|
||||
I2CDetectDialog dlg(busses);
|
||||
dlg.DoModal();
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkDirectMode()
|
||||
{
|
||||
unsigned int aura_device = ((CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE))->GetCurSel();
|
||||
if ( aura_device == 0)
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetDirect(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
controllers[aura_device - 1]->SetDirect(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectMode()
|
||||
{
|
||||
unsigned int aura_device = ((CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE))->GetCurSel();
|
||||
if (aura_device == 0)
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetDirect(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
controllers[aura_device - 1]->SetDirect(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::setMode(unsigned char mode_val)
|
||||
{
|
||||
unsigned int aura_device = ((CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE))->GetCurSel();
|
||||
if (aura_device == 0)
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetMode(mode_val);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
controllers[aura_device - 1]->SetMode(mode_val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectOff()
|
||||
{
|
||||
setMode(AURA_MODE_OFF);
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectStatic()
|
||||
{
|
||||
setMode(AURA_MODE_STATIC);
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectBreathing()
|
||||
{
|
||||
setMode(AURA_MODE_BREATHING);
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectFlashing()
|
||||
{
|
||||
setMode(AURA_MODE_FLASHING);
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectSpectrumCycle()
|
||||
{
|
||||
setMode(AURA_MODE_SPECTRUM_CYCLE);
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectRainbow()
|
||||
{
|
||||
setMode(AURA_MODE_RAINBOW);
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkBreathingSpectrum()
|
||||
{
|
||||
setMode(AURA_MODE_SPECTRUM_CYCLE_BREATHING);
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedRadioOpenaurasdkEffectChaseFade()
|
||||
{
|
||||
setMode(AURA_MODE_CHASE_FADE);
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetColors()
|
||||
{
|
||||
unsigned int aura_device = ((CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE))->GetCurSel();
|
||||
|
||||
if (aura_device == 0)
|
||||
{
|
||||
unsigned char direct = ((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_DIRECT_MODE))->GetCheck();
|
||||
|
||||
if (direct == 0)
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetLEDColorEffect( 0,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B) );
|
||||
controllers[i]->SetLEDColorEffect( 1,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_B) );
|
||||
controllers[i]->SetLEDColorEffect( 2,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_B) );
|
||||
controllers[i]->SetLEDColorEffect( 3,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_B) );
|
||||
controllers[i]->SetLEDColorEffect( 4,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_B) );
|
||||
|
||||
controllers[i]->SetDirect(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetLEDColorDirect( 0,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B) );
|
||||
controllers[i]->SetLEDColorDirect( 1,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_B) );
|
||||
controllers[i]->SetLEDColorDirect( 2,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_B) );
|
||||
controllers[i]->SetLEDColorDirect( 3,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_B) );
|
||||
controllers[i]->SetLEDColorDirect( 4,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_B) );
|
||||
|
||||
controllers[i]->SetDirect(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char direct = controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_DIRECT);
|
||||
|
||||
if (direct == 0)
|
||||
{
|
||||
controllers[aura_device - 1]->SetLEDColorEffect( 0,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B) );
|
||||
controllers[aura_device - 1]->SetLEDColorEffect( 1,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_B) );
|
||||
controllers[aura_device - 1]->SetLEDColorEffect( 2,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_B) );
|
||||
controllers[aura_device - 1]->SetLEDColorEffect( 3,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_B) );
|
||||
controllers[aura_device - 1]->SetLEDColorEffect( 4,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_B) );
|
||||
}
|
||||
else
|
||||
{
|
||||
controllers[aura_device - 1]->SetLEDColorDirect( 0,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B) );
|
||||
controllers[aura_device - 1]->SetLEDColorDirect( 1,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_B) );
|
||||
controllers[aura_device - 1]->SetLEDColorDirect( 2,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_B) );
|
||||
controllers[aura_device - 1]->SetLEDColorDirect( 3,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_B) );
|
||||
controllers[aura_device - 1]->SetLEDColorDirect( 4,
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_B) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetColorsAll()
|
||||
{
|
||||
unsigned int aura_device = ((CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE))->GetCurSel();
|
||||
|
||||
if (aura_device == 0)
|
||||
{
|
||||
unsigned char direct = ((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_DIRECT_MODE))->GetCheck();
|
||||
|
||||
if (direct == 0)
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetAllColorsEffect(GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B));
|
||||
|
||||
controllers[i]->SetDirect(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetAllColorsDirect(GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B));
|
||||
|
||||
controllers[i]->SetDirect(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char direct = controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_DIRECT);
|
||||
|
||||
if (direct == 0)
|
||||
{
|
||||
controllers[aura_device - 1]->SetAllColorsEffect(GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B));
|
||||
}
|
||||
else
|
||||
{
|
||||
controllers[aura_device - 1]->SetAllColorsDirect(GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnCbnCloseupComboOpenaurasdkDevice()
|
||||
{
|
||||
unsigned int aura_device = ((CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE))->GetCurSel();
|
||||
if (aura_device == 0)
|
||||
{
|
||||
/*((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_DIRECT_MODE))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_MODE))->SetCheck(false);
|
||||
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_OFF))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_STATIC))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_BREATHING))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_FLASHING))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_SPECTRUM_CYCLE))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_RAINBOW))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_BREATHING_SPECTRUM))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_CHASE_FADE))->SetCheck(false);
|
||||
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_0_R, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_0_G, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_0_B, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_1_R, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_1_G, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_1_B, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_2_R, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_2_G, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_2_B, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_3_R, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_3_G, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_3_B, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_4_R, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_4_G, "");
|
||||
SetDlgItemText(IDC_EDIT_OPENAURASDK_LED_4_B, "");*/
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char direct = controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_DIRECT);
|
||||
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_DIRECT_MODE))->SetCheck(direct != 0);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_MODE))->SetCheck(direct == 0);
|
||||
|
||||
unsigned char mode = controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_MODE);
|
||||
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_OFF))->SetCheck(mode == AURA_MODE_OFF);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_STATIC))->SetCheck(mode == AURA_MODE_STATIC);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_BREATHING))->SetCheck(mode == AURA_MODE_BREATHING);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_FLASHING))->SetCheck(mode == AURA_MODE_FLASHING);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_SPECTRUM_CYCLE))->SetCheck(mode == AURA_MODE_SPECTRUM_CYCLE);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_RAINBOW))->SetCheck(mode == AURA_MODE_RAINBOW);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_BREATHING_SPECTRUM))->SetCheck(mode == AURA_MODE_SPECTRUM_CYCLE_BREATHING);
|
||||
((CButton*)GetDlgItem(IDC_RADIO_OPENAURASDK_EFFECT_CHASE_FADE))->SetCheck(mode == AURA_MODE_CHASE_FADE);
|
||||
|
||||
if (direct == 0)
|
||||
{
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 0));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 2));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 1));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_R, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 3));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_G, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 5));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_B, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 4));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_R, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 6));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_G, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 8));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_B, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 7));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_R, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 9));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_G, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 11));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_B, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 10));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_R, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 12));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_G, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 14));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_B, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 13));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 0));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 2));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 1));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_R, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 3));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_G, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 5));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_1_B, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 4));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_R, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 6));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_G, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 8));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_2_B, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 7));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_R, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 9));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_G, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 11));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_3_B, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 10));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_R, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 12));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_G, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 14));
|
||||
SetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_4_B, controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 13));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkDump()
|
||||
{
|
||||
unsigned int aura_device = ((CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE))->GetCurSel();
|
||||
|
||||
if (aura_device > 0)
|
||||
{
|
||||
((CButton*)GetDlgItem(IDC_BUTTON_OPENAURASDK_DUMP))->EnableWindow(false);
|
||||
DumpAuraRegisters(controllers[aura_device - 1]);
|
||||
((CButton*)GetDlgItem(IDC_BUTTON_OPENAURASDK_DUMP))->EnableWindow(true);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
#ifndef OPENAURASDK_DIALOG_H
|
||||
#define OPENAURASDK_DIALOG_H
|
||||
|
||||
#include <afxdialogex.h>
|
||||
#include <vector>
|
||||
#include "i2c_smbus.h"
|
||||
#include "AuraController.h"
|
||||
#include "resource.h"
|
||||
|
||||
class OpenAuraSDKDialog : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(OpenAuraSDKDialog)
|
||||
|
||||
public:
|
||||
OpenAuraSDKDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<AuraController *>& control, CWnd* pParent = NULL);
|
||||
virtual ~OpenAuraSDKDialog();
|
||||
virtual BOOL OnInitDialog();
|
||||
|
||||
private:
|
||||
void setMode(unsigned char mode_val);
|
||||
|
||||
protected:
|
||||
std::vector<i2c_smbus_interface *>& busses;
|
||||
std::vector<AuraController *>& controllers;
|
||||
virtual void DoDataExchange(CDataExchange* pDX);
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
afx_msg void OnBnClickedButtonOpenaurasdkI2cdetect();
|
||||
afx_msg void OnBnClickedRadioOpenaurasdkDirectMode();
|
||||
afx_msg void OnBnClickedRadioOpenaurasdkEffectMode();
|
||||
afx_msg void OnBnClickedRadioOpenaurasdkEffectOff();
|
||||
afx_msg void OnBnClickedRadioOpenaurasdkEffectStatic();
|
||||
afx_msg void OnBnClickedRadioOpenaurasdkEffectBreathing();
|
||||
afx_msg void OnBnClickedRadioOpenaurasdkEffectFlashing();
|
||||
afx_msg void OnBnClickedRadioOpenaurasdkEffectSpectrumCycle();
|
||||
afx_msg void OnBnClickedRadioOpenaurasdkEffectRainbow();
|
||||
afx_msg void OnBnClickedRadioOpenaurasdkBreathingSpectrum();
|
||||
afx_msg void OnBnClickedRadioOpenaurasdkEffectChaseFade();
|
||||
afx_msg void OnBnClickedButtonOpenaurasdkSetColors();
|
||||
afx_msg void OnCbnCloseupComboOpenaurasdkDevice();
|
||||
afx_msg void OnBnClickedButtonOpenaurasdkSetColorsAll();
|
||||
afx_msg void OnBnClickedButtonOpenaurasdkDump();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,356 +0,0 @@
|
||||
#include "OpenAuraSDKQtDialog.h"
|
||||
#include "OpenAuraSDK.h"
|
||||
|
||||
using namespace Ui;
|
||||
|
||||
OpenAuraSDKQtDialog::OpenAuraSDKQtDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<AuraController *>& control, QWidget *parent) : QMainWindow(parent), busses(bus), controllers (control), ui(new OpenAuraSDKQtDialogUi)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->ComboAuraDevices->addItem("All Devices");
|
||||
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
ui->ComboAuraDevices->addItem(controllers[i]->GetDeviceName());
|
||||
}
|
||||
|
||||
ui->ComboAuraDevices->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
OpenAuraSDKQtDialog::~OpenAuraSDKQtDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenAuraSDKQtDialog::show()
|
||||
{
|
||||
QMainWindow::show();
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonSetAll_clicked()
|
||||
{
|
||||
unsigned int aura_device = ui->ComboAuraDevices->currentIndex();
|
||||
|
||||
if (aura_device == 0)
|
||||
{
|
||||
unsigned char direct = ui->RadioDirect->isChecked();
|
||||
|
||||
if (direct == 0)
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetAllColorsEffect(ui->EditLED0R->text().toInt(),
|
||||
ui->EditLED0G->text().toInt(),
|
||||
ui->EditLED0B->text().toInt());
|
||||
|
||||
controllers[i]->SetDirect(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetAllColorsDirect(ui->EditLED0R->text().toInt(),
|
||||
ui->EditLED0G->text().toInt(),
|
||||
ui->EditLED0B->text().toInt());
|
||||
|
||||
controllers[i]->SetDirect(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char direct = controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_DIRECT);
|
||||
|
||||
if (direct == 0)
|
||||
{
|
||||
controllers[aura_device - 1]->SetAllColorsEffect(ui->EditLED0R->text().toInt(),
|
||||
ui->EditLED0G->text().toInt(),
|
||||
ui->EditLED0B->text().toInt());
|
||||
}
|
||||
else
|
||||
{
|
||||
controllers[aura_device - 1]->SetAllColorsDirect(ui->EditLED0R->text().toInt(),
|
||||
ui->EditLED0G->text().toInt(),
|
||||
ui->EditLED0B->text().toInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonSetColors_clicked()
|
||||
{
|
||||
unsigned int aura_device = ui->ComboAuraDevices->currentIndex();
|
||||
|
||||
if (aura_device == 0)
|
||||
{
|
||||
unsigned char direct = ui->RadioDirect->isChecked();
|
||||
|
||||
if (direct == 0)
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetLEDColorEffect( 0,
|
||||
ui->EditLED0R->text().toInt(),
|
||||
ui->EditLED0G->text().toInt(),
|
||||
ui->EditLED0B->text().toInt() );
|
||||
controllers[i]->SetLEDColorEffect( 1,
|
||||
ui->EditLED1R->text().toInt(),
|
||||
ui->EditLED1G->text().toInt(),
|
||||
ui->EditLED1B->text().toInt() );
|
||||
controllers[i]->SetLEDColorEffect( 2,
|
||||
ui->EditLED2R->text().toInt(),
|
||||
ui->EditLED2G->text().toInt(),
|
||||
ui->EditLED2B->text().toInt() );
|
||||
controllers[i]->SetLEDColorEffect( 3,
|
||||
ui->EditLED3R->text().toInt(),
|
||||
ui->EditLED3G->text().toInt(),
|
||||
ui->EditLED3B->text().toInt() );
|
||||
controllers[i]->SetLEDColorEffect( 4,
|
||||
ui->EditLED4R->text().toInt(),
|
||||
ui->EditLED4G->text().toInt(),
|
||||
ui->EditLED4B->text().toInt() );
|
||||
|
||||
controllers[i]->SetDirect(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetLEDColorDirect( 0,
|
||||
ui->EditLED0R->text().toInt(),
|
||||
ui->EditLED0G->text().toInt(),
|
||||
ui->EditLED0B->text().toInt() );
|
||||
controllers[i]->SetLEDColorDirect( 1,
|
||||
ui->EditLED1R->text().toInt(),
|
||||
ui->EditLED1G->text().toInt(),
|
||||
ui->EditLED1B->text().toInt() );
|
||||
controllers[i]->SetLEDColorDirect( 2,
|
||||
ui->EditLED2R->text().toInt(),
|
||||
ui->EditLED2G->text().toInt(),
|
||||
ui->EditLED2B->text().toInt() );
|
||||
controllers[i]->SetLEDColorDirect( 3,
|
||||
ui->EditLED3R->text().toInt(),
|
||||
ui->EditLED3G->text().toInt(),
|
||||
ui->EditLED3B->text().toInt() );
|
||||
controllers[i]->SetLEDColorDirect( 4,
|
||||
ui->EditLED4R->text().toInt(),
|
||||
ui->EditLED4G->text().toInt(),
|
||||
ui->EditLED4B->text().toInt() );
|
||||
|
||||
controllers[i]->SetDirect(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char direct = controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_DIRECT);
|
||||
|
||||
if (direct == 0)
|
||||
{
|
||||
controllers[aura_device - 1]->SetLEDColorEffect( 0,
|
||||
ui->EditLED0R->text().toInt(),
|
||||
ui->EditLED0G->text().toInt(),
|
||||
ui->EditLED0B->text().toInt() );
|
||||
controllers[aura_device - 1]->SetLEDColorEffect( 1,
|
||||
ui->EditLED1R->text().toInt(),
|
||||
ui->EditLED1G->text().toInt(),
|
||||
ui->EditLED1B->text().toInt() );
|
||||
controllers[aura_device - 1]->SetLEDColorEffect( 2,
|
||||
ui->EditLED2R->text().toInt(),
|
||||
ui->EditLED2G->text().toInt(),
|
||||
ui->EditLED2B->text().toInt() );
|
||||
controllers[aura_device - 1]->SetLEDColorEffect( 3,
|
||||
ui->EditLED3R->text().toInt(),
|
||||
ui->EditLED3G->text().toInt(),
|
||||
ui->EditLED3B->text().toInt() );
|
||||
controllers[aura_device - 1]->SetLEDColorEffect( 4,
|
||||
ui->EditLED4R->text().toInt(),
|
||||
ui->EditLED4G->text().toInt(),
|
||||
ui->EditLED4B->text().toInt() );
|
||||
}
|
||||
else
|
||||
{
|
||||
controllers[aura_device - 1]->SetLEDColorDirect( 0,
|
||||
ui->EditLED0R->text().toInt(),
|
||||
ui->EditLED0G->text().toInt(),
|
||||
ui->EditLED0B->text().toInt() );
|
||||
controllers[aura_device - 1]->SetLEDColorDirect( 1,
|
||||
ui->EditLED1R->text().toInt(),
|
||||
ui->EditLED1G->text().toInt(),
|
||||
ui->EditLED1B->text().toInt() );
|
||||
controllers[aura_device - 1]->SetLEDColorDirect( 2,
|
||||
ui->EditLED2R->text().toInt(),
|
||||
ui->EditLED2G->text().toInt(),
|
||||
ui->EditLED2B->text().toInt() );
|
||||
controllers[aura_device - 1]->SetLEDColorDirect( 3,
|
||||
ui->EditLED3R->text().toInt(),
|
||||
ui->EditLED3G->text().toInt(),
|
||||
ui->EditLED3B->text().toInt() );
|
||||
controllers[aura_device - 1]->SetLEDColorDirect( 4,
|
||||
ui->EditLED4R->text().toInt(),
|
||||
ui->EditLED4G->text().toInt(),
|
||||
ui->EditLED4B->text().toInt() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_RadioDirect_clicked()
|
||||
{
|
||||
unsigned int aura_device = ui->ComboAuraDevices->currentIndex();
|
||||
if ( aura_device == 0)
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetDirect(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
controllers[aura_device - 1]->SetDirect(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_RadioEffect_clicked()
|
||||
{
|
||||
unsigned int aura_device = ui->ComboAuraDevices->currentIndex();
|
||||
if (aura_device == 0)
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetDirect(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
controllers[aura_device - 1]->SetDirect(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ComboAuraDevices_currentIndexChanged(int aura_device)
|
||||
{
|
||||
if (aura_device != 0)
|
||||
{
|
||||
unsigned char direct = controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_DIRECT);
|
||||
|
||||
ui->RadioDirect->setChecked(direct != 0);
|
||||
ui->RadioEffect->setChecked(direct == 0);
|
||||
|
||||
unsigned char mode = controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_MODE);
|
||||
|
||||
ui->RadioOff->setChecked(mode == AURA_MODE_OFF);
|
||||
ui->RadioStatic->setChecked(mode == AURA_MODE_STATIC);
|
||||
ui->RadioBreathing->setChecked(mode == AURA_MODE_BREATHING);
|
||||
ui->RadioFlashing->setChecked(mode == AURA_MODE_FLASHING);
|
||||
ui->RadioSpectrumCycle->setChecked(mode == AURA_MODE_SPECTRUM_CYCLE);
|
||||
ui->RadioRainbow->setChecked(mode == AURA_MODE_RAINBOW);
|
||||
ui->RadioBreathingSpectrum->setChecked(mode == AURA_MODE_SPECTRUM_CYCLE_BREATHING);
|
||||
ui->RadioChaseFade->setChecked(mode == AURA_MODE_CHASE_FADE);
|
||||
|
||||
if (direct == 0)
|
||||
{
|
||||
ui->EditLED0R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 0)));
|
||||
ui->EditLED0B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 1)));
|
||||
ui->EditLED0G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 2)));
|
||||
ui->EditLED1R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 3)));
|
||||
ui->EditLED1B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 4)));
|
||||
ui->EditLED1G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 5)));
|
||||
ui->EditLED2R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 6)));
|
||||
ui->EditLED2B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 7)));
|
||||
ui->EditLED2G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 8)));
|
||||
ui->EditLED3R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 9)));
|
||||
ui->EditLED3B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 10)));
|
||||
ui->EditLED3G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 11)));
|
||||
ui->EditLED4R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 12)));
|
||||
ui->EditLED4B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 13)));
|
||||
ui->EditLED4G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 14)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->EditLED0R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 0)));
|
||||
ui->EditLED0B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 1)));
|
||||
ui->EditLED0G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 2)));
|
||||
ui->EditLED1R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 3)));
|
||||
ui->EditLED1B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 4)));
|
||||
ui->EditLED1G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 5)));
|
||||
ui->EditLED2R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 6)));
|
||||
ui->EditLED2B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 7)));
|
||||
ui->EditLED2G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 8)));
|
||||
ui->EditLED3R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 9)));
|
||||
ui->EditLED3B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 10)));
|
||||
ui->EditLED3G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 11)));
|
||||
ui->EditLED4R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 12)));
|
||||
ui->EditLED4B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 13)));
|
||||
ui->EditLED4G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 14)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenAuraSDKQtDialog::setMode(unsigned char mode_val)
|
||||
{
|
||||
unsigned int aura_device = ui->ComboAuraDevices->currentIndex();
|
||||
|
||||
if (aura_device == 0)
|
||||
{
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetMode(mode_val);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
controllers[aura_device - 1]->SetMode(mode_val);
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_RadioOff_clicked()
|
||||
{
|
||||
setMode(AURA_MODE_OFF);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_RadioStatic_clicked()
|
||||
{
|
||||
setMode(AURA_MODE_STATIC);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_RadioBreathing_clicked()
|
||||
{
|
||||
setMode(AURA_MODE_BREATHING);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_RadioFlashing_clicked()
|
||||
{
|
||||
setMode(AURA_MODE_FLASHING);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_RadioSpectrumCycle_clicked()
|
||||
{
|
||||
setMode(AURA_MODE_SPECTRUM_CYCLE);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_RadioRainbow_clicked()
|
||||
{
|
||||
setMode(AURA_MODE_RAINBOW);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_RadioBreathingSpectrum_clicked()
|
||||
{
|
||||
setMode(AURA_MODE_SPECTRUM_CYCLE_BREATHING);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_RadioChaseFade_clicked()
|
||||
{
|
||||
setMode(AURA_MODE_CHASE_FADE);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonDumpAura_clicked()
|
||||
{
|
||||
unsigned int aura_device = ui->ComboAuraDevices->currentIndex();
|
||||
|
||||
if (aura_device > 0)
|
||||
{
|
||||
ui->ButtonDumpAura->setEnabled(false);
|
||||
DumpAuraRegisters(controllers[aura_device - 1]);
|
||||
ui->ButtonDumpAura->setEnabled(true);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,53 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| i2c_smbus_nuvoton_nct6793d.h |
|
||||
| |
|
||||
| Nuvoton NCT6793D SMBUS driver for Windows|
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 5/19/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
#define SMBHSTDAT (0 + nuvoton_nct6793d_smba)
|
||||
#define SMBBLKSZ (1 + nuvoton_nct6793d_smba)
|
||||
#define SMBHSTCMD (2 + nuvoton_nct6793d_smba)
|
||||
#define SMBHSTIDX (3 + nuvoton_nct6793d_smba) //Index field is the Command field on other controllers
|
||||
#define SMBHSTCTL (4 + nuvoton_nct6793d_smba)
|
||||
#define SMBHSTADD (5 + nuvoton_nct6793d_smba)
|
||||
#define SMBHSTERR (9 + nuvoton_nct6793d_smba)
|
||||
#define SMBHSTSTS (0xE + nuvoton_nct6793d_smba)
|
||||
|
||||
/* Command register */
|
||||
#define NCT6793D_READ_BYTE 0
|
||||
#define NCT6793D_READ_WORD 1
|
||||
#define NCT6793D_READ_BLOCK 2
|
||||
#define NCT6793D_BLOCK_WRITE_READ_PROC_CALL 3
|
||||
#define NCT6793D_PROC_CALL 4
|
||||
#define NCT6793D_WRITE_BYTE 8
|
||||
#define NCT6793D_WRITE_WORD 9
|
||||
#define NCT6793D_WRITE_BLOCK 10
|
||||
|
||||
/* Control register */
|
||||
#define NCT6793D_MANUAL_START 128
|
||||
#define NCT6793D_SOFT_RESET 64
|
||||
|
||||
/* Error register */
|
||||
#define NCT6793D_NO_ACK 32
|
||||
|
||||
/* Status register */
|
||||
#define NCT6793D_FIFO_EMPTY 1
|
||||
#define NCT6793D_FIFO_FULL 2
|
||||
#define NCT6793D_MANUAL_ACTIVE 4
|
||||
|
||||
class i2c_smbus_nuvoton_nct6793d : public i2c_smbus_interface
|
||||
{
|
||||
public:
|
||||
u16 nuvoton_nct6793d_smba = 0x0290;
|
||||
|
||||
private:
|
||||
s32 nct6793d_access(u16 addr, char read_write, u8 command, int size, i2c_smbus_data *data);
|
||||
s32 i2c_smbus_xfer(u8 addr, char read_write, u8 command, int size, i2c_smbus_data* data);
|
||||
|
||||
};
|
||||
@@ -1,428 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenAuraSDKQtDialogUi</class>
|
||||
<widget class="QMainWindow" name="OpenAuraSDKQtDialogUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>OpenAuraSDK</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<widget class="QPushButton" name="ButtonSetAll">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set All</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonSetColors">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>10</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set Colors</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED0R">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED0G">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>60</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED0B">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>60</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED1R">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED1G">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>90</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED1B">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>90</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED2R">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>120</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED2G">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>120</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED2B">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>120</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED3R">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>150</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED3G">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>150</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED3B">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>150</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED4R">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED4G">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>180</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED4B">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>180</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LabelRed">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Red</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LabelGreen">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>40</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Green</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LabelBlue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>40</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Blue</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="ComboAuraDevices">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>10</y>
|
||||
<width>200</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LabelAuraDevice">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>10</y>
|
||||
<width>90</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Aura Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="GroupBoxDirect">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>40</y>
|
||||
<width>200</width>
|
||||
<height>60</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Mode</string>
|
||||
</property>
|
||||
<widget class="QRadioButton" name="RadioDirect">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>70</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Direct</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="RadioEffect">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>30</y>
|
||||
<width>70</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Effect</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="GroupBoxEffect">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>100</y>
|
||||
<width>200</width>
|
||||
<height>180</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Effect</string>
|
||||
</property>
|
||||
<widget class="QRadioButton" name="RadioOff">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>150</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Off</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="RadioStatic">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>150</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Static</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="RadioBreathing">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>150</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Breathing</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="RadioFlashing">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>80</y>
|
||||
<width>150</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flashing</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="RadioSpectrumCycle">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>100</y>
|
||||
<width>150</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Spectrum Cycle</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="RadioRainbow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>120</y>
|
||||
<width>150</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rainbow Wave</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="RadioBreathingSpectrum">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>180</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Breathing Spectrum</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="RadioChaseFade">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>160</y>
|
||||
<width>180</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Chase Fade</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonDumpAura">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>260</y>
|
||||
<width>89</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dump Aura</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,95 @@
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = OpenAuraSDK
|
||||
TEMPLATE = app
|
||||
|
||||
LIBS += \
|
||||
-lws2_32 \
|
||||
-L"$$PWD/dependencies/inpout32_1501/Win32/" -linpout32
|
||||
|
||||
DEFINES -= \
|
||||
UNICODE
|
||||
|
||||
DEFINES += \
|
||||
_MBCS \
|
||||
WIN32 \
|
||||
_CRT_SECURE_NO_WARNINGS \
|
||||
_WINSOCK_DEPRECATED_NO_WARNINGS \
|
||||
WIN32_LEAN_AND_MEAN
|
||||
|
||||
INCLUDEPATH += \
|
||||
dependencies/inpout32_1501/Win32/ \
|
||||
dependencies/razer-chroma-2.9.0/inc \
|
||||
i2c_smbus/ \
|
||||
net_port/ \
|
||||
serial_port/ \
|
||||
wmi/ \
|
||||
Controllers/AuraController/ \
|
||||
Controllers/CorsairController/ \
|
||||
Controllers/CorsairProController/ \
|
||||
Controllers/HuePlusController/ \
|
||||
Controllers/HyperXController/ \
|
||||
Controllers/LEDStripController/ \
|
||||
RGBController/ \
|
||||
qt/
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
OpenAuraSDK.cpp \
|
||||
qt/OpenAuraSDKQtDialog.cpp \
|
||||
i2c_smbus/i2c_smbus.cpp \
|
||||
i2c_smbus/i2c_smbus_i801.cpp \
|
||||
i2c_smbus/i2c_smbus_nct6775.cpp \
|
||||
i2c_smbus/i2c_smbus_piix4.cpp \
|
||||
net_port/net_port.cpp \
|
||||
serial_port/serial_port.cpp \
|
||||
wmi/wmi.cpp \
|
||||
Controllers/AuraController/AuraController.cpp \
|
||||
Controllers/AuraController/AuraControllerDetect.cpp \
|
||||
Controllers/CorsairController/CorsairController.cpp \
|
||||
Controllers/CorsairController/CorsairControllerDetect.cpp \
|
||||
Controllers/CorsairProController/CorsairProController.cpp \
|
||||
Controllers/CorsairProController/CorsairProControllerDetect.cpp \
|
||||
Controllers/HuePlusController/HuePlusController.cpp \
|
||||
Controllers/HuePlusController/HuePlusControllerDetect.cpp \
|
||||
Controllers/HyperXController/HyperXController.cpp \
|
||||
Controllers/HyperXController/HyperXControllerDetect.cpp \
|
||||
Controllers/LEDStripController/LEDStripController.cpp \
|
||||
Controllers/LEDStripController/LEDStripControllerDetect.cpp \
|
||||
RGBController/RazerChromaSDKDetect.cpp \
|
||||
RGBController/RGBController_Aura.cpp \
|
||||
RGBController/RGBController_Corsair.cpp \
|
||||
RGBController/RGBController_CorsairPro.cpp \
|
||||
RGBController/RGBController_HuePlus.cpp \
|
||||
RGBController/RGBController_HyperX.cpp \
|
||||
RGBController/RGBController_LEDStrip.cpp \
|
||||
RGBController/RGBController_RazerChromaSDK.cpp
|
||||
|
||||
HEADERS += \
|
||||
dependencies/inpout32_1501/Win32/inpout32.h \
|
||||
qt/OpenAuraSDKQtDialog.h \
|
||||
i2c_smbus/i2c_smbus.h \
|
||||
i2c_smbus/i2c_smbus_i801.h \
|
||||
i2c_smbus/i2c_smbus_nct6775.h \
|
||||
i2c_smbus/i2c_smbus_piix4.h \
|
||||
net_port/net_port.h \
|
||||
serial_port/serial_port.h \
|
||||
wmi/wmi.h \
|
||||
Controllers/AuraController/AuraController.h \
|
||||
Controllers/CorsairController/CorsairController.h \
|
||||
Controllers/CorsairProController/CorsairProController.h \
|
||||
Controllers/HuePlusController/HuePlusController.h \
|
||||
Controllers/HyperXController/HyperXController.h \
|
||||
Controllers/LEDStripController/LEDStripController.h \
|
||||
RGBController/RGBController.h \
|
||||
RGBController/RGBController_Aura.h \
|
||||
RGBController/RGBController_Corsair.h \
|
||||
RGBController/RGBController_CorsairPro.h \
|
||||
RGBController/RGBController_HuePlus.h \
|
||||
RGBController/RGBController_HyperX.h \
|
||||
RGBController/RGBController_RazerChromaSDK.h
|
||||
|
||||
FORMS += \
|
||||
qt/openaurasdk.ui
|
||||
@@ -0,0 +1,127 @@
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_OpenRazer.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectOpenRazerControllers *
|
||||
* *
|
||||
* Detect devices supported by the OpenRazer kernel drivers *
|
||||
* * *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
char driver_path[512];
|
||||
DIR *dir;
|
||||
struct dirent *ent;
|
||||
int test_fd;
|
||||
bool done = false;
|
||||
int driver_to_read = 0;
|
||||
|
||||
while(driver_to_read < 8)
|
||||
{
|
||||
switch(driver_to_read)
|
||||
{
|
||||
case 0:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razerkbd/");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razermouse/");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razerfirefly/");
|
||||
break;
|
||||
|
||||
case 3:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razermug/");
|
||||
break;
|
||||
|
||||
case 4:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razercore/");
|
||||
break;
|
||||
|
||||
case 5:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razerkraken/");
|
||||
break;
|
||||
|
||||
case 6:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razermousemat/");
|
||||
break;
|
||||
|
||||
case 7:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razerchromahdk/");
|
||||
break;
|
||||
}
|
||||
|
||||
done = false;
|
||||
|
||||
dir = opendir(driver_path);
|
||||
|
||||
if(dir == NULL)
|
||||
{
|
||||
closedir(dir);
|
||||
|
||||
driver_to_read++;
|
||||
continue;
|
||||
}
|
||||
|
||||
ent = readdir(dir);
|
||||
|
||||
while(ent != NULL)
|
||||
{
|
||||
if(ent->d_type == DT_DIR || ent->d_type == DT_LNK)
|
||||
{
|
||||
if(!strcmp(ent->d_name, "."))
|
||||
{
|
||||
if(done == false)
|
||||
{
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(!strcmp(ent->d_name, "..") || !strcmp(ent->d_name, "module"))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
int device_type;
|
||||
char device_string[1024];
|
||||
strcpy(device_string, driver_path);
|
||||
strcat(device_string, ent->d_name);
|
||||
|
||||
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(device_string);
|
||||
|
||||
if(razer_rgb->device != RGBController_OpenRazer::RAZER_NO_DEVICE)
|
||||
{
|
||||
rgb_controllers.push_back(razer_rgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete razer_rgb;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ent = readdir(dir);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
driver_to_read++;
|
||||
}
|
||||
|
||||
} /* DetectOpenRazerControllers() */
|
||||
@@ -0,0 +1,66 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController.h |
|
||||
| |
|
||||
| Definitions and types for generic RGB |
|
||||
| lighting controller interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/2/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
typedef unsigned int RGBColor;
|
||||
|
||||
#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))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::string name; /* LED name */
|
||||
} led;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::string name; /* Mode name */
|
||||
} mode;
|
||||
|
||||
typedef int zone_type;
|
||||
|
||||
enum
|
||||
{
|
||||
ZONE_TYPE_SINGLE,
|
||||
ZONE_TYPE_LINEAR,
|
||||
ZONE_TYPE_MATRIX
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::string name; /* Zone name */
|
||||
zone_type type; /* Zone type */
|
||||
std::vector<std::vector<int>>
|
||||
map; /* LED index map */
|
||||
} zone;
|
||||
|
||||
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 */
|
||||
|
||||
virtual int GetMode() = 0;
|
||||
virtual void SetMode(int mode) = 0;
|
||||
virtual void SetCustomMode() = 0;
|
||||
virtual void SetAllLEDs(RGBColor color) = 0;
|
||||
virtual void SetAllZoneLEDs(int zone, RGBColor color) = 0;
|
||||
virtual void SetLED(int led, RGBColor color) = 0;
|
||||
virtual void UpdateLEDs() = 0;
|
||||
};
|
||||
@@ -0,0 +1,92 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AorusGPU.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Aorus GPU |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/17/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_AorusGPU.h"
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
static HMODULE handle;
|
||||
static unsigned char data[] = { 0x8E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x40, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00,
|
||||
0x64, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00 };
|
||||
|
||||
int RGBController_AorusGPU::GetMode()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void RGBController_AorusGPU::SetMode(int mode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_AorusGPU::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_AorusGPU::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
data[9] = RGBGetRValue(color);
|
||||
data[10] = RGBGetGValue(color);
|
||||
data[11] = RGBGetBValue(color);
|
||||
|
||||
GvWriteI2C(0x00000000, data, 0x00000000);
|
||||
}
|
||||
|
||||
void RGBController_AorusGPU::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
data[9] = RGBGetRValue(color);
|
||||
data[10] = RGBGetGValue(color);
|
||||
data[11] = RGBGetBValue(color);
|
||||
|
||||
GvWriteI2C(0x00000000, data, 0x00000000);
|
||||
}
|
||||
|
||||
void RGBController_AorusGPU::SetLED(int led, RGBColor color)
|
||||
{
|
||||
data[9] = RGBGetRValue(color);
|
||||
data[10] = RGBGetGValue(color);
|
||||
data[11] = RGBGetBValue(color);
|
||||
|
||||
GvWriteI2C(0x00000000, data, 0x00000000);
|
||||
}
|
||||
|
||||
RGBController_AorusGPU::RGBController_AorusGPU()
|
||||
{
|
||||
name = "Aorus GPU";
|
||||
|
||||
handle = LoadLibrary("GvDisplay.dll");
|
||||
|
||||
GvWriteI2C = (_GvWriteI2C)GetProcAddress(handle, "GvWriteI2C");
|
||||
GvFreeDispLib = (_GvFreeDispLib)GetProcAddress(handle, "GvFreeDispLib");
|
||||
GvInitDispLib = (_GvInitDispLib)GetProcAddress(handle, "GvInitDispLib");
|
||||
|
||||
GvFreeDispLib();
|
||||
GvInitDispLib();
|
||||
|
||||
mode aorus_mode;
|
||||
aorus_mode.name = "Static";
|
||||
modes.push_back(aorus_mode);
|
||||
|
||||
led aorus_led;
|
||||
aorus_led.name = "GPU LED";
|
||||
leds.push_back(aorus_led);
|
||||
|
||||
zone aorus_zone;
|
||||
aorus_zone.name = "GPU LED";
|
||||
std::vector<int> aorus_zone_map;
|
||||
aorus_zone_map.push_back(0);
|
||||
aorus_zone.map.push_back(aorus_zone_map);
|
||||
zones.push_back(aorus_zone);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AorusGPU.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Aorus GPU |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/17/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
|
||||
typedef unsigned int uint32;
|
||||
typedef uint32(*_GvWriteI2C)(uint32, void*, uint32);
|
||||
typedef void (*_GvFreeDispLib)();
|
||||
typedef void (*_GvInitDispLib)();
|
||||
|
||||
class RGBController_AorusGPU : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AorusGPU();
|
||||
int GetMode();
|
||||
void SetMode(int mode);
|
||||
void SetCustomMode();
|
||||
void SetAllLEDs(RGBColor color);
|
||||
void SetAllZoneLEDs(int zone, RGBColor color);
|
||||
void SetLED(int led, RGBColor color);
|
||||
|
||||
private:
|
||||
_GvWriteI2C GvWriteI2C;
|
||||
_GvFreeDispLib GvFreeDispLib;
|
||||
_GvInitDispLib GvInitDispLib;
|
||||
};
|
||||
@@ -0,0 +1,203 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Aura.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Asus Aura driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/13/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_Aura.h"
|
||||
|
||||
int RGBController_Aura::GetMode()
|
||||
{
|
||||
if (aura->AuraRegisterRead(AURA_REG_DIRECT))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(aura->AuraRegisterRead(AURA_REG_MODE) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_Aura::SetMode(int mode)
|
||||
{
|
||||
if (mode == 0)
|
||||
{
|
||||
aura->SetDirect(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
aura->SetMode(mode - 1);
|
||||
aura->SetDirect(false);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_Aura::SetCustomMode()
|
||||
{
|
||||
aura->SetDirect(true);
|
||||
}
|
||||
|
||||
void RGBController_Aura::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
if (GetMode() == 0)
|
||||
{
|
||||
aura->SetAllColorsDirect(red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
aura->SetAllColorsEffect(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_Aura::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
for (int x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (int y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
if (GetMode() == 0)
|
||||
{
|
||||
aura->SetLEDColorDirect(zones[zone].map[x][y], red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
aura->SetLEDColorEffect(zones[zone].map[x][y], red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_Aura::SetLED(int led, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
if (GetMode() == 0)
|
||||
{
|
||||
aura->SetLEDColorDirect(led, red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
aura->SetLEDColorEffect(led, red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_Aura::UpdateLEDs()
|
||||
{
|
||||
for(int led = 0; led < colors.size(); led++)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[led]);
|
||||
unsigned char grn = RGBGetGValue(colors[led]);
|
||||
unsigned char blu = RGBGetBValue(colors[led]);
|
||||
|
||||
if (GetMode() == 0)
|
||||
{
|
||||
aura->SetLEDColorDirect(led, red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
aura->SetLEDColorEffect(led, red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RGBController_Aura::RGBController_Aura(AuraController * aura_ptr)
|
||||
{
|
||||
std::vector<unsigned char> aura_channels;
|
||||
|
||||
aura = aura_ptr;
|
||||
|
||||
name = aura->GetDeviceName();
|
||||
|
||||
mode aura_modes[AURA_NUMBER_MODES + 1];
|
||||
|
||||
aura_modes[0].name = "Direct";
|
||||
aura_modes[1].name = "Off";
|
||||
aura_modes[2].name = "Static";
|
||||
aura_modes[3].name = "Breathing";
|
||||
aura_modes[4].name = "Flashing";
|
||||
aura_modes[5].name = "Spectrum Cycle";
|
||||
aura_modes[6].name = "Rainbow";
|
||||
aura_modes[7].name = "Spectrum Cycle Breathing";
|
||||
aura_modes[8].name = "Chase Fade";
|
||||
aura_modes[9].name = "Spectrum Cycle Chase Fade";
|
||||
aura_modes[10].name = "Chase";
|
||||
aura_modes[11].name = "Spectrum Cycle Chase";
|
||||
aura_modes[12].name = "Spectrum Cycle Wave";
|
||||
aura_modes[13].name = "Chase Rainbow Pulse";
|
||||
aura_modes[14].name = "Random Flicker";
|
||||
|
||||
for (int i = 0; i < (AURA_NUMBER_MODES + 1); i++)
|
||||
{
|
||||
modes.push_back(aura_modes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < aura->GetLEDCount(); i++)
|
||||
{
|
||||
aura_channels.push_back(aura->GetChannel(i));
|
||||
|
||||
led* new_led = new led();
|
||||
|
||||
new_led->name = aura->GetChannelName(i);
|
||||
|
||||
leds.push_back(*new_led);
|
||||
colors.push_back(0x00000000);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> aura_zones;
|
||||
|
||||
// Search through all LEDs and create zones for each channel type
|
||||
for (int i = 0; i < aura_channels.size(); i++)
|
||||
{
|
||||
bool matched = false;
|
||||
|
||||
// Search through existing zones to make sure we don't create a duplicate zone
|
||||
for (int j = 0; j < aura_zones.size(); j++)
|
||||
{
|
||||
if (aura_channels[i] == aura_zones[j])
|
||||
{
|
||||
matched = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If zone does not already exist, create it
|
||||
if (matched == false)
|
||||
{
|
||||
zone* new_zone = new zone();
|
||||
std::vector<int>* zone_row = new std::vector<int>();
|
||||
|
||||
// Set zone name to channel name
|
||||
new_zone->name = aura->GetChannelName(i);
|
||||
|
||||
// Find all LEDs with this channel type and add them to zone
|
||||
for (int j = 0; j < aura->GetLEDCount(); j++)
|
||||
{
|
||||
if (aura->GetChannel(j) == aura_channels[i])
|
||||
{
|
||||
zone_row->push_back(j);
|
||||
}
|
||||
}
|
||||
|
||||
// Aura devices can be either single or linear, never matrix
|
||||
// That means only one row is needed
|
||||
new_zone->map.push_back(*zone_row);
|
||||
|
||||
// Save channel to aura_zones so we know not to create another zone with this channel
|
||||
aura_zones.push_back(aura_channels[i]);
|
||||
|
||||
// Push new zone to zones vector
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Aura.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Asus Aura driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/13/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "AuraController.h"
|
||||
|
||||
class RGBController_Aura : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_Aura(AuraController* aura_ptr);
|
||||
int GetMode();
|
||||
void SetMode(int mode);
|
||||
void SetCustomMode();
|
||||
void SetAllLEDs(RGBColor color);
|
||||
void SetAllZoneLEDs(int zone, RGBColor color);
|
||||
void SetLED(int led, RGBColor color);
|
||||
void UpdateLEDs();
|
||||
|
||||
private:
|
||||
AuraController* aura;
|
||||
};
|
||||
@@ -0,0 +1,107 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Corsair.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Corsair Vengeance RGB driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/13/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_Corsair.h"
|
||||
|
||||
int RGBController_Corsair::GetMode()
|
||||
{
|
||||
return(CORSAIR_VENGEANCE_RGB_MODE_SINGLE);
|
||||
}
|
||||
|
||||
void RGBController_Corsair::SetMode(int mode)
|
||||
{
|
||||
corsair->SetMode(mode);
|
||||
}
|
||||
|
||||
void RGBController_Corsair::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_Corsair::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
corsair->SetAllColors(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_Corsair::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
for (int x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (int y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
corsair->SetLEDColor(zones[zone].map[x][y], red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_Corsair::SetLED(int led, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
corsair->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_Corsair::UpdateLEDs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
RGBController_Corsair::RGBController_Corsair(CorsairController* corsair_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = corsair->GetDeviceName();
|
||||
|
||||
mode corsair_modes[CORSAIR_NUMBER_MODES];
|
||||
|
||||
corsair_modes[0].name = "Static";
|
||||
corsair_modes[1].name = "Fade";
|
||||
corsair_modes[2].name = "Pulse";
|
||||
|
||||
for (int i = 0; i < CORSAIR_NUMBER_MODES; i++)
|
||||
{
|
||||
modes.push_back(corsair_modes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < corsair->GetLEDCount(); i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
|
||||
new_led->name = "Corsair LED";
|
||||
|
||||
leds.push_back(*new_led);
|
||||
colors.push_back(0x00000000);
|
||||
}
|
||||
|
||||
zone new_zone;
|
||||
|
||||
new_zone.name = "Corsair Zone";
|
||||
new_zone.type = ZONE_TYPE_SINGLE;
|
||||
|
||||
std::vector<int> zone_row;
|
||||
|
||||
for (int i = 0; i < corsair->GetLEDCount(); i++)
|
||||
{
|
||||
zone_row.push_back(i);
|
||||
}
|
||||
|
||||
new_zone.map.push_back(zone_row);
|
||||
|
||||
zones.push_back(new_zone);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Corsair.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Corsair Vengeance RGB driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/13/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CorsairController.h"
|
||||
|
||||
class RGBController_Corsair : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_Corsair(CorsairController* corsair_ptr);
|
||||
int GetMode();
|
||||
void SetMode(int mode);
|
||||
void SetCustomMode();
|
||||
void SetAllLEDs(RGBColor color);
|
||||
void SetAllZoneLEDs(int zone, RGBColor color);
|
||||
void SetLED(int led, RGBColor color);
|
||||
void UpdateLEDs();
|
||||
|
||||
private:
|
||||
CorsairController* corsair;
|
||||
};
|
||||
@@ -0,0 +1,150 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairPro.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Corsair Vengeance Pro RGB driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/30/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairPro.h"
|
||||
|
||||
int RGBController_CorsairPro::GetMode()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void RGBController_CorsairPro::SetMode(int mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
corsair->SetEffect(CORSAIR_PRO_MODE_COLOR_SHIFT);
|
||||
break;
|
||||
case 1:
|
||||
corsair->SetEffect(CORSAIR_PRO_MODE_COLOR_PULSE);
|
||||
break;
|
||||
case 2:
|
||||
corsair->SetEffect(CORSAIR_PRO_MODE_RAINBOW_WAVE);
|
||||
break;
|
||||
case 3:
|
||||
corsair->SetEffect(CORSAIR_PRO_MODE_COLOR_WAVE);
|
||||
break;
|
||||
case 4:
|
||||
corsair->SetEffect(CORSAIR_PRO_MODE_VISOR);
|
||||
break;
|
||||
case 5:
|
||||
corsair->SetEffect(CORSAIR_PRO_MODE_RAIN);
|
||||
break;
|
||||
case 6:
|
||||
corsair->SetEffect(CORSAIR_PRO_MODE_MARQUEE);
|
||||
break;
|
||||
case 7:
|
||||
corsair->SetEffect(CORSAIR_PRO_MODE_RAINBOW);
|
||||
break;
|
||||
case 8:
|
||||
corsair->SetEffect(CORSAIR_PRO_MODE_SEQUENTIAL);
|
||||
break;
|
||||
case 9:
|
||||
corsair->SetEffect(CORSAIR_PRO_MODE_STATIC);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CorsairPro::SetCustomMode()
|
||||
{
|
||||
corsair->SetCustom();
|
||||
}
|
||||
|
||||
void RGBController_CorsairPro::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
corsair->SetAllColors(red, grn, blu);
|
||||
corsair->ApplyColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairPro::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
for (int x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (int y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
corsair->SetLEDColor(zones[zone].map[x][y], red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
corsair->ApplyColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairPro::SetLED(int led, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
corsair->SetLEDColor(led, red, grn, blu);
|
||||
corsair->ApplyColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairPro::UpdateLEDs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
RGBController_CorsairPro::RGBController_CorsairPro(CorsairProController* corsair_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = corsair->GetDeviceName();
|
||||
|
||||
mode corsair_modes[CORSAIR_PRO_NUMBER_MODES];
|
||||
|
||||
corsair_modes[0].name = "Color Shift";
|
||||
corsair_modes[1].name = "Color Pulse";
|
||||
corsair_modes[2].name = "Rainbow Wave";
|
||||
corsair_modes[3].name = "Color Wave";
|
||||
corsair_modes[4].name = "Visor";
|
||||
corsair_modes[5].name = "Rain";
|
||||
corsair_modes[6].name = "Marquee";
|
||||
corsair_modes[7].name = "Rainbow";
|
||||
corsair_modes[8].name = "Sequential";
|
||||
corsair_modes[9].name = "Static";
|
||||
|
||||
for (int i = 0; i < CORSAIR_PRO_NUMBER_MODES; i++)
|
||||
{
|
||||
modes.push_back(corsair_modes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < corsair->GetLEDCount(); i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
|
||||
new_led->name = "Corsair Pro LED";
|
||||
|
||||
leds.push_back(*new_led);
|
||||
colors.push_back(0x00000000);
|
||||
}
|
||||
|
||||
zone new_zone;
|
||||
|
||||
new_zone.name = "Corsair Pro Zone";
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
|
||||
std::vector<int> zone_row;
|
||||
|
||||
for (int i = 0; i < corsair->GetLEDCount(); i++)
|
||||
{
|
||||
zone_row.push_back(i);
|
||||
}
|
||||
|
||||
new_zone.map.push_back(zone_row);
|
||||
|
||||
zones.push_back(new_zone);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairPro.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Corsair Vengeance Pro RGB driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/30/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CorsairProController.h"
|
||||
|
||||
class RGBController_CorsairPro : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairPro(CorsairProController* corsair_ptr);
|
||||
int GetMode();
|
||||
void SetMode(int mode);
|
||||
void SetCustomMode();
|
||||
void SetAllLEDs(RGBColor color);
|
||||
void SetAllZoneLEDs(int zone, RGBColor color);
|
||||
void SetLED(int led, RGBColor color);
|
||||
void UpdateLEDs();
|
||||
|
||||
private:
|
||||
CorsairProController* corsair;
|
||||
};
|
||||
@@ -0,0 +1,86 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_HuePlus.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for NZXT Hue+ |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/20/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_HuePlus.h"
|
||||
|
||||
|
||||
RGBController_HuePlus::RGBController_HuePlus(HuePlusController* hueplus_ptr)
|
||||
{
|
||||
strip = hueplus_ptr;
|
||||
|
||||
name = "LED Strip";
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
zone led_zone;
|
||||
led_zone.name = "LED Strip";
|
||||
std::vector<int> led_zone_map;
|
||||
for (int i = 0; i < strip->num_leds; i++)
|
||||
{
|
||||
led_zone_map.push_back(i);
|
||||
}
|
||||
led_zone.map.push_back(led_zone_map);
|
||||
zones.push_back(led_zone);
|
||||
}
|
||||
|
||||
int RGBController_HuePlus::GetMode()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::SetMode(int mode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
for (int i = 0; i < colors.size(); i++)
|
||||
{
|
||||
colors[i] = color;
|
||||
}
|
||||
|
||||
strip->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
for (int i = 0; i < colors.size(); i++)
|
||||
{
|
||||
colors[i] = color;
|
||||
}
|
||||
|
||||
strip->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::SetLED(int led, RGBColor color)
|
||||
{
|
||||
colors[led] = color;
|
||||
|
||||
strip->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::UpdateLEDs()
|
||||
{
|
||||
strip->SetLEDs(colors);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_HuePlus.h |
|
||||
| |
|
||||
| Generic RGB Interface for NZXT Hue+ |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/20/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "serial_port.h"
|
||||
#include "HuePlusController.h"
|
||||
|
||||
class RGBController_HuePlus : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HuePlus(HuePlusController* hueplus_ptr);
|
||||
int GetMode();
|
||||
void SetMode(int mode);
|
||||
void SetCustomMode();
|
||||
void SetAllLEDs(RGBColor color);
|
||||
void SetAllZoneLEDs(int zone, RGBColor color);
|
||||
void SetLED(int led, RGBColor color);
|
||||
void UpdateLEDs();
|
||||
|
||||
private:
|
||||
HuePlusController* strip;
|
||||
};
|
||||
@@ -0,0 +1,112 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_HyperX.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| HyperX Predator RGB interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/29/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_HyperX.h"
|
||||
|
||||
int RGBController_HyperX::GetMode()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void RGBController_HyperX::SetMode(int mode)
|
||||
{
|
||||
hyperx->SetMode(mode);
|
||||
}
|
||||
|
||||
void RGBController_HyperX::SetCustomMode()
|
||||
{
|
||||
hyperx->SetMode(HYPERX_MODE_STATIC);
|
||||
}
|
||||
|
||||
void RGBController_HyperX::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
hyperx->SetAllColors(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_HyperX::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
for (int x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (int y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
hyperx->SetLEDColor(zones[zone].map[x][y], red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HyperX::SetLED(int led, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
hyperx->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_HyperX::UpdateLEDs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
RGBController_HyperX::RGBController_HyperX(HyperXController* hyperx_ptr)
|
||||
{
|
||||
hyperx = hyperx_ptr;
|
||||
|
||||
name = hyperx->GetDeviceName();
|
||||
|
||||
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";
|
||||
|
||||
for (int i = 0; i < HYPERX_NUMBER_MODES; i++)
|
||||
{
|
||||
modes.push_back(hyperx_modes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < hyperx->GetLEDCount(); i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
|
||||
new_led->name = "HyperX LED";
|
||||
|
||||
leds.push_back(*new_led);
|
||||
colors.push_back(0x00000000);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_HyperX.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| HyperX Predator RGB interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/29/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "HyperXController.h"
|
||||
|
||||
class RGBController_HyperX : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperX(HyperXController* hyperx_ptr);
|
||||
int GetMode();
|
||||
void SetMode(int mode);
|
||||
void SetCustomMode();
|
||||
void SetAllLEDs(RGBColor color);
|
||||
void SetAllZoneLEDs(int zone, RGBColor color);
|
||||
void SetLED(int led, RGBColor color);
|
||||
void UpdateLEDs();
|
||||
|
||||
private:
|
||||
HyperXController* hyperx;
|
||||
};
|
||||
@@ -0,0 +1,87 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LEDStrip.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| KeyboardVisualizer LED strip interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/20/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LEDStrip.h"
|
||||
|
||||
|
||||
RGBController_LEDStrip::RGBController_LEDStrip(LEDStripController* ledstrip_ptr)
|
||||
{
|
||||
strip = ledstrip_ptr;
|
||||
|
||||
name = "LED Strip";
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
zone led_zone;
|
||||
led_zone.name = "LED Strip";
|
||||
std::vector<int> led_zone_map;
|
||||
for (int i = 0; i < strip->num_leds; i++)
|
||||
{
|
||||
led_zone_map.push_back(i);
|
||||
}
|
||||
led_zone.map.push_back(led_zone_map);
|
||||
zones.push_back(led_zone);
|
||||
}
|
||||
|
||||
int RGBController_LEDStrip::GetMode()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGBController_LEDStrip::SetMode(int mode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LEDStrip::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LEDStrip::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
for (int i = 0; i < colors.size(); i++)
|
||||
{
|
||||
colors[i] = color;
|
||||
}
|
||||
|
||||
strip->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_LEDStrip::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
for (int i = 0; i < colors.size(); i++)
|
||||
{
|
||||
colors[i] = color;
|
||||
}
|
||||
|
||||
strip->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_LEDStrip::SetLED(int led, RGBColor color)
|
||||
{
|
||||
colors[led] = color;
|
||||
|
||||
strip->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_LEDStrip::UpdateLEDs()
|
||||
{
|
||||
strip->SetLEDs(colors);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LEDStrip.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| KeyboardVisualizer LED strip interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/20/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "serial_port.h"
|
||||
#include "LEDStripController.h"
|
||||
|
||||
class RGBController_LEDStrip : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LEDStrip(LEDStripController* ledstrip_ptr);
|
||||
int GetMode();
|
||||
void SetMode(int mode);
|
||||
void SetCustomMode();
|
||||
void SetAllLEDs(RGBColor color);
|
||||
void SetAllZoneLEDs(int zone, RGBColor color);
|
||||
void SetLED(int led, RGBColor color);
|
||||
void UpdateLEDs();
|
||||
|
||||
private:
|
||||
LEDStripController* strip;
|
||||
};
|
||||
@@ -0,0 +1,782 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_OpenRazer.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRazer |
|
||||
| kernel drivers for Chroma peripherals |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/15/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_OpenRazer.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
int RGBController_OpenRazer::GetMode()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetMode(int mode)
|
||||
{
|
||||
char update_value = 1;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case RAZER_TYPE_MATRIX_FRAME:
|
||||
case RAZER_TYPE_MATRIX_NOFRAME:
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case RAZER_MODE_CUSTOM:
|
||||
matrix_effect_custom.write(&update_value, 1);
|
||||
matrix_effect_custom.flush();
|
||||
break;
|
||||
|
||||
case RAZER_MODE_OFF:
|
||||
matrix_effect_none.write(&update_value, 1);
|
||||
matrix_effect_none.flush();
|
||||
break;
|
||||
|
||||
case RAZER_MODE_STATIC:
|
||||
break;
|
||||
|
||||
case RAZER_MODE_BREATHING:
|
||||
break;
|
||||
|
||||
case RAZER_MODE_SPECTRUM_CYCLE:
|
||||
matrix_effect_spectrum.write(&update_value, 1);
|
||||
matrix_effect_spectrum.flush();
|
||||
break;
|
||||
|
||||
case RAZER_MODE_WAVE:
|
||||
matrix_effect_wave.write(&update_value, 1);
|
||||
matrix_effect_wave.flush();
|
||||
break;
|
||||
|
||||
case RAZER_MODE_REACTIVE:
|
||||
matrix_effect_reactive.write(&update_value, 1);
|
||||
matrix_effect_reactive.flush();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_TYPE_NOMATRIX:
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case RAZER_MODE_CUSTOM:
|
||||
update_value = 0;
|
||||
logo_led_effect.write(&update_value, 1);
|
||||
scroll_led_effect.write(&update_value, 1);
|
||||
logo_led_effect.flush();
|
||||
scroll_led_effect.flush();
|
||||
break;
|
||||
|
||||
case RAZER_MODE_SPECTRUM_CYCLE:
|
||||
update_value = '4';
|
||||
logo_led_effect.write(&update_value, 1);
|
||||
scroll_led_effect.write(&update_value, 1);
|
||||
logo_led_effect.flush();
|
||||
scroll_led_effect.flush();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetCustomMode()
|
||||
{
|
||||
SetMode(RAZER_MODE_CUSTOM);
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::UpdateLEDs()
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case RAZER_TYPE_MATRIX_FRAME:
|
||||
case RAZER_TYPE_MATRIX_NOFRAME:
|
||||
{
|
||||
for (int row = 0; row < matrix_rows; row++)
|
||||
{
|
||||
unsigned int output_array_size;
|
||||
unsigned int output_offset;
|
||||
unsigned int row_offset = (row * matrix_cols);
|
||||
|
||||
if(type == RAZER_TYPE_MATRIX_NOFRAME)
|
||||
{
|
||||
output_array_size = 3;
|
||||
output_offset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
output_array_size = 3 + (matrix_cols* 3);
|
||||
output_offset = 3;
|
||||
}
|
||||
|
||||
char output_array[output_array_size];
|
||||
char update_value = 1;
|
||||
|
||||
if(type != RAZER_TYPE_MATRIX_NOFRAME)
|
||||
{
|
||||
output_array[0] = row;
|
||||
output_array[1] = 0;
|
||||
output_array[2] = matrix_cols - 1;
|
||||
}
|
||||
|
||||
for(int col = 0; col < matrix_cols; col++)
|
||||
{
|
||||
unsigned int color_idx = col + row_offset;
|
||||
output_array[(col * 3) + 0 + output_offset] = (char)RGBGetRValue(colors[color_idx]);
|
||||
output_array[(col * 3) + 1 + output_offset] = (char)RGBGetGValue(colors[color_idx]);
|
||||
output_array[(col * 3) + 2 + output_offset] = (char)RGBGetBValue(colors[color_idx]);
|
||||
}
|
||||
|
||||
if(type == RAZER_TYPE_MATRIX_NOFRAME)
|
||||
{
|
||||
matrix_effect_custom.write(output_array, output_array_size);
|
||||
matrix_effect_custom.flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
matrix_custom_frame.write(output_array, output_array_size);
|
||||
matrix_custom_frame.flush();
|
||||
matrix_effect_custom.write(&update_value, 1);
|
||||
matrix_effect_custom.flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_TYPE_NOMATRIX:
|
||||
{
|
||||
unsigned int output_array_size = 3;
|
||||
char output_array[output_array_size];
|
||||
char update_value = 0;
|
||||
|
||||
output_array[0] = (char)RGBGetRValue(colors[0]);
|
||||
output_array[1] = (char)RGBGetGValue(colors[0]);
|
||||
output_array[2] = (char)RGBGetBValue(colors[0]);
|
||||
logo_led_rgb.write(output_array, output_array_size);
|
||||
|
||||
output_array[0] = (char)RGBGetRValue(colors[1]);
|
||||
output_array[1] = (char)RGBGetGValue(colors[1]);
|
||||
output_array[2] = (char)RGBGetBValue(colors[1]);
|
||||
scroll_led_rgb.write(output_array, output_array_size);
|
||||
|
||||
logo_led_rgb.flush();
|
||||
scroll_led_rgb.flush();
|
||||
|
||||
logo_led_effect.write(&update_value, 1);
|
||||
scroll_led_effect.write(&update_value, 1);
|
||||
logo_led_effect.flush();
|
||||
scroll_led_effect.flush();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
for(int i = 0; i < colors.size(); i++)
|
||||
{
|
||||
colors[i] = color;
|
||||
}
|
||||
|
||||
UpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
for (int x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (int y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
colors[zones[zone].map[x][y]] = color;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetLED(int led, RGBColor color)
|
||||
{
|
||||
colors[led] = color;
|
||||
|
||||
UpdateLEDs();
|
||||
}
|
||||
|
||||
static std::string GetDeviceTypeString(std::string dev_path)
|
||||
{
|
||||
// Read device_type for device name string
|
||||
std::string dev_type_path = dev_path + "/device_type";
|
||||
std::ifstream dev_type_file;
|
||||
std::string ret_str;
|
||||
|
||||
dev_type_file.open(dev_type_path);
|
||||
std::getline(dev_type_file, ret_str);
|
||||
dev_type_file.close();
|
||||
|
||||
return(ret_str);
|
||||
}
|
||||
|
||||
unsigned int RGBController_OpenRazer::GetTypeFromDeviceName(std::string dev_name)
|
||||
{
|
||||
if(dev_name == "Razer Mamba Tournament Edition")
|
||||
{
|
||||
return(RAZER_MAMBA_TOURNAMENT_EDITION_CHROMA);
|
||||
}
|
||||
|
||||
else if(dev_name == "Razer DeathAdder Chroma")
|
||||
{
|
||||
return(RAZER_DEATHADDER_CHROMA);
|
||||
}
|
||||
|
||||
else if(dev_name == "Razer Diamondback Chroma")
|
||||
{
|
||||
return(RAZER_DIAMONDBACK_CHROMA);
|
||||
}
|
||||
|
||||
else if(dev_name == "Razer DeathStalker Chroma")
|
||||
{
|
||||
return(RAZER_DEATHSTALKER_CHROMA);
|
||||
}
|
||||
|
||||
else if(dev_name == "Razer Tartarus Chroma")
|
||||
{
|
||||
return(RAZER_TARTARUS_CHROMA);
|
||||
}
|
||||
|
||||
else if(dev_name == "Razer Core")
|
||||
{
|
||||
return(RAZER_CORE);
|
||||
}
|
||||
|
||||
else if(dev_name == "Razer Firefly")
|
||||
{
|
||||
return(RAZER_FIREFLY_CHROMA);
|
||||
}
|
||||
|
||||
else if(dev_name == "Razer Goliathus Extended")
|
||||
{
|
||||
return(RAZER_GOLIATHUS_EXTENDED_CHROMA);
|
||||
}
|
||||
|
||||
else if(dev_name == "Razer Chroma Mug Holder")
|
||||
{
|
||||
return(RAZER_MUG_HOLDER);
|
||||
}
|
||||
|
||||
else if(dev_name == "Razer Kraken 7.1 Chroma")
|
||||
{
|
||||
return(RAZER_KRAKEN_V1);
|
||||
}
|
||||
|
||||
else if(dev_name == "Razer Kraken 7.1 V2")
|
||||
{
|
||||
return(RAZER_KRAKEN_V2);
|
||||
}
|
||||
|
||||
else if(dev_name == "Razer Chroma HDK")
|
||||
{
|
||||
return(RAZER_CHROMA_HDK);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return(RAZER_NO_DEVICE);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetupMatrixDevice(std::string dev_path, unsigned int rows, unsigned int cols)
|
||||
{
|
||||
matrix_custom_frame.open(dev_path + "/matrix_custom_frame");
|
||||
matrix_effect_custom.open(dev_path + "/matrix_effect_custom");
|
||||
matrix_effect_breath.open(dev_path + "/matrix_effect_breath");
|
||||
matrix_effect_none.open(dev_path + "/matrix_effect_none");
|
||||
matrix_effect_reactive.open(dev_path + "/matrix_effect_reactive");
|
||||
matrix_effect_spectrum.open(dev_path + "/matrix_effect_spectrum");
|
||||
matrix_effect_static.open(dev_path + "/matrix_effect_static");
|
||||
matrix_effect_wave.open(dev_path + "/matrix_effect_wave");
|
||||
|
||||
if(!matrix_custom_frame)
|
||||
{
|
||||
type = RAZER_TYPE_MATRIX_NOFRAME;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = RAZER_TYPE_MATRIX_FRAME;
|
||||
|
||||
matrix_rows = rows;
|
||||
matrix_cols = cols;
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetupNonMatrixDevice(std::string dev_path)
|
||||
{
|
||||
logo_led_effect.open(dev_path + "/logo_led_effect");
|
||||
logo_led_rgb.open(dev_path + "/logo_led_rgb");
|
||||
scroll_led_effect.open(dev_path + "/scroll_led_effect");
|
||||
scroll_led_rgb.open(dev_path + "/scroll_led_rgb");
|
||||
|
||||
type = RAZER_TYPE_NOMATRIX;
|
||||
}
|
||||
|
||||
RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
|
||||
{
|
||||
name = GetDeviceTypeString(dev_path);
|
||||
|
||||
device = GetTypeFromDeviceName(name);
|
||||
|
||||
mode razer_modes[RAZER_NUM_MODES];
|
||||
|
||||
razer_modes[0].name = "Custom";
|
||||
razer_modes[1].name = "Off";
|
||||
razer_modes[2].name = "Static";
|
||||
razer_modes[3].name = "Breathing";
|
||||
razer_modes[4].name = "Spectrum Cycle";
|
||||
razer_modes[5].name = "Wave";
|
||||
razer_modes[6].name = "Reactive";
|
||||
|
||||
for (int i = 0; i < RAZER_NUM_MODES; i++)
|
||||
{
|
||||
modes.push_back(razer_modes[i]);
|
||||
}
|
||||
|
||||
switch(device)
|
||||
{
|
||||
case RAZER_MAMBA_TOURNAMENT_EDITION_CHROMA:
|
||||
{
|
||||
SetupMatrixDevice(dev_path, 1, 16);
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
RGBColor new_color = 0x00000000;
|
||||
colors.push_back(new_color);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Left Strip";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
for (int i = 7; i < 14; i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Right Strip";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Logo";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Mouse Wheel";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
zone left_zone;
|
||||
left_zone.name = "Left Strip";
|
||||
left_zone.type = ZONE_TYPE_LINEAR;
|
||||
std::vector<int> left_zone_map;
|
||||
for(int i = 0; i < 7; i++)
|
||||
{
|
||||
left_zone_map.push_back(i);
|
||||
}
|
||||
left_zone.map.push_back(left_zone_map);
|
||||
zones.push_back(left_zone);
|
||||
|
||||
zone right_zone;
|
||||
right_zone.name = "Right Strip";
|
||||
right_zone.type = ZONE_TYPE_LINEAR;
|
||||
std::vector<int> right_zone_map;
|
||||
for(int i = 7; i < 14; i++)
|
||||
{
|
||||
right_zone_map.push_back(i);
|
||||
}
|
||||
right_zone.map.push_back(right_zone_map);
|
||||
zones.push_back(right_zone);
|
||||
|
||||
zone logo_zone;
|
||||
logo_zone.name = "Logo";
|
||||
logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
std::vector<int> logo_zone_map;
|
||||
logo_zone_map.push_back(14);
|
||||
logo_zone.map.push_back(logo_zone_map);
|
||||
zones.push_back(logo_zone);
|
||||
|
||||
zone wheel_zone;
|
||||
wheel_zone.name = "Mouse Wheel";
|
||||
wheel_zone.type = ZONE_TYPE_SINGLE;
|
||||
std::vector<int> wheel_zone_map;
|
||||
wheel_zone_map.push_back(15);
|
||||
wheel_zone.map.push_back(wheel_zone_map);
|
||||
zones.push_back(wheel_zone);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_DIAMONDBACK_CHROMA:
|
||||
{
|
||||
SetupMatrixDevice(dev_path, 1, 21);
|
||||
|
||||
for (int i = 0; i < 21; i++)
|
||||
{
|
||||
RGBColor new_color = 0x00000000;
|
||||
colors.push_back(new_color);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Left Strip";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
for (int i = 7; i < 19; i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Right Strip";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Logo";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Mouse Wheel";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
zone left_zone;
|
||||
left_zone.name = "Left Strip";
|
||||
left_zone.type = ZONE_TYPE_LINEAR;
|
||||
std::vector<int> left_zone_map;
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
left_zone_map.push_back(i);
|
||||
}
|
||||
left_zone.map.push_back(left_zone_map);
|
||||
zones.push_back(left_zone);
|
||||
|
||||
zone right_zone;
|
||||
right_zone.name = "Right Strip";
|
||||
right_zone.type = ZONE_TYPE_LINEAR;
|
||||
std::vector<int> right_zone_map;
|
||||
for(int i = 7; i < 19; i++)
|
||||
{
|
||||
right_zone_map.push_back(i);
|
||||
}
|
||||
right_zone.map.push_back(right_zone_map);
|
||||
zones.push_back(right_zone);
|
||||
|
||||
zone logo_zone;
|
||||
logo_zone.name = "Logo";
|
||||
logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
std::vector<int> logo_zone_map;
|
||||
logo_zone_map.push_back(19);
|
||||
logo_zone.map.push_back(logo_zone_map);
|
||||
zones.push_back(logo_zone);
|
||||
|
||||
zone wheel_zone;
|
||||
wheel_zone.name = "Mouse Wheel";
|
||||
wheel_zone.type = ZONE_TYPE_SINGLE;
|
||||
std::vector<int> wheel_zone_map;
|
||||
wheel_zone_map.push_back(20);
|
||||
wheel_zone.map.push_back(wheel_zone_map);
|
||||
zones.push_back(wheel_zone);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_DEATHADDER_CHROMA:
|
||||
{
|
||||
SetupNonMatrixDevice(dev_path);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
RGBColor new_color = 0x00000000;
|
||||
colors.push_back(new_color);
|
||||
}
|
||||
|
||||
led logo_led;
|
||||
logo_led.name = "Logo";
|
||||
leds.push_back(logo_led);
|
||||
|
||||
led wheel_led;
|
||||
wheel_led.name = "Mouse Wheel";
|
||||
leds.push_back(wheel_led);
|
||||
|
||||
zone logo_zone;
|
||||
logo_zone.name = "Logo";
|
||||
logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
std::vector<int> logo_zone_map;
|
||||
logo_zone_map.push_back(0);
|
||||
logo_zone.map.push_back(logo_zone_map);
|
||||
zones.push_back(logo_zone);
|
||||
|
||||
zone wheel_zone;
|
||||
wheel_zone.name = "Mouse Wheel";
|
||||
wheel_zone.type = ZONE_TYPE_SINGLE;
|
||||
std::vector<int> wheel_zone_map;
|
||||
wheel_zone_map.push_back(1);
|
||||
wheel_zone.map.push_back(wheel_zone_map);
|
||||
zones.push_back(wheel_zone);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_DEATHSTALKER_CHROMA:
|
||||
{
|
||||
SetupMatrixDevice(dev_path, 1, 12);
|
||||
|
||||
for(int i = 0; i < 12; i++)
|
||||
{
|
||||
RGBColor new_color = 0x00000000;
|
||||
colors.push_back(new_color);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "Keyboard";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
zone keyboard_zone;
|
||||
keyboard_zone.name = "Keyboard";
|
||||
keyboard_zone.type = ZONE_TYPE_LINEAR;
|
||||
std::vector<int> keyboard_zone_map;
|
||||
for(int i = 0; i < 12; i++)
|
||||
{
|
||||
keyboard_zone_map.push_back(i);
|
||||
}
|
||||
keyboard_zone.map.push_back(keyboard_zone_map);
|
||||
zones.push_back(keyboard_zone);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_TARTARUS_CHROMA:
|
||||
{
|
||||
SetupMatrixDevice(dev_path, 1, 1);
|
||||
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
RGBColor new_color = 0x00000000;
|
||||
colors.push_back(new_color);
|
||||
}
|
||||
|
||||
led logo_led;
|
||||
logo_led.name = "Keypad";
|
||||
leds.push_back(logo_led);
|
||||
|
||||
zone logo_zone;
|
||||
logo_zone.name = "Keypad";
|
||||
logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
std::vector<int> logo_zone_map;
|
||||
logo_zone_map.push_back(0);
|
||||
logo_zone.map.push_back(logo_zone_map);
|
||||
zones.push_back(logo_zone);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_CORE:
|
||||
{
|
||||
SetupMatrixDevice(dev_path, 1, 9);
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
RGBColor new_color = 0x00000000;
|
||||
colors.push_back(new_color);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "GPU Lighting";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "LED Strip";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
zone zone_1;
|
||||
zone_1.name = "GPU Lighting";
|
||||
zone_1.type = ZONE_TYPE_SINGLE;
|
||||
std::vector<int> zone_1_map;
|
||||
for(int i = 0; i < 1; i++)
|
||||
{
|
||||
zone_1_map.push_back(i);
|
||||
}
|
||||
zone_1.map.push_back(zone_1_map);
|
||||
zones.push_back(zone_1);
|
||||
|
||||
zone zone_2;
|
||||
zone_2.name = "LED Strip";
|
||||
zone_2.type = ZONE_TYPE_LINEAR;
|
||||
std::vector<int> zone_2_map;
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
zone_2_map.push_back(i);
|
||||
}
|
||||
zone_2.map.push_back(zone_2_map);
|
||||
zones.push_back(zone_2);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_FIREFLY_CHROMA:
|
||||
{
|
||||
SetupMatrixDevice(dev_path, 1, 15);
|
||||
|
||||
for(int i = 0; i < 15; i++)
|
||||
{
|
||||
RGBColor new_color = 0x00000000;
|
||||
colors.push_back(new_color);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "LED Strip";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
zone zone_1;
|
||||
zone_1.name = "LED Strip";
|
||||
zone_1.type = ZONE_TYPE_LINEAR;
|
||||
std::vector<int> zone_1_map;
|
||||
for(int i = 0; i < 15; i++)
|
||||
{
|
||||
zone_1_map.push_back(i);
|
||||
}
|
||||
zone_1.map.push_back(zone_1_map);
|
||||
zones.push_back(zone_1);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_GOLIATHUS_EXTENDED_CHROMA:
|
||||
{
|
||||
SetupMatrixDevice(dev_path, 1, 1);
|
||||
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
RGBColor new_color = 0x00000000;
|
||||
colors.push_back(new_color);
|
||||
}
|
||||
|
||||
led logo_led;
|
||||
logo_led.name = "Logo";
|
||||
leds.push_back(logo_led);
|
||||
|
||||
zone logo_zone;
|
||||
logo_zone.name = "Logo";
|
||||
logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
std::vector<int> logo_zone_map;
|
||||
logo_zone_map.push_back(0);
|
||||
logo_zone.map.push_back(logo_zone_map);
|
||||
zones.push_back(logo_zone);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_MUG_HOLDER:
|
||||
{
|
||||
SetupMatrixDevice(dev_path, 1, 15);
|
||||
|
||||
for(int i = 0; i < 15; i++)
|
||||
{
|
||||
RGBColor new_color = 0x00000000;
|
||||
colors.push_back(new_color);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "LED Strip";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
zone keyboard_zone;
|
||||
keyboard_zone.name = "LED Strip";
|
||||
keyboard_zone.type = ZONE_TYPE_LINEAR;
|
||||
std::vector<int> keyboard_zone_map;
|
||||
for(int i = 0; i < 15; i++)
|
||||
{
|
||||
keyboard_zone_map.push_back(i);
|
||||
}
|
||||
keyboard_zone.map.push_back(keyboard_zone_map);
|
||||
zones.push_back(keyboard_zone);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_KRAKEN_V1:
|
||||
case RAZER_KRAKEN_V2:
|
||||
{
|
||||
SetupMatrixDevice(dev_path, 1, 1);
|
||||
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
RGBColor new_color = 0x00000000;
|
||||
colors.push_back(new_color);
|
||||
}
|
||||
|
||||
led logo_led;
|
||||
logo_led.name = "Logo";
|
||||
leds.push_back(logo_led);
|
||||
|
||||
zone logo_zone;
|
||||
logo_zone.name = "Logo";
|
||||
logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
std::vector<int> logo_zone_map;
|
||||
logo_zone_map.push_back(0);
|
||||
logo_zone.map.push_back(logo_zone_map);
|
||||
zones.push_back(logo_zone);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_CHROMA_HDK:
|
||||
{
|
||||
SetupMatrixDevice(dev_path, 4, 16);
|
||||
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
RGBColor new_color = 0x00000000;
|
||||
colors.push_back(new_color);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "LED Strip";
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
zone* new_zone = new zone();
|
||||
new_zone->name = "LED Strip";
|
||||
new_zone->type = ZONE_TYPE_LINEAR;
|
||||
|
||||
std::vector<int>* new_zone_map = new std::vector<int>();
|
||||
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
new_zone_map->push_back((i * 16) + j);
|
||||
}
|
||||
|
||||
new_zone->map.push_back(*new_zone_map);
|
||||
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_OpenRazer.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRazer |
|
||||
| kernel drivers for Chroma peripherals |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/15/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include <fstream>
|
||||
|
||||
class RGBController_OpenRazer : public RGBController
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
RAZER_NO_DEVICE,
|
||||
RAZER_BLACKWIDOW_CHROMA,
|
||||
RAZER_DEATHSTALKER_CHROMA,
|
||||
RAZER_ORNATA_CHROMA,
|
||||
RAZER_BLADE_STEALTH,
|
||||
RAZER_BLADE_PRO,
|
||||
RAZER_TARTARUS_CHROMA,
|
||||
RAZER_DEATHADDER_CHROMA,
|
||||
RAZER_DEATHADDER_ELITE,
|
||||
RAZER_NAGA_CHROMA,
|
||||
RAZER_DIAMONDBACK_CHROMA,
|
||||
RAZER_MAMBA_TOURNAMENT_EDITION_CHROMA,
|
||||
RAZER_FIREFLY_CHROMA,
|
||||
RAZER_GOLIATHUS_EXTENDED_CHROMA,
|
||||
RAZER_MUG_HOLDER,
|
||||
RAZER_CORE,
|
||||
RAZER_KRAKEN_V1,
|
||||
RAZER_KRAKEN_V2,
|
||||
RAZER_CHROMA_HDK,
|
||||
RAZER_NUM_DEVICES
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RAZER_MODE_CUSTOM,
|
||||
RAZER_MODE_OFF,
|
||||
RAZER_MODE_STATIC,
|
||||
RAZER_MODE_BREATHING,
|
||||
RAZER_MODE_SPECTRUM_CYCLE,
|
||||
RAZER_MODE_WAVE,
|
||||
RAZER_MODE_REACTIVE,
|
||||
RAZER_NUM_MODES
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RAZER_TYPE_MATRIX_FRAME,
|
||||
RAZER_TYPE_MATRIX_NOFRAME,
|
||||
RAZER_TYPE_NOMATRIX,
|
||||
RAZER_NUM_TYPES
|
||||
};
|
||||
|
||||
public:
|
||||
RGBController_OpenRazer(std::string dev_path);
|
||||
int GetMode();
|
||||
void SetMode(int mode);
|
||||
void SetCustomMode();
|
||||
void SetAllLEDs(RGBColor color);
|
||||
void SetAllZoneLEDs(int zone, RGBColor color);
|
||||
void SetLED(int led, RGBColor color);
|
||||
void UpdateLEDs();
|
||||
|
||||
unsigned int device;
|
||||
|
||||
private:
|
||||
void SetupMatrixDevice(std::string dev_path, unsigned int rows, unsigned int cols);
|
||||
void SetupNonMatrixDevice(std::string dev_path);
|
||||
unsigned int GetTypeFromDeviceName(std::string dev_name);
|
||||
|
||||
unsigned int type;
|
||||
unsigned int matrix_rows;
|
||||
unsigned int matrix_cols;
|
||||
|
||||
//OpenRazer Sysfs Entries for Matrix Devices
|
||||
std::ofstream matrix_custom_frame;
|
||||
std::ofstream matrix_effect_custom;
|
||||
std::ofstream matrix_effect_breath;
|
||||
std::ofstream matrix_effect_none;
|
||||
std::ofstream matrix_effect_reactive;
|
||||
std::ofstream matrix_effect_spectrum;
|
||||
std::ofstream matrix_effect_static;
|
||||
std::ofstream matrix_effect_wave;
|
||||
|
||||
//OpenRazer Sysfs Entries for Non-Matrix Devices
|
||||
std::ofstream logo_led_effect;
|
||||
std::ofstream logo_led_rgb;
|
||||
std::ofstream scroll_led_effect;
|
||||
std::ofstream scroll_led_rgb;
|
||||
};
|
||||
@@ -0,0 +1,189 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_RazerChromaSDK.h |
|
||||
| |
|
||||
| Generic RGB Interface for official Razer |
|
||||
| Chroma SDK |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 9/2/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_RazerChromaSDK.h"
|
||||
|
||||
CREATEEFFECT RGBController_RazerChromaSDK::CreateEffect = NULL;
|
||||
CREATEKEYBOARDEFFECT RGBController_RazerChromaSDK::CreateKeyboardEffect = NULL;
|
||||
CREATEMOUSEEFFECT RGBController_RazerChromaSDK::CreateMouseEffect = NULL;
|
||||
CREATEMOUSEPADEFFECT RGBController_RazerChromaSDK::CreateMousepadEffect = NULL;
|
||||
CREATEHEADSETEFFECT RGBController_RazerChromaSDK::CreateHeadsetEffect = NULL;
|
||||
CREATECHROMALINKEFFECT RGBController_RazerChromaSDK::CreateChromaLinkEffect = NULL;
|
||||
|
||||
RGBController_RazerChromaSDK::RGBController_RazerChromaSDK(unsigned int device_type, HMODULE* hModule)
|
||||
{
|
||||
unsigned int led_count = 0;
|
||||
|
||||
for (int i = 0; i < RAZER_NUM_DEVICES; i++)
|
||||
{
|
||||
if (device_list[i]->type == device_type)
|
||||
{
|
||||
name = device_list[i]->name;
|
||||
|
||||
for (int zone_id = 0; zone_id < RAZER_MAX_ZONES; zone_id++)
|
||||
{
|
||||
if (device_list[i]->zones[zone_id] != NULL)
|
||||
{
|
||||
device = device_list[i];
|
||||
|
||||
zone* new_zone = new zone();
|
||||
new_zone->name = device_list[i]->zones[zone_id]->name;
|
||||
new_zone->type = device_list[i]->zones[zone_id]->type;
|
||||
|
||||
std::vector<int> new_zone_map;
|
||||
|
||||
for (int led_id = 0; led_id < device_list[i]->zones[zone_id]->leds; led_id++)
|
||||
{
|
||||
RGBColor new_color = 0x00000000;
|
||||
colors.push_back(new_color);
|
||||
|
||||
led* new_led = new led();
|
||||
new_led->name = device_list[i]->zones[zone_id]->name;
|
||||
leds.push_back(*new_led);
|
||||
|
||||
new_zone_map.push_back(led_count);
|
||||
|
||||
led_count++;
|
||||
}
|
||||
|
||||
new_zone->map.push_back(new_zone_map);
|
||||
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(CreateEffect == NULL) CreateEffect = (CREATEEFFECT)GetProcAddress(*hModule, "CreateEffect");
|
||||
if(CreateKeyboardEffect == NULL) CreateKeyboardEffect = (CREATEKEYBOARDEFFECT)GetProcAddress(*hModule, "CreateKeyboardEffect");
|
||||
if(CreateMouseEffect == NULL) CreateMouseEffect = (CREATEMOUSEEFFECT)GetProcAddress(*hModule, "CreateMouseEffect");
|
||||
if(CreateMousepadEffect == NULL) CreateMousepadEffect = (CREATEMOUSEPADEFFECT)GetProcAddress(*hModule, "CreateMousepadEffect");
|
||||
if(CreateHeadsetEffect == NULL) CreateHeadsetEffect = (CREATEHEADSETEFFECT)GetProcAddress(*hModule, "CreateHeadsetEffect");
|
||||
if(CreateChromaLinkEffect == NULL) CreateChromaLinkEffect = (CREATECHROMALINKEFFECT)GetProcAddress(*hModule, "CreateChromaLinkEffect");
|
||||
}
|
||||
|
||||
int RGBController_RazerChromaSDK::GetMode()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGBController_RazerChromaSDK::SetMode(int mode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_RazerChromaSDK::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_RazerChromaSDK::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
for (int i = 0; i < colors.size(); i++)
|
||||
{
|
||||
colors[i] = color;
|
||||
}
|
||||
|
||||
UpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_RazerChromaSDK::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
for (int x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (int y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
colors[zones[zone].map[x][y]] = color;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_RazerChromaSDK::SetLED(int led, RGBColor color)
|
||||
{
|
||||
colors[led] = color;
|
||||
|
||||
UpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_RazerChromaSDK::UpdateLEDs()
|
||||
{
|
||||
switch (device->type)
|
||||
{
|
||||
case RAZER_GENERIC_MOUSE:
|
||||
{
|
||||
ChromaSDK::Mouse::CUSTOM_EFFECT_TYPE2 MouseEffect = {};
|
||||
|
||||
std::vector<int> left_zone_map = zones[0].map[0];
|
||||
|
||||
for (int left = 1; left < 8; left++)
|
||||
{
|
||||
MouseEffect.Color[left][0] = colors[left_zone_map[left - 1]];
|
||||
}
|
||||
|
||||
std::vector<int> right_zone_map = zones[1].map[0];
|
||||
|
||||
for (int right = 1; right < 8; right++)
|
||||
{
|
||||
MouseEffect.Color[right][6] = colors[right_zone_map[right - 1]];
|
||||
}
|
||||
|
||||
std::vector<int> bottom_zone_map = zones[2].map[0];
|
||||
|
||||
for (int bottom = 1; bottom < 6; bottom++)
|
||||
{
|
||||
MouseEffect.Color[8][bottom] = colors[bottom_zone_map[bottom - 1]];
|
||||
}
|
||||
|
||||
std::vector<int> scroll_wheel_zone_map = zones[3].map[0];
|
||||
|
||||
MouseEffect.Color[2][3] = colors[scroll_wheel_zone_map[0]];
|
||||
|
||||
std::vector<int> logo_zone_map = zones[4].map[0];
|
||||
|
||||
MouseEffect.Color[7][3] = colors[logo_zone_map[0]];
|
||||
|
||||
std::vector<int> numpad_backlight_zone_map = zones[5].map[0];
|
||||
|
||||
MouseEffect.Color[4][3] = colors[numpad_backlight_zone_map[0]];
|
||||
|
||||
CreateMouseEffect(ChromaSDK::Mouse::CHROMA_CUSTOM2, &MouseEffect, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_GENERIC_MOUSEPAD:
|
||||
{
|
||||
ChromaSDK::Mousepad::CUSTOM_EFFECT_TYPE MousepadEffect = {};
|
||||
|
||||
for (int x = 0; x < 15; x++)
|
||||
{
|
||||
MousepadEffect.Color[x] = colors[x];
|
||||
}
|
||||
|
||||
CreateMousepadEffect(ChromaSDK::Mousepad::CHROMA_CUSTOM, &MousepadEffect, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_CHROMA_HDK:
|
||||
{
|
||||
ChromaSDK::CUSTOM_EFFECT_TYPE ChromaBoxEffect = {};
|
||||
|
||||
for (int x = 0; x < 16; x++)
|
||||
{
|
||||
for (int y = 0; y < 4; y++)
|
||||
{
|
||||
ChromaBoxEffect.Color[y][x] = colors[(y*16) + x];
|
||||
}
|
||||
}
|
||||
CreateEffect(ChromaSDK::CHROMABOX, ChromaSDK::CHROMA_CUSTOM, &ChromaBoxEffect, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_RazerChromaSDK.h |
|
||||
| |
|
||||
| Generic RGB Interface for official Razer |
|
||||
| Chroma SDK |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 9/2/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include <Windows.h>
|
||||
|
||||
#include "RzChromaSDKDefines.h"
|
||||
#include "RzChromaSDKTypes.h"
|
||||
#include "RzErrors.h"
|
||||
|
||||
using namespace ChromaSDK::Keyboard;
|
||||
|
||||
typedef RZRESULT(*INIT)(void);
|
||||
typedef RZRESULT(*UNINIT)(void);
|
||||
typedef RZRESULT(*CREATEEFFECT)(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
|
||||
typedef RZRESULT(*CREATEKEYBOARDEFFECT)(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
|
||||
typedef RZRESULT(*CREATEMOUSEEFFECT)(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
|
||||
typedef RZRESULT(*CREATEMOUSEPADEFFECT)(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
|
||||
typedef RZRESULT(*CREATEHEADSETEFFECT)(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
|
||||
typedef RZRESULT(*CREATECHROMALINKEFFECT)(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
|
||||
|
||||
#define RAZER_MAX_ZONES 6
|
||||
#define RAZER_NUM_DEVICES 3
|
||||
|
||||
enum
|
||||
{
|
||||
RAZER_GENERIC_KEYBOARD,
|
||||
RAZER_GENERIC_MOUSE,
|
||||
RAZER_GENERIC_MOUSEPAD,
|
||||
RAZER_CHROMA_HDK
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RAZER_MODE_CUSTOM,
|
||||
RAZER_MODE_OFF,
|
||||
RAZER_MODE_STATIC,
|
||||
RAZER_MODE_BREATHING,
|
||||
RAZER_MODE_SPECTRUM_CYCLE,
|
||||
RAZER_MODE_WAVE,
|
||||
RAZER_MODE_REACTIVE,
|
||||
RAZER_NUM_MODES
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::string name;
|
||||
unsigned int type;
|
||||
unsigned int leds;
|
||||
} razer_zone;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::string name;
|
||||
unsigned int type;
|
||||
const razer_zone* zones[RAZER_MAX_ZONES];
|
||||
} razer_device;
|
||||
|
||||
/*------------------------------------------------------------ *\
|
||||
| Razer Generic Mouse |
|
||||
| |
|
||||
| Zone "Left" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| |
|
||||
| Zone "Right" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| |
|
||||
| Zone "Bottom" |
|
||||
| Linear |
|
||||
| 5 LEDs |
|
||||
| |
|
||||
| Zone "Scroll Wheel" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
| |
|
||||
| Zone "Numpad/Backlight" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone mouse_left_zone =
|
||||
{
|
||||
"Left LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
7
|
||||
};
|
||||
|
||||
static const razer_zone mouse_right_zone =
|
||||
{
|
||||
"Right LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
7
|
||||
};
|
||||
|
||||
static const razer_zone mouse_bottom_zone =
|
||||
{
|
||||
"Bottom LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
5
|
||||
};
|
||||
|
||||
static const razer_zone mouse_scroll_wheel_zone =
|
||||
{
|
||||
"Scroll Wheel",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_zone mouse_logo_zone =
|
||||
{
|
||||
"Logo",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_zone mouse_numpad_backlight_zone =
|
||||
{
|
||||
"Numpad/Backlight",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_device mouse_device =
|
||||
{
|
||||
"Razer Generic Mouse",
|
||||
RAZER_GENERIC_MOUSE,
|
||||
{
|
||||
&mouse_left_zone,
|
||||
&mouse_right_zone,
|
||||
&mouse_bottom_zone,
|
||||
&mouse_scroll_wheel_zone,
|
||||
&mouse_logo_zone,
|
||||
&mouse_numpad_backlight_zone
|
||||
}
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------ *\
|
||||
| Razer Generic Mousepad (Firefly, Mug Holder) |
|
||||
| |
|
||||
| Zone "LED Strip" |
|
||||
| Linear |
|
||||
| 15 LEDs |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone mousepad_zone =
|
||||
{
|
||||
"LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
15
|
||||
};
|
||||
|
||||
static const razer_device mousepad_device =
|
||||
{
|
||||
"Razer Generic Mousepad",
|
||||
RAZER_GENERIC_MOUSEPAD,
|
||||
{
|
||||
&mousepad_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------ *\
|
||||
| Razer Chroma HDK |
|
||||
| |
|
||||
| Zone "LED Strip" |
|
||||
| Linear |
|
||||
| 16 LEDs |
|
||||
| |
|
||||
| Zone "LED Strip" |
|
||||
| Linear |
|
||||
| 16 LEDs |
|
||||
| |
|
||||
| Zone "LED Strip" |
|
||||
| Linear |
|
||||
| 16 LEDs |
|
||||
| |
|
||||
| Zone "LED Strip" |
|
||||
| Linear |
|
||||
| 16 LEDs |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone chromahdk_zone =
|
||||
{
|
||||
"LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
16
|
||||
};
|
||||
|
||||
static const razer_device chromahdk_device =
|
||||
{
|
||||
"Razer Chroma HDK",
|
||||
RAZER_CHROMA_HDK,
|
||||
{
|
||||
&chromahdk_zone,
|
||||
&chromahdk_zone,
|
||||
&chromahdk_zone,
|
||||
&chromahdk_zone,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
static const razer_device* device_list[RAZER_NUM_DEVICES] =
|
||||
{
|
||||
&mouse_device,
|
||||
&mousepad_device,
|
||||
&chromahdk_device
|
||||
};
|
||||
|
||||
class RGBController_RazerChromaSDK : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_RazerChromaSDK(unsigned int device_type, HMODULE* hModule);
|
||||
int GetMode();
|
||||
void SetMode(int mode);
|
||||
void SetCustomMode();
|
||||
void SetAllLEDs(RGBColor color);
|
||||
void SetAllZoneLEDs(int zone, RGBColor color);
|
||||
void SetLED(int led, RGBColor color);
|
||||
void UpdateLEDs();
|
||||
|
||||
private:
|
||||
const razer_device* device;
|
||||
|
||||
static CREATEEFFECT CreateEffect;
|
||||
static CREATEKEYBOARDEFFECT CreateKeyboardEffect;
|
||||
static CREATEMOUSEEFFECT CreateMouseEffect;
|
||||
static CREATEMOUSEPADEFFECT CreateMousepadEffect;
|
||||
static CREATEHEADSETEFFECT CreateHeadsetEffect;
|
||||
static CREATECHROMALINKEFFECT CreateChromaLinkEffect;
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_RazerChromaSDK.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
static HMODULE hModule;
|
||||
|
||||
#include "RzChromaSDKDefines.h"
|
||||
#include "RzChromaSDKTypes.h"
|
||||
#include "RzErrors.h"
|
||||
|
||||
using namespace ChromaSDK::Keyboard;
|
||||
|
||||
typedef RZRESULT(*INIT)(void);
|
||||
typedef RZRESULT(*UNINIT)(void);
|
||||
typedef RZRESULT(*CREATEEFFECT)(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
|
||||
typedef RZRESULT(*CREATEKEYBOARDEFFECT)(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
|
||||
typedef RZRESULT(*CREATEMOUSEEFFECT)(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
|
||||
typedef RZRESULT(*CREATEMOUSEPADEFFECT)(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
|
||||
typedef RZRESULT(*CREATEHEADSETEFFECT)(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
|
||||
typedef RZRESULT(*CREATECHROMALINKEFFECT)(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId);
|
||||
|
||||
#ifdef _WIN64
|
||||
#define CHROMASDKDLL ("RzChromaSDK64.dll")
|
||||
#else
|
||||
#define CHROMASDKDLL ("RzChromaSDK.dll")
|
||||
#endif
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectRazerChromaSDKControllers *
|
||||
* *
|
||||
* Detect devices supported by the Razer Chroma SDK *
|
||||
* * *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectRazerChromaSDKControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
RGBController_RazerChromaSDK* razer_rgb;
|
||||
|
||||
// Dynamically loads the Chroma SDK library.
|
||||
hModule = LoadLibrary(CHROMASDKDLL);
|
||||
if (hModule)
|
||||
{
|
||||
INIT Init = (INIT)GetProcAddress(hModule, "Init");
|
||||
if (Init)
|
||||
{
|
||||
//Initialize the SDK
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
razer_rgb = new RGBController_RazerChromaSDK(RAZER_GENERIC_MOUSE, &hModule);
|
||||
|
||||
rgb_controllers.push_back(razer_rgb);
|
||||
|
||||
razer_rgb = new RGBController_RazerChromaSDK(RAZER_GENERIC_MOUSEPAD, &hModule);
|
||||
|
||||
rgb_controllers.push_back(razer_rgb);
|
||||
|
||||
razer_rgb = new RGBController_RazerChromaSDK(RAZER_CHROMA_HDK, &hModule);
|
||||
|
||||
rgb_controllers.push_back(razer_rgb);
|
||||
|
||||
} /* DetectRazerChromaSDKControllers() */
|
||||
@@ -0,0 +1,62 @@
|
||||
//! \file RzChromaLinkAPI.h
|
||||
//! \brief Exported APIs.
|
||||
|
||||
#ifndef _RZCHROMALINKAPI_H_
|
||||
#define _RZCHROMALINKAPI_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RzErrors.h"
|
||||
#include "RzChromaSDKTypes.h"
|
||||
|
||||
using namespace ChromaSDK;
|
||||
|
||||
// Callback funtion
|
||||
typedef LONG(*LPCHROMALINKPROC)(ChromaLink::EFFECT_TYPE Effect, PRZPARAM pData);
|
||||
|
||||
// Exported functions
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
/*!
|
||||
* Initialize Chroma Link API.
|
||||
* @return <b>RZRESULT_ALREADY_INITIALIZED</b>: Chroma Link API has already been initialized.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT Init(ChromaSDK::APPINFOTYPE AppInfo);
|
||||
|
||||
/*!
|
||||
* UnInitialize Chroma API.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT UnInit(void);
|
||||
|
||||
/*!
|
||||
* Register for Chroma Link effect events.
|
||||
* @param[in] lpFunc Callback function.
|
||||
* @return <b>ERROR_INVALID_PARAMETER</b>: lpFunc is invalid.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
* @remark
|
||||
* - <b>CHROMA_NONE</b> : This event will be sent when there are no more Chroma Link events.
|
||||
* Clients can resume their own lighting effects.
|
||||
* - <b>CHROMA_CUSTOM</b> : This event will be sent when there is a ChromaSDK::ChromaLink::CHROMA_CUSTOM effect event.
|
||||
* pData is casted to ChromaSDK::ChromaLink::CUSTOM_EFFECT_TYPE.
|
||||
* The colors of each (5) LEDs can be accessed from the array.
|
||||
* - <b>CHROMA_STATIC</b> : This event will be sent when there is a ChromaSDK::ChromaLink::CHROMA_STATIC effect event.
|
||||
* pData is casted to ChromaSDK::ChromaLink::STATIC_EFFECT_TYPE.
|
||||
* The color can be accessed from the structure.
|
||||
*/
|
||||
RZRESULT RegisterEventNotification(LPCHROMALINKPROC lpFunc);
|
||||
|
||||
/*!
|
||||
* Register for Chroma Link effect events.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT UnregisterEventNotification(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _RZCHROMALINKAPI_H_
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
|
||||
//! \file RzChromaSDK.h
|
||||
//! \brief Exported APIs.
|
||||
|
||||
#ifndef _RZCHROMASDK_H_
|
||||
#define _RZCHROMASDK_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RzErrors.h"
|
||||
#include "RzChromaSDKDefines.h"
|
||||
#include "RzChromaSDKTypes.h"
|
||||
|
||||
using namespace ChromaSDK;
|
||||
using namespace ChromaSDK::Keyboard;
|
||||
using namespace ChromaSDK::Mouse;
|
||||
using namespace ChromaSDK::Headset;
|
||||
using namespace ChromaSDK::Mousepad;
|
||||
using namespace ChromaSDK::Keypad;
|
||||
using namespace ChromaSDK::ChromaLink;
|
||||
|
||||
// Exported functions
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Initialize Chroma SDK.
|
||||
* @return <b>RZRESULT_SERVICE_NOT_ACTIVE</b>: Chroma SDK Service not running.
|
||||
* @return <b>RZRESULT_ALREADY_INITIALIZED</b>: Chroma SDK has already been initialized.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT Init(void);
|
||||
|
||||
/*!
|
||||
* UnInitialize Chroma SDK.
|
||||
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. For every Init() call there should be a corresponding UnInit().
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT UnInit(void);
|
||||
|
||||
/*!
|
||||
* Create generic effect for specific or all devices.
|
||||
* @param[in] DeviceId Device Id defined in RzChromaSDKDefines.h
|
||||
* @param[in] Effect Standard effect type.
|
||||
* @param[in] pParam Pointer to a parameter type specified by Effect.
|
||||
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
|
||||
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
|
||||
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
|
||||
* @return <b>RZRESULT_DEVICE_NOT_AVAILABLE</b>: Device not supported.
|
||||
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT CreateEffect(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
|
||||
|
||||
/*!
|
||||
* Create keyboard effect.
|
||||
* @param[in] Effect Keyboard effect type.
|
||||
* @param[in] pParam Pointer to a parameter type specified by Effect.
|
||||
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
|
||||
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
|
||||
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
|
||||
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT CreateKeyboardEffect(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
|
||||
|
||||
/*!
|
||||
* Create mouse effect.
|
||||
* @param[in] Effect Mouse effect type.
|
||||
* @param[in] pParam Pointer to a parameter type specified by Effect.
|
||||
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
|
||||
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
|
||||
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
|
||||
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT CreateMouseEffect(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
|
||||
|
||||
/*!
|
||||
* Create headset effect.
|
||||
* @param[in] Effect Headset effect type.
|
||||
* @param[in] pParam Pointer to a parameter type specified by Effect defined in RzChromaSDKTypes.h
|
||||
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
|
||||
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
|
||||
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
|
||||
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT CreateHeadsetEffect(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
|
||||
|
||||
/*!
|
||||
* Create mousepad effect.
|
||||
* @param[in] Effect Mousemat effect type.
|
||||
* @param[in] pParam Pointer to a parameter type specified by Effect defined in RzChromaSDKTypes.h
|
||||
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
|
||||
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
|
||||
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
|
||||
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT CreateMousepadEffect(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
|
||||
|
||||
/*!
|
||||
* Create keypad effect.
|
||||
* @param[in] Effect Keypad effect type.
|
||||
* @param[in] pParam Pointer to a parameter type specified by Effect defined in RzChromaSDKTypes.h
|
||||
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
|
||||
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
|
||||
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
|
||||
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT CreateKeypadEffect(ChromaSDK::Keypad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
|
||||
|
||||
/*!
|
||||
* Create effects on Chroma Linked devices.
|
||||
* @param[in] Effect Chroma Link effect type.
|
||||
* @param[in] pParam Pointer to a parameter type specified by Effect defined in RzChromaSDKTypes.h
|
||||
* @param[in,out] pEffectId Valid effect Id if successful. Set it to NULL if not required.
|
||||
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
|
||||
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
|
||||
* @return <b>RZRESULT_NOT_SUPPORTED</b>: Effect not supported for this device.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT CreateChromaLinkEffect(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId);
|
||||
|
||||
/*!
|
||||
* Delete effect
|
||||
* @param[in] EffectId Id of the effect that needs to be deleted.
|
||||
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
|
||||
* @return <b>RZRESULT_NOT_FOUND</b>: Effect Id not found.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT DeleteEffect(RZEFFECTID EffectId);
|
||||
|
||||
/*!
|
||||
* Set effect.
|
||||
* @param[in] EffectId Id of the effect that needs to be set.
|
||||
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
|
||||
* @return <b>RZRESULT_ACCESS_DENIED</b>: No permision to access device.
|
||||
* @return <b>RZRESULT_NOT_FOUND</b>: Effect Id not found.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT SetEffect(RZEFFECTID EffectId);
|
||||
|
||||
/*!
|
||||
* Register for event notification.
|
||||
* @param[in] hWnd Application window handle.
|
||||
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Chroma SDK not in a valid state. Did you forgot to call Init()?
|
||||
* @return <b>RZRESULT_ALREADY_INITIALIZED</b>: Invalid Windows handle.
|
||||
* @return <b>RZRESULT_INVALID_PARAMETER</b>: Invalid parameter.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
* @remark <b>WM_CHROMA_EVENT</b> will be sent if there is an event.
|
||||
* @remark
|
||||
* - \c <b>wParam</b> = 1 : Chroma SDK support.
|
||||
* - \c <b>lParam</b> = 1 : Enabled.
|
||||
* - \c <b>lParam</b> = 0 : Disabled.
|
||||
* - \c <b>wParam</b> = 2 : Access to device.
|
||||
* - \c <b>lParam</b> = 1 : Granted accessible.
|
||||
* - \c <b>lParam</b> = 0 = Access revoked.
|
||||
* - \c <b>wParam</b> = 3 : Application state.
|
||||
* - \c <b>lParam</b> = 1 : Enabled.
|
||||
* - \c <b>lParam</b> = 0 = Disabled.
|
||||
*/
|
||||
RZRESULT RegisterEventNotification(HWND hWnd);
|
||||
|
||||
/*!
|
||||
* Un-register for event notification.
|
||||
* @return <b>RZRESULT_NOT_VALID_STATE</b>: Internal state is not valid. There was no event registered.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT UnregisterEventNotification();
|
||||
|
||||
/*!
|
||||
* Query for device information.
|
||||
* @param[in] DeviceId Device id found in RzChromaSDKDefines.h
|
||||
* @param[out] DeviceInfo Contains device information specified by DeviceId.
|
||||
* @return <b>RZRESULT_DEVICE_NOT_AVAILABLE</b>: Device not supported.
|
||||
* @return For other error codes, please refer to [Windows System Error Codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx) from Windows SDK (WinError.h).
|
||||
*/
|
||||
RZRESULT QueryDevice(RZDEVICEID DeviceId, DEVICE_INFO_TYPE &DeviceInfo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,182 @@
|
||||
//! \file RzChromaSDKDefines.h
|
||||
//! \brief Definitions of global and static variables.
|
||||
|
||||
#ifndef _RZSCHROMADKDEFINES_H_
|
||||
#define _RZSCHROMADKDEFINES_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef GUID_DEFINED
|
||||
#include <Guiddef.h>
|
||||
#endif
|
||||
|
||||
namespace ChromaSDK
|
||||
{
|
||||
// Keyboards
|
||||
//! Razer Blackwidow Chroma device.
|
||||
// {2EA1BB63-CA28-428D-9F06-196B88330BBB}
|
||||
static const GUID BLACKWIDOW_CHROMA =
|
||||
{ 0x2ea1bb63, 0xca28, 0x428d, { 0x9f, 0x06, 0x19, 0x6b, 0x88, 0x33, 0x0b, 0xbb } };
|
||||
|
||||
//! Razer Blackwidow Chroma Tournament Edition device.
|
||||
// {ED1C1B82-BFBE-418F-B49D-D03F05B149DF}
|
||||
static const GUID BLACKWIDOW_CHROMA_TE =
|
||||
{ 0xed1c1b82, 0xbfbe, 0x418f, { 0xb4, 0x9d, 0xd0, 0x3f, 0x5, 0xb1, 0x49, 0xdf } };
|
||||
|
||||
//! Razer Deathstalker device.
|
||||
// {18C5AD9B-4326-4828-92C4-2669A66D2283}
|
||||
static const GUID DEATHSTALKER_CHROMA =
|
||||
{ 0x18c5ad9b, 0x4326, 0x4828, { 0x92, 0xc4, 0x26, 0x69, 0xa6, 0x6d, 0x22, 0x83 } };
|
||||
|
||||
//! Overwatch Keyboard.
|
||||
// {872AB2A9-7959-4478-9FED-15F6186E72E4}
|
||||
static const GUID OVERWATCH_KEYBOARD =
|
||||
{ 0x872ab2a9, 0x7959, 0x4478, { 0x9f, 0xed, 0x15, 0xf6, 0x18, 0x6e, 0x72, 0xe4 } };
|
||||
|
||||
//! Razer Blackwidow X Chroma device.
|
||||
// {5AF60076-ADE9-43D4-B574-52599293B554}
|
||||
static const GUID BLACKWIDOW_X_CHROMA =
|
||||
{ 0x5af60076, 0xade9, 0x43d4, { 0xb5, 0x74, 0x52, 0x59, 0x92, 0x93, 0xb5, 0x54 } };
|
||||
|
||||
//! Razer Blackwidow X TE Chroma device.
|
||||
// {2D84DD51-3290-4AAC-9A89-D8AFDE38B57C}
|
||||
static const GUID BLACKWIDOW_X_TE_CHROMA =
|
||||
{ 0x2d84dd51, 0x3290, 0x4aac, { 0x9a, 0x89, 0xd8, 0xaf, 0xde, 0x38, 0xb5, 0x7c } };
|
||||
|
||||
//! Razer Ornata Chroma
|
||||
// {803378C1-CC48-4970-8539-D828CC1D420A}
|
||||
static const GUID ORNATA_CHROMA =
|
||||
{ 0x803378c1, 0xcc48, 0x4970,{ 0x85, 0x39, 0xd8, 0x28, 0xcc, 0x1d, 0x42, 0xa } };
|
||||
|
||||
//! Razer Blade Stealth.
|
||||
// {C83BDFE8-E7FC-40E0-99DB-872E23F19891}
|
||||
static const GUID BLADE_STEALTH =
|
||||
{ 0xc83bdfe8, 0xe7fc, 0x40e0, { 0x99, 0xdb, 0x87, 0x2e, 0x23, 0xf1, 0x98, 0x91 } };
|
||||
|
||||
//! Razer Blade
|
||||
// {F2BEDFAF-A0FE-4651-9D41-B6CE603A3DDD}
|
||||
static const GUID BLADE =
|
||||
{ 0xf2bedfaf, 0xa0fe, 0x4651, { 0x9d, 0x41, 0xb6, 0xce, 0x60, 0x3a, 0x3d, 0xdd } };
|
||||
|
||||
//! Razer Blade Pro
|
||||
// {A73AC338-F0E5-4BF7-91AE-DD1F7E1737A5}
|
||||
static const GUID BLADE_PRO =
|
||||
{ 0xa73ac338, 0xf0e5, 0x4bf7,{ 0x91, 0xae, 0xdd, 0x1f, 0x7e, 0x17, 0x37, 0xa5 } };
|
||||
|
||||
|
||||
// Mice
|
||||
//! Razer Deathadder Chroma device.
|
||||
// {AEC50D91-B1F1-452F-8E16-7B73F376FDF3}
|
||||
static const GUID DEATHADDER_CHROMA =
|
||||
{ 0xaec50d91, 0xb1f1, 0x452f, { 0x8e, 0x16, 0x7b, 0x73, 0xf3, 0x76, 0xfd, 0xf3 } };
|
||||
|
||||
//! Razer Mamba Chroma Tournament Edition device.
|
||||
// {7EC00450-E0EE-4289-89D5-0D879C19061A}
|
||||
static const GUID MAMBA_CHROMA_TE =
|
||||
{ 0x7ec00450, 0xe0ee, 0x4289, { 0x89, 0xd5, 0xd, 0x87, 0x9c, 0x19, 0x6, 0x1a } };
|
||||
|
||||
//! Razer Diamondback device.
|
||||
// {FF8A5929-4512-4257-8D59-C647BF9935D0}
|
||||
static const GUID DIAMONDBACK_CHROMA =
|
||||
{ 0xff8a5929, 0x4512, 0x4257, { 0x8d, 0x59, 0xc6, 0x47, 0xbf, 0x99, 0x35, 0xd0 } };
|
||||
|
||||
//! Razer Mamba device.
|
||||
// {D527CBDC-EB0A-483A-9E89-66D50463EC6C}
|
||||
static const GUID MAMBA_CHROMA =
|
||||
{ 0xd527cbdc, 0xeb0a, 0x483a, { 0x9e, 0x89, 0x66, 0xd5, 0x4, 0x63, 0xec, 0x6c } };
|
||||
|
||||
//! Razer Naga Epic device.
|
||||
// {D714C50B-7158-4368-B99C-601ACB985E98}
|
||||
static const GUID NAGA_EPIC_CHROMA =
|
||||
{ 0xd714c50b, 0x7158, 0x4368, { 0xb9, 0x9c, 0x60, 0x1a, 0xcb, 0x98, 0x5e, 0x98 } };
|
||||
|
||||
//! Razer Naga device.
|
||||
// {F1876328-6CA4-46AE-BE04-BE812B414433}
|
||||
static const GUID NAGA_CHROMA =
|
||||
{ 0xf1876328, 0x6ca4, 0x46ae, { 0xbe, 0x4, 0xbe, 0x81, 0x2b, 0x41, 0x44, 0x33 } };
|
||||
|
||||
//! Razer Orochi Chroma device.
|
||||
// {52C15681-4ECE-4DD9-8A52-A1418459EB34}
|
||||
static const GUID OROCHI_CHROMA =
|
||||
{ 0x52c15681, 0x4ece, 0x4dd9, { 0x8a, 0x52, 0xa1, 0x41, 0x84, 0x59, 0xeb, 0x34 } };
|
||||
|
||||
//! Razer Naga Hex Chroma device.
|
||||
// {195D70F5-F285-4CFF-99F2-B8C0E9658DB4}
|
||||
static const GUID NAGA_HEX_CHROMA =
|
||||
{ 0x195d70f5, 0xf285, 0x4cff, { 0x99, 0xf2, 0xb8, 0xc0, 0xe9, 0x65, 0x8d, 0xb4 } };
|
||||
|
||||
//! Razer DeathAdder Elite Chroma device.
|
||||
// {77834867-3237-4A9F-AD77-4A46C4183003}
|
||||
static const GUID DEATHADDER_ELITE_CHROMA =
|
||||
{ 0x77834867, 0x3237, 0x4a9f,{ 0xad, 0x77, 0x4a, 0x46, 0xc4, 0x18, 0x30, 0x3 } };
|
||||
|
||||
|
||||
// Headsets
|
||||
//! Razer Kraken 7.1 Chroma device.
|
||||
// {CD1E09A5-D5E6-4A6C-A93B-E6D9BF1D2092}
|
||||
static const GUID KRAKEN71_CHROMA =
|
||||
{ 0xcd1e09a5, 0xd5e6, 0x4a6c, { 0xa9, 0x3b, 0xe6, 0xd9, 0xbf, 0x1d, 0x20, 0x92 } };
|
||||
|
||||
//! Razer ManO'War device.
|
||||
// {DF3164D7-5408-4A0E-8A7F-A7412F26BEBF}
|
||||
static const GUID MANOWAR_CHROMA =
|
||||
{ 0xdf3164d7, 0x5408, 0x4a0e, { 0x8a, 0x7f, 0xa7, 0x41, 0x2f, 0x26, 0xbe, 0xbf } };
|
||||
|
||||
//! Razer Kraken 7.1 Chroma Refresh headset.
|
||||
// {7FB8A36E-9E74-4BB3-8C86-CAC7F7891EBD}
|
||||
static const GUID KRAKEN71_REFRESH_CHROMA =
|
||||
{ 0x7fb8a36e, 0x9e74, 0x4bb3,{ 0x8c, 0x86, 0xca, 0xc7, 0xf7, 0x89, 0x1e, 0xbd } };
|
||||
|
||||
|
||||
// Mouse mat
|
||||
//! Razer Firefly device.
|
||||
// {80F95A94-73D2-48CA-AE9A-0986789A9AF2}
|
||||
static const GUID FIREFLY_CHROMA =
|
||||
{ 0x80f95a94, 0x73d2, 0x48ca, { 0xae, 0x9a, 0x9, 0x86, 0x78, 0x9a, 0x9a, 0xf2 } };
|
||||
|
||||
|
||||
// Keypads
|
||||
//! Razer Tartarus device.
|
||||
// {00F0545C-E180-4AD1-8E8A-419061CE505E}
|
||||
static const GUID TARTARUS_CHROMA =
|
||||
{ 0xf0545c, 0xe180, 0x4ad1, { 0x8e, 0x8a, 0x41, 0x90, 0x61, 0xce, 0x50, 0x5e } };
|
||||
|
||||
//! Razer Orbweaver device.
|
||||
// {9D24B0AB-0162-466C-9640-7A924AA4D9FD}
|
||||
static const GUID ORBWEAVER_CHROMA =
|
||||
{ 0x9d24b0ab, 0x162, 0x466c, { 0x96, 0x40, 0x7a, 0x92, 0x4a, 0xa4, 0xd9, 0xfd } };
|
||||
|
||||
|
||||
// Chroma Linked devices
|
||||
// {35F6F18D-1AE5-436C-A575-AB44A127903A}
|
||||
static const GUID LENOVO_Y900 =
|
||||
{ 0x35f6f18d, 0x1ae5, 0x436c, { 0xa5, 0x75, 0xab, 0x44, 0xa1, 0x27, 0x90, 0x3a } };
|
||||
|
||||
// {47DB1FA7-6B9B-4EE6-B6F4-4071A3B2053B}
|
||||
static const GUID LENOVO_Y27 =
|
||||
{ 0x47db1fa7, 0x6b9b, 0x4ee6, { 0xb6, 0xf4, 0x40, 0x71, 0xa3, 0xb2, 0x5, 0x3b } };
|
||||
|
||||
// {0201203B-62F3-4C50-83DD-598BABD208E0}
|
||||
static const GUID CORE_CHROMA =
|
||||
{ 0x201203b, 0x62f3, 0x4c50, { 0x83, 0xdd, 0x59, 0x8b, 0xab, 0xd2, 0x8, 0xe0 } };
|
||||
|
||||
// {BB2E9C9B-B0D2-461A-BA52-230B5D6C3609}
|
||||
static const GUID CHROMABOX =
|
||||
{ 0xbb2e9c9b, 0xb0d2, 0x461a,{ 0xba, 0x52, 0x23, 0xb, 0x5d, 0x6c, 0x36, 0x9 } };
|
||||
|
||||
|
||||
// Speakers
|
||||
//! Razer Nommo
|
||||
// {45B308F2-CD44-4594-8375-4D5945AD880E}
|
||||
static const GUID NOMMO_CHROMA =
|
||||
{ 0x45b308f2, 0xcd44, 0x4594,{ 0x83, 0x75, 0x4d, 0x59, 0x45, 0xad, 0x88, 0xe } };
|
||||
|
||||
|
||||
//! Razer Nommo Pro
|
||||
// {3017280B-D7F9-4D7B-930E-7B47181B46B5}
|
||||
static const GUID NOMMO_CHROMA_PRO =
|
||||
{ 0x3017280b, 0xd7f9, 0x4d7b,{ 0x93, 0xe, 0x7b, 0x47, 0x18, 0x1b, 0x46, 0xb5 } };
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,832 @@
|
||||
//! \file RzChromaSDKTypes.h
|
||||
//! \brief Data types.
|
||||
|
||||
#ifndef _RZCHROMASDKTYPES_H_
|
||||
#define _RZCHROMASDKTYPES_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef LONG RZRESULT; //!< Return result.
|
||||
typedef GUID RZEFFECTID; //!< Effect Id.
|
||||
typedef GUID RZDEVICEID; //!< Device Id.
|
||||
typedef unsigned int RZDURATION; //!< Milliseconds.
|
||||
typedef size_t RZSIZE; //!< Size.
|
||||
typedef void* PRZPARAM; //!< Context sensitive pointer.
|
||||
typedef DWORD RZID; //!< Generic data type for Identifier.
|
||||
typedef DWORD RZCOLOR; //!< Color data. 1st byte = Red; 2nd byte = Green; 3rd byte = Blue; 4th byte = Alpha (if applicable)
|
||||
|
||||
namespace ChromaSDK
|
||||
{
|
||||
//! Event notification Window message
|
||||
const UINT WM_CHROMA_EVENT = WM_APP+0x2000;
|
||||
|
||||
//! Application information.
|
||||
typedef struct APPINFOTYPE
|
||||
{
|
||||
TCHAR Title[256]; //!< Title of the application.
|
||||
TCHAR Description[1024]; //!< A short description of the application.
|
||||
//! Author information
|
||||
struct Author
|
||||
{
|
||||
TCHAR Name[256]; //!< Name of the developer/company.
|
||||
TCHAR Contact[256]; //!< Contact info.
|
||||
} Author;
|
||||
DWORD SupportedDevice;
|
||||
DWORD Category; //!< 0 = Utility; 1 = Game; 2 = Chroma Link Broadcast
|
||||
} APPINFOTYPE;
|
||||
|
||||
//! Chroma generic effects. Note: Not all devices supported the listed effects.
|
||||
typedef enum EFFECT_TYPE
|
||||
{
|
||||
CHROMA_NONE = 0, //!< No effect.
|
||||
CHROMA_WAVE, //!< Wave effect (Deprecated and should not be used).
|
||||
CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (Deprecated and should not be used).
|
||||
CHROMA_BREATHING, //!< Breathing effect (Deprecated and should not be used).
|
||||
CHROMA_BLINKING, //!< Blinking effect (Deprecated and should not be used).
|
||||
CHROMA_REACTIVE, //!< Reactive effect (Deprecated and should not be used).
|
||||
CHROMA_STATIC, //!< Static single color effect.
|
||||
CHROMA_CUSTOM, //!< Custom effect. For mice, please see Mouse::CHROMA_CUSTOM2.
|
||||
CHROMA_RESERVED, //!< Reserved
|
||||
CHROMA_INVALID //!< Invalid effect.
|
||||
} EFFECT_TYPE;
|
||||
|
||||
//! Device info.
|
||||
typedef struct DEVICE_INFO_TYPE
|
||||
{
|
||||
//! Device types.
|
||||
enum DeviceType
|
||||
{
|
||||
DEVICE_KEYBOARD = 1, //!< Keyboard device.
|
||||
DEVICE_MOUSE = 2, //!< Mouse device.
|
||||
DEVICE_HEADSET = 3, //!< Headset device.
|
||||
DEVICE_MOUSEPAD = 4, //!< Mousepad device.
|
||||
DEVICE_KEYPAD = 5, //!< Keypad device.
|
||||
DEVICE_SYSTEM = 6, //!< System device.
|
||||
DEVICE_SPEAKERS = 7, //!< Speakers.
|
||||
DEVICE_INVALID //!< Invalid device.
|
||||
} DeviceType;
|
||||
|
||||
DWORD Connected; //!< Number of devices connected.
|
||||
} DEVICE_INFO_TYPE;
|
||||
|
||||
const RZSIZE MAX_ROW = 30; //!< Maximum rows for custom effects.
|
||||
const RZSIZE MAX_COLUMN = 30; //!< Maximum columns for custom effects.
|
||||
|
||||
//! Blinking effect (Deprecated and should not be used).
|
||||
typedef struct BLINKING_EFFECT_TYPE
|
||||
{
|
||||
RZSIZE Size; //!< Size of the structure. Size = sizeof(BLINKING_EFFECT_TYPE)
|
||||
DWORD Param; //!< Extra parameters.
|
||||
|
||||
COLORREF Color; //!< Blinking color
|
||||
} BLINKING_EFFECT_TYPE;
|
||||
|
||||
//! Breathing effect (Deprecated and should not be used).
|
||||
typedef struct BREATHING_EFFECT_TYPE
|
||||
{
|
||||
RZSIZE Size; //!< Size of ths structure. Size = sizeof(BREATHING_EFFECT_TYPE)
|
||||
DWORD Param; //!< Extra parameters.
|
||||
|
||||
//! Breathing effect types.
|
||||
enum _Type
|
||||
{
|
||||
ONE_COLOR = 1, //!< 1 color (Only fill Color1).
|
||||
TWO_COLORS, //!< 2 colors.
|
||||
RANDOM_COLORS //!< Random colors
|
||||
} Type;
|
||||
|
||||
COLORREF Color1; //!< First color.
|
||||
COLORREF Color2; //!< Second color.
|
||||
} BREATHING_EFFECT_TYPE;
|
||||
|
||||
//! Custom effect (Deprecated and should not be used).
|
||||
typedef struct CUSTOM_EFFECT_TYPE
|
||||
{
|
||||
RZSIZE Size; //!< Size of the structure. Size = sizeof(CUSTOM_EFFECT_TYPE)
|
||||
DWORD Param; //!< Extra parameters.
|
||||
|
||||
RZCOLOR Color[MAX_ROW][MAX_COLUMN];
|
||||
} CUSTOM_EFFECT_TYPE;
|
||||
|
||||
//! No effect.
|
||||
typedef struct NO_EFFECT_TYPE
|
||||
{
|
||||
RZSIZE Size; //!< Size of the structure. Size = sizeof(NO_EFFECT_TYPE)
|
||||
DWORD Param; //!< Extra parameters.
|
||||
} NO_EFFECT_TYPE;
|
||||
|
||||
//! Reactive effect (Deprecated and should not be used).
|
||||
typedef struct REACTIVE_EFFECT_TYPE
|
||||
{
|
||||
RZSIZE Size; //!< Size of the structure. Size = sizeof(REACTIVE_EFFECT_TYPE)
|
||||
DWORD Param; //!< Extra parameters.
|
||||
|
||||
//! Duration of the effect.
|
||||
enum _Duration
|
||||
{
|
||||
DURATION_SHORT = 1, //!< Short duration.
|
||||
DURATION_MEDIUM, //!< Medium duration.
|
||||
DURATION_LONG //!< Long duration.
|
||||
} Duration; //!< The time taken for the effect to fade away.
|
||||
|
||||
COLORREF Color; //!< Color of the effect.
|
||||
} REACTIVE_EFFECT_TYPE;
|
||||
|
||||
//! Spectrum cycling effect (Deprecated and should not be used).
|
||||
typedef struct SPECTRUMCYCLING_EFFECT_TYPE
|
||||
{
|
||||
RZSIZE Size; //!< Size of the structure. Size = sizeof(SPECTRUMCYCLING_EFFECT_TYPE)
|
||||
DWORD Param; //!< Extra parameters.
|
||||
} SPECTRUMCYCLING_EFFECT_TYPE;
|
||||
|
||||
//! Starlight effect (Deprecated and should not be used).
|
||||
typedef struct STARLIGHT_EFFECT_TYPE
|
||||
{
|
||||
RZSIZE Size; //!< Size of the structure. Size = sizeof(SPECTRUMCYCLING_EFFECT_TYPE)
|
||||
DWORD Param; //!< Extra parameters.
|
||||
|
||||
//! Starlight effect types.
|
||||
enum _Type
|
||||
{
|
||||
TWO_COLORS = 1, //!< 2 colors.
|
||||
RANDOM_COLORS //!< Random colors
|
||||
} Type;
|
||||
|
||||
COLORREF Color1; //!< First color.
|
||||
COLORREF Color2; //!< Second color.
|
||||
|
||||
//! Duration of the effect.
|
||||
enum _Duration
|
||||
{
|
||||
DURATION_SHORT = 1, //!< Short duration.
|
||||
DURATION_MEDIUM, //!< Medium duration.
|
||||
DURATION_LONG //!< Long duration.
|
||||
} Duration; //!< The time taken for the effect to fade away.
|
||||
|
||||
} STARLIGHT_EFFECT_TYPE;
|
||||
|
||||
//! Static effect (Deprecated and should not be used).
|
||||
typedef struct STATIC_EFFECT_TYPE
|
||||
{
|
||||
RZSIZE Size; //!< Size of the structure. Size = sizeof(STATIC_EFFECT_TYPE)
|
||||
DWORD Param; //!< Extra parameters.
|
||||
|
||||
COLORREF Color; //!< Color of the effect.
|
||||
} STATIC_EFFECT_TYPE;
|
||||
|
||||
//! Wave effect (Deprecated and should not be used).
|
||||
typedef struct WAVE_EFFECT_TYPE
|
||||
{
|
||||
RZSIZE Size; //!< Size of the structure. Size = sizeof(WAVE_EFFECT_TYPE)
|
||||
DWORD Param; //!< Extra parameters.
|
||||
|
||||
//! Direction of effect.
|
||||
enum _Direction
|
||||
{
|
||||
DIRECTION_LEFT_TO_RIGHT = 1, //!< Left to right.
|
||||
DIRECTION_RIGHT_TO_LEFT, //!< Right to left.
|
||||
DIRECTION_FRONT_TO_BACK, //!< Front to back
|
||||
DIRECTION_BACK_TO_FRONT //!< Back top front
|
||||
} Direction;
|
||||
} WAVE_EFFECT_TYPE;
|
||||
|
||||
//! Keyboards
|
||||
namespace Keyboard
|
||||
{
|
||||
//! Definitions of keys.
|
||||
typedef enum RZKEY
|
||||
{
|
||||
RZKEY_ESC = 0x0001, /*!< Esc (VK_ESCAPE) */
|
||||
RZKEY_F1 = 0x0003, /*!< F1 (VK_F1) */
|
||||
RZKEY_F2 = 0x0004, /*!< F2 (VK_F2) */
|
||||
RZKEY_F3 = 0x0005, /*!< F3 (VK_F3) */
|
||||
RZKEY_F4 = 0x0006, /*!< F4 (VK_F4) */
|
||||
RZKEY_F5 = 0x0007, /*!< F5 (VK_F5) */
|
||||
RZKEY_F6 = 0x0008, /*!< F6 (VK_F6) */
|
||||
RZKEY_F7 = 0x0009, /*!< F7 (VK_F7) */
|
||||
RZKEY_F8 = 0x000A, /*!< F8 (VK_F8) */
|
||||
RZKEY_F9 = 0x000B, /*!< F9 (VK_F9) */
|
||||
RZKEY_F10 = 0x000C, /*!< F10 (VK_F10) */
|
||||
RZKEY_F11 = 0x000D, /*!< F11 (VK_F11) */
|
||||
RZKEY_F12 = 0x000E, /*!< F12 (VK_F12) */
|
||||
RZKEY_1 = 0x0102, /*!< 1 (VK_1) */
|
||||
RZKEY_2 = 0x0103, /*!< 2 (VK_2) */
|
||||
RZKEY_3 = 0x0104, /*!< 3 (VK_3) */
|
||||
RZKEY_4 = 0x0105, /*!< 4 (VK_4) */
|
||||
RZKEY_5 = 0x0106, /*!< 5 (VK_5) */
|
||||
RZKEY_6 = 0x0107, /*!< 6 (VK_6) */
|
||||
RZKEY_7 = 0x0108, /*!< 7 (VK_7) */
|
||||
RZKEY_8 = 0x0109, /*!< 8 (VK_8) */
|
||||
RZKEY_9 = 0x010A, /*!< 9 (VK_9) */
|
||||
RZKEY_0 = 0x010B, /*!< 0 (VK_0) */
|
||||
RZKEY_A = 0x0302, /*!< A (VK_A) */
|
||||
RZKEY_B = 0x0407, /*!< B (VK_B) */
|
||||
RZKEY_C = 0x0405, /*!< C (VK_C) */
|
||||
RZKEY_D = 0x0304, /*!< D (VK_D) */
|
||||
RZKEY_E = 0x0204, /*!< E (VK_E) */
|
||||
RZKEY_F = 0x0305, /*!< F (VK_F) */
|
||||
RZKEY_G = 0x0306, /*!< G (VK_G) */
|
||||
RZKEY_H = 0x0307, /*!< H (VK_H) */
|
||||
RZKEY_I = 0x0209, /*!< I (VK_I) */
|
||||
RZKEY_J = 0x0308, /*!< J (VK_J) */
|
||||
RZKEY_K = 0x0309, /*!< K (VK_K) */
|
||||
RZKEY_L = 0x030A, /*!< L (VK_L) */
|
||||
RZKEY_M = 0x0409, /*!< M (VK_M) */
|
||||
RZKEY_N = 0x0408, /*!< N (VK_N) */
|
||||
RZKEY_O = 0x020A, /*!< O (VK_O) */
|
||||
RZKEY_P = 0x020B, /*!< P (VK_P) */
|
||||
RZKEY_Q = 0x0202, /*!< Q (VK_Q) */
|
||||
RZKEY_R = 0x0205, /*!< R (VK_R) */
|
||||
RZKEY_S = 0x0303, /*!< S (VK_S) */
|
||||
RZKEY_T = 0x0206, /*!< T (VK_T) */
|
||||
RZKEY_U = 0x0208, /*!< U (VK_U) */
|
||||
RZKEY_V = 0x0406, /*!< V (VK_V) */
|
||||
RZKEY_W = 0x0203, /*!< W (VK_W) */
|
||||
RZKEY_X = 0x0404, /*!< X (VK_X) */
|
||||
RZKEY_Y = 0x0207, /*!< Y (VK_Y) */
|
||||
RZKEY_Z = 0x0403, /*!< Z (VK_Z) */
|
||||
RZKEY_NUMLOCK = 0x0112, /*!< Numlock (VK_NUMLOCK) */
|
||||
RZKEY_NUMPAD0 = 0x0513, /*!< Numpad 0 (VK_NUMPAD0) */
|
||||
RZKEY_NUMPAD1 = 0x0412, /*!< Numpad 1 (VK_NUMPAD1) */
|
||||
RZKEY_NUMPAD2 = 0x0413, /*!< Numpad 2 (VK_NUMPAD2) */
|
||||
RZKEY_NUMPAD3 = 0x0414, /*!< Numpad 3 (VK_NUMPAD3) */
|
||||
RZKEY_NUMPAD4 = 0x0312, /*!< Numpad 4 (VK_NUMPAD4) */
|
||||
RZKEY_NUMPAD5 = 0x0313, /*!< Numpad 5 (VK_NUMPAD5) */
|
||||
RZKEY_NUMPAD6 = 0x0314, /*!< Numpad 6 (VK_NUMPAD6) */
|
||||
RZKEY_NUMPAD7 = 0x0212, /*!< Numpad 7 (VK_NUMPAD7) */
|
||||
RZKEY_NUMPAD8 = 0x0213, /*!< Numpad 8 (VK_NUMPAD8) */
|
||||
RZKEY_NUMPAD9 = 0x0214, /*!< Numpad 9 (VK_ NUMPAD9*/
|
||||
RZKEY_NUMPAD_DIVIDE = 0x0113, /*!< Divide (VK_DIVIDE) */
|
||||
RZKEY_NUMPAD_MULTIPLY = 0x0114, /*!< Multiply (VK_MULTIPLY) */
|
||||
RZKEY_NUMPAD_SUBTRACT = 0x0115, /*!< Subtract (VK_SUBTRACT) */
|
||||
RZKEY_NUMPAD_ADD = 0x0215, /*!< Add (VK_ADD) */
|
||||
RZKEY_NUMPAD_ENTER = 0x0415, /*!< Enter (VK_RETURN - Extended) */
|
||||
RZKEY_NUMPAD_DECIMAL = 0x0514, /*!< Decimal (VK_DECIMAL) */
|
||||
RZKEY_PRINTSCREEN = 0x000F, /*!< Print Screen (VK_PRINT) */
|
||||
RZKEY_SCROLL = 0x0010, /*!< Scroll Lock (VK_SCROLL) */
|
||||
RZKEY_PAUSE = 0x0011, /*!< Pause (VK_PAUSE) */
|
||||
RZKEY_INSERT = 0x010F, /*!< Insert (VK_INSERT) */
|
||||
RZKEY_HOME = 0x0110, /*!< Home (VK_HOME) */
|
||||
RZKEY_PAGEUP = 0x0111, /*!< Page Up (VK_PRIOR) */
|
||||
RZKEY_DELETE = 0x020f, /*!< Delete (VK_DELETE) */
|
||||
RZKEY_END = 0x0210, /*!< End (VK_END) */
|
||||
RZKEY_PAGEDOWN = 0x0211, /*!< Page Down (VK_NEXT) */
|
||||
RZKEY_UP = 0x0410, /*!< Up (VK_UP) */
|
||||
RZKEY_LEFT = 0x050F, /*!< Left (VK_LEFT) */
|
||||
RZKEY_DOWN = 0x0510, /*!< Down (VK_DOWN) */
|
||||
RZKEY_RIGHT = 0x0511, /*!< Right (VK_RIGHT) */
|
||||
RZKEY_TAB = 0x0201, /*!< Tab (VK_TAB) */
|
||||
RZKEY_CAPSLOCK = 0x0301, /*!< Caps Lock(VK_CAPITAL) */
|
||||
RZKEY_BACKSPACE = 0x010E, /*!< Backspace (VK_BACK) */
|
||||
RZKEY_ENTER = 0x030E, /*!< Enter (VK_RETURN) */
|
||||
RZKEY_LCTRL = 0x0501, /*!< Left Control(VK_LCONTROL) */
|
||||
RZKEY_LWIN = 0x0502, /*!< Left Window (VK_LWIN) */
|
||||
RZKEY_LALT = 0x0503, /*!< Left Alt (VK_LMENU) */
|
||||
RZKEY_SPACE = 0x0507, /*!< Spacebar (VK_SPACE) */
|
||||
RZKEY_RALT = 0x050B, /*!< Right Alt (VK_RMENU) */
|
||||
RZKEY_FN = 0x050C, /*!< Function key. */
|
||||
RZKEY_RMENU = 0x050D, /*!< Right Menu (VK_APPS) */
|
||||
RZKEY_RCTRL = 0x050E, /*!< Right Control (VK_RCONTROL) */
|
||||
RZKEY_LSHIFT = 0x0401, /*!< Left Shift (VK_LSHIFT) */
|
||||
RZKEY_RSHIFT = 0x040E, /*!< Right Shift (VK_RSHIFT) */
|
||||
RZKEY_MACRO1 = 0x0100, /*!< Macro Key 1 */
|
||||
RZKEY_MACRO2 = 0x0200, /*!< Macro Key 2 */
|
||||
RZKEY_MACRO3 = 0x0300, /*!< Macro Key 3 */
|
||||
RZKEY_MACRO4 = 0x0400, /*!< Macro Key 4 */
|
||||
RZKEY_MACRO5 = 0x0500, /*!< Macro Key 5 */
|
||||
RZKEY_OEM_1 = 0x0101, /*!< ~ (tilde/半角/全角) (VK_OEM_3) */
|
||||
RZKEY_OEM_2 = 0x010C, /*!< -- (minus) (VK_OEM_MINUS) */
|
||||
RZKEY_OEM_3 = 0x010D, /*!< = (equal) (VK_OEM_PLUS) */
|
||||
RZKEY_OEM_4 = 0x020C, /*!< [ (left sqaure bracket) (VK_OEM_4) */
|
||||
RZKEY_OEM_5 = 0x020D, /*!< ] (right square bracket) (VK_OEM_6) */
|
||||
RZKEY_OEM_6 = 0x020E, /*!< \ (backslash) (VK_OEM_5) */
|
||||
RZKEY_OEM_7 = 0x030B, /*!< ; (semi-colon) (VK_OEM_1) */
|
||||
RZKEY_OEM_8 = 0x030C, /*!< ' (apostrophe) (VK_OEM_7) */
|
||||
RZKEY_OEM_9 = 0x040A, /*!< , (comma) (VK_OEM_COMMA) */
|
||||
RZKEY_OEM_10 = 0x040B, /*!< . (period) (VK_OEM_PERIOD) */
|
||||
RZKEY_OEM_11 = 0x040C, /*!< / (forward slash) (VK_OEM_2) */
|
||||
RZKEY_EUR_1 = 0x030D, /*!< "#" (VK_OEM_5) */
|
||||
RZKEY_EUR_2 = 0x0402, /*!< \ (VK_OEM_102) */
|
||||
RZKEY_JPN_1 = 0x0015, /*!< ¥ (0xFF) */
|
||||
RZKEY_JPN_2 = 0x040D, /*!< \ (0xC1) */
|
||||
RZKEY_JPN_3 = 0x0504, /*!< 無変換 (VK_OEM_PA1) */
|
||||
RZKEY_JPN_4 = 0x0509, /*!< 変換 (0xFF) */
|
||||
RZKEY_JPN_5 = 0x050A, /*!< ひらがな/カタカナ (0xFF) */
|
||||
RZKEY_KOR_1 = 0x0015, /*!< | (0xFF) */
|
||||
RZKEY_KOR_2 = 0x030D, /*!< (VK_OEM_5) */
|
||||
RZKEY_KOR_3 = 0x0402, /*!< (VK_OEM_102) */
|
||||
RZKEY_KOR_4 = 0x040D, /*!< (0xC1) */
|
||||
RZKEY_KOR_5 = 0x0504, /*!< (VK_OEM_PA1) */
|
||||
RZKEY_KOR_6 = 0x0509, /*!< 한/영 (0xFF) */
|
||||
RZKEY_KOR_7 = 0x050A, /*!< (0xFF) */
|
||||
RZKEY_INVALID = 0xFFFF /*!< Invalid keys. */
|
||||
} RZKEY;
|
||||
|
||||
//! Definition of LEDs.
|
||||
typedef enum RZLED
|
||||
{
|
||||
RZLED_LOGO = 0x0014 /*!< Razer logo */
|
||||
} RZLED;
|
||||
|
||||
//! Maximum number of rows in a keyboard.
|
||||
const RZSIZE MAX_ROW = 6;
|
||||
|
||||
//! Maximum number of columns in a keyboard.
|
||||
const RZSIZE MAX_COLUMN = 22;
|
||||
|
||||
//! Maximum number of keys.
|
||||
const RZSIZE MAX_KEYS = MAX_ROW * MAX_COLUMN;
|
||||
|
||||
//! Maximum number of custom effects.
|
||||
const RZSIZE MAX_CUSTOM_EFFECTS = MAX_KEYS;
|
||||
|
||||
//! Keyboard LED layout.
|
||||
const COLORREF RZKEY_LAYOUT[MAX_ROW][MAX_COLUMN] = {};
|
||||
|
||||
//! Chroma keyboard effect types
|
||||
typedef enum EFFECT_TYPE
|
||||
{
|
||||
CHROMA_NONE = 0, //!< No effect.
|
||||
CHROMA_BREATHING, //!< Breathing effect (Deprecated and should not be used.).
|
||||
CHROMA_CUSTOM, //!< Custom effect.
|
||||
CHROMA_REACTIVE, //!< Reactive effect (Deprecated and should not be used).
|
||||
CHROMA_STATIC, //!< Static single color effect.
|
||||
CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (Deprecated and should not be used).
|
||||
CHROMA_WAVE, //!< Wave effect (Deprecated and should not be used).
|
||||
CHROMA_RESERVED, //!< Reserved.
|
||||
CHROMA_CUSTOM_KEY, //!< Custom effects with keys.
|
||||
CHROMA_INVALID //!< Invalid effect.
|
||||
} EFFECT_TYPE;
|
||||
|
||||
// Chroma keyboard effects
|
||||
//! Breathing effect type (Deprecated and should not be used).
|
||||
typedef struct BREATHING_EFFECT_TYPE
|
||||
{
|
||||
//! Breathing effects.
|
||||
enum Type
|
||||
{
|
||||
TWO_COLORS = 1, //!< 2 colors
|
||||
RANDOM_COLORS, //!< Random colors
|
||||
INVALID //!< Invalid type
|
||||
} Type;
|
||||
COLORREF Color1; //!< First color.
|
||||
COLORREF Color2; //!< Second color.
|
||||
} BREATHING_EFFECT_TYPE;
|
||||
|
||||
//! Custom effect using a matrix type.
|
||||
typedef struct CUSTOM_EFFECT_TYPE
|
||||
{
|
||||
COLORREF Color[MAX_ROW][MAX_COLUMN]; //!< Grid layout. 6 rows by 22 columns.
|
||||
} CUSTOM_EFFECT_TYPE;
|
||||
|
||||
//! Custom effect with keys.
|
||||
typedef struct CUSTOM_KEY_EFFECT_TYPE
|
||||
{
|
||||
COLORREF Color[MAX_ROW][MAX_COLUMN]; //!< Grid layout. 6 rows by 22 columns.
|
||||
COLORREF Key[MAX_ROW][MAX_COLUMN]; //!< Keys information. 6 rows by 22 columns. To indidate there is a key effect, OR with 0x01000000. i.e. Key[0][1] = 0x01000000 | Color;
|
||||
} CUSTOM_KEY_EFFECT_TYPE;
|
||||
|
||||
//! Reactive effect type (Deprecated and should not be used).
|
||||
typedef struct REACTIVE_EFFECT_TYPE
|
||||
{
|
||||
//! Duration of the effect.
|
||||
enum Duration
|
||||
{
|
||||
DURATION_NONE=0, //!< No duration.
|
||||
DURATION_SHORT, //!< Short duration.
|
||||
DURATION_MEDIUM, //!< Medium duration.
|
||||
DURATION_LONG, //!< Long duration.
|
||||
DURATION_INVALID //!< Invalid duration.
|
||||
} Duration; //!< The time taken for the effect to fade away.
|
||||
|
||||
COLORREF Color; //!< Color of the effect
|
||||
} REACTIVE_EFFECT_TYPE;
|
||||
|
||||
//! Starlight effect (Deprecated and should not be used).
|
||||
typedef struct STARLIGHT_EFFECT_TYPE
|
||||
{
|
||||
//! Starlight effect types.
|
||||
enum _Type
|
||||
{
|
||||
TWO_COLORS = 1, //!< 2 colors.
|
||||
RANDOM_COLORS //!< Random colors
|
||||
} Type;
|
||||
|
||||
COLORREF Color1; //!< First color.
|
||||
COLORREF Color2; //!< Second color.
|
||||
|
||||
//! Duration of the effect.
|
||||
enum _Duration
|
||||
{
|
||||
DURATION_SHORT = 1, //!< Short duration.
|
||||
DURATION_MEDIUM, //!< Medium duration.
|
||||
DURATION_LONG //!< Long duration.
|
||||
} Duration; //!< The time taken for the effect to fade away.
|
||||
|
||||
} STARLIGHT_EFFECT_TYPE;
|
||||
|
||||
//! Static effect type
|
||||
typedef struct STATIC_EFFECT_TYPE
|
||||
{
|
||||
COLORREF Color; //!< Color of the effect
|
||||
} STATIC_EFFECT_TYPE;
|
||||
|
||||
//! Wave effect type (Deprecated and should not be used).
|
||||
typedef struct WAVE_EFFECT_TYPE
|
||||
{
|
||||
//! Direction of the wave effect.
|
||||
enum Direction
|
||||
{
|
||||
DIRECTION_NONE=0, //!< No direction.
|
||||
DIRECTION_LEFT_TO_RIGHT, //!< Left to right.
|
||||
DIRECTION_RIGHT_TO_LEFT, //!< Right to left.
|
||||
DIRECTION_INVALID //!< Invalid direction.
|
||||
} Direction; //!< Direction of the wave.
|
||||
} WAVE_EFFECT_TYPE;
|
||||
}
|
||||
|
||||
//! Mice
|
||||
namespace Mouse
|
||||
{
|
||||
//! Maximum number of custom LEDs (old definition to maintain backward compatibility).
|
||||
const RZSIZE MAX_LEDS = 30;
|
||||
|
||||
//! Mice LED layout (old definition to maintain backward compatibility).
|
||||
const RZCOLOR RZLED_LAYOUT[MAX_LEDS] = {};
|
||||
|
||||
//! Maximum number of rows of the virtual grid.
|
||||
const RZSIZE MAX_ROW = 9;
|
||||
|
||||
//! Maximum number of columns of the virtual grid.
|
||||
const RZSIZE MAX_COLUMN = 7;
|
||||
|
||||
//! Maximum number of LEDs of the virtual grid.
|
||||
const RZSIZE MAX_LEDS2 = MAX_ROW * MAX_COLUMN;
|
||||
|
||||
//! Mice LED virtual grid layout.
|
||||
const RZCOLOR RZLED_LAYOUT2[MAX_ROW][MAX_COLUMN] = {};
|
||||
|
||||
//! Mouse LED Id defintion (Deprecated and should not be used).
|
||||
typedef enum RZLED
|
||||
{
|
||||
RZLED_NONE = 0, //!< No LED.
|
||||
RZLED_SCROLLWHEEL = 1, //!< Scroll Wheel LED.
|
||||
RZLED_LOGO = 2, //!< Logo LED.
|
||||
RZLED_BACKLIGHT = 3, //!< Backlight or numpad.
|
||||
RZLED_SIDE_STRIP1 = 4, //!< Side strip LED 1. (For Mamba TE, starts from top left hand)
|
||||
RZLED_SIDE_STRIP2 = 5, //!< Side strip LED 2. (For Mamba TE)
|
||||
RZLED_SIDE_STRIP3 = 6, //!< Side strip LED 3. (For Mamba TE)
|
||||
RZLED_SIDE_STRIP4 = 7, //!< Side strip LED 4. (For Mamba TE)
|
||||
RZLED_SIDE_STRIP5 = 8, //!< Side strip LED 5. (For Mamba TE)
|
||||
RZLED_SIDE_STRIP6 = 9, //!< Side strip LED 6. (For Mamba TE)
|
||||
RZLED_SIDE_STRIP7 = 10, //!< Side strip LED 7. (For Mamba TE)
|
||||
RZLED_SIDE_STRIP8 = 11, //!< Side strip LED 8. (For Mamba TE)
|
||||
RZLED_SIDE_STRIP9 = 12, //!< Side strip LED 9. (For Mamba TE)
|
||||
RZLED_SIDE_STRIP10 = 13, //!< Side strip LED 10. (For Mamba TE)
|
||||
RZLED_SIDE_STRIP11 = 14, //!< Side strip LED 11. (For Mamba TE)
|
||||
RZLED_SIDE_STRIP12 = 15, //!< Side strip LED 12. (For Mamba TE)
|
||||
RZLED_SIDE_STRIP13 = 16, //!< Side strip LED 13. (For Mamba TE)
|
||||
RZLED_SIDE_STRIP14 = 17, //!< Side strip LED 14. (For Mamba TE)
|
||||
RZLED_ALL = 0xFFFF
|
||||
} RZLED;
|
||||
|
||||
//! Mouse LED Id defintion for the virtual grid.
|
||||
typedef enum RZLED2
|
||||
{
|
||||
RZLED2_SCROLLWHEEL = 0x0203, //!< Scroll Wheel LED.
|
||||
RZLED2_LOGO = 0x0703, //!< Logo LED.
|
||||
RZLED2_BACKLIGHT = 0x0403, //!< Backlight LED.
|
||||
RZLED2_LEFT_SIDE1 = 0x0100, //!< Left LED 1.
|
||||
RZLED2_LEFT_SIDE2 = 0x0200, //!< Left LED 2.
|
||||
RZLED2_LEFT_SIDE3 = 0x0300, //!< Left LED 3.
|
||||
RZLED2_LEFT_SIDE4 = 0x0400, //!< Left LED 4.
|
||||
RZLED2_LEFT_SIDE5 = 0x0500, //!< Left LED 5.
|
||||
RZLED2_LEFT_SIDE6 = 0x0600, //!< Left LED 6.
|
||||
RZLED2_LEFT_SIDE7 = 0x0700, //!< Left LED 7.
|
||||
RZLED2_BOTTOM1 = 0x0801, //!< Bottom LED 1.
|
||||
RZLED2_BOTTOM2 = 0x0802, //!< Bottom LED 2.
|
||||
RZLED2_BOTTOM3 = 0x0803, //!< Bottom LED 3.
|
||||
RZLED2_BOTTOM4 = 0x0804, //!< Bottom LED 4.
|
||||
RZLED2_BOTTOM5 = 0x0805, //!< Bottom LED 5.
|
||||
RZLED2_RIGHT_SIDE1 = 0x0106, //!< Right LED 1.
|
||||
RZLED2_RIGHT_SIDE2 = 0x0206, //!< Right LED 2.
|
||||
RZLED2_RIGHT_SIDE3 = 0x0306, //!< Right LED 3.
|
||||
RZLED2_RIGHT_SIDE4 = 0x0406, //!< Right LED 4.
|
||||
RZLED2_RIGHT_SIDE5 = 0x0506, //!< Right LED 5.
|
||||
RZLED2_RIGHT_SIDE6 = 0x0606, //!< Right LED 6.
|
||||
RZLED2_RIGHT_SIDE7 = 0x0706 //!< Right LED 7.
|
||||
} RZLED2;
|
||||
|
||||
//! Chroma mouse effect types
|
||||
typedef enum EFFECT_TYPE
|
||||
{
|
||||
CHROMA_NONE = 0, //!< No effect.
|
||||
CHROMA_BLINKING, //!< Blinking effect (Deprecated and should not be used).
|
||||
CHROMA_BREATHING, //!< Breathing effect (Deprecated and should not be used).
|
||||
CHROMA_CUSTOM, //!< Custom effect (Deprecated and should not be used).
|
||||
CHROMA_REACTIVE, //!< Reactive effect (Deprecated and should not be used).
|
||||
CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (Deprecated and should not be used).
|
||||
CHROMA_STATIC, //!< Static single color effect.
|
||||
CHROMA_WAVE, //!< Wave effect (Deprecated and should not be used).
|
||||
CHROMA_CUSTOM2, //!< Custom effects using a virtual grid.
|
||||
CHROMA_INVALID //!< Invalid effect.
|
||||
} EFFECT_TYPE;
|
||||
|
||||
//! Static effect type
|
||||
typedef struct STATIC_EFFECT_TYPE
|
||||
{
|
||||
RZLED LEDId; //!< LED Id
|
||||
COLORREF Color; //!< Color of the effect.
|
||||
} STATIC_EFFECT_TYPE;
|
||||
|
||||
//! Blinking effect type (Deprecated and should not be used).
|
||||
typedef struct BLINKING_EFFECT_TYPE
|
||||
{
|
||||
RZLED LEDId; //!< LED Id
|
||||
COLORREF Color; //!< Color.
|
||||
} BLINKING_EFFECT_TYPE;
|
||||
|
||||
//! Breathing effect (Deprecated and should not be used).
|
||||
typedef struct BREATHING_EFFECT_TYPE
|
||||
{
|
||||
RZLED LEDId; //!< LED Id
|
||||
|
||||
//! Breathing type.
|
||||
enum Type
|
||||
{
|
||||
ONE_COLOR = 1, //!< 1 color (Only fill Color1).
|
||||
TWO_COLORS, //!< 2 colors.
|
||||
RANDOM_COLORS, //!< Random colors
|
||||
INVALID //!< Invalid type
|
||||
} Type;
|
||||
|
||||
COLORREF Color1; //!< First color.
|
||||
COLORREF Color2; //!< Second color.
|
||||
} BREATHING_EFFECT_TYPE;
|
||||
|
||||
//! Custom effect (Deprecated and should not be used).
|
||||
typedef struct CUSTOM_EFFECT_TYPE
|
||||
{
|
||||
RZCOLOR Color[MAX_LEDS]; //!< Array of colors.
|
||||
} CUSTOM_EFFECT_TYPE;
|
||||
|
||||
//! Custom effect using virtual grid.
|
||||
//! Indexes of the LED are defined in RZLED2.i.e. Row = HIBYTE(RZLED2_SCROLLWHEEL), Column = LOBYTE(RZLED2_SCROLLWHEEL)
|
||||
typedef struct CUSTOM_EFFECT_TYPE2
|
||||
{
|
||||
RZCOLOR Color[MAX_ROW][MAX_COLUMN]; //!< Array of colors.
|
||||
} CUSTOM_EFFECT_TYPE2;
|
||||
|
||||
//! Reactive effect (Deprecated and should not be used).
|
||||
typedef struct REACTIVE_EFFECT_TYPE
|
||||
{
|
||||
RZLED LEDId; //!< LED Id
|
||||
|
||||
//! Duration of the effect.
|
||||
enum Duration
|
||||
{
|
||||
DURATION_NONE=0, //!< No duration.
|
||||
DURATION_SHORT, //!< Short duration.
|
||||
DURATION_MEDIUM, //!< Medium duration.
|
||||
DURATION_LONG //!< Long duration.
|
||||
} Duration;
|
||||
|
||||
RZCOLOR Color; //!< Color of the effect.
|
||||
} REACTIVE_EFFECT_TYPE;
|
||||
|
||||
//! No effect (Deprecated and should not be used).
|
||||
typedef struct NO_EFFECT_TYPE
|
||||
{
|
||||
RZLED LEDId; //!< LED Id
|
||||
} NO_EFFECT_TYPE;
|
||||
|
||||
//! Spectrum cycling (Deprecated and should not be used).
|
||||
typedef struct SPECTRUMCYCLING_EFFECT_TYPE
|
||||
{
|
||||
RZLED LEDId; //!< LED id.
|
||||
} SPECTRUMCYCLING_EFFECT_TYPE;
|
||||
|
||||
//! Wave effect (Deprecated and should not be used).
|
||||
typedef struct WAVE_EFFECT_TYPE
|
||||
{
|
||||
//! Direction of the wave effect.
|
||||
enum Direction
|
||||
{
|
||||
FRONT_TO_BACK, //!< Front to back
|
||||
BACK_TO_FRONT //!< Back to front
|
||||
} Direction;
|
||||
} WAVE_EFFECT_TYPE;
|
||||
}
|
||||
|
||||
//! Headsets
|
||||
namespace Headset
|
||||
{
|
||||
//! Maximum number of LEDs
|
||||
const RZSIZE MAX_LEDS = 5;
|
||||
|
||||
//! Chroma headset effect types
|
||||
typedef enum EFFECT_TYPE
|
||||
{
|
||||
CHROMA_NONE = 0, //!< No effect.
|
||||
CHROMA_STATIC, //!< Static single color effect.
|
||||
CHROMA_BREATHING, //!< Breathing effect (Deprecated and should not be used).
|
||||
CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (Deprecated and should not be used).
|
||||
CHROMA_CUSTOM, //!< Custom effects.
|
||||
CHROMA_INVALID //!< Invalid effect.
|
||||
} EFFECT_TYPE;
|
||||
|
||||
//! Static effect type
|
||||
typedef struct STATIC_EFFECT_TYPE
|
||||
{
|
||||
COLORREF Color; //!< Color of the effect.
|
||||
} STATIC_EFFECT_TYPE;
|
||||
|
||||
//! Breathing effect type (Deprecated and should not be used).
|
||||
typedef struct BREATHING_EFFECT_TYPE
|
||||
{
|
||||
COLORREF Color; //!< Color.
|
||||
} BREATHING_EFFECT_TYPE;
|
||||
|
||||
//! Custom effect type.
|
||||
typedef struct CUSTOM_EFFECT_TYPE
|
||||
{
|
||||
RZCOLOR Color[MAX_LEDS]; //!< Array of colors.
|
||||
} CUSTOM_EFFECT_TYPE;
|
||||
}
|
||||
|
||||
//! Mousepads
|
||||
namespace Mousepad
|
||||
{
|
||||
//! Maximum number of LEDs
|
||||
const RZSIZE MAX_LEDS = 15;
|
||||
|
||||
//! Chroma mousepad effect types
|
||||
typedef enum EFFECT_TYPE
|
||||
{
|
||||
CHROMA_NONE = 0, //!< No effect.
|
||||
CHROMA_BREATHING, //!< Breathing effect (Deprecated and should not be used).
|
||||
CHROMA_CUSTOM, //!< Custom effect.
|
||||
CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (Deprecated and should not be used).
|
||||
CHROMA_STATIC, //!< Static single color effect.
|
||||
CHROMA_WAVE, //!< Wave effect (Deprecated and should not be used).
|
||||
CHROMA_INVALID //!< Invalid effect.
|
||||
} EFFECT_TYPE;
|
||||
|
||||
// Chroma mousepad effects
|
||||
//! Breathing effect type (Deprecated and should not be used).
|
||||
typedef struct BREATHING_EFFECT_TYPE
|
||||
{
|
||||
//! Breathing effects.
|
||||
enum Type
|
||||
{
|
||||
TWO_COLORS = 1, //!< 2 colors
|
||||
RANDOM_COLORS, //!< Random colors
|
||||
INVALID
|
||||
} Type;
|
||||
COLORREF Color1; //!< First color.
|
||||
COLORREF Color2; //!< Second color.
|
||||
} BREATHING_EFFECT_TYPE;
|
||||
|
||||
//! Custom effect type.
|
||||
typedef struct CUSTOM_EFFECT_TYPE
|
||||
{
|
||||
RZCOLOR Color[MAX_LEDS]; //!< An array of colors for all the sides of the mousepad. First LED starts from top-right corner.
|
||||
//!< LED 0-4 right side, 5-9 bottom side, 10-14 left side.
|
||||
} CUSTOM_EFFECT_TYPE;
|
||||
|
||||
//! Static effect type
|
||||
typedef struct STATIC_EFFECT_TYPE
|
||||
{
|
||||
COLORREF Color; //!< Color of the effect
|
||||
} STATIC_EFFECT_TYPE;
|
||||
|
||||
//! Wave effect type
|
||||
typedef struct WAVE_EFFECT_TYPE
|
||||
{
|
||||
//! Direction of the wave effect.
|
||||
enum Direction
|
||||
{
|
||||
DIRECTION_NONE=0, //!< No direction.
|
||||
DIRECTION_LEFT_TO_RIGHT, //!< Left to right.
|
||||
DIRECTION_RIGHT_TO_LEFT, //!< Right to left.
|
||||
DIRECTION_INVALID //!< Invalid direction.
|
||||
} Direction; //!< Direction of the wave.
|
||||
} WAVE_EFFECT_TYPE;
|
||||
}
|
||||
|
||||
//! Keypads
|
||||
namespace Keypad
|
||||
{
|
||||
//! Maximum number of rows.
|
||||
const RZSIZE MAX_ROW = 4;
|
||||
|
||||
//! Maximum number of columns.
|
||||
const RZSIZE MAX_COLUMN = 5;
|
||||
|
||||
//! Total number of keys.
|
||||
const RZSIZE MAX_KEYS = MAX_ROW * MAX_COLUMN;
|
||||
|
||||
//! Chroma keypad effect types
|
||||
typedef enum EFFECT_TYPE
|
||||
{
|
||||
CHROMA_NONE = 0, //!< No effect.
|
||||
CHROMA_BREATHING, //!< Breathing effect (Deprecated and should not be used).
|
||||
CHROMA_CUSTOM, //!< Custom effect.
|
||||
CHROMA_REACTIVE, //!< Reactive effect (Deprecated and should not be used).
|
||||
CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (Deprecated and should not be used).
|
||||
CHROMA_STATIC, //!< Static single color effect.
|
||||
CHROMA_WAVE, //!< Wave effect (Deprecated and should not be used).
|
||||
CHROMA_INVALID //!< Invalid effect.
|
||||
} EFFECT_TYPE;
|
||||
|
||||
// Chroma keypad effects
|
||||
//! Breathing effect type (Deprecated and should not be used).
|
||||
typedef struct BREATHING_EFFECT_TYPE
|
||||
{
|
||||
//! Breathing effects.
|
||||
enum Type
|
||||
{
|
||||
TWO_COLORS = 1, //!< 2 colors
|
||||
RANDOM_COLORS, //!< Random colors
|
||||
INVALID //!< Invalid type
|
||||
} Type;
|
||||
COLORREF Color1; //!< First color.
|
||||
COLORREF Color2; //!< Second color.
|
||||
} BREATHING_EFFECT_TYPE;
|
||||
|
||||
//! Custom effect type
|
||||
typedef struct CUSTOM_EFFECT_TYPE
|
||||
{
|
||||
RZCOLOR Color[MAX_ROW][MAX_COLUMN]; //!< Custom effect.
|
||||
//!< For Razer Tartarus Chroma only Color[0] is valid. Use index '0' to change the keypad color.
|
||||
} CUSTOM_EFFECT_TYPE;
|
||||
|
||||
//! Reactive effect type (Deprecated and should not be used).
|
||||
typedef struct REACTIVE_EFFECT_TYPE
|
||||
{
|
||||
//! Duration of the effect.
|
||||
enum Duration
|
||||
{
|
||||
DURATION_NONE=0, //!< No duration.
|
||||
DURATION_SHORT, //!< Short duration.
|
||||
DURATION_MEDIUM, //!< Medium duration.
|
||||
DURATION_LONG, //!< Long duration.
|
||||
DURATION_INVALID //!< Invalid duration.
|
||||
} Duration; //!< The time taken for the effect to fade away.
|
||||
|
||||
COLORREF Color; //!< Color of the effect
|
||||
} REACTIVE_EFFECT_TYPE;
|
||||
|
||||
//! Static effect type
|
||||
typedef struct STATIC_EFFECT_TYPE
|
||||
{
|
||||
RZCOLOR Color; //!< Color of the effect.
|
||||
} STATIC_EFFECT_TYPE;
|
||||
|
||||
//! Wave effect type (Deprecated and should not be used).
|
||||
typedef struct WAVE_EFFECT_TYPE
|
||||
{
|
||||
//! Direction of the wave effect.
|
||||
enum Direction
|
||||
{
|
||||
DIRECTION_NONE=0, //!< No direction.
|
||||
DIRECTION_LEFT_TO_RIGHT, //!< Left to right.
|
||||
DIRECTION_RIGHT_TO_LEFT, //!< Right to left.
|
||||
DIRECTION_INVALID //!< Invalid direction.
|
||||
} Direction; //!< Direction of the wave.
|
||||
} WAVE_EFFECT_TYPE;
|
||||
}
|
||||
|
||||
//! Chroma Link
|
||||
namespace ChromaLink
|
||||
{
|
||||
//! Maximum number of elements/LEDs
|
||||
const RZSIZE MAX_LEDS = 5;
|
||||
|
||||
//! Chroma Link effect types
|
||||
typedef enum EFFECT_TYPE
|
||||
{
|
||||
CHROMA_NONE = 0, //!< No effect.
|
||||
CHROMA_CUSTOM, //!< Custom effect.
|
||||
CHROMA_STATIC, //!< Static single color effect.
|
||||
CHROMA_INVALID //!< Invalid effect.
|
||||
} EFFECT_TYPE;
|
||||
|
||||
//! Custom effect type.\n
|
||||
//! Use Custom type to create a sequence of animated effects.\n
|
||||
//! [ChromaLinkL#1|ChromaLinkL#2|ChromaLinkL#3|ChromaLinkL#4|ChromaLinkL#5].\n
|
||||
typedef struct CUSTOM_EFFECT_TYPE
|
||||
{
|
||||
RZCOLOR Color[MAX_LEDS]; //!< Array of colors.
|
||||
} CUSTOM_EFFECT_TYPE;
|
||||
|
||||
//! Static effect type.\n
|
||||
//! Use Static type to create effects for all LEDs (ChromaLinkL#1).
|
||||
typedef struct STATIC_EFFECT_TYPE
|
||||
{
|
||||
RZCOLOR Color; //!< Color of the effect.
|
||||
} STATIC_EFFECT_TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
|
||||
//! \file RzErrors.h
|
||||
//! \brief Error codes for Chroma SDK. If the error is not defined here, refer to WinError.h from the Windows SDK.
|
||||
|
||||
#ifndef _RZERRORS_H_
|
||||
#define _RZERRORS_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
// Error codes
|
||||
//! Invalid
|
||||
#define RZRESULT_INVALID -1L
|
||||
//! Success
|
||||
#define RZRESULT_SUCCESS 0L
|
||||
//! Access denied
|
||||
#define RZRESULT_ACCESS_DENIED 5L
|
||||
//! Invalid handle
|
||||
#define RZRESULT_INVALID_HANDLE 6L
|
||||
//! Not supported
|
||||
#define RZRESULT_NOT_SUPPORTED 50L
|
||||
//! Invalid parameter.
|
||||
#define RZRESULT_INVALID_PARAMETER 87L
|
||||
//! The service has not been started
|
||||
#define RZRESULT_SERVICE_NOT_ACTIVE 1062L
|
||||
//! Cannot start more than one instance of the specified program.
|
||||
#define RZRESULT_SINGLE_INSTANCE_APP 1152L
|
||||
//! Device not connected
|
||||
#define RZRESULT_DEVICE_NOT_CONNECTED 1167L
|
||||
//! Element not found.
|
||||
#define RZRESULT_NOT_FOUND 1168L
|
||||
//! Request aborted.
|
||||
#define RZRESULT_REQUEST_ABORTED 1235L
|
||||
//! An attempt was made to perform an initialization operation when initialization has already been completed.
|
||||
#define RZRESULT_ALREADY_INITIALIZED 1247L
|
||||
//! Resource not available or disabled
|
||||
#define RZRESULT_RESOURCE_DISABLED 4309L
|
||||
//! Device not available or supported
|
||||
#define RZRESULT_DEVICE_NOT_AVAILABLE 4319L
|
||||
//! The group or resource is not in the correct state to perform the requested operation.
|
||||
#define RZRESULT_NOT_VALID_STATE 5023L
|
||||
//! No more items
|
||||
#define RZRESULT_NO_MORE_ITEMS 259L
|
||||
//! General failure.
|
||||
#define RZRESULT_FAILED 2147500037L
|
||||
|
||||
#endif
|
||||
@@ -1,22 +1,22 @@
|
||||
/*-----------------------------------------*\
|
||||
| i2c_smbus_nuvoton_nct6793d.cpp |
|
||||
| i2c_smbus_nct6775.cpp |
|
||||
| |
|
||||
| Nuvoton NCT6793D SMBUS driver for Windows|
|
||||
| Nuvoton NCT67xx SMBUS driver for Windows |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 5/19/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "i2c_smbus_nuvoton_nct6793d.h"
|
||||
#include "i2c_smbus_nct6775.h"
|
||||
#include <Windows.h>
|
||||
#include "inpout32.h"
|
||||
|
||||
#pragma comment(lib, "inpout32.lib")
|
||||
|
||||
s32 i2c_smbus_nuvoton_nct6793d::nct6793d_access(u16 addr, char read_write, u8 command, int size, i2c_smbus_data *data)
|
||||
s32 i2c_smbus_nct6775::nct6775_access(u16 addr, char read_write, u8 command, int size, i2c_smbus_data *data)
|
||||
{
|
||||
int i, len, status, cnt;
|
||||
|
||||
Out32(SMBHSTCTL, NCT6793D_SOFT_RESET);
|
||||
Out32(SMBHSTCTL, NCT6775_SOFT_RESET);
|
||||
|
||||
switch (size)
|
||||
{
|
||||
@@ -30,11 +30,11 @@ s32 i2c_smbus_nuvoton_nct6793d::nct6793d_access(u16 addr, char read_write, u8 co
|
||||
if (read_write == I2C_SMBUS_WRITE)
|
||||
{
|
||||
Out32(SMBHSTDAT, data->byte);
|
||||
Out32(SMBHSTCMD, NCT6793D_WRITE_BYTE);
|
||||
Out32(SMBHSTCMD, NCT6775_WRITE_BYTE);
|
||||
}
|
||||
else
|
||||
{
|
||||
Out32(SMBHSTCMD, NCT6793D_READ_BYTE);
|
||||
Out32(SMBHSTCMD, NCT6775_READ_BYTE);
|
||||
}
|
||||
break;
|
||||
case I2C_SMBUS_WORD_DATA:
|
||||
@@ -44,11 +44,11 @@ s32 i2c_smbus_nuvoton_nct6793d::nct6793d_access(u16 addr, char read_write, u8 co
|
||||
{
|
||||
Out32(SMBHSTDAT, data->word & 0xFF);
|
||||
Out32(SMBHSTDAT, (data->word & 0xFF00) >> 8);
|
||||
Out32(SMBHSTCMD, NCT6793D_WRITE_WORD);
|
||||
Out32(SMBHSTCMD, NCT6775_WRITE_WORD);
|
||||
}
|
||||
else
|
||||
{
|
||||
Out32(SMBHSTCMD, NCT6793D_READ_WORD);
|
||||
Out32(SMBHSTCMD, NCT6775_READ_WORD);
|
||||
}
|
||||
break;
|
||||
case I2C_SMBUS_BLOCK_DATA:
|
||||
@@ -85,25 +85,25 @@ s32 i2c_smbus_nuvoton_nct6793d::nct6793d_access(u16 addr, char read_write, u8 co
|
||||
len = 0;
|
||||
}
|
||||
|
||||
Out32(SMBHSTCMD, NCT6793D_WRITE_BLOCK);
|
||||
Out32(SMBHSTCMD, NCT6775_WRITE_BLOCK);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
//Out32(SMBHSTCMD, NCT6793D_READ_BLOCK);
|
||||
//Out32(SMBHSTCMD, NCT6775_READ_BLOCK);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
Out32(SMBHSTCTL, NCT6793D_MANUAL_START);
|
||||
Out32(SMBHSTCTL, NCT6775_MANUAL_START);
|
||||
|
||||
while ((size == I2C_SMBUS_BLOCK_DATA) && (len > 0))
|
||||
{
|
||||
if (read_write == I2C_SMBUS_WRITE)
|
||||
{
|
||||
while ((Inp32(SMBHSTSTS) & NCT6793D_FIFO_EMPTY) == 0);
|
||||
while ((Inp32(SMBHSTSTS) & NCT6775_FIFO_EMPTY) == 0);
|
||||
|
||||
//Load more bytes into FIFO
|
||||
if (len >= 4)
|
||||
@@ -129,9 +129,9 @@ s32 i2c_smbus_nuvoton_nct6793d::nct6793d_access(u16 addr, char read_write, u8 co
|
||||
}
|
||||
|
||||
//wait for manual mode to complete
|
||||
while ((Inp32(SMBHSTSTS) & NCT6793D_MANUAL_ACTIVE) != 0);
|
||||
while ((Inp32(SMBHSTSTS) & NCT6775_MANUAL_ACTIVE) != 0);
|
||||
|
||||
if ((Inp32(SMBHSTERR) & NCT6793D_NO_ACK) != 0)
|
||||
if ((Inp32(SMBHSTERR) & NCT6775_NO_ACK) != 0)
|
||||
{
|
||||
return -EPROTO;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ s32 i2c_smbus_nuvoton_nct6793d::nct6793d_access(u16 addr, char read_write, u8 co
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 i2c_smbus_nuvoton_nct6793d::i2c_smbus_xfer(u8 addr, char read_write, u8 command, int size, i2c_smbus_data* data)
|
||||
s32 i2c_smbus_nct6775::i2c_smbus_xfer(u8 addr, char read_write, u8 command, int size, i2c_smbus_data* data)
|
||||
{
|
||||
return nct6793d_access(addr, read_write, command, size, data);
|
||||
return nct6775_access(addr, read_write, command, size, data);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*-----------------------------------------*\
|
||||
| i2c_smbus_nct6775.h |
|
||||
| |
|
||||
| Nuvoton NCT67xx SMBUS driver for Windows |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 5/19/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
#define SMBHSTDAT (0 + nct6775_smba)
|
||||
#define SMBBLKSZ (1 + nct6775_smba)
|
||||
#define SMBHSTCMD (2 + nct6775_smba)
|
||||
#define SMBHSTIDX (3 + nct6775_smba) //Index field is the Command field on other controllers
|
||||
#define SMBHSTCTL (4 + nct6775_smba)
|
||||
#define SMBHSTADD (5 + nct6775_smba)
|
||||
#define SMBHSTERR (9 + nct6775_smba)
|
||||
#define SMBHSTSTS (0xE + nct6775_smba)
|
||||
|
||||
/* Command register */
|
||||
#define NCT6775_READ_BYTE 0
|
||||
#define NCT6775_READ_WORD 1
|
||||
#define NCT6775_READ_BLOCK 2
|
||||
#define NCT6775_BLOCK_WRITE_READ_PROC_CALL 3
|
||||
#define NCT6775_PROC_CALL 4
|
||||
#define NCT6775_WRITE_BYTE 8
|
||||
#define NCT6775_WRITE_WORD 9
|
||||
#define NCT6775_WRITE_BLOCK 10
|
||||
|
||||
/* Control register */
|
||||
#define NCT6775_MANUAL_START 128
|
||||
#define NCT6775_SOFT_RESET 64
|
||||
|
||||
/* Error register */
|
||||
#define NCT6775_NO_ACK 32
|
||||
|
||||
/* Status register */
|
||||
#define NCT6775_FIFO_EMPTY 1
|
||||
#define NCT6775_FIFO_FULL 2
|
||||
#define NCT6775_MANUAL_ACTIVE 4
|
||||
|
||||
class i2c_smbus_nct6775: public i2c_smbus_interface
|
||||
{
|
||||
public:
|
||||
u16 nct6775_smba = 0x0290;
|
||||
|
||||
private:
|
||||
s32 nct6775_access(u16 addr, char read_write, u8 command, int size, i2c_smbus_data *data);
|
||||
s32 i2c_smbus_xfer(u8 addr, char read_write, u8 command, int size, i2c_smbus_data* data);
|
||||
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* main.cpp *
|
||||
* *
|
||||
* Main function for OpenAuraSDK GUI project *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
#include "OpenAuraSDK.h"
|
||||
#include "RGBController.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "OpenAuraSDKQtDialog.h"
|
||||
|
||||
|
||||
extern std::vector<i2c_smbus_interface*> busses;
|
||||
extern std::vector<RGBController*> rgb_controllers;
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* main *
|
||||
* *
|
||||
* Main function. Detects busses and Aura controllers, then opens the main window *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
DetectRGBControllers();
|
||||
|
||||
QApplication a(argc, argv);
|
||||
|
||||
Ui::OpenAuraSDKQtDialog 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,371 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Cross Platform Network Library for Windows and Linux |
|
||||
| This library provides access to TCP and UDP ports with |
|
||||
| a common API for both Windows and Linux systems. It |
|
||||
| features read and write |
|
||||
| |
|
||||
| Adam Honse ([email protected]), 12/15/2016 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "net_port.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <memory.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
|
||||
const char yes = 1;
|
||||
|
||||
net_port::net_port()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//net_port (constructor)
|
||||
// When created with port information, the constructor
|
||||
// will automatically open client address <client_name> on port <port>
|
||||
net_port::net_port(const char * client_name, const char * port)
|
||||
{
|
||||
udp_client(client_name, port);
|
||||
}
|
||||
|
||||
net_port::~net_port()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool net_port::udp_client(const char * client_name, const char * port)
|
||||
{
|
||||
sockaddr_in myAddress;
|
||||
|
||||
#ifdef WIN32
|
||||
if (WSAStartup(MAKEWORD(2, 2), &wsa) != NO_ERROR)
|
||||
{
|
||||
WSACleanup();
|
||||
return(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sock == INVALID_SOCKET)
|
||||
{
|
||||
WSACleanup();
|
||||
return(false);
|
||||
}
|
||||
|
||||
myAddress.sin_family = AF_INET;
|
||||
myAddress.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||
myAddress.sin_port = htons(0);
|
||||
|
||||
if (bind(sock, (sockaddr*)&myAddress, sizeof(myAddress)) == SOCKET_ERROR)
|
||||
{
|
||||
WSACleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
result_list = NULL;
|
||||
addrinfo hints = {};
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
if(getaddrinfo(client_name, port, &hints, &result_list) == 0)
|
||||
{
|
||||
memcpy(&addrDest, result_list->ai_addr, result_list->ai_addrlen);
|
||||
freeaddrinfo(result_list);
|
||||
return(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
WSACleanup();
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
int net_port::udp_listen(char * recv_data, int length)
|
||||
{
|
||||
return(recvfrom(sock, recv_data, length, 0, NULL, NULL));
|
||||
}
|
||||
|
||||
int net_port::udp_write(char * buffer, int length)
|
||||
{
|
||||
return(sendto(sock, buffer, length, 0, (sockaddr *)&addrDest, sizeof(addrDest)));
|
||||
}
|
||||
|
||||
bool net_port::tcp_client(const char * client_name, const char * port)
|
||||
{
|
||||
addrinfo hints = {};
|
||||
|
||||
connected = false;
|
||||
result_list = NULL;
|
||||
|
||||
#ifdef WIN32
|
||||
if (WSAStartup(MAKEWORD(2, 2), &wsa) != NO_ERROR)
|
||||
{
|
||||
WSACleanup();
|
||||
return(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
port = strtok((char *)port, "\r");
|
||||
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
getaddrinfo(client_name, port, &hints, &result_list);
|
||||
|
||||
if(result_list == NULL)
|
||||
{
|
||||
WSACleanup();
|
||||
return(false);
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool net_port::tcp_client_connect()
|
||||
{
|
||||
if (!connected)
|
||||
{
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock == INVALID_SOCKET)
|
||||
{
|
||||
WSACleanup();
|
||||
return(false);
|
||||
}
|
||||
|
||||
u_long arg = 1;
|
||||
fd_set fdset;
|
||||
timeval tv;
|
||||
|
||||
ioctlsocket(sock, FIONBIO, &arg);
|
||||
|
||||
if(result_list == NULL)
|
||||
{
|
||||
connected = false;
|
||||
return(false);
|
||||
}
|
||||
connect(sock, result_list->ai_addr, result_list->ai_addrlen);
|
||||
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(sock, &fdset);
|
||||
|
||||
tv.tv_sec = 4;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
if (select(sock + 1, NULL, &fdset, NULL, &tv) == 1)
|
||||
{
|
||||
char so_error;
|
||||
socklen_t len = sizeof(so_error);
|
||||
|
||||
getsockopt(sock, SOL_SOCKET, SO_ERROR, &so_error, &len);
|
||||
|
||||
if (so_error == 0)
|
||||
{
|
||||
connected = true;
|
||||
arg = 0;
|
||||
ioctlsocket(sock, FIONBIO, &arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
connected = false;
|
||||
closesocket(sock);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
connected = false;
|
||||
closesocket(sock);
|
||||
}
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool net_port::tcp_server(const char * port)
|
||||
{
|
||||
sockaddr_in myAddress;
|
||||
|
||||
#ifdef WIN32
|
||||
if (WSAStartup(MAKEWORD(2, 2), &wsa) != NO_ERROR)
|
||||
{
|
||||
WSACleanup();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock == INVALID_SOCKET)
|
||||
{
|
||||
WSACleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
port = strtok((char *)port, "\r");
|
||||
|
||||
myAddress.sin_family = AF_INET;
|
||||
myAddress.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||
myAddress.sin_port = htons(atoi(port));
|
||||
|
||||
if (bind(sock, (sockaddr*)&myAddress, sizeof(myAddress)) == SOCKET_ERROR)
|
||||
{
|
||||
WSACleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes));
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
void net_port::tcp_server_listen()
|
||||
{
|
||||
SOCKET * client = new SOCKET();
|
||||
listen(sock, 10);
|
||||
*client = accept(sock, NULL, NULL);
|
||||
u_long arg = 0;
|
||||
ioctlsocket(*client, FIONBIO, &arg);
|
||||
setsockopt(*client, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes));
|
||||
clients.push_back(client);
|
||||
}
|
||||
|
||||
void net_port::tcp_close()
|
||||
{
|
||||
closesocket(sock);
|
||||
connected = false;
|
||||
}
|
||||
|
||||
int net_port::tcp_listen(char * recv_data, int length)
|
||||
{
|
||||
int ret = 0;
|
||||
int len = 0;
|
||||
int tot = 0;
|
||||
timeval waitd;
|
||||
|
||||
fd_set readfd;
|
||||
|
||||
FD_ZERO(&readfd);
|
||||
FD_SET(sock, &readfd);
|
||||
|
||||
if (connected)
|
||||
{
|
||||
while(ret != sizeof(len))
|
||||
{
|
||||
waitd.tv_sec = 10;
|
||||
waitd.tv_usec = 0;
|
||||
|
||||
if (select(sock + 1, &readfd, NULL, NULL, &waitd))
|
||||
{
|
||||
ret = recv(sock, (char *)&len, sizeof(len), 0);
|
||||
|
||||
if (ret == -1 || ret == 0)
|
||||
{
|
||||
closesocket(sock);
|
||||
connected = false;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
closesocket(sock);
|
||||
connected = false;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
while(tot != len)
|
||||
{
|
||||
waitd.tv_sec = 10;
|
||||
waitd.tv_usec = 0;
|
||||
|
||||
if (select(sock + 1, &readfd, NULL, NULL, &waitd))
|
||||
{
|
||||
ret = recv(sock, recv_data + ret, len - ret, 0);
|
||||
|
||||
if (ret == -1 || ret == 0)
|
||||
{
|
||||
closesocket(sock);
|
||||
connected = false;
|
||||
return(0);
|
||||
}
|
||||
|
||||
tot += ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
closesocket(sock);
|
||||
connected = false;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int net_port::tcp_client_write(char * buffer, int length)
|
||||
{
|
||||
return(send(sock, buffer, length, 0));
|
||||
}
|
||||
|
||||
int net_port::tcp_write(char * buffer, int length)
|
||||
{
|
||||
int ret = length;
|
||||
int val = length;
|
||||
|
||||
timeval waitd;
|
||||
fd_set writefd;
|
||||
|
||||
for (unsigned int i = 0; i < clients.size(); i++)
|
||||
{
|
||||
val = length;
|
||||
|
||||
FD_ZERO(&writefd);
|
||||
FD_SET(*(clients[i]), &writefd);
|
||||
|
||||
waitd.tv_sec = 5;
|
||||
waitd.tv_usec = 0;
|
||||
|
||||
if (select(*(clients[i]) + 1, NULL, &writefd, NULL, &waitd))
|
||||
{
|
||||
val = send(*(clients[i]), (const char *)&length, sizeof(length), 0);
|
||||
|
||||
if (val == -1)
|
||||
{
|
||||
clients.erase(clients.begin() + i);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
clients.erase(clients.begin() + i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
waitd.tv_sec = 5;
|
||||
waitd.tv_usec = 0;
|
||||
|
||||
if (select(*(clients[i]) + 1, NULL, &writefd, NULL, &waitd))
|
||||
{
|
||||
val = send(*(clients[i]), buffer, length, 0);
|
||||
|
||||
if (val == -1)
|
||||
{
|
||||
clients.erase(clients.begin() + i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (val != length)
|
||||
{
|
||||
ret = val;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
clients.erase(clients.begin() + i);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Cross Platform Network Library for Windows and Linux |
|
||||
| This library provides access to TCP and UDP ports with |
|
||||
| a common API for both Windows and Linux systems. It |
|
||||
| features read and write |
|
||||
| |
|
||||
| Adam Honse ([email protected]), 12/15/2016 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#ifndef NET_PORT_H
|
||||
#define NET_PORT_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <net/if.h>
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#define SOCKET int
|
||||
#define ioctlsocket ioctl
|
||||
#define closesocket close
|
||||
#define WSACleanup()
|
||||
#define INVALID_SOCKET -1
|
||||
#define SOCKET_ERROR -1
|
||||
#endif
|
||||
|
||||
//Network Port Class
|
||||
//The reason for this class is that network ports are treated differently
|
||||
//on Windows and Linux. By creating a class, those differences can be
|
||||
//made invisible to the program and make cross-platform usage easy
|
||||
|
||||
class net_port
|
||||
{
|
||||
public:
|
||||
net_port();
|
||||
net_port(const char * client_name, const char * port);
|
||||
|
||||
~net_port();
|
||||
|
||||
//Function to open the port
|
||||
bool udp_client(const char* client_name, const char * port);
|
||||
bool tcp_client(const char* client_name, const char * port);
|
||||
bool tcp_client_connect();
|
||||
|
||||
//Function to open a server
|
||||
bool tcp_server(const char * port);
|
||||
void tcp_server_listen();
|
||||
|
||||
int udp_listen(char * recv_data, int length);
|
||||
int tcp_listen(char * recv_data, int length);
|
||||
|
||||
//Function to write data to the serial port
|
||||
int udp_write(char * buffer, int length);
|
||||
int tcp_write(char * buffer, int length);
|
||||
int tcp_client_write(char * buffer, int length);
|
||||
|
||||
void tcp_close();
|
||||
|
||||
bool connected;
|
||||
|
||||
private:
|
||||
#ifdef WIN32
|
||||
WSADATA wsa;
|
||||
#endif
|
||||
SOCKET sock;
|
||||
std::vector<SOCKET *> clients;
|
||||
|
||||
sockaddr addrDest;
|
||||
addrinfo* result_list;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,196 @@
|
||||
#include "OpenAuraSDKQtDialog.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)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
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();
|
||||
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
ui->ComboDevices->addItem(controllers[i]->name.c_str());
|
||||
}
|
||||
|
||||
//Triggers on_ComboDevices_currentIndexChanged so we don't need to update the other fields here
|
||||
ui->ComboDevices->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
OpenAuraSDKQtDialog::~OpenAuraSDKQtDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenAuraSDKQtDialog::show()
|
||||
{
|
||||
QMainWindow::show();
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonRed_clicked()
|
||||
{
|
||||
ui->EditLED0R->setText("255");
|
||||
ui->EditLED0G->setText("0");
|
||||
ui->EditLED0B->setText("0");
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonYellow_clicked()
|
||||
{
|
||||
ui->EditLED0R->setText("255");
|
||||
ui->EditLED0G->setText("255");
|
||||
ui->EditLED0B->setText("0");
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonGreen_clicked()
|
||||
{
|
||||
ui->EditLED0R->setText("0");
|
||||
ui->EditLED0G->setText("255");
|
||||
ui->EditLED0B->setText("0");
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonCyan_clicked()
|
||||
{
|
||||
ui->EditLED0R->setText("0");
|
||||
ui->EditLED0G->setText("255");
|
||||
ui->EditLED0B->setText("255");
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonBlue_clicked()
|
||||
{
|
||||
ui->EditLED0R->setText("0");
|
||||
ui->EditLED0G->setText("0");
|
||||
ui->EditLED0B->setText("255");
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonMagenta_clicked()
|
||||
{
|
||||
ui->EditLED0R->setText("255");
|
||||
ui->EditLED0G->setText("0");
|
||||
ui->EditLED0B->setText("255");
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonSetAll_clicked()
|
||||
{
|
||||
RGBColor color = ToRGBColor(
|
||||
ui->EditLED0R->text().toInt(),
|
||||
ui->EditLED0G->text().toInt(),
|
||||
ui->EditLED0B->text().toInt()
|
||||
);
|
||||
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetCustomMode();
|
||||
controllers[i]->SetAllLEDs(color);
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonSetDevice_clicked()
|
||||
{
|
||||
RGBColor color = ToRGBColor(
|
||||
ui->EditLED0R->text().toInt(),
|
||||
ui->EditLED0G->text().toInt(),
|
||||
ui->EditLED0B->text().toInt()
|
||||
);
|
||||
|
||||
controllers[ui->ComboDevices->currentIndex()]->SetAllLEDs(color);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonSetZone_clicked()
|
||||
{
|
||||
RGBColor color = ToRGBColor(
|
||||
ui->EditLED0R->text().toInt(),
|
||||
ui->EditLED0G->text().toInt(),
|
||||
ui->EditLED0B->text().toInt()
|
||||
);
|
||||
|
||||
controllers[ui->ComboDevices->currentIndex()]->SetAllZoneLEDs(ui->ComboZones->currentIndex(), color);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ButtonSetLED_clicked()
|
||||
{
|
||||
RGBColor color = ToRGBColor(
|
||||
ui->EditLED0R->text().toInt(),
|
||||
ui->EditLED0G->text().toInt(),
|
||||
ui->EditLED0B->text().toInt()
|
||||
);
|
||||
|
||||
controllers[ui->ComboDevices->currentIndex()]->SetLED(ui->ComboLEDs->currentIndex(), color);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ComboDevices_currentIndexChanged(int index)
|
||||
{
|
||||
ui->ComboModes->clear();
|
||||
|
||||
for (int i = 0; i < controllers[ui->ComboDevices->currentIndex()]->modes.size(); i++)
|
||||
{
|
||||
ui->ComboModes->addItem(controllers[ui->ComboDevices->currentIndex()]->modes[i].name.c_str());
|
||||
}
|
||||
|
||||
ui->ComboModes->setCurrentIndex(controllers[ui->ComboDevices->currentIndex()]->GetMode());
|
||||
|
||||
ui->ComboZones->clear();
|
||||
|
||||
for (int i = 0; i < controllers[ui->ComboDevices->currentIndex()]->zones.size(); i++)
|
||||
{
|
||||
ui->ComboZones->addItem(controllers[ui->ComboDevices->currentIndex()]->zones[i].name.c_str());
|
||||
}
|
||||
|
||||
ui->ComboZones->setCurrentIndex(0);
|
||||
|
||||
ui->ComboLEDs->clear();
|
||||
|
||||
for (int i = 0; i < controllers[ui->ComboDevices->currentIndex()]->leds.size(); i++)
|
||||
{
|
||||
ui->ComboLEDs->addItem(controllers[ui->ComboDevices->currentIndex()]->leds[i].name.c_str());
|
||||
}
|
||||
|
||||
ui->ComboLEDs->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void Ui::OpenAuraSDKQtDialog::on_ComboModes_currentIndexChanged(int index)
|
||||
{
|
||||
controllers[ui->ComboDevices->currentIndex()]->SetMode(ui->ComboModes->currentIndex());
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include "i2c_smbus.h"
|
||||
#include "AuraController.h"
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QTimer>
|
||||
@@ -22,7 +22,7 @@ class Ui::OpenAuraSDKQtDialog : public QMainWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenAuraSDKQtDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<AuraController *>& control, QWidget *parent = 0);
|
||||
explicit OpenAuraSDKQtDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, QWidget *parent = 0);
|
||||
~OpenAuraSDKQtDialog();
|
||||
|
||||
void show();
|
||||
@@ -30,36 +30,27 @@ public:
|
||||
|
||||
protected:
|
||||
std::vector<i2c_smbus_interface *>& busses;
|
||||
std::vector<AuraController *>& controllers;
|
||||
std::vector<RGBController *>& controllers;
|
||||
|
||||
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_ButtonSetAll_clicked();
|
||||
|
||||
void on_ButtonSetColors_clicked();
|
||||
void on_ButtonSetDevice_clicked();
|
||||
|
||||
void on_RadioDirect_clicked();
|
||||
void on_ButtonSetZone_clicked();
|
||||
|
||||
void on_RadioEffect_clicked();
|
||||
void on_ButtonSetLED_clicked();
|
||||
|
||||
void on_ComboAuraDevices_currentIndexChanged(int index);
|
||||
void on_ComboDevices_currentIndexChanged(int index);
|
||||
|
||||
void on_RadioOff_clicked();
|
||||
|
||||
void on_RadioStatic_clicked();
|
||||
|
||||
void on_RadioBreathing_clicked();
|
||||
|
||||
void on_RadioFlashing_clicked();
|
||||
|
||||
void on_RadioSpectrumCycle_clicked();
|
||||
|
||||
void on_RadioRainbow_clicked();
|
||||
|
||||
void on_RadioBreathingSpectrum_clicked();
|
||||
|
||||
void on_RadioChaseFade_clicked();
|
||||
|
||||
void on_ButtonDumpAura_clicked();
|
||||
void on_ComboModes_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::OpenAuraSDKQtDialogUi *ui;
|
||||
@@ -0,0 +1,312 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenAuraSDKQtDialogUi</class>
|
||||
<widget class="QMainWindow" name="OpenAuraSDKQtDialogUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>160</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>OpenAuraSDK</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<widget class="QPushButton" name="ButtonSetAll">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>80</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set All</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonSetZone">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>110</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set Zone</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED0R">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED0G">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>50</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="EditLED0B">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>50</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LabelRed">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Red</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LabelGreen">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>30</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Green</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LabelBlue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>30</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Blue</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="ComboDevices">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>10</y>
|
||||
<width>200</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LabelAuraDevice">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>10</y>
|
||||
<width>90</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="ComboModes">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>40</y>
|
||||
<width>200</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LabelMode">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>40</y>
|
||||
<width>90</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="ComboZones">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>70</y>
|
||||
<width>200</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LabelZone">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>70</y>
|
||||
<width>90</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zone</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="ComboLEDs">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>100</y>
|
||||
<width>200</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LabelLED">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>100</y>
|
||||
<width>90</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>LED</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonSetLED">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>110</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set LED</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonSetDevice">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>80</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonRed">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</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>40</x>
|
||||
<y>10</y>
|
||||
<width>21</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonGreen">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>10</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>100</x>
|
||||
<y>10</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>130</x>
|
||||
<y>10</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>160</x>
|
||||
<y>10</y>
|
||||
<width>21</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,219 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Cross Platform Serial COM Library for Windows and Linux |
|
||||
| This library provides access to serial ports with a |
|
||||
| common API for both Windows and Linux systems. It |
|
||||
| features read and write as well as tx/rx buffer flush. |
|
||||
| |
|
||||
| Adam Honse ([email protected]), 1/21/2013 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "serial_port.h"
|
||||
|
||||
//serial_port (constructor)
|
||||
// The default constructor does not initialize the serial port
|
||||
serial_port::serial_port()
|
||||
{
|
||||
//Set a default baud rate
|
||||
baud_rate = 9600;
|
||||
}
|
||||
|
||||
//serial_port (constructor)
|
||||
// When created with port information, the constructor
|
||||
// will automatically open port <name> at baud rate <baud>
|
||||
serial_port::serial_port(const char * name, unsigned int baud)
|
||||
{
|
||||
serial_open(name, baud);
|
||||
}
|
||||
|
||||
//~serial_port (destructor)
|
||||
// Closes the port before destroying the object
|
||||
serial_port::~serial_port()
|
||||
{
|
||||
serial_close();
|
||||
}
|
||||
|
||||
//open
|
||||
// Opens the serial port using stored information
|
||||
// Sets the baud rate to the stored baud rate
|
||||
// 8 data bits, no parity, one stop bit
|
||||
bool serial_port::serial_open()
|
||||
{
|
||||
// printf("SerialPort: Opening serial port %s at baud rate %d.\n", port_name, baud_rate);
|
||||
|
||||
#ifdef WIN32
|
||||
file_descriptor = CreateFile(port_name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
||||
if((int)file_descriptor < 0)
|
||||
{
|
||||
// printf("SerialPort: Port %s could not be opened: %d.\n", port_name, file_descriptor);
|
||||
return false;
|
||||
}
|
||||
|
||||
SetupComm(file_descriptor, 1, 128);
|
||||
GetCommState(file_descriptor, &dcb);
|
||||
|
||||
dcb.BaudRate = baud_rate; //Set baud rate
|
||||
dcb.ByteSize = 8; //8 data bits
|
||||
dcb.Parity = NOPARITY; //Parity = none
|
||||
dcb.StopBits = ONESTOPBIT; //One stop bit
|
||||
dcb.fAbortOnError = TRUE; //Abort on error
|
||||
dcb.fOutX = FALSE; //XON/XOFF off for transmit
|
||||
dcb.fInX = FALSE; //XON/XOFF off for receive
|
||||
dcb.fOutxCtsFlow = FALSE; //Turn off CTS flow control
|
||||
dcb.fRtsControl = RTS_CONTROL_DISABLE; //Options DISABLE, ENABLE, HANDSHAKE
|
||||
dcb.fOutxDsrFlow = FALSE; //Turn off DSR flow control
|
||||
dcb.fDtrControl = DTR_CONTROL_DISABLE; //Disable DTR control
|
||||
|
||||
SetCommState(file_descriptor, &dcb);
|
||||
|
||||
COMMTIMEOUTS timeouts = {0};
|
||||
timeouts.ReadIntervalTimeout = 50;
|
||||
timeouts.ReadTotalTimeoutConstant=50;
|
||||
timeouts.ReadTotalTimeoutMultiplier=10;
|
||||
timeouts.WriteTotalTimeoutConstant=50;
|
||||
timeouts.WriteTotalTimeoutMultiplier=10;
|
||||
SetCommTimeouts(file_descriptor, &timeouts);
|
||||
|
||||
#else
|
||||
|
||||
file_descriptor = open(port_name, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
|
||||
if(file_descriptor < 0)
|
||||
{
|
||||
// printf("SerialPort: Port %s could not be opened: %d.\n", port_name, file_descriptor);
|
||||
return false;
|
||||
}
|
||||
|
||||
struct termios2 options;
|
||||
ioctl(file_descriptor, TCGETS2, &options);
|
||||
options.c_cflag &= ~CBAUD;
|
||||
options.c_cflag |= BOTHER;
|
||||
options.c_ispeed = baud_rate;
|
||||
options.c_ospeed = baud_rate;
|
||||
ioctl(file_descriptor, TCSETS2, &options);
|
||||
|
||||
//serial_struct ss;
|
||||
//int closestSpeed;
|
||||
//ioctl(file_descriptor, TIOCGSERIAL, &ss);
|
||||
//ss.flags = (ss.flags & ~ASYNC_SPD_MASK) | ASYNC_SPD_CUST | ASYNCB_LOW_LATENCY;
|
||||
//ss.custom_divisor = (ss.baud_base + (baud_rate / 2)) / baud_rate;
|
||||
//if(ss.custom_divisor == 0)
|
||||
//{
|
||||
// closestSpeed = baud_rate;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// closestSpeed = ss.baud_base / ss.custom_divisor;
|
||||
//}
|
||||
|
||||
//if((float)closestSpeed < ((float)baud_rate * (98.0f/100.0f)) || (float)closestSpeed > ((float)baud_rate * (102.0f/100.0f)))
|
||||
//{
|
||||
// printf("SerialPort: Cannot set %s to %d. Closest possible speed is %d.\n", port_name, baud_rate, closestSpeed);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// printf("SerialPort: %s speed set to %d.\n", port_name, baud_rate);
|
||||
//}
|
||||
|
||||
//fcntl(file_descriptor, F_SETFL, 0);
|
||||
#endif
|
||||
|
||||
// printf("SerialPort: Serial port %s opened successfully.\n", port_name);
|
||||
return true;
|
||||
}
|
||||
|
||||
//open
|
||||
// Opens the serial port <name> without changing stored baud rate
|
||||
bool serial_port::serial_open(const char * name)
|
||||
{
|
||||
return serial_open(name, baud_rate);
|
||||
}
|
||||
|
||||
//open
|
||||
// Opens the serial port <name> at baud rate <baud>
|
||||
bool serial_port::serial_open(const char* name, unsigned int baud)
|
||||
{
|
||||
strcpy(port_name, name);
|
||||
baud_rate = baud;
|
||||
return serial_open();
|
||||
}
|
||||
|
||||
//close
|
||||
// Closes the serial port
|
||||
void serial_port::serial_close()
|
||||
{
|
||||
// printf("SerialPort: Closing port %s.\n", port_name);
|
||||
#ifdef WIN32
|
||||
|
||||
#else
|
||||
|
||||
close(file_descriptor);
|
||||
#endif
|
||||
}
|
||||
|
||||
// read
|
||||
// Reads <length> bytes from the serial port into <buffer>
|
||||
// Returns the number of bytes actually read
|
||||
// If less than <length> bytes are available, it will read all
|
||||
// available bytes
|
||||
int serial_port::serial_read(char * buffer, int length)
|
||||
{
|
||||
#ifdef WIN32
|
||||
DWORD bytesread;
|
||||
ReadFile(file_descriptor, buffer, length, &bytesread, NULL);
|
||||
|
||||
#else
|
||||
|
||||
int bytesread;
|
||||
bytesread = read(file_descriptor, buffer, length);
|
||||
#endif
|
||||
|
||||
//printf("SerialPort: Read %d bytes on port %s.\n", bytesread, port_name);
|
||||
return bytesread;
|
||||
}
|
||||
|
||||
//write
|
||||
// Writes <length> bytes to the serial port from <buffer>
|
||||
// Returns the number of bytes actually written
|
||||
// Does not check for null-termination, so if <length> is
|
||||
// greater than the number of bytes in <buffer>, it will read
|
||||
// past <buffer> and may cause a segfault
|
||||
int serial_port::serial_write(char * buffer, int length)
|
||||
{
|
||||
#ifdef WIN32
|
||||
DWORD byteswritten;
|
||||
WriteFile(file_descriptor, buffer, length, &byteswritten, NULL);
|
||||
|
||||
#else
|
||||
|
||||
int byteswritten;
|
||||
byteswritten = write(file_descriptor, buffer, length);
|
||||
#endif
|
||||
|
||||
//printf("SerialPort: Wrote %d bytes on port %s.\n", byteswritten, port_name);
|
||||
return byteswritten;
|
||||
}
|
||||
|
||||
//flush
|
||||
void serial_port::serial_flush_rx()
|
||||
{
|
||||
#ifdef WIN32
|
||||
PurgeComm(file_descriptor, PURGE_RXABORT | PURGE_RXCLEAR);
|
||||
|
||||
#else
|
||||
|
||||
tcflush(file_descriptor, TCIFLUSH);
|
||||
#endif
|
||||
}
|
||||
|
||||
void serial_port::serial_flush_tx()
|
||||
{
|
||||
|
||||
#ifdef WIN32
|
||||
PurgeComm(file_descriptor, PURGE_TXABORT | PURGE_TXCLEAR);
|
||||
|
||||
#else
|
||||
|
||||
tcflush(file_descriptor, TCOFLUSH);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Cross Platform Serial COM Library for Windows and Linux |
|
||||
| This library provides access to serial ports with a |
|
||||
| common API for both Windows and Linux systems. It |
|
||||
| features read and write as well as tx/rx buffer flush. |
|
||||
| |
|
||||
| Adam Honse ([email protected]), 1/21/2013 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#ifndef SERIAL_PORT_H
|
||||
#define SERIAL_PORT_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
//winsize, termio, and termios structs are redefined in
|
||||
//asm/termios.h, to prevent compiler errors from multply
|
||||
//defining them, use a #define to rename them -
|
||||
//essentially to undef them before they are redefined
|
||||
#define winsize undefine_winsize
|
||||
#define termio undefine_termio
|
||||
#define termios undefine_termios
|
||||
|
||||
#include <asm/termios.h>
|
||||
#include <asm-generic/ioctls.h>
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//Serial Port Class
|
||||
//The reason for this class is that serial ports are treated differently
|
||||
//on Windows and Linux. By creating a class, those differences can be
|
||||
//made invisible to the program and make cross-platform usage easy
|
||||
|
||||
class serial_port
|
||||
{
|
||||
public:
|
||||
serial_port();
|
||||
serial_port(const char * name, unsigned int baud);
|
||||
|
||||
~serial_port();
|
||||
|
||||
//Function to open the port
|
||||
bool serial_open();
|
||||
bool serial_open(const char* name);
|
||||
bool serial_open(const char* name, unsigned int baud);
|
||||
|
||||
//Function to close the port
|
||||
void serial_close();
|
||||
|
||||
//Functions for controlling baud rate
|
||||
void serial_set_baud(unsigned int baud);
|
||||
int serial_get_baud();
|
||||
|
||||
//Function to read data from the port buffer
|
||||
int serial_read(char * buffer, int length);
|
||||
|
||||
//Function to write data to the serial port
|
||||
int serial_write(char * buffer, int length);
|
||||
|
||||
//Functions to flush the serial port rx and tx buffers
|
||||
void serial_flush_rx();
|
||||
void serial_flush_tx();
|
||||
|
||||
//Function to list the number of available bytes
|
||||
int serial_available();
|
||||
|
||||
private:
|
||||
char port_name[1024];
|
||||
unsigned int baud_rate;
|
||||
|
||||
#ifdef WIN32
|
||||
HANDLE file_descriptor;
|
||||
DCB dcb;
|
||||
|
||||
#else
|
||||
|
||||
int file_descriptor;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,197 @@
|
||||
#include "OpenAuraSDKDialog.h"
|
||||
#include "OpenAuraSDK.h"
|
||||
#include "I2CDetectDialog.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC(OpenAuraSDKDialog, CDialogEx)
|
||||
|
||||
OpenAuraSDKDialog::OpenAuraSDKDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, CWnd* pParent)
|
||||
: CDialogEx(IDD_DIALOG_OPENAURASDK, pParent), busses(bus), controllers (control)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
OpenAuraSDKDialog::~OpenAuraSDKDialog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OpenAuraSDKDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(OpenAuraSDKDialog, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BUTTON_OPENAURASDK_I2CDETECT, &OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkI2cdetect)
|
||||
ON_CBN_CLOSEUP(IDC_COMBO_OPENAURASDK_DEVICE, &OpenAuraSDKDialog::OnCbnCloseupComboOpenaurasdkDevice)
|
||||
ON_BN_CLICKED(IDC_BUTTON_OPENAURASDK_SET_COLORS_ALL, &OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetColorsAll)
|
||||
ON_CBN_CLOSEUP(IDC_COMBO_OPENAURASDK_MODE, &OpenAuraSDKDialog::OnCbnCloseupComboOpenaurasdkMode)
|
||||
ON_BN_CLICKED(IDC_BUTTON_OPENAURASDK_SET_ZONE, &OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetZone)
|
||||
ON_BN_CLICKED(IDC_BUTTON_OPENAURASDK_SET_COLORS_LED, &OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetColorsLed)
|
||||
ON_BN_CLICKED(IDC_BUTTON_OPENAURASDK_SET_COLORS_DEVICE, &OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetColorsDevice)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
BOOL OpenAuraSDKDialog::OnInitDialog()
|
||||
{
|
||||
CComboBox* controller_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE);
|
||||
CComboBox* mode_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_MODE);
|
||||
CComboBox* zone_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_ZONE);
|
||||
CComboBox* led_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_LED);
|
||||
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controller_box->AddString(controllers[i]->name.c_str());
|
||||
}
|
||||
|
||||
controller_box->SetCurSel(0);
|
||||
|
||||
if (controllers.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < controllers[0]->modes.size(); i++)
|
||||
{
|
||||
mode_box->AddString(controllers[0]->modes[i].name.c_str());
|
||||
}
|
||||
|
||||
mode_box->SetCurSel(controllers[0]->GetMode());
|
||||
|
||||
for (int i = 0; i < controllers[0]->zones.size(); i++)
|
||||
{
|
||||
zone_box->AddString(controllers[0]->zones[i].name.c_str());
|
||||
}
|
||||
|
||||
zone_box->SetCurSel(0);
|
||||
|
||||
for (int i = 0; i < controllers[0]->leds.size(); i++)
|
||||
{
|
||||
led_box->AddString(controllers[0]->leds[i].name.c_str());
|
||||
}
|
||||
|
||||
led_box->SetCurSel(0);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkI2cdetect()
|
||||
{
|
||||
I2CDetectDialog dlg(busses);
|
||||
dlg.DoModal();
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetColorsAll()
|
||||
{
|
||||
RGBColor color = ToRGBColor(
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B)
|
||||
);
|
||||
|
||||
for (int i = 0; i < controllers.size(); i++)
|
||||
{
|
||||
controllers[i]->SetCustomMode();
|
||||
controllers[i]->SetAllLEDs(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnCbnCloseupComboOpenaurasdkDevice()
|
||||
{
|
||||
CComboBox* controller_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE);
|
||||
CComboBox* mode_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_MODE);
|
||||
CComboBox* zone_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_ZONE);
|
||||
CComboBox* led_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_LED);
|
||||
|
||||
if (controllers.size() > 0)
|
||||
{
|
||||
mode_box->ResetContent();
|
||||
|
||||
for (int i = 0; i < controllers[controller_box->GetCurSel()]->modes.size(); i++)
|
||||
{
|
||||
mode_box->AddString(controllers[controller_box->GetCurSel()]->modes[i].name.c_str());
|
||||
}
|
||||
|
||||
mode_box->SetCurSel(controllers[controller_box->GetCurSel()]->GetMode());
|
||||
|
||||
zone_box->ResetContent();
|
||||
|
||||
for (int i = 0; i < controllers[controller_box->GetCurSel()]->zones.size(); i++)
|
||||
{
|
||||
zone_box->AddString(controllers[controller_box->GetCurSel()]->zones[i].name.c_str());
|
||||
}
|
||||
|
||||
zone_box->SetCurSel(0);
|
||||
|
||||
led_box->ResetContent();
|
||||
|
||||
for (int i = 0; i < controllers[controller_box->GetCurSel()]->leds.size(); i++)
|
||||
{
|
||||
led_box->AddString(controllers[controller_box->GetCurSel()]->leds[i].name.c_str());
|
||||
}
|
||||
|
||||
led_box->SetCurSel(0);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenAuraSDKDialog::OnCbnCloseupComboOpenaurasdkMode()
|
||||
{
|
||||
CComboBox* controller_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE);
|
||||
CComboBox* mode_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_MODE);
|
||||
|
||||
if (controllers.size() > 0)
|
||||
{
|
||||
controllers[controller_box->GetCurSel()]->SetMode(mode_box->GetCurSel());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetZone()
|
||||
{
|
||||
CComboBox* controller_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE);
|
||||
CComboBox* zone_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_ZONE);
|
||||
|
||||
RGBColor color = ToRGBColor(
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B)
|
||||
);
|
||||
|
||||
if (controllers.size() > 0)
|
||||
{
|
||||
controllers[controller_box->GetCurSel()]->SetAllZoneLEDs(zone_box->GetCurSel(), color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetColorsLed()
|
||||
{
|
||||
CComboBox* controller_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE);
|
||||
CComboBox* led_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_LED);
|
||||
|
||||
RGBColor color = ToRGBColor(
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B)
|
||||
);
|
||||
|
||||
if (controllers.size() > 0)
|
||||
{
|
||||
controllers[controller_box->GetCurSel()]->SetLED(led_box->GetCurSel(), color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetColorsDevice()
|
||||
{
|
||||
CComboBox* controller_box = (CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE);
|
||||
|
||||
RGBColor color = ToRGBColor(
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_R),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_G),
|
||||
GetDlgItemInt(IDC_EDIT_OPENAURASDK_LED_0_B)
|
||||
);
|
||||
|
||||
if (controllers.size() > 0)
|
||||
{
|
||||
controllers[controller_box->GetCurSel()]->SetAllLEDs(color);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef OPENAURASDK_DIALOG_H
|
||||
#define OPENAURASDK_DIALOG_H
|
||||
|
||||
#include <afxdialogex.h>
|
||||
#include <vector>
|
||||
#include "i2c_smbus.h"
|
||||
#include "RGBController.h"
|
||||
#include "resource.h"
|
||||
|
||||
class OpenAuraSDKDialog : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(OpenAuraSDKDialog)
|
||||
|
||||
public:
|
||||
OpenAuraSDKDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, CWnd* pParent = NULL);
|
||||
virtual ~OpenAuraSDKDialog();
|
||||
virtual BOOL OnInitDialog();
|
||||
|
||||
private:
|
||||
void setMode(unsigned char mode_val);
|
||||
|
||||
protected:
|
||||
std::vector<i2c_smbus_interface *>& busses;
|
||||
std::vector<RGBController *>& controllers;
|
||||
virtual void DoDataExchange(CDataExchange* pDX);
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
afx_msg void OnBnClickedButtonOpenaurasdkI2cdetect();
|
||||
afx_msg void OnCbnCloseupComboOpenaurasdkDevice();
|
||||
afx_msg void OnBnClickedButtonOpenaurasdkSetColorsAll();
|
||||
afx_msg void OnCbnCloseupComboOpenaurasdkMode();
|
||||
afx_msg void OnBnClickedButtonOpenaurasdkSetZone();
|
||||
afx_msg void OnBnClickedButtonOpenaurasdkSetColorsLed();
|
||||
afx_msg void OnBnClickedButtonOpenaurasdkSetColorsDevice();
|
||||
};
|
||||
|
||||
#endif
|
||||
Binary file not shown.
@@ -24,7 +24,11 @@
|
||||
#define IDC_BUTTON_OPENAURASDK_SET_COLORS_ALL 1019
|
||||
#define IDC_COMBO_OPENAURASDK_DEVICE 1020
|
||||
#define IDC_EDIT_OPENAURASDK_LED_1_R 1021
|
||||
#define IDC_BUTTON_OPENAURASDK_SET_COLORS_ALL2 1021
|
||||
#define IDC_BUTTON_OPENAURASDK_SET_COLORS_LED 1021
|
||||
#define IDC_EDIT_OPENAURASDK_LED_1_G 1022
|
||||
#define IDC_BUTTON_OPENAURASDK_SET_COLORS_ALL3 1022
|
||||
#define IDC_BUTTON_OPENAURASDK_SET_COLORS_DEVICE 1022
|
||||
#define IDC_EDIT_OPENAURASDK_LED_1_B 1023
|
||||
#define IDC_EDIT_OPENAURASDK_LED_2_R 1024
|
||||
#define IDC_EDIT_OPENAURASDK_LED_2_G 1025
|
||||
@@ -39,6 +43,11 @@
|
||||
#define IDC_BUTTON_OPENAURASDK_DUMP 1033
|
||||
#define IDC_BUTTON_OPENAURASDK_SET_COLORS2 1034
|
||||
#define IDC_BUTTON_OPENAURASDK_SET_COLORS 1034
|
||||
#define IDC_BUTTON_OPENAURASDK_SET_ZONE 1034
|
||||
#define IDC_COMBO_OPENAURASDK_DEVICE2 1035
|
||||
#define IDC_COMBO_OPENAURASDK_MODE 1035
|
||||
#define IDC_COMBO_OPENAURASDK_ZONE 1036
|
||||
#define IDC_COMBO_OPENAURASDK_LED 1037
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
Reference in New Issue
Block a user