Compare commits
114
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46cc9ea248 | ||
|
|
bfd8030438 | ||
|
|
af84c5bb00 | ||
|
|
3de7150408 | ||
|
|
6fdf34e16f | ||
|
|
7bdf19387d | ||
|
|
a27c614a8b | ||
|
|
b7b93ad606 | ||
|
|
dbf796256b | ||
|
|
f38b90ad52 | ||
|
|
5f3fe509a4 | ||
|
|
189bf0d7a4 | ||
|
|
60531bbf07 | ||
|
|
fd9134c911 | ||
|
|
f33f00d8a9 | ||
|
|
f2d35466a5 | ||
|
|
bce9fc929e | ||
|
|
cdaae5fb9f | ||
|
|
9fc9059b0b | ||
|
|
2c1fe31211 | ||
|
|
13f53ae4f8 | ||
|
|
eac739fdb4 | ||
|
|
5ae3de993d | ||
|
|
e79c97c4d0 | ||
|
|
45c7bc8008 | ||
|
|
7de0b2549b | ||
|
|
39b52326b6 | ||
|
|
b35c900fae | ||
|
|
7cea74e466 | ||
|
|
5f3e43e7b8 | ||
|
|
a84407b609 | ||
|
|
000511deff | ||
|
|
fe37c261a2 | ||
|
|
cbdbb71d79 | ||
|
|
5f786e649a | ||
|
|
f76bf34d8d | ||
|
|
e799574730 | ||
|
|
1a5b12c7a0 | ||
|
|
d2acc75ba8 | ||
|
|
74bcfbd940 | ||
|
|
1db45f2cf2 | ||
|
|
6e467fe8cd | ||
|
|
441c462e59 | ||
|
|
89b4716012 | ||
|
|
e51e9a71a0 | ||
|
|
02273a3601 | ||
|
|
e0018b23aa | ||
|
|
b06f384350 | ||
|
|
7dddb9d111 | ||
|
|
0d38154134 | ||
|
|
7dd84c7ac8 | ||
|
|
ffd0088378 | ||
|
|
f0c486c30d | ||
|
|
010ab1182d | ||
|
|
7e64ca1f83 | ||
|
|
2fcff92523 | ||
|
|
8beeb5f7b2 | ||
|
|
7d2b5f285f | ||
|
|
b8eb4e9bcb | ||
|
|
733b904ec4 | ||
|
|
59a3b41480 | ||
|
|
28b41451f8 | ||
|
|
126c9295ac | ||
|
|
0e4a162667 | ||
|
|
15fd537fa8 | ||
|
|
557c9df9a0 | ||
|
|
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 |
@@ -0,0 +1,3 @@
|
||||
[submodule "dependencies/libe131"]
|
||||
path = dependencies/libe131
|
||||
url = https://github.com/CalcProgrammer1/libe131
|
||||
@@ -0,0 +1,330 @@
|
||||
/*-----------------------------------------*\
|
||||
| AMDWraithPrismController.h |
|
||||
| |
|
||||
| Driver for AMD Wraith Prism RGB lighting |
|
||||
| controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/6/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "AMDWraithPrismController.h"
|
||||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
AMDWraithPrismController::AMDWraithPrismController(libusb_device_handle* dev_handle)
|
||||
{
|
||||
dev = dev_handle;
|
||||
|
||||
strcpy(device_name, "AMD Wraith Prism");
|
||||
|
||||
SendEnableCommand();
|
||||
SetRingEffectChannel(0x00);
|
||||
SendApplyCommand();
|
||||
}
|
||||
|
||||
AMDWraithPrismController::~AMDWraithPrismController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
char* AMDWraithPrismController::GetDeviceName()
|
||||
{
|
||||
return device_name;
|
||||
}
|
||||
|
||||
std::string AMDWraithPrismController::GetEffectChannelString(unsigned char channel)
|
||||
{
|
||||
std::string ret_string = "";
|
||||
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x40, 0x21, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
int actual;
|
||||
|
||||
usb_buf[0x02] = channel;
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
|
||||
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
|
||||
|
||||
ret_string.append((char *)&usb_buf[0x08]);
|
||||
|
||||
return(ret_string);
|
||||
}
|
||||
|
||||
std::string AMDWraithPrismController::GetFirmwareVersionString()
|
||||
{
|
||||
std::string ret_string = "";
|
||||
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x12, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
int actual;
|
||||
unsigned char fw_buf[16] = {0x00};
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
|
||||
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
|
||||
|
||||
for(int char_idx = 0; char_idx < 16; char_idx+=2)
|
||||
{
|
||||
if(usb_buf[char_idx + 0x08] != 0)
|
||||
{
|
||||
fw_buf[char_idx / 2] = usb_buf[char_idx + 0x08];
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ret_string.append((char *)fw_buf);
|
||||
|
||||
return(ret_string);
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SetFanColor(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x51, 0x2C, 0x01, 0x00,
|
||||
0x06, 0xFF, 0x00, 0x01,
|
||||
0xFF, 0xFF, 0x00, 0xFF,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
|
||||
int actual;
|
||||
|
||||
usb_buf[0x0A] = red;
|
||||
usb_buf[0x0B] = green;
|
||||
usb_buf[0x0C] = blue;
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
|
||||
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SetLogoColor(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x51, 0x2C, 0x01, 0x00,
|
||||
0x05, 0xFF, 0x00, 0x01,
|
||||
0xFF, 0xFF, 0x00, 0xFF,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
|
||||
int actual;
|
||||
|
||||
usb_buf[0x0A] = red;
|
||||
usb_buf[0x0B] = green;
|
||||
usb_buf[0x0C] = blue;
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
|
||||
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SetRingColor(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x51, 0x2C, 0x01, 0x00,
|
||||
0x00, 0xFF, 0x00, 0xFF,
|
||||
0xFF, 0xFF, 0x00, 0xFF,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
|
||||
int actual;
|
||||
|
||||
usb_buf[0x0A] = red;
|
||||
usb_buf[0x0B] = green;
|
||||
usb_buf[0x0C] = blue;
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
|
||||
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SetRingEffectChannel(unsigned char channel)
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x51, 0xA0, 0x01, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00,
|
||||
0x05, 0x06, 0x07, 0x07,
|
||||
0x07, 0x07, 0x07, 0x07,
|
||||
0x07, 0x07, 0x07, 0x07,
|
||||
0x07, 0x07, 0x07, 0x07,
|
||||
0x07, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
int actual;
|
||||
|
||||
for(int led = 0x0A; led <= 0x18; led++)
|
||||
{
|
||||
usb_buf[led] = channel;
|
||||
}
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
|
||||
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SendEnableCommand()
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x41, 0x80, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
int actual;
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
|
||||
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SendApplyCommand()
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x51, 0x28, 0x00, 0x00,
|
||||
0xE0, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
int actual;
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
|
||||
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SendEffectCommand()
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x51, 0x2C, 0x01, 0x00,
|
||||
0x05, 0xFF, 0x00, 0x01,
|
||||
0xFF, 0xFF, 0x00, 0xFF,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
|
||||
int actual;
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
|
||||
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*-----------------------------------------*\
|
||||
| AMDWraithPrismController.h |
|
||||
| |
|
||||
| Definitions and types for AMD Wraith |
|
||||
| Prism lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/6/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
class AMDWraithPrismController
|
||||
{
|
||||
public:
|
||||
AMDWraithPrismController(libusb_device_handle* dev_handle);
|
||||
~AMDWraithPrismController();
|
||||
|
||||
char* GetDeviceName();
|
||||
|
||||
std::string GetEffectChannelString(unsigned char channel);
|
||||
std::string GetFirmwareVersionString();
|
||||
|
||||
void SetRingEffectChannel(unsigned char channel);
|
||||
|
||||
void SetFanColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLogoColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetRingColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
void SendEnableCommand();
|
||||
void SendApplyCommand();
|
||||
void SendEffectCommand();
|
||||
|
||||
private:
|
||||
char device_name[32];
|
||||
libusb_device_handle* dev;
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "AMDWraithPrismController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AMDWraithPrism.h"
|
||||
#include <vector>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
|
||||
#define AMD_WRAITH_PRISM_VID 0x2516
|
||||
#define AMD_WRAITH_PRISM_PID 0x0051
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectAMDWraithPrismControllers *
|
||||
* *
|
||||
* Tests the USB address to see if an AMD Wraith Prism controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAMDWraithPrismControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
libusb_context * ctx;
|
||||
libusb_init(&ctx);
|
||||
|
||||
//Look for AMD Wraith Prism
|
||||
libusb_device_handle * dev = libusb_open_device_with_vid_pid(ctx, AMD_WRAITH_PRISM_VID, AMD_WRAITH_PRISM_PID);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
libusb_detach_kernel_driver(dev, 1);
|
||||
libusb_claim_interface(dev, 1);
|
||||
|
||||
AMDWraithPrismController* controller = new AMDWraithPrismController(dev);
|
||||
|
||||
RGBController_AMDWraithPrism* rgb_controller = new RGBController_AMDWraithPrism(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraController.h |
|
||||
| AuraController.cpp |
|
||||
| |
|
||||
| Driver for ASUS Aura RGB lighting |
|
||||
| controller |
|
||||
@@ -17,49 +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;
|
||||
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()
|
||||
@@ -67,11 +82,76 @@ AuraController::~AuraController()
|
||||
|
||||
}
|
||||
|
||||
char * AuraController::GetDeviceName()
|
||||
std::string AuraController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string AuraController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
unsigned char AuraController::GetChannel(unsigned int led)
|
||||
{
|
||||
return(config_table[channel_cfg + led]);
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -81,7 +161,7 @@ void AuraController::SetAllColorsDirect(unsigned char red, unsigned char green,
|
||||
{
|
||||
unsigned char* colors = new unsigned char[led_count * 3];
|
||||
|
||||
for (int i = 0; i < (led_count * 3); i += 3)
|
||||
for (unsigned int i = 0; i < (led_count * 3); i += 3)
|
||||
{
|
||||
colors[i + 0] = red;
|
||||
colors[i + 1] = blue;
|
||||
@@ -97,7 +177,7 @@ void AuraController::SetAllColorsEffect(unsigned char red, unsigned char green,
|
||||
{
|
||||
unsigned char* colors = new unsigned char[led_count * 3];
|
||||
|
||||
for (int i = 0; i < (led_count * 3); i += 3)
|
||||
for (unsigned int i = 0; i < (led_count * 3); i += 3)
|
||||
{
|
||||
colors[i + 0] = red;
|
||||
colors[i + 1] = blue;
|
||||
@@ -108,7 +188,7 @@ void AuraController::SetAllColorsEffect(unsigned char red, unsigned char green,
|
||||
|
||||
AuraRegisterWrite(AURA_REG_APPLY, AURA_APPLY_VAL);
|
||||
|
||||
delete colors;
|
||||
delete[] colors;
|
||||
}
|
||||
|
||||
void AuraController::SetDirect(unsigned char direct)
|
||||
@@ -175,4 +255,4 @@ void AuraController::AuraRegisterWriteBlock(aura_register reg, unsigned char * d
|
||||
//Write Aura block data
|
||||
bus->i2c_smbus_write_block_data(dev, 0x03, sz, data);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
| Adam Honse (CalcProgrammer1) 8/19/2018 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
@@ -19,6 +20,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 +48,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
|
||||
@@ -54,7 +94,10 @@ public:
|
||||
AuraController(i2c_smbus_interface* bus, aura_dev_id dev);
|
||||
~AuraController();
|
||||
|
||||
char* GetDeviceName();
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
unsigned char GetChannel(unsigned int led);
|
||||
const char* GetChannelName(unsigned int led);
|
||||
unsigned int GetLEDCount();
|
||||
void SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetAllColorsEffect(unsigned char red, unsigned char green, unsigned char blue);
|
||||
@@ -65,17 +108,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,190 @@
|
||||
#include "AuraController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_Aura.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
static void Sleep(unsigned int milliseconds)
|
||||
{
|
||||
usleep(1000 * milliseconds);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
| This list contains the available SMBus addresses for mapping Aura RAM |
|
||||
\*----------------------------------------------------------------------*/
|
||||
#define AURA_RAM_ADDRESS_COUNT 17
|
||||
|
||||
static const unsigned char aura_ram_addresses[] =
|
||||
{
|
||||
0x70,
|
||||
0x71,
|
||||
0x73,
|
||||
0x74,
|
||||
0x75,
|
||||
0x76,
|
||||
0x78,
|
||||
0x79,
|
||||
0x7A,
|
||||
0x7B,
|
||||
0x7C,
|
||||
0x7D,
|
||||
0x7E,
|
||||
0x7F,
|
||||
0x4F,
|
||||
0x66,
|
||||
0x67
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------------*\
|
||||
| This list contains the available SMBus addresses for mapping Aura motherboards |
|
||||
\*---------------------------------------------------------------------------------*/
|
||||
#define AURA_MOBO_ADDRESS_COUNT 4
|
||||
|
||||
static const unsigned char aura_mobo_addresses[] =
|
||||
{
|
||||
0x40,
|
||||
0x4E,
|
||||
0x4F,
|
||||
0x66
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* AuraRegisterWrite *
|
||||
* *
|
||||
* A standalone version of the AuraController::AuraRegisterWrite function for access *
|
||||
* to Aura devices without instancing the AuraController class or reading the config *
|
||||
* table from the device. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void AuraRegisterWrite(i2c_smbus_interface* bus, aura_dev_id dev, aura_register reg, unsigned char val)
|
||||
{
|
||||
//Write Aura register
|
||||
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
|
||||
|
||||
//Write Aura value
|
||||
bus->i2c_smbus_write_byte_data(dev, 0x01, val);
|
||||
}
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* 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++)
|
||||
{
|
||||
int address_list_idx = 0;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if(address_list_idx < AURA_RAM_ADDRESS_COUNT)
|
||||
{
|
||||
res = busses[bus]->i2c_smbus_write_quick(aura_ram_addresses[address_list_idx], I2C_SMBUS_WRITE);
|
||||
address_list_idx++;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while (res >= 0);
|
||||
|
||||
AuraRegisterWrite(busses[bus], 0x77, AURA_REG_SLOT_INDEX, slot);
|
||||
AuraRegisterWrite(busses[bus], 0x77, AURA_REG_I2C_ADDRESS, (aura_ram_addresses[address_list_idx] << 1));
|
||||
}
|
||||
|
||||
// Add Aura-enabled controllers at their remapped addresses
|
||||
for (unsigned int address_list_idx = 0; address_list_idx < AURA_RAM_ADDRESS_COUNT; address_list_idx++)
|
||||
{
|
||||
if (TestForAuraController(busses[bus], aura_ram_addresses[address_list_idx]))
|
||||
{
|
||||
new_aura = new AuraController(busses[bus], aura_ram_addresses[address_list_idx]);
|
||||
new_controller = new RGBController_Aura(new_aura);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
// Add Aura-enabled motherboard controllers
|
||||
for (unsigned int address_list_idx = 0; address_list_idx < AURA_MOBO_ADDRESS_COUNT; address_list_idx++)
|
||||
{
|
||||
if (TestForAuraController(busses[bus], aura_mobo_addresses[address_list_idx]))
|
||||
{
|
||||
new_aura = new AuraController(busses[bus], aura_mobo_addresses[address_list_idx]);
|
||||
new_controller = new RGBController_Aura(new_aura);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectAuraControllers() */
|
||||
+27
-3
@@ -24,21 +24,45 @@ CorsairController::~CorsairController()
|
||||
|
||||
}
|
||||
|
||||
char * CorsairController::GetDeviceName()
|
||||
std::string CorsairController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string CorsairController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
unsigned int CorsairController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
| Adam Honse (CalcProgrammer1) 3/8/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
@@ -29,6 +30,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 +39,17 @@ public:
|
||||
CorsairController(i2c_smbus_interface* bus, corsair_dev_id dev);
|
||||
~CorsairController();
|
||||
|
||||
char* GetDeviceName();
|
||||
unsigned int GetLEDCount();
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
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,147 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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>
|
||||
|
||||
static 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 (unsigned int i = 0; i < led_count; i++)
|
||||
{
|
||||
led_red[i] = 0;
|
||||
led_green[i] = 0;
|
||||
led_blue[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CorsairProController::~CorsairProController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string CorsairProController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string CorsairProController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
unsigned int CorsairProController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
}
|
||||
|
||||
void CorsairProController::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
for (unsigned 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,90 @@
|
||||
/*-----------------------------------------*\
|
||||
| CorsairProController.h |
|
||||
| |
|
||||
| Definitions and types for Corsair |
|
||||
| Vengeance Pro RGB RAM lighting controller|
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/30/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#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();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
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,180 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Processing Code for NZXT Hue 2 |
|
||||
| |
|
||||
| Adam Honse ([email protected]), 12/29/2016 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "Hue2Controller.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
Hue2Controller::Hue2Controller(libusb_device_handle* dev_handle)
|
||||
{
|
||||
dev = dev_handle;
|
||||
|
||||
GetStripsOnChannel(HUE_2_CHANNEL_1);
|
||||
}
|
||||
|
||||
Hue2Controller::~Hue2Controller()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int Hue2Controller::GetStripsOnChannel(unsigned int /*channel*/)
|
||||
{
|
||||
unsigned int ret_val = 0;
|
||||
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x20, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
int actual = 0;
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
|
||||
libusb_interrupt_transfer(dev, 0x81, usb_buf, 64, &actual, 0);
|
||||
|
||||
for(int chan = 0; chan < 4; chan++)
|
||||
{
|
||||
unsigned int start = 0x0F + (6 * chan);
|
||||
unsigned int num_leds_on_channel = 0;
|
||||
for(int dev = 0; dev < 6; dev++)
|
||||
{
|
||||
switch(usb_buf[start + dev])
|
||||
{
|
||||
case 0x01: //Hue 1 strip
|
||||
num_leds_on_channel += 10;
|
||||
break;
|
||||
|
||||
case 0x04: //Hue 2 strip
|
||||
num_leds_on_channel += 10;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
channel_leds[chan] = num_leds_on_channel;
|
||||
}
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
void Hue2Controller::SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors)
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x22, 0x10, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
unsigned char usb_apply[] =
|
||||
{
|
||||
0x22, 0xA0, 0x01, 0x00,
|
||||
0x01, 0x00, 0x00, 0x28,
|
||||
0x00, 0x00, 0x80, 0x00,
|
||||
0x32, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
int actual;
|
||||
|
||||
std::size_t pkt_max = 20;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set channel in USB packets |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x02] = channel;
|
||||
usb_apply[0x02] = channel;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send first packet for first 20 LEDs |
|
||||
\*-----------------------------------------------------*/
|
||||
if(pkt_max > colors.size())
|
||||
{
|
||||
pkt_max = colors.size();
|
||||
}
|
||||
|
||||
for (std::size_t idx = 0; idx < pkt_max; idx++)
|
||||
{
|
||||
int pixel_idx = idx * 3;
|
||||
RGBColor color = colors[idx];
|
||||
usb_buf[pixel_idx + 4] = RGBGetGValue(color);
|
||||
usb_buf[pixel_idx + 5] = RGBGetRValue(color);
|
||||
usb_buf[pixel_idx + 6] = RGBGetBValue(color);
|
||||
}
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send second packet for second 20 LEDs if necessary |
|
||||
\*-----------------------------------------------------*/
|
||||
for(int idx = 4; idx < 64; idx++)
|
||||
{
|
||||
usb_buf[idx] = 0;
|
||||
}
|
||||
|
||||
usb_buf[0x01] = 0x11;
|
||||
pkt_max = 20;
|
||||
|
||||
if (colors.size() > 20)
|
||||
{
|
||||
pkt_max = colors.size() - 20;
|
||||
}
|
||||
|
||||
if(pkt_max > 0)
|
||||
{
|
||||
for (std::size_t idx = 0; idx < pkt_max; idx++)
|
||||
{
|
||||
int pixel_idx = idx * 3;
|
||||
RGBColor color = colors[idx + 20];
|
||||
usb_buf[pixel_idx + 4] = RGBGetGValue(color);
|
||||
usb_buf[pixel_idx + 5] = RGBGetRValue(color);
|
||||
usb_buf[pixel_idx + 6] = RGBGetBValue(color);
|
||||
}
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send apply packet |
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_interrupt_transfer(dev, 0x01, usb_apply, 64, &actual, 0);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Definitions for NZXT Hue 2 |
|
||||
| |
|
||||
| Adam Honse ([email protected]), 12/29/2016 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
#include <vector>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
HUE_2_CHANNEL_ALL = 0x00, /* All channels */
|
||||
HUE_2_CHANNEL_1 = 0x01, /* Channel 1 */
|
||||
HUE_2_CHANNEL_2 = 0x02, /* Channel 2 */
|
||||
HUE_2_CHANNEL_3 = 0x03, /* Channel 3 */
|
||||
HUE_2_CHANNEL_4 = 0x04, /* Channel 4 */
|
||||
HUE_2_NUM_CHANNELS = 0x04 /* Number of channels */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HUE_2_CHANNEL_1_IDX = 0x00, /* Channel 1 array index */
|
||||
HUE_2_CHANNEL_2_IDX = 0x01, /* Channel 2 array index */
|
||||
HUE_2_CHANNEL_3_IDX = 0x01, /* Channel 3 array index */
|
||||
HUE_2_CHANNEL_4_IDX = 0x01, /* Channel 4 array index */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HUE_2_MODE_FIXED = 0x00, /* Fixed colors mode */
|
||||
HUE_2_MODE_FADING = 0x01, /* Fading mode */
|
||||
HUE_2_MODE_SPECTRUM = 0x02, /* Spectrum cycle mode */
|
||||
HUE_2_MODE_MARQUEE = 0x03, /* Marquee mode */
|
||||
HUE_2_MODE_COVER_MARQUEE = 0x04, /* Cover marquee mode */
|
||||
HUE_2_MODE_ALTERNATING = 0x05, /* Alternating mode */
|
||||
HUE_2_MODE_PULSING = 0x06, /* Pulsing mode */
|
||||
HUE_2_MODE_BREATHING = 0x07, /* Breathing mode */
|
||||
HUE_2_NUM_MODES /* Number of Hue 2 modes */
|
||||
};
|
||||
|
||||
class Hue2Controller
|
||||
{
|
||||
public:
|
||||
Hue2Controller(libusb_device_handle* dev_handle);
|
||||
~Hue2Controller();
|
||||
|
||||
char* GetLEDString();
|
||||
unsigned int GetStripsOnChannel(unsigned int channel);
|
||||
void SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors);
|
||||
|
||||
unsigned int channel_leds[HUE_2_NUM_CHANNELS];
|
||||
|
||||
private:
|
||||
libusb_device_handle* dev;
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "Hue2Controller.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_Hue2.h"
|
||||
#include <vector>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
|
||||
#define NZXT_HUE_2_VID 0x1E71
|
||||
#define NZXT_HUE_2_PID 0x2001
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectHue2Controllers *
|
||||
* *
|
||||
* Detect devices supported by the Hue2 driver *
|
||||
* * *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectHue2Controllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
libusb_context * ctx;
|
||||
libusb_init(&ctx);
|
||||
|
||||
//Look for NZXT Hue 2
|
||||
libusb_device_handle * dev = libusb_open_device_with_vid_pid(ctx, NZXT_HUE_2_VID, NZXT_HUE_2_PID);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
libusb_detach_kernel_driver(dev, 0);
|
||||
libusb_claim_interface(dev, 0);
|
||||
|
||||
Hue2Controller* controller = new Hue2Controller(dev);
|
||||
|
||||
RGBController_Hue2* rgb_controller = new RGBController_Hue2(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
} /* DetectHuePlusControllers() */
|
||||
@@ -0,0 +1,114 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| Processing Code for NZXT Hue+ |
|
||||
| |
|
||||
| Adam Honse ([email protected]), 12/11/2016 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "HuePlusController.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
static void Sleep(unsigned int milliseconds)
|
||||
{
|
||||
usleep(1000 * milliseconds);
|
||||
}
|
||||
#endif
|
||||
|
||||
HuePlusController::HuePlusController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
HuePlusController::~HuePlusController()
|
||||
{
|
||||
}
|
||||
|
||||
void HuePlusController::Initialize(char* port_name)
|
||||
{
|
||||
strcpy(led_string, port_name);
|
||||
|
||||
serialport = new serial_port(port_name, HUE_PLUS_BAUD);
|
||||
|
||||
channel_leds[HUE_PLUS_CHANNEL_1_IDX] = GetStripsOnChannel(HUE_PLUS_CHANNEL_1) * 10;
|
||||
channel_leds[HUE_PLUS_CHANNEL_2_IDX] = GetStripsOnChannel(HUE_PLUS_CHANNEL_2) * 10;
|
||||
}
|
||||
|
||||
char* HuePlusController::GetLEDString()
|
||||
{
|
||||
return(led_string);
|
||||
}
|
||||
|
||||
unsigned int HuePlusController::GetStripsOnChannel(unsigned int channel)
|
||||
{
|
||||
unsigned int ret_val = 0;
|
||||
|
||||
if (serialport != NULL)
|
||||
{
|
||||
unsigned char *serial_buf;
|
||||
serial_buf = new unsigned char[5];
|
||||
|
||||
serial_buf[0] = 0x8D;
|
||||
serial_buf[1] = channel;
|
||||
|
||||
serialport->serial_flush_rx();
|
||||
serialport->serial_write((char *)serial_buf, 2);
|
||||
serialport->serial_flush_tx();
|
||||
|
||||
Sleep(50);
|
||||
|
||||
int bytes_read = serialport->serial_read((char *)serial_buf, 5);
|
||||
|
||||
if(bytes_read == 5)
|
||||
{
|
||||
ret_val = serial_buf[4];
|
||||
}
|
||||
|
||||
delete[] serial_buf;
|
||||
}
|
||||
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
void HuePlusController::SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors)
|
||||
{
|
||||
if (serialport != NULL)
|
||||
{
|
||||
unsigned char *serial_buf;
|
||||
|
||||
serial_buf = new unsigned char[HUE_PLUS_PACKET_SIZE];
|
||||
|
||||
serial_buf[0] = 0x4B;
|
||||
serial_buf[1] = channel;
|
||||
serial_buf[2] = HUE_PLUS_MODE_FIXED;
|
||||
serial_buf[3] = 0x00;
|
||||
serial_buf[4] = 0x00;
|
||||
|
||||
for (int i = 5; i < HUE_PLUS_PACKET_SIZE; i++)
|
||||
{
|
||||
serial_buf[i] = 0x00;
|
||||
}
|
||||
|
||||
for (unsigned int idx = 0; idx < (colors.size() * 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, HUE_PLUS_PACKET_SIZE);
|
||||
serialport->serial_flush_tx();
|
||||
|
||||
delete[] serial_buf;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| 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
|
||||
|
||||
#define HUE_PLUS_BAUD 256000
|
||||
#define HUE_PLUS_PACKET_SIZE 125
|
||||
|
||||
enum
|
||||
{
|
||||
HUE_PLUS_CHANNEL_BOTH = 0x00, /* Both channels */
|
||||
HUE_PLUS_CHANNEL_1 = 0x01, /* Channel 1 */
|
||||
HUE_PLUS_CHANNEL_2 = 0x02, /* Channel 2 */
|
||||
HUE_PLUS_NUM_CHANNELS = 0x02 /* Number of channels */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HUE_PLUS_CHANNEL_1_IDX = 0x00, /* Channel 1 array index */
|
||||
HUE_PLUS_CHANNEL_2_IDX = 0x01, /* Channel 2 array index */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HUE_PLUS_MODE_FIXED = 0x00, /* Fixed colors mode */
|
||||
HUE_PLUS_MODE_FADING = 0x01, /* Fading mode */
|
||||
HUE_PLUS_MODE_SPECTRUM = 0x02, /* Spectrum cycle mode */
|
||||
HUE_PLUS_NUM_MODES /* Number of Hue Plus modes */
|
||||
};
|
||||
|
||||
class HuePlusController
|
||||
{
|
||||
public:
|
||||
HuePlusController();
|
||||
~HuePlusController();
|
||||
|
||||
void Initialize(char* port_name);
|
||||
char* GetLEDString();
|
||||
unsigned int GetStripsOnChannel(unsigned int channel);
|
||||
void SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors);
|
||||
|
||||
unsigned int channel_leds[HUE_PLUS_NUM_CHANNELS];
|
||||
|
||||
private:
|
||||
char led_string[1024];
|
||||
char port_name[128];
|
||||
serial_port *serialport;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "HuePlusController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_HuePlus.h"
|
||||
#include "find_usb_serial_port.h"
|
||||
#include <vector>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectHuePlusControllers *
|
||||
* *
|
||||
* Detect devices supported by the HuePlus driver *
|
||||
* * *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectHuePlusControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
HuePlusController* new_hueplus;
|
||||
RGBController_HuePlus* new_controller;
|
||||
|
||||
std::string portname = find_usb_serial_port(0x04D8, 0x00DF);
|
||||
if( portname != "" )
|
||||
{
|
||||
new_hueplus = new HuePlusController();
|
||||
new_hueplus->Initialize((char *)portname.c_str());
|
||||
|
||||
new_controller = new RGBController_HuePlus(new_hueplus);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
} /* DetectHuePlusControllers() */
|
||||
@@ -0,0 +1,244 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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, unsigned char slots)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
slots_valid = slots;
|
||||
|
||||
strcpy(device_name, "HyperX Predator RGB");
|
||||
|
||||
led_count = 0;
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
if((slots_valid & (1 << i)) != 0)
|
||||
{
|
||||
led_count += 5;
|
||||
}
|
||||
}
|
||||
|
||||
mode = HYPERX_MODE_DIRECT;
|
||||
}
|
||||
|
||||
HyperXController::~HyperXController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string HyperXController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string HyperXController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
unsigned int HyperXController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
}
|
||||
|
||||
unsigned int HyperXController::GetSlotCount()
|
||||
{
|
||||
unsigned int slot_count = 0;
|
||||
|
||||
for(int slot = 0; slot < 4; slot++)
|
||||
{
|
||||
if((slots_valid & (1 << slot)) != 0)
|
||||
{
|
||||
slot_count++;
|
||||
}
|
||||
}
|
||||
|
||||
return(slot_count);
|
||||
}
|
||||
|
||||
unsigned int HyperXController::GetMode()
|
||||
{
|
||||
return(mode);
|
||||
}
|
||||
|
||||
void HyperXController::SetEffectColor(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_EFFECT_RED, red );
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_EFFECT_GREEN, green);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_EFFECT_BLUE, blue );
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_EFFECT_BRIGHTNESS, 0x64 );
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
|
||||
}
|
||||
|
||||
void HyperXController::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Loop through all slots and only set those which are |
|
||||
| active. |
|
||||
\*-----------------------------------------------------*/
|
||||
for(int slot = 0; slot < 4; slot++)
|
||||
{
|
||||
if((slots_valid & (1 << slot)) != 0)
|
||||
{
|
||||
unsigned char base = slot_base[slot];
|
||||
unsigned char red_base = base + 0x00;
|
||||
unsigned char green_base = base + 0x01;
|
||||
unsigned char blue_base = base + 0x02;
|
||||
unsigned char bright_base = base + 0x10;
|
||||
|
||||
if(mode == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE3, HYPERX_MODE3_DIRECT);
|
||||
}
|
||||
|
||||
for(int led = 0; led < 5; led++)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, red_base + (3 * led), red );
|
||||
bus->i2c_smbus_write_byte_data(dev, green_base + (3 * led), green);
|
||||
bus->i2c_smbus_write_byte_data(dev, blue_base + (3 * led), blue );
|
||||
bus->i2c_smbus_write_byte_data(dev, bright_base + (3 * led), 0x64 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
|
||||
}
|
||||
|
||||
void HyperXController::SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| led_slot - the unmapped slot ID for the given LED |
|
||||
| led - the LED ID within that slot |
|
||||
| slot_id - counts enabled slots |
|
||||
| slot - the mapped slot ID for the given LED |
|
||||
\*-----------------------------------------------------*/
|
||||
int led_slot = led / 5;
|
||||
int slot_id = -1;
|
||||
int slot;
|
||||
|
||||
led -= (led_slot * 5);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Loop through all possible slots and only count those |
|
||||
| which are active. |
|
||||
\*-----------------------------------------------------*/
|
||||
for(slot = 0; slot < 4; slot++)
|
||||
{
|
||||
if((slots_valid & ( 1 << slot)) != 0)
|
||||
{
|
||||
slot_id++;
|
||||
}
|
||||
|
||||
if(slot_id == led_slot)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char base = slot_base[slot];
|
||||
unsigned char red_base = base + 0x00;
|
||||
unsigned char green_base = base + 0x01;
|
||||
unsigned char blue_base = base + 0x02;
|
||||
unsigned char bright_base = base + 0x10;
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, red_base + (3 * led), red );
|
||||
bus->i2c_smbus_write_byte_data(dev, green_base + (3 * led), green);
|
||||
bus->i2c_smbus_write_byte_data(dev, blue_base + (3 * led), blue );
|
||||
bus->i2c_smbus_write_byte_data(dev, bright_base + (3 * led), 0x64 );
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
|
||||
}
|
||||
|
||||
|
||||
void HyperXController::SetLEDColor(unsigned int slot, unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
unsigned char base = slot_base[slot];
|
||||
unsigned char red_base = base + 0x00;
|
||||
unsigned char green_base = base + 0x01;
|
||||
unsigned char blue_base = base + 0x02;
|
||||
unsigned char bright_base = base + 0x10;
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, red_base + (3 * led), red );
|
||||
bus->i2c_smbus_write_byte_data(dev, green_base + (3 * led), green);
|
||||
bus->i2c_smbus_write_byte_data(dev, blue_base + (3 * led), blue );
|
||||
bus->i2c_smbus_write_byte_data(dev, bright_base + (3 * led), 0x64 );
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
|
||||
}
|
||||
|
||||
void HyperXController::SetMode(unsigned char new_mode)
|
||||
{
|
||||
mode = new_mode;
|
||||
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case HYPERX_MODE_DIRECT:
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE3, HYPERX_MODE3_DIRECT);
|
||||
break;
|
||||
|
||||
case HYPERX_MODE_STATIC:
|
||||
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_STATIC);
|
||||
break;
|
||||
|
||||
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,182 @@
|
||||
/*-----------------------------------------*\
|
||||
| HyperXController.h |
|
||||
| |
|
||||
| Definitions and types for HyperX Predator|
|
||||
| RGB RAM lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/29/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char hyperx_dev_id;
|
||||
typedef unsigned short hyperx_register;
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_REG_SLOT0_LED0_RED = 0x11, /* R color register for LED 0, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED0_GREEN = 0x12, /* G color register for LED 0, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED0_BLUE = 0x13, /* B color register for LED 0, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED1_RED = 0x14, /* R color register for LED 1, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED1_GREEN = 0x15, /* G color register for LED 1, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED1_BLUE = 0x16, /* B color register for LED 1, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED2_RED = 0x17, /* R color register for LED 2, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED2_GREEN = 0x18, /* G color register for LED 2, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED2_BLUE = 0x19, /* B color register for LED 2, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED3_RED = 0x1A, /* R color register for LED 3, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED3_GREEN = 0x1B, /* G color register for LED 3, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED3_BLUE = 0x1C, /* B color register for LED 3, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED4_RED = 0x1D, /* R color register for LED 4, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED4_GREEN = 0x1E, /* G color register for LED 4, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED4_BLUE = 0x1F, /* B color register for LED 4, Slot 0 */
|
||||
HYPERX_REG_SLOT0_LED0_BRIGHTNESS = 0x21, /* Brightness for LED 0, Slot 0 (0-100) */
|
||||
HYPERX_REG_SLOT0_LED1_BRIGHTNESS = 0x24, /* Brightness for LED 1, Slot 0 (0-100) */
|
||||
HYPERX_REG_SLOT0_LED2_BRIGHTNESS = 0x27, /* Brightness for LED 2, Slot 0 (0-100) */
|
||||
HYPERX_REG_SLOT0_LED3_BRIGHTNESS = 0x2A, /* Brightness for LED 3, Slot 0 (0-100) */
|
||||
HYPERX_REG_SLOT0_LED4_BRIGHTNESS = 0x2D, /* Brightness for LED 4, Slot 0 (0-100) */
|
||||
|
||||
HYPERX_REG_SLOT1_LED0_RED = 0x41, /* R color register for LED 0, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED0_GREEN = 0x42, /* G color register for LED 0, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED0_BLUE = 0x43, /* B color register for LED 0, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED1_RED = 0x44, /* R color register for LED 1, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED1_GREEN = 0x45, /* G color register for LED 1, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED1_BLUE = 0x46, /* B color register for LED 1, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED2_RED = 0x47, /* R color register for LED 2, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED2_GREEN = 0x48, /* G color register for LED 2, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED2_BLUE = 0x49, /* B color register for LED 2, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED3_RED = 0x4A, /* R color register for LED 3, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED3_GREEN = 0x4B, /* G color register for LED 3, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED3_BLUE = 0x4C, /* B color register for LED 3, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED4_RED = 0x4D, /* R color register for LED 4, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED4_GREEN = 0x4E, /* G color register for LED 4, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED4_BLUE = 0x4F, /* B color register for LED 4, Slot 1 */
|
||||
HYPERX_REG_SLOT1_LED0_BRIGHTNESS = 0x51, /* Brightness for LED 0, Slot 1 (0-100) */
|
||||
HYPERX_REG_SLOT1_LED1_BRIGHTNESS = 0x54, /* Brightness for LED 1, Slot 1 (0-100) */
|
||||
HYPERX_REG_SLOT1_LED2_BRIGHTNESS = 0x57, /* Brightness for LED 2, Slot 1 (0-100) */
|
||||
HYPERX_REG_SLOT1_LED3_BRIGHTNESS = 0x5A, /* Brightness for LED 3, Slot 1 (0-100) */
|
||||
HYPERX_REG_SLOT1_LED4_BRIGHTNESS = 0x5D, /* Brightness for LED 4, Slot 1 (0-100) */
|
||||
|
||||
HYPERX_REG_SLOT2_LED0_RED = 0x71, /* R color register for LED 0, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED0_GREEN = 0x72, /* G color register for LED 0, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED0_BLUE = 0x73, /* B color register for LED 0, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED1_RED = 0x74, /* R color register for LED 1, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED1_GREEN = 0x75, /* G color register for LED 1, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED1_BLUE = 0x76, /* B color register for LED 1, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED2_RED = 0x77, /* R color register for LED 2, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED2_GREEN = 0x78, /* G color register for LED 2, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED2_BLUE = 0x79, /* B color register for LED 2, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED3_RED = 0x7A, /* R color register for LED 3, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED3_GREEN = 0x7B, /* G color register for LED 3, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED3_BLUE = 0x7C, /* B color register for LED 3, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED4_RED = 0x7D, /* R color register for LED 4, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED4_GREEN = 0x7E, /* G color register for LED 4, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED4_BLUE = 0x7F, /* B color register for LED 4, Slot 2 */
|
||||
HYPERX_REG_SLOT2_LED0_BRIGHTNESS = 0x81, /* Brightness for LED 0, Slot 2 (0-100) */
|
||||
HYPERX_REG_SLOT2_LED1_BRIGHTNESS = 0x84, /* Brightness for LED 1, Slot 2 (0-100) */
|
||||
HYPERX_REG_SLOT2_LED2_BRIGHTNESS = 0x87, /* Brightness for LED 2, Slot 2 (0-100) */
|
||||
HYPERX_REG_SLOT2_LED3_BRIGHTNESS = 0x8A, /* Brightness for LED 3, Slot 2 (0-100) */
|
||||
HYPERX_REG_SLOT2_LED4_BRIGHTNESS = 0x8D, /* Brightness for LED 4, Slot 2 (0-100) */
|
||||
|
||||
HYPERX_REG_SLOT3_LED0_RED = 0xA1, /* R color register for LED 0, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED0_GREEN = 0xA2, /* G color register for LED 0, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED0_BLUE = 0xA3, /* B color register for LED 0, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED1_RED = 0xA4, /* R color register for LED 1, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED1_GREEN = 0xA5, /* G color register for LED 1, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED1_BLUE = 0xA6, /* B color register for LED 1, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED2_RED = 0xA7, /* R color register for LED 2, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED2_GREEN = 0xA8, /* G color register for LED 2, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED2_BLUE = 0xA9, /* B color register for LED 2, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED3_RED = 0xAA, /* R color register for LED 3, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED3_GREEN = 0xAB, /* G color register for LED 3, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED3_BLUE = 0xAC, /* B color register for LED 3, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED4_RED = 0xAD, /* R color register for LED 4, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED4_GREEN = 0xAE, /* G color register for LED 4, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED4_BLUE = 0xAF, /* B color register for LED 4, Slot 3 */
|
||||
HYPERX_REG_SLOT3_LED0_BRIGHTNESS = 0xB1, /* Brightness for LED 0, Slot 3 (0-100) */
|
||||
HYPERX_REG_SLOT3_LED1_BRIGHTNESS = 0xB4, /* Brightness for LED 1, Slot 3 (0-100) */
|
||||
HYPERX_REG_SLOT3_LED2_BRIGHTNESS = 0xB7, /* Brightness for LED 2, Slot 3 (0-100) */
|
||||
HYPERX_REG_SLOT3_LED3_BRIGHTNESS = 0xBA, /* Brightness for LED 3, Slot 3 (0-100) */
|
||||
HYPERX_REG_SLOT3_LED4_BRIGHTNESS = 0xBD, /* Brightness for LED 4, Slot 3 (0-100) */
|
||||
|
||||
HYPERX_REG_EFFECT_BRIGHTNESS = 0xDD, /* Brightness for effects (0-100) */
|
||||
HYPERX_REG_APPLY = 0xE1, /* Apply changes register */
|
||||
HYPERX_REG_MODE1 = 0xE3, /* Mode control register 1 */
|
||||
HYPERX_REG_MODE2 = 0xE4, /* Mode control register 2 */
|
||||
HYPERX_REG_MODE3 = 0xE5, /* Mode control register 3 */
|
||||
HYPERX_REG_EFFECT_RED = 0xEC, /* Red color register for effects */
|
||||
HYPERX_REG_EFFECT_GREEN = 0xED, /* Green color register for effects */
|
||||
HYPERX_REG_EFFECT_BLUE = 0xEE, /* Blue color register for effects */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
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_MODE3_DIRECT = 0x21, /* Mode 3 direct control */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_MODE_DIRECT = 0, /* Direct control mode */
|
||||
HYPERX_MODE_STATIC = 1, /* Static color mode */
|
||||
HYPERX_MODE_RAINBOW = 2, /* Rainbow wave mode */
|
||||
HYPERX_MODE_COMET = 3, /* Comet (chase) mode */
|
||||
HYPERX_MODE_HEARTBEAT = 4, /* Heartbeat (pulsing) mode */
|
||||
HYPERX_MODE_CYCLE = 5, /* Spectrum cycle mode */
|
||||
HYPERX_MODE_BREATHING = 6, /* Breathing mode */
|
||||
HYPERX_MODE_BOUNCE = 7, /* Bounce mode */
|
||||
HYPERX_MODE_BLINK = 8, /* Blinking mode */
|
||||
HYPERX_NUMBER_MODES /* Number of HyperX modes */
|
||||
};
|
||||
|
||||
static const unsigned char slot_base[4] =
|
||||
{
|
||||
HYPERX_REG_SLOT0_LED0_RED, /* SPD 0x50 maps to slot 0 */
|
||||
HYPERX_REG_SLOT1_LED0_RED, /* SPD 0x51 maps to slot 1 */
|
||||
HYPERX_REG_SLOT2_LED0_RED, /* SPD 0x52 maps to slot 2 */
|
||||
HYPERX_REG_SLOT3_LED0_RED /* SPD 0x53 maps to slot 3 */
|
||||
};
|
||||
|
||||
class HyperXController
|
||||
{
|
||||
public:
|
||||
HyperXController(i2c_smbus_interface* bus, hyperx_dev_id dev, unsigned char slots);
|
||||
~HyperXController();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
unsigned int GetLEDCount();
|
||||
unsigned int GetSlotCount();
|
||||
unsigned int GetMode();
|
||||
void SetMode(unsigned char new_mode);
|
||||
|
||||
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetEffectColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDColor(unsigned int slot, unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
private:
|
||||
char device_name[32];
|
||||
unsigned int led_count;
|
||||
unsigned char slots_valid;
|
||||
i2c_smbus_interface* bus;
|
||||
hyperx_dev_id dev;
|
||||
unsigned int mode;
|
||||
};
|
||||
@@ -0,0 +1,104 @@
|
||||
#include "HyperXController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_HyperX.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
static void Sleep(unsigned int milliseconds)
|
||||
{
|
||||
usleep(1000 * milliseconds);
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForHyperXController *
|
||||
* *
|
||||
* 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++)
|
||||
{
|
||||
unsigned char slots_valid = 0x00;
|
||||
|
||||
// Check for HyperX controller at 0x27
|
||||
if (TestForHyperXController(busses[bus], 0x27))
|
||||
{
|
||||
busses[bus]->i2c_smbus_write_byte_data(0x37, 0x00, 0xFF);
|
||||
|
||||
Sleep(1);
|
||||
|
||||
for(int slot_addr = 0x50; slot_addr <= 0x57; slot_addr++)
|
||||
{
|
||||
// Test for HyperX SPD at slot_addr
|
||||
// This test was copied from NGENUITY software
|
||||
// Tests SPD addresses in order: 0x40, 0x41
|
||||
if((busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x40) == 0x01)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x41) == 0x98))
|
||||
{
|
||||
slots_valid |= (1 << (slot_addr - 0x50));
|
||||
}
|
||||
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
if(slots_valid != 0)
|
||||
{
|
||||
new_hyperx = new HyperXController(busses[bus], 0x27, slots_valid);
|
||||
new_controller = new RGBController_HyperX(new_hyperx);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectHyperXControllers() */
|
||||
@@ -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, "\\ledstrip.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, "/ledstrip.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() */
|
||||
@@ -0,0 +1,175 @@
|
||||
/*-----------------------------------------*\
|
||||
| PatriotViperController.cpp |
|
||||
| |
|
||||
| Definitions and types for Patriot Viper |
|
||||
| RGB RAM lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/1/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "PatriotViperController.h"
|
||||
#include <cstring>
|
||||
|
||||
PatriotViperController::PatriotViperController(i2c_smbus_interface* bus, viper_dev_id dev, unsigned char slots)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
slots_valid = slots;
|
||||
|
||||
strcpy(device_name, "Patriot Viper RGB");
|
||||
|
||||
led_count = 0;
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
if((slots_valid & (1 << i)) != 0)
|
||||
{
|
||||
led_count += 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PatriotViperController::~PatriotViperController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string PatriotViperController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string PatriotViperController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
unsigned int PatriotViperController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
}
|
||||
|
||||
unsigned int PatriotViperController::GetSlotCount()
|
||||
{
|
||||
unsigned int slot_count = 0;
|
||||
|
||||
for(int slot = 0; slot < 4; slot++)
|
||||
{
|
||||
if((slots_valid & (1 << slot)) != 0)
|
||||
{
|
||||
slot_count++;
|
||||
}
|
||||
}
|
||||
|
||||
return(slot_count);
|
||||
}
|
||||
|
||||
unsigned int PatriotViperController::GetMode()
|
||||
{
|
||||
return(mode);
|
||||
}
|
||||
|
||||
void PatriotViperController::SetEffectColor(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
ViperRegisterWrite(VIPER_REG_START, 0xFF, 0xFF, 0xFF);
|
||||
ViperRegisterWrite(VIPER_REG_STATIC, 0x04, 0x00, 0x00);
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_LED0_EFFECT_COLOR, red, blue, green);
|
||||
ViperRegisterWrite(VIPER_REG_LED1_EFFECT_COLOR, red, blue, green);
|
||||
ViperRegisterWrite(VIPER_REG_LED2_EFFECT_COLOR, red, blue, green);
|
||||
ViperRegisterWrite(VIPER_REG_LED3_EFFECT_COLOR, red, blue, green);
|
||||
ViperRegisterWrite(VIPER_REG_LED4_EFFECT_COLOR, red, blue, green);
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_MODE, mode, 0x00, 0x0C);
|
||||
ViperRegisterWrite(VIPER_REG_MODE, 0xAA, 0x00, 0x00);
|
||||
ViperRegisterWrite(VIPER_REG_MODE, 0xFA, 0x00, 0x00);
|
||||
}
|
||||
|
||||
void PatriotViperController::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
ViperRegisterWrite(VIPER_REG_START, 0xFF, 0xFF, 0xFF);
|
||||
ViperRegisterWrite(VIPER_REG_STATIC, 0x04, 0x00, 0x00);
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_LED0_DIRECT_COLOR, red, blue, green);
|
||||
ViperRegisterWrite(VIPER_REG_LED1_DIRECT_COLOR, red, blue, green);
|
||||
ViperRegisterWrite(VIPER_REG_LED2_DIRECT_COLOR, red, blue, green);
|
||||
ViperRegisterWrite(VIPER_REG_LED3_DIRECT_COLOR, red, blue, green);
|
||||
ViperRegisterWrite(VIPER_REG_LED4_DIRECT_COLOR, red, blue, green);
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_APPLY, 0x01, 0x00, 0x00);
|
||||
}
|
||||
|
||||
void PatriotViperController::SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
ViperRegisterWrite(VIPER_REG_START, 0xFF, 0xFF, 0xFF);
|
||||
ViperRegisterWrite(VIPER_REG_STATIC, 0x04, 0x00, 0x00);
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_LED0_DIRECT_COLOR + led, red, blue, green);
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_APPLY, 0x01, 0x00, 0x00);
|
||||
}
|
||||
|
||||
void PatriotViperController::SetLEDEffectColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
ViperRegisterWrite(VIPER_REG_START, 0xFF, 0xFF, 0xFF);
|
||||
ViperRegisterWrite(VIPER_REG_STATIC, 0x04, 0x00, 0x00);
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_LED0_EFFECT_COLOR + led, red, blue, green);
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_MODE, mode, 0x00, 0x0C);
|
||||
ViperRegisterWrite(VIPER_REG_MODE, 0xAA, 0x00, 0x00);
|
||||
ViperRegisterWrite(VIPER_REG_MODE, 0xFA, 0x00, 0x00);
|
||||
}
|
||||
|
||||
void PatriotViperController::SetLEDColor(unsigned int slot, unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
ViperRegisterWrite(VIPER_REG_START, 0xFF, 0xFF, 0xFF);
|
||||
ViperRegisterWrite(VIPER_REG_STATIC, 0x04, 0x00, 0x00);
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_LED0_DIRECT_COLOR + led, red, blue, green);
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_APPLY, 0x01, 0x00, 0x00);
|
||||
}
|
||||
|
||||
void PatriotViperController::SetLEDEffectColor(unsigned int slot, unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
ViperRegisterWrite(VIPER_REG_START, 0xFF, 0xFF, 0xFF);
|
||||
ViperRegisterWrite(VIPER_REG_STATIC, 0x04, 0x00, 0x00);
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_LED0_EFFECT_COLOR + led, red, blue, green);
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_MODE, mode, 0x00, 0x0C);
|
||||
ViperRegisterWrite(VIPER_REG_MODE, 0xAA, 0x00, 0x00);
|
||||
ViperRegisterWrite(VIPER_REG_MODE, 0xFA, 0x00, 0x00);
|
||||
}
|
||||
|
||||
void PatriotViperController::SetMode(unsigned char new_mode)
|
||||
{
|
||||
direct = false;
|
||||
mode = new_mode;
|
||||
|
||||
ViperRegisterWrite(VIPER_REG_START, 0xFF, 0xFF, 0xFF);
|
||||
ViperRegisterWrite(VIPER_REG_STATIC, 0x04, 0x00, 0x00);
|
||||
ViperRegisterWrite(VIPER_REG_MODE, new_mode, 0x00, 0x0C);
|
||||
ViperRegisterWrite(VIPER_REG_MODE, 0xAA, 0x00, 0x00);
|
||||
ViperRegisterWrite(VIPER_REG_MODE, 0xFA, 0x00, 0x00);
|
||||
}
|
||||
|
||||
void PatriotViperController::SetDirect()
|
||||
{
|
||||
direct = true;
|
||||
ViperRegisterWrite(VIPER_REG_START, 0xFF, 0xFF, 0xFF);
|
||||
ViperRegisterWrite(VIPER_REG_STATIC, 0x04, 0x00, 0x00);
|
||||
ViperRegisterWrite(VIPER_REG_APPLY, 0x01, 0x00, 0x00);
|
||||
}
|
||||
|
||||
void PatriotViperController::ViperRegisterWrite(viper_register reg, unsigned char val0, unsigned char val1, unsigned char val2)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, reg, val0);
|
||||
bus->i2c_smbus_write_byte_data(dev, val2, val1);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*-----------------------------------------*\
|
||||
| PatriotViperController.h |
|
||||
| |
|
||||
| Definitions and types for Patriot Viper |
|
||||
| RGB RAM lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/1/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char viper_dev_id;
|
||||
typedef unsigned short viper_register;
|
||||
|
||||
enum
|
||||
{
|
||||
VIPER_REG_STATIC = 0x01, /* Set static mode */
|
||||
VIPER_REG_MODE = 0x03, /* Mode register */
|
||||
VIPER_REG_LED0_DIRECT_COLOR = 0x30, /* LED 0 Color (R, B, G) */
|
||||
VIPER_REG_LED1_DIRECT_COLOR = 0x31, /* LED 1 Color (R, B, G) */
|
||||
VIPER_REG_LED2_DIRECT_COLOR = 0x32, /* LED 2 Color (R, B, G) */
|
||||
VIPER_REG_LED3_DIRECT_COLOR = 0x33, /* LED 3 Color (R, B, G) */
|
||||
VIPER_REG_LED4_DIRECT_COLOR = 0x34, /* LED 4 Color (R, B, G) */
|
||||
VIPER_REG_APPLY = 0x35, /* Apply Changes (0x01, 0x00, 0x00) */
|
||||
VIPER_REG_LED0_EFFECT_COLOR = 0x3B, /* LED 0 Color (R, B, G) */
|
||||
VIPER_REG_LED1_EFFECT_COLOR = 0x3C, /* LED 1 Color (R, B, G) */
|
||||
VIPER_REG_LED2_EFFECT_COLOR = 0x3D, /* LED 2 Color (R, B, G) */
|
||||
VIPER_REG_LED3_EFFECT_COLOR = 0x3E, /* LED 3 Color (R, B, G) */
|
||||
VIPER_REG_LED4_EFFECT_COLOR = 0x3F, /* LED 4 Color (R, B, G) */
|
||||
VIPER_REG_START = 0xFF, /* Start Frame (0xFF, 0xFF, 0xFF) */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
VIPER_MODE_DARK = 0x00, /* Dark mode */
|
||||
VIPER_MODE_BREATHING = 0x01, /* Breathing mode */
|
||||
VIPER_MODE_VIPER = 0x02, /* Viper mode */
|
||||
VIPER_MODE_HEARTBEAT = 0x03, /* Heartbeat mode */
|
||||
VIPER_MODE_MARQUEE = 0x04, /* Marquee mode */
|
||||
VIPER_MODE_RAINDROP = 0x05, /* Raindrop mode */
|
||||
VIPER_MODE_AURORA = 0x06, /* Aurora mode */
|
||||
VIPER_MODE_NEON = 0x08, /* Neon mode */
|
||||
};
|
||||
|
||||
class PatriotViperController
|
||||
{
|
||||
public:
|
||||
PatriotViperController(i2c_smbus_interface* bus, viper_dev_id dev, unsigned char slots);
|
||||
~PatriotViperController();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
unsigned int GetLEDCount();
|
||||
unsigned int GetSlotCount();
|
||||
unsigned int GetMode();
|
||||
void SetMode(unsigned char new_mode);
|
||||
void SetDirect();
|
||||
|
||||
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetEffectColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDColor(unsigned int slot, unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDEffectColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDEffectColor(unsigned int slot, unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
void ViperRegisterWrite(viper_register reg, unsigned char val0, unsigned char val1, unsigned char val2);
|
||||
bool direct;
|
||||
|
||||
private:
|
||||
char device_name[32];
|
||||
unsigned int led_count;
|
||||
unsigned char slots_valid;
|
||||
i2c_smbus_interface* bus;
|
||||
viper_dev_id dev;
|
||||
unsigned int mode;
|
||||
};
|
||||
@@ -0,0 +1,81 @@
|
||||
#include "PatriotViperController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_PatriotViper.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
static void Sleep(unsigned int milliseconds)
|
||||
{
|
||||
usleep(1000 * milliseconds);
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectPatriotViperControllers *
|
||||
* *
|
||||
* Detect Patriot Viper RGB controllers on the enumerated I2C busses. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where Aura device is connected *
|
||||
* dev - I2C address of Aura device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectPatriotViperControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
PatriotViperController* new_viper;
|
||||
RGBController_PatriotViper* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
unsigned char slots_valid = 0x00;
|
||||
|
||||
for(int slot_addr = 0x50; slot_addr <= 0x57; slot_addr++)
|
||||
{
|
||||
// Test for Patriot Viper RGB SPD at slot_addr
|
||||
// This test was copied from Viper RGB software
|
||||
// Tests SPD addresses in order: 0x00, 0x40, 0x41, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68
|
||||
busses[bus]->i2c_smbus_write_byte_data(0x36, 0x00, 0xFF);
|
||||
|
||||
Sleep(1);
|
||||
|
||||
if(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x00) == 0x23)
|
||||
{
|
||||
busses[bus]->i2c_smbus_write_byte_data(0x37, 0x00, 0xFF);
|
||||
|
||||
Sleep(1);
|
||||
|
||||
if((busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x40) == 0x85)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x41) == 0x02)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x61) == 0x4D)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x62) == 0x49)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x63) == 0x43)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x64) == 0x53)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x65) == 0x59)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x66) == 0x53)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x67) == 0x5f)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x68) == 0x44))
|
||||
{
|
||||
slots_valid |= (1 << (slot_addr - 0x50));
|
||||
}
|
||||
}
|
||||
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
if(slots_valid != 0)
|
||||
{
|
||||
new_viper = new PatriotViperController(busses[bus], 0x77, slots_valid);
|
||||
new_controller = new RGBController_PatriotViper(new_viper);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectPatriotViperControllers() */
|
||||
@@ -0,0 +1,120 @@
|
||||
/*-----------------------------------------*\
|
||||
| PolychromeController.cpp |
|
||||
| |
|
||||
| Driver for for ASRock ASR LED and |
|
||||
| Polychrome RGB lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/14/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "PolychromeController.h"
|
||||
#include <cstring>
|
||||
|
||||
PolychromeController::PolychromeController(i2c_smbus_interface* bus, polychrome_dev_id dev)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
switch (GetFirmwareVersion())
|
||||
{
|
||||
case FIRMWARE_VER_1_PT_10:
|
||||
led_count = 1;
|
||||
asr_led = true;
|
||||
strcpy(device_name, "ASRock ASR LED FW 1.10");
|
||||
break;
|
||||
|
||||
case FIRMWARE_VER_2_PT_00:
|
||||
led_count = 1;
|
||||
asr_led = false;
|
||||
strcpy(device_name, "ASRock Polychrome FW 2.00");
|
||||
break;
|
||||
|
||||
case FIRMWARE_VER_3_PT_00:
|
||||
led_count = 1;
|
||||
asr_led = false;
|
||||
strcpy(device_name, "ASRock Polychrome FW 3.00");
|
||||
break;
|
||||
|
||||
default:
|
||||
led_count = 0;
|
||||
strcpy(device_name, "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PolychromeController::~PolychromeController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
char* PolychromeController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
unsigned short PolychromeController::GetFirmwareVersion()
|
||||
{
|
||||
// The firmware register holds two bytes, so the first read should return 2
|
||||
// If not, report invalid firmware revision FFFF
|
||||
if (bus->i2c_smbus_read_byte_data(dev, POLYCHROME_REG_FIRMWARE_VER) == 0x02)
|
||||
{
|
||||
unsigned char major = bus->i2c_smbus_read_byte(dev);
|
||||
unsigned char minor = bus->i2c_smbus_read_byte(dev);
|
||||
|
||||
return((major << 8) | minor);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(0xFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int PolychromeController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
}
|
||||
|
||||
unsigned int PolychromeController::GetMode()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void PolychromeController::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
if (asr_led)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char colors[3] = { red, green, blue };
|
||||
|
||||
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_COLOR, 3, colors);
|
||||
}
|
||||
}
|
||||
|
||||
void PolychromeController::SetLEDColor(unsigned int /*led*/, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
if (asr_led)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char colors[3] = { red, green, blue };
|
||||
|
||||
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_COLOR, 3, colors);
|
||||
}
|
||||
}
|
||||
|
||||
void PolychromeController::SetMode(unsigned char mode)
|
||||
{
|
||||
if (asr_led)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, POLYCHROME_REG_MODE, mode);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*-----------------------------------------*\
|
||||
| PolychromeController.h |
|
||||
| |
|
||||
| Definitions and types for ASRock |
|
||||
| ASR LED and Polychrome RGB lighting |
|
||||
| controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/13/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char polychrome_dev_id;
|
||||
|
||||
enum
|
||||
{
|
||||
FIRMWARE_VER_1_PT_10 = 0x010A, /* Firmware nu51_1.10 */
|
||||
FIRMWARE_VER_2_PT_00 = 0x0200, /* Firmware nu51_2.00 */
|
||||
FIRMWARE_VER_3_PT_00 = 0x0300, /* Firmware nu51_3.00 */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ASRLED_REG_FIRMWARE_VER = 0x00, /* Firmware version Major.Minor */
|
||||
ASRLED_REG_MODE = 0x30, /* Mode selection register */
|
||||
};
|
||||
|
||||
#define ASRLED_NUM_MODES 8 /* Number of ASR LED modes */
|
||||
|
||||
enum
|
||||
{
|
||||
ASRLED_MODE_OFF = 0x10, /* OFF mode */
|
||||
ASRLED_MODE_STATIC = 0x11, /* Static color mode */
|
||||
ASRLED_MODE_BREATHING = 0x12, /* Breathing effect mode */
|
||||
ASRLED_MODE_FLASHING = 0x13, /* Flashing effect mode */
|
||||
ASRLED_MODE_SPECTRUM_CYCLE = 0x14, /* Spectrum Cycle effect mode */
|
||||
ASRLED_MODE_RANDOM = 0x15, /* Random effect mode */
|
||||
ASRLED_MODE_MUSIC = 0x17, /* Music effect mode */
|
||||
ASRLED_MODE_WAVE = 0x18, /* Wave effect mode */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
POLYCHROME_REG_FIRMWARE_VER = 0x00, /* Firmware version Major.Minor */
|
||||
POLYCHROME_REG_MODE = 0x30, /* Mode selection register */
|
||||
POLYCHROME_REG_COLOR = 0x34, /* Color register: Red, Green, Blue */
|
||||
};
|
||||
|
||||
#define POLYCHROME_NUM_MODES 14 /* Number of Polychrome modes */
|
||||
|
||||
enum
|
||||
{
|
||||
POLYCHROME_MODE_OFF = 0x10, /* OFF mode */
|
||||
POLYCHROME_MODE_STATIC = 0x11, /* Static color mode */
|
||||
POLYCHROME_MODE_BREATHING = 0x12, /* Breating effect mode */
|
||||
POLYCHROME_MODE_FLASHING = 0x13, /* Flashing effect mode */
|
||||
POLYCHROME_MODE_SPECTRUM_CYCLE = 0x14, /* Spectrum Cycle effect mode */
|
||||
POLYCHROME_MODE_RANDOM = 0x15, /* Random effect mode */
|
||||
POLYCHROME_MODE_WAVE = 0x17, /* Wave effect mode */
|
||||
POLYCHROME_MODE_SPRING = 0x18, /* Spring effect mode */
|
||||
POLYCHROME_MODE_STACK = 0x19, /* Stack effect mode */
|
||||
POLYCHROME_MODE_CRAM = 0x1A, /* Cram effect mode */
|
||||
POLYCHROME_MODE_SCAN = 0x1B, /* Scan effect mode */
|
||||
POLYCHROME_MODE_NEON = 0x1C, /* Neon effect mode */
|
||||
POLYCHROME_MODE_WATER = 0x1D, /* Water effect mode */
|
||||
POLYCHROME_MODE_RAINBOW = 0x1E, /* Rainbow effect mode */
|
||||
};
|
||||
|
||||
class PolychromeController
|
||||
{
|
||||
public:
|
||||
PolychromeController(i2c_smbus_interface* bus, polychrome_dev_id dev);
|
||||
~PolychromeController();
|
||||
|
||||
char* GetDeviceName();
|
||||
unsigned int GetLEDCount();
|
||||
unsigned int GetMode();
|
||||
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 SetMode(unsigned char mode);
|
||||
unsigned short GetFirmwareVersion();
|
||||
|
||||
private:
|
||||
bool asr_led;
|
||||
char device_name[32];
|
||||
unsigned int led_count;
|
||||
i2c_smbus_interface* bus;
|
||||
polychrome_dev_id dev;
|
||||
|
||||
};
|
||||
@@ -0,0 +1,69 @@
|
||||
#include "PolychromeController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_Polychrome.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForPolychromeController *
|
||||
* *
|
||||
* Tests the given address to see if an ASRock Polychrome RGB controller exists there.*
|
||||
* First does a quick write to test for a response *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForPolychromeController(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;
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForPolychromeController() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectPolychromeControllers *
|
||||
* *
|
||||
* Detect ASRock Polychrome RGB controllers on the enumerated I2C busses at address *
|
||||
* 0x6A. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where Polychrome device is connected *
|
||||
* dev - I2C address of Polychrome device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
PolychromeController* new_polychrome;
|
||||
RGBController_Polychrome* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
// Check for Polychrome controller at 0x6A
|
||||
if (TestForPolychromeController(busses[bus], 0x6A))
|
||||
{
|
||||
new_polychrome = new PolychromeController(busses[bus], 0x6A);
|
||||
|
||||
if(new_polychrome->GetLEDCount() != 0)
|
||||
{
|
||||
new_controller = new RGBController_Polychrome(new_polychrome);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete new_polychrome;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectPolychromeControllers() */
|
||||
@@ -0,0 +1,176 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBFusionController.cpp |
|
||||
| |
|
||||
| Driver for Gigabyte Aorus RGB Fusion |
|
||||
| lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/10/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBFusionController.h"
|
||||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
RGBFusionController::RGBFusionController(i2c_smbus_interface* bus, rgb_fusion_dev_id dev)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
// Set Device name
|
||||
strcpy(device_name, "Gigabyte Motherboard");
|
||||
|
||||
// Set LED count
|
||||
led_count = 2;
|
||||
|
||||
// Enable control
|
||||
switch_bank(0);
|
||||
bus->i2c_smbus_write_byte_data(dev, 0x02, 0x09);
|
||||
}
|
||||
|
||||
RGBFusionController::~RGBFusionController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string RGBFusionController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string RGBFusionController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
unsigned int RGBFusionController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
}
|
||||
|
||||
unsigned char RGBFusionController::GetMode()
|
||||
{
|
||||
switch_bank(0);
|
||||
return(get_mode_ch_0());
|
||||
}
|
||||
|
||||
void RGBFusionController::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
unsigned char mode_ch_0;
|
||||
unsigned char mode_ch_1;
|
||||
|
||||
switch_bank(1);
|
||||
set_color_ch_0(red, green, blue);
|
||||
set_color_ch_1(red, green, blue);
|
||||
|
||||
switch_bank(0);
|
||||
mode_ch_0 = get_mode_ch_0();
|
||||
mode_ch_1 = get_mode_ch_1();
|
||||
set_mode_ch_0(mode_ch_0);
|
||||
set_mode_ch_1(mode_ch_1);
|
||||
|
||||
}
|
||||
|
||||
void RGBFusionController::SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
unsigned char mode;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
case 0:
|
||||
switch_bank(1);
|
||||
set_color_ch_0(red, green, blue);
|
||||
|
||||
switch_bank(0);
|
||||
mode = get_mode_ch_0();
|
||||
set_mode_ch_0(mode);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
switch_bank(1);
|
||||
set_color_ch_1(red, green, blue);
|
||||
|
||||
switch_bank(0);
|
||||
mode = get_mode_ch_1();
|
||||
set_mode_ch_1(mode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RGBFusionController::SetMode(unsigned char mode)
|
||||
{
|
||||
switch_bank(0);
|
||||
set_mode_ch_0(mode);
|
||||
set_mode_ch_1(mode);
|
||||
}
|
||||
|
||||
void RGBFusionController::dump()
|
||||
{
|
||||
int i, j;
|
||||
|
||||
int start = 0x00;
|
||||
|
||||
FILE* file = freopen("rgb_fusion_dump.txt", "a", stdout);
|
||||
|
||||
printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f\r\n");
|
||||
|
||||
for (i = 0; i < 0xFF; i += 16)
|
||||
{
|
||||
printf("%04x: ", i + start);
|
||||
|
||||
for (j = 0; j < 16; j++)
|
||||
{
|
||||
printf("%02x ", bus->i2c_smbus_read_byte_data(dev, (start + i + j)));
|
||||
}
|
||||
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
unsigned char RGBFusionController::get_mode_ch_0()
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_0_MODE));
|
||||
}
|
||||
|
||||
unsigned char RGBFusionController::get_mode_ch_1()
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_1_MODE));
|
||||
}
|
||||
|
||||
void RGBFusionController::set_color_ch_0(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_1_REG_CH_0_R, red);
|
||||
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_1_REG_CH_0_G, green);
|
||||
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_1_REG_CH_0_B, blue);
|
||||
bus->i2c_smbus_write_byte_data(dev, 0x03, 0x01);
|
||||
}
|
||||
|
||||
void RGBFusionController::set_color_ch_1(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_1_REG_CH_1_R, red);
|
||||
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_1_REG_CH_1_G, green);
|
||||
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_1_REG_CH_1_B, blue);
|
||||
bus->i2c_smbus_write_byte_data(dev, 0x0B, 0x01);
|
||||
}
|
||||
|
||||
void RGBFusionController::set_mode_ch_0(unsigned char mode)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_0_MODE, mode + RGB_FUSION_WRITE_MODE_OFST);
|
||||
}
|
||||
|
||||
void RGBFusionController::set_mode_ch_1(unsigned char mode)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_1_MODE, mode + RGB_FUSION_WRITE_MODE_OFST);
|
||||
}
|
||||
|
||||
void RGBFusionController::switch_bank(unsigned char bank)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_SWITCH_REG, bank);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBFusionController.h |
|
||||
| |
|
||||
| Definitions and types for Gigabyte Aorus |
|
||||
| RGB Fusion lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/10/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char rgb_fusion_dev_id;
|
||||
|
||||
enum
|
||||
{
|
||||
RGB_FUSION_BANK_0_REG_CH_0_MODE = 0x03, /* Channel 0 Mode Selection */
|
||||
RGB_FUSION_BANK_0_REG_CH_1_MODE = 0x13, /* Channel 1 Mode Selection */
|
||||
RGB_FUSION_BANK_1_REG_CH_0_R = 0x00, /* Channel 0 Red Value */
|
||||
RGB_FUSION_BANK_1_REG_CH_0_G = 0x01, /* Channel 0 Green Value */
|
||||
RGB_FUSION_BANK_1_REG_CH_0_B = 0x02, /* Channel 0 Blue Value */
|
||||
RGB_FUSION_BANK_1_REG_CH_1_R = 0x08, /* Channel 1 Red Value */
|
||||
RGB_FUSION_BANK_1_REG_CH_1_G = 0x09, /* Channel 1 Green Value */
|
||||
RGB_FUSION_BANK_1_REG_CH_1_B = 0x0A, /* Channel 1 Blue Value */
|
||||
RGB_FUSION_BANK_SWITCH_REG = 0xF0, /* Bank Switch Register */
|
||||
};
|
||||
|
||||
#define RGB_FUSION_NUMBER_MODES 3 /* Number of RGB Fusion modes */
|
||||
#define RGB_FUSION_WRITE_MODE_OFST 0x10 /* offset to add when writing mode */
|
||||
|
||||
enum
|
||||
{
|
||||
RGB_FUSION_MODE_STATIC = 0x00, /* Static color mode */
|
||||
RGB_FUSION_MODE_BREATHING = 0x01, /* Breathing effect mode */
|
||||
RGB_FUSION_MODE_FLASHING = 0x02, /* Flashing effect mode */
|
||||
};
|
||||
|
||||
class RGBFusionController
|
||||
{
|
||||
public:
|
||||
RGBFusionController(i2c_smbus_interface* bus, rgb_fusion_dev_id dev);
|
||||
~RGBFusionController();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
unsigned int GetLEDCount();
|
||||
unsigned char GetMode();
|
||||
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 SetMode(unsigned char mode);
|
||||
|
||||
private:
|
||||
void dump();
|
||||
|
||||
unsigned char get_mode_ch_0();
|
||||
unsigned char get_mode_ch_1();
|
||||
|
||||
void set_color_ch_0(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void set_color_ch_1(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void set_mode_ch_0(unsigned char mode);
|
||||
void set_mode_ch_1(unsigned char mode);
|
||||
void switch_bank(unsigned char bank);
|
||||
|
||||
char device_name[32];
|
||||
unsigned int led_count;
|
||||
i2c_smbus_interface* bus;
|
||||
rgb_fusion_dev_id dev;
|
||||
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "RGBFusionController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_RGBFusion.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForRGBFusionController *
|
||||
* *
|
||||
* Tests the given address to see if an RGB Fusion controller exists there. First *
|
||||
* does a quick write to test for a response *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForRGBFusionController(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;
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForRGBFusionController() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectRGBFusionControllers *
|
||||
* *
|
||||
* Detect RGB Fusion controllers on the enumerated I2C busses at address 0x28. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where RGB Fusion device is connected *
|
||||
* dev - I2C address of RGB Fusion device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectRGBFusionControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
RGBFusionController* new_rgb_fusion;
|
||||
RGBController_RGBFusion* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
// Check for RGB Fusion controller at 0x28
|
||||
if (TestForRGBFusionController(busses[bus], 0x28))
|
||||
{
|
||||
new_rgb_fusion = new RGBFusionController(busses[bus], 0x28);
|
||||
new_controller = new RGBController_RGBFusion(new_rgb_fusion);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectRGBFusionControllers() */
|
||||
@@ -1,22 +0,0 @@
|
||||
QT += core gui
|
||||
|
||||
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
|
||||
|
||||
HEADERS += \
|
||||
OpenAuraSDK/i2c_smbus.h \
|
||||
OpenAuraSDK/i2c_smbus_linux.h \
|
||||
OpenAuraSDK/AuraController.h \
|
||||
OpenAuraSDK/OpenAuraSDKQtDialog.h
|
||||
|
||||
FORMS += \
|
||||
OpenAuraSDK/openaurasdk.ui
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27703.2026
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenAuraSDK", "OpenAuraSDK\OpenAuraSDK.vcxproj", "{6D22BFF3-C1DF-407A-8816-05D63919A991}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6D22BFF3-C1DF-407A-8816-05D63919A991}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6D22BFF3-C1DF-407A-8816-05D63919A991}.Debug|x64.Build.0 = Debug|x64
|
||||
{6D22BFF3-C1DF-407A-8816-05D63919A991}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{6D22BFF3-C1DF-407A-8816-05D63919A991}.Debug|x86.Build.0 = Debug|Win32
|
||||
{6D22BFF3-C1DF-407A-8816-05D63919A991}.Release|x64.ActiveCfg = Release|x64
|
||||
{6D22BFF3-C1DF-407A-8816-05D63919A991}.Release|x64.Build.0 = Release|x64
|
||||
{6D22BFF3-C1DF-407A-8816-05D63919A991}.Release|x86.ActiveCfg = Release|Win32
|
||||
{6D22BFF3-C1DF-407A-8816-05D63919A991}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A2BB3E13-D506-413D-900E-F2B1323B3BB3}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,50 +0,0 @@
|
||||
#include "I2CDetectDialog.h"
|
||||
#include "OpenAuraSDK.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC(I2CDetectDialog, CDialogEx)
|
||||
|
||||
I2CDetectDialog::I2CDetectDialog(std::vector<i2c_smbus_interface *>& bus, CWnd* pParent)
|
||||
: CDialogEx(IDD_DIALOG_I2C_DETECT, pParent), busses(bus)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
I2CDetectDialog::~I2CDetectDialog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void I2CDetectDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(I2CDetectDialog, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BUTTON_I2C_DETECT, &I2CDetectDialog::OnBnClickedButtonI2cDetect)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
BOOL I2CDetectDialog::OnInitDialog()
|
||||
{
|
||||
CComboBox* i2c_bus_box = (CComboBox*)GetDlgItem(IDC_COMBO_I2C_BUS);
|
||||
for (int i = 0; i < busses.size(); i++)
|
||||
{
|
||||
i2c_bus_box->AddString(busses[i]->device_name);
|
||||
}
|
||||
|
||||
i2c_bus_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"));
|
||||
|
||||
CEdit* edit = (CEdit*)GetDlgItem(IDC_EDIT_I2C_DETECT);
|
||||
edit->SetFont(myFont);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void I2CDetectDialog::OnBnClickedButtonI2cDetect()
|
||||
{
|
||||
i2c_smbus_interface* bus = busses[((CComboBox*)GetDlgItem(IDC_COMBO_I2C_BUS))->GetCurSel()];
|
||||
|
||||
SetDlgItemText(IDC_EDIT_I2C_DETECT, DetectI2C(bus, MODE_QUICK).c_str());
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef I2CDETECT_DIALOG_H
|
||||
#define I2CDETECT_DIALOG_H
|
||||
|
||||
#include <afxdialogex.h>
|
||||
#include <vector>
|
||||
#include "i2c_smbus.h"
|
||||
#include "resource.h"
|
||||
|
||||
class I2CDetectDialog : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(I2CDetectDialog)
|
||||
|
||||
public:
|
||||
I2CDetectDialog(std::vector<i2c_smbus_interface *>& bus, CWnd* pParent = NULL);
|
||||
virtual ~I2CDetectDialog();
|
||||
virtual BOOL OnInitDialog();
|
||||
|
||||
private:
|
||||
|
||||
protected:
|
||||
std::vector<i2c_smbus_interface *>& busses;
|
||||
virtual void DoDataExchange(CDataExchange* pDX);
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
afx_msg void OnBnClickedButtonI2cDetect();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <string>
|
||||
#include "AuraController.h"
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#define MODE_AUTO 0
|
||||
#define MODE_QUICK 1
|
||||
#define MODE_READ 2
|
||||
#define MODE_FUNC 3
|
||||
|
||||
std::string DetectI2C(i2c_smbus_interface * bus, int mode);
|
||||
void DumpAuraRegisters(AuraController * controller);
|
||||
@@ -1,209 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{6D22BFF3-C1DF-407A-8816-05D63919A991}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>OpenAuraSDK</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<PrecompiledHeaderFile />
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeaderFile />
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<AdditionalIncludeDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<PrecompiledHeaderFile />
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_AFXDLL</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeaderFile />
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<AdditionalIncludeDirectories>..\dependencies\inpout32_1501\Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<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="OpenAuraSDK.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resource.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</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);
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
#ifndef OPENAURASDKQTDIALOG_H
|
||||
#define OPENAURASDKQTDIALOG_H
|
||||
|
||||
#include "ui_openaurasdk.h"
|
||||
|
||||
#include <vector>
|
||||
#include "i2c_smbus.h"
|
||||
#include "AuraController.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QTimer>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QMenu>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenAuraSDKQtDialog;
|
||||
}
|
||||
|
||||
class Ui::OpenAuraSDKQtDialog : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenAuraSDKQtDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<AuraController *>& control, QWidget *parent = 0);
|
||||
~OpenAuraSDKQtDialog();
|
||||
|
||||
void show();
|
||||
void setMode(unsigned char mode_val);
|
||||
|
||||
protected:
|
||||
std::vector<i2c_smbus_interface *>& busses;
|
||||
std::vector<AuraController *>& controllers;
|
||||
|
||||
private slots:
|
||||
void on_ButtonSetAll_clicked();
|
||||
|
||||
void on_ButtonSetColors_clicked();
|
||||
|
||||
void on_RadioDirect_clicked();
|
||||
|
||||
void on_RadioEffect_clicked();
|
||||
|
||||
void on_ComboAuraDevices_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();
|
||||
|
||||
private:
|
||||
Ui::OpenAuraSDKQtDialogUi *ui;
|
||||
};
|
||||
|
||||
#endif // OPENAURASDKQTDIALOG_H
|
||||
Binary file not shown.
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>
|
||||
@@ -1,52 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by Resource.rc
|
||||
//
|
||||
#define IDD_DIALOG_I2C_DETECT 101
|
||||
#define IDD_DIALOG_OPENAURASDK 103
|
||||
#define IDC_COMBO_I2C_BUS 1001
|
||||
#define IDC_BUTTON_I2C_DETECT 1002
|
||||
#define IDC_EDIT_I2C_DETECT 1003
|
||||
#define IDC_BUTTON_OPENAURASDK_I2CDETECT 1004
|
||||
#define IDC_RADIO_OPENAURASDK_DIRECT_MODE 1006
|
||||
#define IDC_RADIO_OPENAURASDK_EFFECT_MODE 1007
|
||||
#define IDC_RADIO_OPENAURASDK_EFFECT_STATIC 1008
|
||||
#define IDC_RADIO_OPENAURASDK_EFFECT_OFF 1009
|
||||
#define IDC_RADIO_OPENAURASDK_EFFECT_BREATHING 1010
|
||||
#define IDC_RADIO_OPENAURASDK_EFFECT_FLASHING 1011
|
||||
#define IDC_RADIO_OPENAURASDK_EFFECT_SPECTRUM_CYCLE 1012
|
||||
#define IDC_RADIO_OPENAURASDK_EFFECT_RAINBOW 1013
|
||||
#define IDC_RADIO_OPENAURASDK_BREATHING_SPECTRUM 1014
|
||||
#define IDC_RADIO_OPENAURASDK_EFFECT_CHASE_FADE 1015
|
||||
#define IDC_EDIT_OPENAURASDK_LED_0_R 1016
|
||||
#define IDC_EDIT_OPENAURASDK_LED_0_G 1017
|
||||
#define IDC_EDIT_OPENAURASDK_LED_0_B 1018
|
||||
#define IDC_BUTTON_OPENAURASDK_SET_COLORS_ALL 1019
|
||||
#define IDC_COMBO_OPENAURASDK_DEVICE 1020
|
||||
#define IDC_EDIT_OPENAURASDK_LED_1_R 1021
|
||||
#define IDC_EDIT_OPENAURASDK_LED_1_G 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
|
||||
#define IDC_EDIT_OPENAURASDK_LED_2_B 1026
|
||||
#define IDC_EDIT_OPENAURASDK_LED_3_R 1027
|
||||
#define IDC_EDIT_OPENAURASDK_LED_3_G 1028
|
||||
#define IDC_EDIT_OPENAURASDK_LED_3_B 1029
|
||||
#define IDC_EDIT_OPENAURASDK_LED_4_R 1030
|
||||
#define IDC_EDIT_OPENAURASDK_LED_4_G 1031
|
||||
#define IDC_EDIT_OPENAURASDK_LED_4_B 1032
|
||||
#define IDC_BUTTON1 1033
|
||||
#define IDC_BUTTON_OPENAURASDK_DUMP 1033
|
||||
#define IDC_BUTTON_OPENAURASDK_SET_COLORS2 1034
|
||||
#define IDC_BUTTON_OPENAURASDK_SET_COLORS 1034
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1034
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,12 +1,12 @@
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* OpenAuraSDK.cpp *
|
||||
* OpenRGB.cpp *
|
||||
* *
|
||||
* Functions for communicating with Asus Aura devices on Windows and Linux *
|
||||
* Functions for communicating with RGBController API devices on Windows and Linux *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
#include "AuraController.h"
|
||||
#include "RGBController.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
@@ -14,29 +14,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
|
||||
/******************************************************************************************\
|
||||
@@ -124,14 +121,14 @@ void DetectNuvotonI2CBusses()
|
||||
case SIO_NCT6102_ID:
|
||||
case SIO_NCT6793_ID:
|
||||
case SIO_NCT6796_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)
|
||||
@@ -260,8 +257,8 @@ void DetectI2CBusses()
|
||||
struct dirent * ent;
|
||||
int test_fd;
|
||||
|
||||
// Start looking for I2C adapters in /sys/class/i2c-adapter/
|
||||
strcpy(driver_path, "/sys/class/i2c-adapter/");
|
||||
// Start looking for I2C adapters in /sys/bus/i2c/devices/
|
||||
strcpy(driver_path, "/sys/bus/i2c/devices/");
|
||||
dir = opendir(driver_path);
|
||||
|
||||
if(dir == NULL)
|
||||
@@ -320,260 +317,62 @@ 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() */
|
||||
|
||||
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 DetectPatriotViperControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectRGBFusionControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectHue2Controllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectHuePlusControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectRazerChromaSDKControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectAMDWraithPrismControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectAorusGPUControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectAuraControllers *
|
||||
* DetectRGBConrollers *
|
||||
* *
|
||||
* 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 *
|
||||
* Detect and populate RGB Controllers vector *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
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() */
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectI2C *
|
||||
* *
|
||||
* Prints a list of all detected I2C addresses on the given bus *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface to scan *
|
||||
* mode - one of AUTO, QUICK, READ, FUNC - method of access *
|
||||
* *
|
||||
* Code adapted from i2cdetect.c from i2c-tools Linux package *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
#define MODE_AUTO 0
|
||||
#define MODE_QUICK 1
|
||||
#define MODE_READ 2
|
||||
#define MODE_FUNC 3
|
||||
|
||||
std::string DetectI2C(i2c_smbus_interface * bus, int mode)
|
||||
{
|
||||
int i, j;
|
||||
int res;
|
||||
int slave_addr;
|
||||
char line[128];
|
||||
std::string text;
|
||||
|
||||
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);
|
||||
|
||||
for (i = 0; i < 128; i += 16)
|
||||
{
|
||||
sprintf(line, "%02x: ", i);
|
||||
text.append(line);
|
||||
|
||||
for (j = 0; j < 16; j++)
|
||||
{
|
||||
/* Set slave address */
|
||||
slave_addr = i + j;
|
||||
|
||||
/* Probe this address */
|
||||
switch (mode)
|
||||
{
|
||||
case MODE_QUICK:
|
||||
res = bus->i2c_smbus_write_quick(slave_addr, I2C_SMBUS_WRITE);
|
||||
break;
|
||||
case MODE_READ:
|
||||
res = bus->i2c_smbus_read_byte(slave_addr);
|
||||
break;
|
||||
default:
|
||||
if ((i + j >= 0x30 && i + j <= 0x37)
|
||||
|| (i + j >= 0x50 && i + j <= 0x5F))
|
||||
res = bus->i2c_smbus_read_byte(slave_addr);
|
||||
else
|
||||
res = bus->i2c_smbus_write_quick(slave_addr, I2C_SMBUS_WRITE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
sprintf(line, "-- ");
|
||||
text.append(line);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(line, "%02x ", i + j);
|
||||
text.append(line);
|
||||
}
|
||||
}
|
||||
sprintf(line, "\r\n");
|
||||
text.append(line);
|
||||
}
|
||||
|
||||
return text;
|
||||
|
||||
} /* DetectI2C() */
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DumpAuraRegisters *
|
||||
* *
|
||||
* Dumps register values from an Aura device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DumpAuraRegisters(AuraController * controller)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
int start = 0x0000;
|
||||
|
||||
FILE* file = freopen("auradump.txt", "a", stdout);
|
||||
|
||||
printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f\r\n");
|
||||
|
||||
for (i = 0; i < 0xFFFF; i += 16)
|
||||
{
|
||||
printf("%04x: ", i + start);
|
||||
|
||||
for (j = 0; j < 16; j++)
|
||||
{
|
||||
printf("%02x ", controller->AuraRegisterRead(start + i + j));
|
||||
}
|
||||
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
||||
} /* DumpAuraRegisters() */
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* main *
|
||||
* *
|
||||
* Main function. Detects busses and Aura controllers, then opens the main window *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
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);
|
||||
DetectPatriotViperControllers(busses, rgb_controllers);
|
||||
DetectPolychromeControllers(busses, rgb_controllers);
|
||||
DetectRGBFusionControllers(busses, rgb_controllers);
|
||||
|
||||
#if WIN32
|
||||
OpenAuraSDKDialog dlg(busses, controllers);
|
||||
dlg.DoModal();
|
||||
DetectLEDStripControllers(rgb_controllers);
|
||||
DetectHue2Controllers(rgb_controllers);
|
||||
DetectHuePlusControllers(rgb_controllers);
|
||||
|
||||
return 0;
|
||||
DetectAMDWraithPrismControllers(rgb_controllers);
|
||||
|
||||
DetectE131Controllers(rgb_controllers);
|
||||
|
||||
/*-------------------------------------*\
|
||||
| Windows-only devices |
|
||||
\*-------------------------------------*/
|
||||
#ifdef WIN32
|
||||
DetectRazerChromaSDKControllers(rgb_controllers);
|
||||
//DetectAorusGPUControllers(rgb_controllers);
|
||||
|
||||
/*-------------------------------------*\
|
||||
| Linux-only devices |
|
||||
\*-------------------------------------*/
|
||||
#else
|
||||
QApplication a(argc, argv);
|
||||
|
||||
Ui::OpenAuraSDKQtDialog dlg(busses, controllers);
|
||||
dlg.show();
|
||||
|
||||
return a.exec();
|
||||
DetectOpenRazerControllers(rgb_controllers);
|
||||
#endif
|
||||
}
|
||||
|
||||
} /* DetectRGBControllers() */
|
||||
+685
@@ -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 */
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = OpenRGB
|
||||
TEMPLATE = app
|
||||
|
||||
INCLUDEPATH += \
|
||||
dependencies/libe131/src/ \
|
||||
i2c_smbus/ \
|
||||
i2c_tools/ \
|
||||
net_port/ \
|
||||
serial_port/ \
|
||||
Controllers/AMDWraithPrismController/ \
|
||||
Controllers/AuraController/ \
|
||||
Controllers/CorsairController/ \
|
||||
Controllers/CorsairProController/ \
|
||||
Controllers/Hue2Controller/ \
|
||||
Controllers/HuePlusController/ \
|
||||
Controllers/HyperXController/ \
|
||||
Controllers/LEDStripController/ \
|
||||
Controllers/PatriotViperController/ \
|
||||
Controllers/PolychromeController/ \
|
||||
Controllers/RGBFusionController/ \
|
||||
RGBController/ \
|
||||
qt/
|
||||
|
||||
SOURCES += \
|
||||
dependencies/libe131/src/e131.c \
|
||||
main.cpp \
|
||||
OpenRGB.cpp \
|
||||
qt/OpenRGBDeviceInfoPage.cpp \
|
||||
qt/OpenRGBDevicePage.cpp \
|
||||
qt/OpenRGBDialog.cpp \
|
||||
i2c_smbus/i2c_smbus.cpp \
|
||||
i2c_tools/i2c_tools.cpp \
|
||||
net_port/net_port.cpp \
|
||||
qt/OpenRGBDialog2.cpp \
|
||||
qt/OpenRGBSystemInfoPage.cpp \
|
||||
qt/hsv.cpp \
|
||||
serial_port/serial_port.cpp \
|
||||
Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp \
|
||||
Controllers/AMDWraithPrismController/AMDWraithPrismControllerDetect.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/Hue2Controller/Hue2Controller.cpp \
|
||||
Controllers/Hue2Controller/Hue2ControllerDetect.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 \
|
||||
Controllers/PatriotViperController/PatriotViperController.cpp \
|
||||
Controllers/PatriotViperController/PatriotViperControllerDetect.cpp \
|
||||
Controllers/PolychromeController/PolychromeController.cpp \
|
||||
Controllers/PolychromeController/PolychromeControllerDetect.cpp \
|
||||
Controllers/RGBFusionController/RGBFusionController.cpp \
|
||||
Controllers/RGBFusionController/RGBFusionControllerDetect.cpp \
|
||||
RGBController/E131ControllerDetect.cpp \
|
||||
RGBController/RGBController_AMDWraithPrism.cpp \
|
||||
RGBController/RGBController_Aura.cpp \
|
||||
RGBController/RGBController_Corsair.cpp \
|
||||
RGBController/RGBController_CorsairPro.cpp \
|
||||
RGBController/RGBController_Hue2.cpp \
|
||||
RGBController/RGBController_HuePlus.cpp \
|
||||
RGBController/RGBController_HyperX.cpp \
|
||||
RGBController/RGBController_E131.cpp \
|
||||
RGBController/RGBController_LEDStrip.cpp \
|
||||
RGBController/RGBController_PatriotViper.cpp \
|
||||
RGBController/RGBController_Polychrome.cpp \
|
||||
RGBController/RGBController_RGBFusion.cpp
|
||||
|
||||
HEADERS += \
|
||||
Controllers/RGBFusionController/RGBFusionController.h \
|
||||
qt/OpenRGBDeviceInfoPage.h \
|
||||
qt/OpenRGBDevicePage.h \
|
||||
qt/OpenRGBDialog.h \
|
||||
i2c_smbus/i2c_smbus.h \
|
||||
i2c_tools/i2c_tools.h \
|
||||
net_port/net_port.h \
|
||||
qt/OpenRGBDialog2.h \
|
||||
qt/OpenRGBSystemInfoPage.h \
|
||||
serial_port/find_usb_serial_port.h \
|
||||
serial_port/serial_port.h \
|
||||
Controllers/AMDWraithPrismController/AMDWraithPrismController.h \
|
||||
Controllers/AuraController/AuraController.h \
|
||||
Controllers/CorsairController/CorsairController.h \
|
||||
Controllers/CorsairProController/CorsairProController.h \
|
||||
Controllers/Hue2Controller/Hue2Controller.h \
|
||||
Controllers/HuePlusController/HuePlusController.h \
|
||||
Controllers/HyperXController/HyperXController.h \
|
||||
Controllers/LEDStripController/LEDStripController.h \
|
||||
Controllers/PatriotViperController/PatriotViperController.h \
|
||||
Controllers/PolychromeController/PolychromeController.h \
|
||||
Controllers/RGBFusionController/RGBFusionController.h \
|
||||
RGBController/RGBController.h \
|
||||
RGBController/RGBController_AMDWraithPrism.h \
|
||||
RGBController/RGBController_Aura.h \
|
||||
RGBController/RGBController_Corsair.h \
|
||||
RGBController/RGBController_CorsairPro.h \
|
||||
RGBController/RGBController_E131.h \
|
||||
RGBController/RGBController_Hue2.h \
|
||||
RGBController/RGBController_HuePlus.h \
|
||||
RGBController/RGBController_HyperX.h \
|
||||
RGBController/RGBController_PatriotViper.h \
|
||||
RGBController/RGBController_Polychrome.h \
|
||||
RGBController/RGBController_RGBFusion.h
|
||||
|
||||
RESOURCES += \
|
||||
qt/resources.qrc
|
||||
|
||||
FORMS += \
|
||||
qt/OpenRGBDeviceInfoPage.ui \
|
||||
qt/OpenRGBDevicePage.ui \
|
||||
qt/OpenRGBDialog.ui \
|
||||
qt/OpenRGBDialog2.ui \
|
||||
qt/OpenRGBSystemInfoPage.ui
|
||||
|
||||
#-----------------------------------------------
|
||||
# Windows specific project configuration
|
||||
#-----------------------------------------------
|
||||
win32:INCLUDEPATH += \
|
||||
dependencies/inpout32_1501/Win32/ \
|
||||
dependencies/razer-chroma-2.9.0/inc \
|
||||
dependencies/libusb-1.0.22/include \
|
||||
wmi/ \
|
||||
|
||||
win32:SOURCES += \
|
||||
i2c_smbus/i2c_smbus_i801.cpp \
|
||||
i2c_smbus/i2c_smbus_nct6775.cpp \
|
||||
i2c_smbus/i2c_smbus_piix4.cpp \
|
||||
serial_port/find_usb_serial_port_win.cpp \
|
||||
wmi/wmi.cpp \
|
||||
RGBController/AorusGPUDetect.cpp \
|
||||
RGBController/RGBController_AorusGPU.cpp \
|
||||
RGBController/RazerChromaSDKDetect.cpp \
|
||||
RGBController/RGBController_RazerChromaSDK.cpp \
|
||||
|
||||
win32:HEADERS += \
|
||||
dependencies/inpout32_1501/Win32/inpout32.h \
|
||||
i2c_smbus/i2c_smbus_i801.h \
|
||||
i2c_smbus/i2c_smbus_nct6775.h \
|
||||
i2c_smbus/i2c_smbus_piix4.h \
|
||||
wmi/wmi.h \
|
||||
RGBController/RGBController_AorusGPU.h \
|
||||
RGBController/RGBController_RazerChromaSDK.h \
|
||||
|
||||
win32:LIBS += \
|
||||
-lws2_32 \
|
||||
-L"$$PWD/dependencies/inpout32_1501/Win32/" -linpout32 \
|
||||
-L"$$PWD/dependencies/libusb-1.0.22/MS32/dll" -llibusb-1.0
|
||||
|
||||
win32:DEFINES -= \
|
||||
UNICODE
|
||||
|
||||
win32:DEFINES += \
|
||||
_MBCS \
|
||||
WIN32 \
|
||||
_CRT_SECURE_NO_WARNINGS \
|
||||
_WINSOCK_DEPRECATED_NO_WARNINGS \
|
||||
WIN32_LEAN_AND_MEAN
|
||||
|
||||
#-----------------------------------------------
|
||||
# Linux specific project configuration
|
||||
#-----------------------------------------------
|
||||
unix:INCLUDEPATH += \
|
||||
|
||||
unix:HEADERS += \
|
||||
i2c_smbus/i2c_smbus_linux.h \
|
||||
|
||||
unix:LIBS += \
|
||||
-lusb-1.0
|
||||
|
||||
unix:SOURCES += \
|
||||
i2c_smbus/i2c_smbus_linux.cpp \
|
||||
serial_port/find_usb_serial_port_linux.cpp \
|
||||
RGBController/OpenRazerDetect.cpp \
|
||||
RGBController/RGBController_OpenRazer.cpp \
|
||||
@@ -1,25 +1,66 @@
|
||||
OpenAuraSDK
|
||||
# OpenRGB (formerly OpenAuraSDK)
|
||||
|
||||
This project is an open-source implementation of the Asus Aura RGB controller software. It currently only supports a limited number of motherboard and RAM module lighting controllers.
|
||||
The goal of this project is to create an easy-to-use open source software program and library for accessing and controlling RGB lights on various PC hardware including motherboards, RAM modules, graphics cards, cooling devices, and peripherals.
|
||||
|
||||
It supports both Windows and Linux. To build on Windows, download the latest Visual Studio Community edition and open the .sln. You may have to retarget the project to the latest version of the Windows SDK and build tools and stuff. Build for x86, the InpOut32 library I use does not support x64.
|
||||
This project originally focused only on ASUS Aura. It was spun off of Keyboard Visualizer's AsusAuraWindows branch to learn more about the details behind the Aura protocol and to develop a more flexible, compatible, and reliable driver for Aura. Our Aura implementation is now quite solid and supports multiple generations of Aura controller across both Intel and AMD platforms. It also supports Aura-compatible controllers used across multiple manufacturers of RGB memory modules including G.Skill Trident Z RGB and others. It is still lacking a few capabilities, namely saving settings to persist across reboots, but the core functionality of setting colors and modes is there.
|
||||
|
||||
To build on Linux, you can either open the project using QT Creator or build it using qmake.
|
||||
After getting a solid Aura implementation, the project branched out into other manufacturers and categories of RGB devices. A major focus was to develop a software API that could reliably represent as many RGB devices as possible, exposing their various modes and describing their LED layouts via zones, that was generic enough to write a user application without specifically targeting any one manufacturer. To this extent, the generic_rgb_interface_test branch was created which became the foundation of OpenRGB. The goal of OpenRGB is to both develop new drivers for unsupported devices and integrate existing open source drivers for devices that do have some sort of open support. The goal is to be the one-stop solution to open source RGB lighting control!
|
||||
|
||||
To build with qmake:
|
||||
## Supported Devices
|
||||
|
||||
cd OpenAuraSDK
|
||||
* Asus Aura (SMBus variants only)
|
||||
|
||||
qmake OpenAuraSDK.pro
|
||||
* Gigabyte RGB Fusion 1.0
|
||||
|
||||
make
|
||||
* Asus Aura RAM
|
||||
|
||||
You'll have to enable user access to your SMbus if you don't run as root, for instance:
|
||||
* Corsair Vengeance RGB
|
||||
|
||||
sudo chmod 777 /dev/i2c-0
|
||||
* Corsair Vengeance Pro RGB
|
||||
|
||||
You can figure out which SMBus is your motherboard's by using i2cdetect -l. For AMD boards, the second SMBus isn't currently picked up by the kernel driver and that seems to be where Asus wired the Aura controllers so I have a kernel patch here:
|
||||
* HyperX Predator RGB
|
||||
|
||||
* NZXT Hue+
|
||||
|
||||
* KeyboardVisualizer Arduino LED Strips
|
||||
|
||||
* E1.31 (Linux only)
|
||||
|
||||
* OpenRazer (Linux only)
|
||||
|
||||
## Installation
|
||||
#### Windows
|
||||
1. Download the latest Visual Studio Community Edition and Qt Creator.
|
||||
2. Update the submodules: git submodule update --init --recursive
|
||||
3. Open the OpenRGB_Win.pro project.
|
||||
4. Build the project for `x86` Architecture. The InpOut32 library I use does not support x64.
|
||||
5. Copy InpOut32.dll from dependencies to the same path as OpenAuraSDK.exe along with the Qt libraries.
|
||||
|
||||
**You must run the application as Administrator the first time to allow InpOut32 to set up. It can be run as a normal user afterwards**
|
||||
|
||||
#### Linux:
|
||||
1. Either open the project using QT Creator or build it using qmake. You will need the libusb-1.0-0 (or equivalent) development package from your distribution's package manager installed.
|
||||
|
||||
git clone https://gitlab.com/CalcProgrammer1/OpenRGB
|
||||
cd OpenRGB
|
||||
git submodule update --init --recursive
|
||||
qmake OpenRGB.pro
|
||||
make
|
||||
|
||||
|
||||
2. Allow access to SMBus:<br>
|
||||
|
||||
- This can be identified by your motherboard
|
||||
##### Intel
|
||||
- `modprobe i2c-dev i2c-i801`
|
||||
- Asus used the SMBus controller on the Super IO chip for on-board Aura chips on Intel motherboards. I have a kernel patch to add a driver for this chip [here](https://gitlab.com/CalcProgrammer1/OpenAuraSDK/issues/22). After patching the kernel, enable the Nuvoton NCT67xx SMBus driver in your kernel configuration. The driver may be loaded with `modprobe i2c-nct6775`
|
||||
##### AMD
|
||||
- `modprobe i2c-dev i2c-piix4`
|
||||
- The second SMBus isn't currently picked up by the kernel driver and that seems to be where Asus wired the Aura controllers so I have a kernel patch [here](https://gitlab.com/CalcProgrammer1/OpenAuraSDK/issues/9) that will allow the kernel to use the second bus (at `0x0b20`).
|
||||
|
||||
- You'll have to enable user access to your SMbus if you don't run as root.
|
||||
- List all SMBus controllers: `sudo i2cdetect -l`
|
||||
- Find out which control your Aura devices (PIIX4, I801, and NCT67xx)
|
||||
- Give user access to those controllers, for instance: `sudo chmod 777 /dev/i2c-0`
|
||||
|
||||
https://gitlab.com/CalcProgrammer1/OpenAuraSDK/issues/9
|
||||
|
||||
that will allow the kernel to use the second bus (at 0x0b20). Additionally, the AMD SMBus driver adds duplicate entries for the first bus (at 0x0b00) so I've just been giving access to only one of them, otherwise devices will show up multiple times in the list.
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AorusGPU.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectAorusGPUControllers *
|
||||
* *
|
||||
* Detect devices supported by the Aorus GPU driver *
|
||||
* * *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAorusGPUControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
RGBController_AorusGPU * aorus_rgb = new RGBController_AorusGPU();
|
||||
|
||||
rgb_controllers.push_back(aorus_rgb);
|
||||
} /* DetectLEDStripControllers() */
|
||||
@@ -0,0 +1,172 @@
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_E131.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>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#define LPSTR char *
|
||||
#define strtok_s strtok_r
|
||||
#endif
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectE131Controllers *
|
||||
* *
|
||||
* Detect devices supported by the E131 driver *
|
||||
* * *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
RGBController_E131* 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, "\\e131.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, "/e131.txt");
|
||||
#endif
|
||||
|
||||
E131Device dev;
|
||||
std::vector<E131Device> devices;
|
||||
|
||||
bool new_device = false;
|
||||
|
||||
//Open settings file
|
||||
infile.open(filename);
|
||||
|
||||
if (infile.good())
|
||||
{
|
||||
for (std::string line; std::getline(infile, line); )
|
||||
{
|
||||
if (new_device)
|
||||
{
|
||||
dev.name = line;
|
||||
new_device = false;
|
||||
}
|
||||
|
||||
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, "e131_device_start") == 0)
|
||||
{
|
||||
new_device = true;
|
||||
}
|
||||
else if(strcmp(argument, "num_leds") == 0)
|
||||
{
|
||||
dev.num_leds = atoi(value);
|
||||
}
|
||||
else if(strcmp(argument, "start_universe") == 0)
|
||||
{
|
||||
dev.start_universe = atoi(value);
|
||||
}
|
||||
else if(strcmp(argument, "start_channel") == 0)
|
||||
{
|
||||
dev.start_channel = atoi(value);
|
||||
}
|
||||
else if(strcmp(argument, "rgb_order") == 0)
|
||||
{
|
||||
if(strcmp(value, "RGB") == 0)
|
||||
{
|
||||
dev.rgb_order = E131_RGB_ORDER_RGB;
|
||||
}
|
||||
else if(strcmp(value, "RBG") == 0)
|
||||
{
|
||||
dev.rgb_order = E131_RGB_ORDER_RBG;
|
||||
}
|
||||
else if(strcmp(value, "GRB") == 0)
|
||||
{
|
||||
dev.rgb_order = E131_RGB_ORDER_GRB;
|
||||
}
|
||||
else if(strcmp(value, "GBR") == 0)
|
||||
{
|
||||
dev.rgb_order = E131_RGB_ORDER_GBR;
|
||||
}
|
||||
else if(strcmp(value, "BRG") == 0)
|
||||
{
|
||||
dev.rgb_order = E131_RGB_ORDER_BRG;
|
||||
}
|
||||
else if(strcmp(value, "BGR") == 0)
|
||||
{
|
||||
dev.rgb_order = E131_RGB_ORDER_BGR;
|
||||
}
|
||||
else
|
||||
{
|
||||
dev.rgb_order = atoi(value);
|
||||
}
|
||||
}
|
||||
else if(strcmp(argument, "type") == 0)
|
||||
{
|
||||
if(strcmp(value, "SINGLE") == 0)
|
||||
{
|
||||
dev.type = ZONE_TYPE_SINGLE;
|
||||
}
|
||||
else if(strcmp(value, "LINEAR") == 0)
|
||||
{
|
||||
dev.type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
else if(strcmp(value, "MATRIX") == 0)
|
||||
{
|
||||
dev.type = ZONE_TYPE_MATRIX;
|
||||
}
|
||||
else
|
||||
{
|
||||
dev.type = atoi(value);
|
||||
}
|
||||
}
|
||||
else if(strcmp(argument, "e131_device_end") == 0)
|
||||
{
|
||||
devices.push_back(dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(devices.size() > 0)
|
||||
{
|
||||
new_controller = new RGBController_E131(devices);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectE131Controllers() */
|
||||
@@ -0,0 +1,125 @@
|
||||
#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;
|
||||
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
|
||||
{
|
||||
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 != -1)
|
||||
{
|
||||
rgb_controllers.push_back(razer_rgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete razer_rgb;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ent = readdir(dir);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
driver_to_read++;
|
||||
}
|
||||
|
||||
} /* DetectOpenRazerControllers() */
|
||||
@@ -0,0 +1,89 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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 int device_type;
|
||||
|
||||
enum
|
||||
{
|
||||
DEVICE_TYPE_MOTHERBOARD,
|
||||
DEVICE_TYPE_DRAM,
|
||||
DEVICE_TYPE_GPU,
|
||||
DEVICE_TYPE_COOLER,
|
||||
DEVICE_TYPE_LEDSTRIP,
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
DEVICE_TYPE_MOUSE,
|
||||
DEVICE_TYPE_MOUSEMAT,
|
||||
DEVICE_TYPE_HEADSET,
|
||||
DEVICE_TYPE_UNKNOWN
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::string name; /* Zone name */
|
||||
zone_type type; /* Zone type */
|
||||
std::vector<std::vector<int>>
|
||||
map; /* LED index map */
|
||||
} zone;
|
||||
|
||||
class RGBController
|
||||
{
|
||||
public:
|
||||
std::string name; /* controller name */
|
||||
std::string description; /* controller description */
|
||||
std::string version; /* controller version */
|
||||
std::string serial; /* controller serial number */
|
||||
std::string location; /* controller location */
|
||||
std::vector<led> leds; /* LEDs */
|
||||
std::vector<zone> zones; /* Zones */
|
||||
std::vector<mode> modes; /* Modes */
|
||||
std::vector<RGBColor> colors; /* Color buffer */
|
||||
device_type type; /* device type */
|
||||
|
||||
virtual ~RGBController() = default;
|
||||
|
||||
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,135 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AMDWraithPrism.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for AMD Wraith |
|
||||
| Prism |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/25/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_AMDWraithPrism.h"
|
||||
|
||||
RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismController* wraith_ptr)
|
||||
{
|
||||
wraith = wraith_ptr;
|
||||
|
||||
name = "AMD Wraith Prism";
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
version = wraith->GetFirmwareVersionString();
|
||||
|
||||
mode led_mode;
|
||||
led_mode.name = "Custom";
|
||||
modes.push_back(led_mode);
|
||||
|
||||
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);
|
||||
|
||||
led fan_led;
|
||||
fan_led.name = "Fan";
|
||||
leds.push_back(fan_led);
|
||||
|
||||
zone fan_zone;
|
||||
fan_zone.name = "Fan";
|
||||
fan_zone.type = ZONE_TYPE_SINGLE;
|
||||
std::vector<int> fan_zone_map;
|
||||
fan_zone_map.push_back(1);
|
||||
fan_zone.map.push_back(fan_zone_map);
|
||||
zones.push_back(fan_zone);
|
||||
|
||||
led ring_led;
|
||||
ring_led.name = "Ring";
|
||||
leds.push_back(ring_led);
|
||||
|
||||
zone ring_zone;
|
||||
ring_zone.name = "Ring";
|
||||
ring_zone.type = ZONE_TYPE_SINGLE;
|
||||
std::vector<int> ring_zone_map;
|
||||
ring_zone_map.push_back(2);
|
||||
ring_zone.map.push_back(ring_zone_map);
|
||||
zones.push_back(ring_zone);
|
||||
}
|
||||
|
||||
RGBController_AMDWraithPrism::~RGBController_AMDWraithPrism()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int RGBController_AMDWraithPrism::GetMode()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGBController_AMDWraithPrism::SetMode(int /*mode*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_AMDWraithPrism::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_AMDWraithPrism::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
wraith->SetFanColor(red, grn, blu);
|
||||
wraith->SetLogoColor(red, grn, blu);
|
||||
wraith->SetRingColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_AMDWraithPrism::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
if(zone == 0)
|
||||
{
|
||||
wraith->SetLogoColor(red, grn, blu);
|
||||
}
|
||||
else if(zone == 1)
|
||||
{
|
||||
wraith->SetFanColor(red, grn, blu);
|
||||
}
|
||||
else if(zone == 2)
|
||||
{
|
||||
wraith->SetRingColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_AMDWraithPrism::SetLED(int led, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
if(led == 0)
|
||||
{
|
||||
wraith->SetLogoColor(red, grn, blu);
|
||||
}
|
||||
else if(led == 1)
|
||||
{
|
||||
wraith->SetFanColor(red, grn, blu);
|
||||
}
|
||||
else if(led == 2)
|
||||
{
|
||||
wraith->SetRingColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_AMDWraithPrism::UpdateLEDs()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AMDWraithPrism.h |
|
||||
| |
|
||||
| Generic RGB Interface for AMD Wraith |
|
||||
| Prism |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/25/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "AMDWraithPrismController.h"
|
||||
|
||||
class RGBController_AMDWraithPrism : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AMDWraithPrism(AMDWraithPrismController* wraith_ptr);
|
||||
~RGBController_AMDWraithPrism();
|
||||
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:
|
||||
AMDWraithPrismController* wraith;
|
||||
};
|
||||
@@ -0,0 +1,98 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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);
|
||||
}
|
||||
|
||||
void RGBController_AorusGPU::UpdateLEDs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
RGBController_AorusGPU::RGBController_AorusGPU()
|
||||
{
|
||||
name = "Aorus GPU";
|
||||
type = DEVICE_TYPE_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,34 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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);
|
||||
void UpdateLEDs();
|
||||
|
||||
private:
|
||||
_GvWriteI2C GvWriteI2C;
|
||||
_GvFreeDispLib GvFreeDispLib;
|
||||
_GvInitDispLib GvInitDispLib;
|
||||
};
|
||||
@@ -0,0 +1,214 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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 (std::size_t x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (std::size_t 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(std::size_t 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;
|
||||
|
||||
version = aura->GetDeviceName();
|
||||
location = aura->GetDeviceLocation();
|
||||
if((version.find("DIMM_LED") != std::string::npos) || (version.find("AUDA") != std::string::npos) )
|
||||
{
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
name = "ASUS Aura DRAM";
|
||||
}
|
||||
else
|
||||
{
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
name = "ASUS Aura Motherboard";
|
||||
}
|
||||
|
||||
mode aura_modes[AURA_NUMBER_MODES + 1];
|
||||
|
||||
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 (std::size_t i = 0; i < (AURA_NUMBER_MODES + 1); i++)
|
||||
{
|
||||
modes.push_back(aura_modes[i]);
|
||||
}
|
||||
|
||||
for (std::size_t 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 (std::size_t 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 (std::size_t 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 (std::size_t 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,110 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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 (std::size_t x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (std::size_t 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();
|
||||
location = corsair->GetDeviceLocation();
|
||||
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
|
||||
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 (unsigned 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 (unsigned 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,153 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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 (std::size_t x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (std::size_t 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();
|
||||
location = corsair->GetDeviceLocation();
|
||||
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
|
||||
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 (unsigned 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 (unsigned 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,193 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LEDStrip.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| E1.31 Streaming ACN interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 10/18/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_E131.h"
|
||||
#include <e131.h>
|
||||
#include <math.h>
|
||||
|
||||
RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
||||
{
|
||||
name = "E1.31 Streaming ACN Device";
|
||||
|
||||
devices = device_list;
|
||||
|
||||
unsigned int led_zone_idx = 0;
|
||||
mode led_mode;
|
||||
led_mode.name = "Custom";
|
||||
modes.push_back(led_mode);
|
||||
|
||||
sockfd = e131_socket();
|
||||
|
||||
for (std::size_t i = 0; i < devices.size(); i++)
|
||||
{
|
||||
/*-----------------------------------------*\
|
||||
| Add LEDs |
|
||||
\*-----------------------------------------*/
|
||||
for (unsigned int led_idx = 0; led_idx < devices[i].num_leds; led_idx++)
|
||||
{
|
||||
colors.push_back(0x00000000);
|
||||
led new_led;
|
||||
new_led.name = devices[i].name + " LED";
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Add Zones |
|
||||
\*-----------------------------------------*/
|
||||
zone led_zone;
|
||||
led_zone.name = devices[i].name;
|
||||
led_zone.type = devices[i].type;
|
||||
std::vector<int> led_zone_map;
|
||||
for (unsigned int led_idx = 0; led_idx < devices[i].num_leds; led_idx++)
|
||||
{
|
||||
led_zone_map.push_back(led_zone_idx);
|
||||
led_zone_idx++;
|
||||
}
|
||||
led_zone.map.push_back(led_zone_map);
|
||||
zones.push_back(led_zone);
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Add Universes |
|
||||
\*-----------------------------------------*/
|
||||
unsigned int total_universes = ceil( ( ( devices[i].num_leds * 3 ) + devices[i].start_channel ) / 512.0f );
|
||||
|
||||
for (unsigned int univ_idx = 0; univ_idx < total_universes; univ_idx++)
|
||||
{
|
||||
unsigned int universe = devices[i].start_universe + univ_idx;
|
||||
bool universe_exists = false;
|
||||
|
||||
for (std::size_t pkt_idx = 0; pkt_idx < packets.size(); pkt_idx++)
|
||||
{
|
||||
if(universes[pkt_idx] == universe)
|
||||
{
|
||||
universe_exists = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!universe_exists)
|
||||
{
|
||||
e131_packet_t packet;
|
||||
e131_addr_t dest_addr;
|
||||
|
||||
e131_pkt_init(&packet, universe, 512);
|
||||
e131_multicast_dest(&dest_addr, universe, E131_DEFAULT_PORT);
|
||||
|
||||
packets.push_back(packet);
|
||||
universes.push_back(universe);
|
||||
dest_addrs.push_back(dest_addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int RGBController_E131::GetMode()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGBController_E131::SetMode(int /*mode*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_E131::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_E131::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
for (std::size_t i = 0; i < colors.size(); i++)
|
||||
{
|
||||
colors[i] = color;
|
||||
}
|
||||
|
||||
UpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_E131::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
for (std::size_t x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (std::size_t y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
colors[zones[zone].map[x][y]] = color;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_E131::SetLED(int led, RGBColor color)
|
||||
{
|
||||
colors[led] = color;
|
||||
|
||||
UpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_E131::UpdateLEDs()
|
||||
{
|
||||
int color_idx = 0;
|
||||
|
||||
for(std::size_t device_idx = 0; device_idx < devices.size(); device_idx++)
|
||||
{
|
||||
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / 512.0f );
|
||||
unsigned int channel_idx = devices[device_idx].start_channel;
|
||||
unsigned int led_idx = 0;
|
||||
unsigned int rgb_idx = 0;
|
||||
bool done = false;
|
||||
|
||||
for (unsigned int univ_idx = 0; univ_idx < total_universes; univ_idx++)
|
||||
{
|
||||
unsigned int universe = devices[device_idx].start_universe + univ_idx;
|
||||
|
||||
for(std::size_t packet_idx = 0; packet_idx < packets.size(); packet_idx++)
|
||||
{
|
||||
if(!done && (universes[packet_idx] == universe))
|
||||
{
|
||||
while(!done && (channel_idx <= 512))
|
||||
{
|
||||
switch(rgb_idx)
|
||||
{
|
||||
case 0:
|
||||
packets[packet_idx].dmp.prop_val[channel_idx] = RGBGetRValue( colors[color_idx] );
|
||||
rgb_idx = 1;
|
||||
break;
|
||||
case 1:
|
||||
packets[packet_idx].dmp.prop_val[channel_idx] = RGBGetGValue( colors[color_idx] );
|
||||
rgb_idx = 2;
|
||||
break;
|
||||
case 2:
|
||||
packets[packet_idx].dmp.prop_val[channel_idx] = RGBGetBValue( colors[color_idx] );
|
||||
rgb_idx = 0;
|
||||
led_idx++;
|
||||
color_idx++;
|
||||
break;
|
||||
}
|
||||
|
||||
if(led_idx >= devices[device_idx].num_leds)
|
||||
{
|
||||
done = true;
|
||||
}
|
||||
|
||||
channel_idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
channel_idx = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for(std::size_t packet_idx = 0; packet_idx < packets.size(); packet_idx++)
|
||||
{
|
||||
e131_send(sockfd, &packets[packet_idx], &dest_addrs[packet_idx]);
|
||||
packets[packet_idx].frame.seq_number++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_E131.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| E1.31 Streaming ACN interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 10/18/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include <e131.h>
|
||||
|
||||
typedef unsigned int e131_rgb_order;
|
||||
|
||||
enum
|
||||
{
|
||||
E131_RGB_ORDER_RGB,
|
||||
E131_RGB_ORDER_RBG,
|
||||
E131_RGB_ORDER_GRB,
|
||||
E131_RGB_ORDER_GBR,
|
||||
E131_RGB_ORDER_BRG,
|
||||
E131_RGB_ORDER_BGR
|
||||
};
|
||||
|
||||
struct E131Device
|
||||
{
|
||||
std::string name;
|
||||
unsigned int num_leds;
|
||||
unsigned int start_universe;
|
||||
unsigned int start_channel;
|
||||
e131_rgb_order rgb_order;
|
||||
zone_type type;
|
||||
};
|
||||
|
||||
class RGBController_E131 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_E131(std::vector<E131Device> device_list);
|
||||
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:
|
||||
std::vector<E131Device> devices;
|
||||
std::vector<e131_packet_t> packets;
|
||||
std::vector<e131_addr_t> dest_addrs;
|
||||
std::vector<unsigned int> universes;
|
||||
int sockfd;
|
||||
};
|
||||
@@ -0,0 +1,156 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Hue2.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for NZXT Hue 2 |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/29/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_Hue2.h"
|
||||
|
||||
|
||||
RGBController_Hue2::RGBController_Hue2(Hue2Controller* hue2_ptr)
|
||||
{
|
||||
hue2 = hue2_ptr;
|
||||
|
||||
name = "NZXT Hue 2";
|
||||
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
|
||||
mode led_mode;
|
||||
led_mode.name = "Custom";
|
||||
modes.push_back(led_mode);
|
||||
|
||||
unsigned int led_idx = 0;
|
||||
|
||||
for (unsigned int channel_idx = 0; channel_idx < HUE_2_NUM_CHANNELS; channel_idx++)
|
||||
{
|
||||
if(hue2->channel_leds[channel_idx] > 0)
|
||||
{
|
||||
zone* new_zone = new zone;
|
||||
|
||||
char ch_idx_string[2];
|
||||
sprintf(ch_idx_string, "%d", channel_idx + 1);
|
||||
|
||||
new_zone->name = "Hue 2 Channel ";
|
||||
new_zone->name.append(ch_idx_string);
|
||||
new_zone->type = ZONE_TYPE_LINEAR;
|
||||
|
||||
std::vector<int> *new_zone_map = new std::vector<int>();
|
||||
|
||||
for (unsigned int led_ch_idx = 0; led_ch_idx < hue2->channel_leds[channel_idx]; led_ch_idx++)
|
||||
{
|
||||
colors.push_back(0x00000000);
|
||||
|
||||
char led_idx_string[3];
|
||||
sprintf(led_idx_string, "%d", led_ch_idx + 1);
|
||||
|
||||
led new_led;
|
||||
new_led.name = "Hue 2 Channel ";
|
||||
new_led.name.append(ch_idx_string);
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(led_idx_string);
|
||||
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(channel_idx + 1);
|
||||
|
||||
new_zone_map->push_back(led_idx);
|
||||
led_idx++;
|
||||
}
|
||||
|
||||
new_zone->map.push_back(*new_zone_map);
|
||||
zones.push_back(*new_zone);
|
||||
zones_channel.push_back(channel_idx + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int RGBController_Hue2::GetMode()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGBController_Hue2::SetMode(int /*mode*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_Hue2::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_Hue2::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
for (std::size_t i = 0; i < colors.size(); i++)
|
||||
{
|
||||
colors[i] = color;
|
||||
}
|
||||
|
||||
UpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_Hue2::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
unsigned int channel = zones_channel[zone];
|
||||
|
||||
for (std::size_t x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (std::size_t y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
colors[zones[zone].map[x][y]] = color;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RGBColor> channel_colors;
|
||||
|
||||
for(std::size_t color = 0; color < colors.size(); color++)
|
||||
{
|
||||
if(leds_channel[color] == channel)
|
||||
{
|
||||
channel_colors.push_back(colors[color]);
|
||||
}
|
||||
}
|
||||
|
||||
hue2->SetChannelLEDs(channel, channel_colors);
|
||||
}
|
||||
|
||||
void RGBController_Hue2::SetLED(int led, RGBColor color)
|
||||
{
|
||||
unsigned int channel = leds_channel[led];
|
||||
colors[led] = color;
|
||||
|
||||
std::vector<RGBColor> channel_colors;
|
||||
|
||||
for(std::size_t color = 0; color < colors.size(); color++)
|
||||
{
|
||||
if(leds_channel[color] == channel)
|
||||
{
|
||||
channel_colors.push_back(colors[color]);
|
||||
}
|
||||
}
|
||||
hue2->SetChannelLEDs(channel, channel_colors);
|
||||
}
|
||||
|
||||
void RGBController_Hue2::UpdateLEDs()
|
||||
{
|
||||
std::vector<RGBColor> channel_colors;
|
||||
|
||||
for(unsigned int channel = 0; channel < HUE_2_NUM_CHANNELS; channel++)
|
||||
{
|
||||
for(std::size_t color = 0; color < colors.size(); color++)
|
||||
{
|
||||
if(leds_channel[color] == channel)
|
||||
{
|
||||
channel_colors.push_back(colors[color]);
|
||||
}
|
||||
}
|
||||
|
||||
if(channel_colors.size() > 0)
|
||||
{
|
||||
hue2->SetChannelLEDs(channel, channel_colors);
|
||||
}
|
||||
|
||||
channel_colors.clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Hue2.h |
|
||||
| |
|
||||
| Generic RGB Interface for NZXT Hue 2 |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/29/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "serial_port.h"
|
||||
#include "Hue2Controller.h"
|
||||
|
||||
class RGBController_Hue2 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_Hue2(Hue2Controller* hue2_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:
|
||||
Hue2Controller* hue2;
|
||||
std::vector<unsigned int> leds_channel;
|
||||
std::vector<unsigned int> zones_channel;
|
||||
};
|
||||
@@ -0,0 +1,140 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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)
|
||||
{
|
||||
hueplus = hueplus_ptr;
|
||||
|
||||
name = "NZXT Hue+";
|
||||
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
|
||||
location = hueplus->GetLEDString();
|
||||
|
||||
mode led_mode;
|
||||
led_mode.name = "Custom";
|
||||
modes.push_back(led_mode);
|
||||
|
||||
unsigned int led_idx = 0;
|
||||
|
||||
for (int channel_idx = 0; channel_idx < HUE_PLUS_NUM_CHANNELS; channel_idx++)
|
||||
{
|
||||
if(hueplus->channel_leds[channel_idx] > 0)
|
||||
{
|
||||
zone* new_zone = new zone;
|
||||
|
||||
char ch_idx_string[2];
|
||||
sprintf(ch_idx_string, "%d", channel_idx + 1);
|
||||
|
||||
new_zone->name = "Hue+ Channel ";
|
||||
new_zone->name.append(ch_idx_string);
|
||||
new_zone->type = ZONE_TYPE_LINEAR;
|
||||
|
||||
std::vector<int> *new_zone_map = new std::vector<int>();
|
||||
|
||||
for (unsigned led_ch_idx = 0; led_ch_idx < hueplus->channel_leds[channel_idx]; led_ch_idx++)
|
||||
{
|
||||
colors.push_back(0x00000000);
|
||||
|
||||
char led_idx_string[3];
|
||||
sprintf(led_idx_string, "%d", led_ch_idx + 1);
|
||||
|
||||
led new_led;
|
||||
new_led.name = "Hue+ Channel ";
|
||||
new_led.name.append(ch_idx_string);
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(led_idx_string);
|
||||
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(channel_idx + 1);
|
||||
|
||||
new_zone_map->push_back(led_idx);
|
||||
led_idx++;
|
||||
}
|
||||
|
||||
new_zone->map.push_back(*new_zone_map);
|
||||
zones.push_back(*new_zone);
|
||||
zones_channel.push_back(channel_idx + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int RGBController_HuePlus::GetMode()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::SetMode(int /*mode*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
for (std::size_t i = 0; i < colors.size(); i++)
|
||||
{
|
||||
colors[i] = color;
|
||||
}
|
||||
|
||||
hueplus->SetChannelLEDs(0, colors);
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
unsigned int channel = zones_channel[zone];
|
||||
|
||||
for (std::size_t x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (std::size_t y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
colors[zones[zone].map[x][y]] = color;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RGBColor> channel_colors;
|
||||
|
||||
for(std::size_t color = 0; color < colors.size(); color++)
|
||||
{
|
||||
if(leds_channel[color] == channel)
|
||||
{
|
||||
channel_colors.push_back(colors[color]);
|
||||
}
|
||||
}
|
||||
|
||||
hueplus->SetChannelLEDs(channel, channel_colors);
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::SetLED(int led, RGBColor color)
|
||||
{
|
||||
unsigned int channel = leds_channel[led];
|
||||
colors[led] = color;
|
||||
|
||||
std::vector<RGBColor> channel_colors;
|
||||
|
||||
for(std::size_t color = 0; color < colors.size(); color++)
|
||||
{
|
||||
if(leds_channel[color] == channel)
|
||||
{
|
||||
channel_colors.push_back(colors[color]);
|
||||
}
|
||||
}
|
||||
hueplus->SetChannelLEDs(channel, channel_colors);
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::UpdateLEDs()
|
||||
{
|
||||
hueplus->SetChannelLEDs(0, colors);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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* hueplus;
|
||||
std::vector<unsigned int> leds_channel;
|
||||
std::vector<unsigned int> zones_channel;
|
||||
};
|
||||
@@ -0,0 +1,150 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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_DIRECT);
|
||||
}
|
||||
|
||||
void RGBController_HyperX::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
hyperx->SetAllColors(red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
hyperx->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperX::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
for (std::size_t x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (std::size_t y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
hyperx->SetLEDColor(zones[zone].map[x][y], red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hyperx->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HyperX::SetLED(int led, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
hyperx->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
hyperx->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HyperX::UpdateLEDs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
RGBController_HyperX::RGBController_HyperX(HyperXController* hyperx_ptr)
|
||||
{
|
||||
hyperx = hyperx_ptr;
|
||||
|
||||
name = hyperx->GetDeviceName();
|
||||
location = hyperx->GetDeviceLocation();
|
||||
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
|
||||
mode hyperx_modes[HYPERX_NUMBER_MODES];
|
||||
|
||||
hyperx_modes[0].name = "Direct";
|
||||
hyperx_modes[1].name = "Static";
|
||||
hyperx_modes[2].name = "Rainbow";
|
||||
hyperx_modes[3].name = "Comet";
|
||||
hyperx_modes[4].name = "Heartbeat";
|
||||
hyperx_modes[5].name = "Spectrum Cycle";
|
||||
hyperx_modes[6].name = "Breathing";
|
||||
hyperx_modes[7].name = "Bounce";
|
||||
hyperx_modes[8].name = "Blink";
|
||||
|
||||
for (int i = 0; i < HYPERX_NUMBER_MODES; i++)
|
||||
{
|
||||
modes.push_back(hyperx_modes[i]);
|
||||
}
|
||||
|
||||
unsigned int led_idx = 0;
|
||||
|
||||
for(unsigned int slot = 0; slot < hyperx->GetSlotCount(); slot++)
|
||||
{
|
||||
zone* new_zone = new zone;
|
||||
|
||||
char slot_idx_str[3];
|
||||
sprintf(slot_idx_str, "%d", slot);
|
||||
new_zone->name = "HyperX Slot ";
|
||||
new_zone->name.append(slot_idx_str);
|
||||
|
||||
new_zone->type = ZONE_TYPE_LINEAR;
|
||||
|
||||
std::vector<int> *new_zone_map = new std::vector<int>();
|
||||
|
||||
for(int led_slot_idx = 0; led_slot_idx < 5; led_slot_idx++)
|
||||
{
|
||||
colors.push_back(0x00000000);
|
||||
|
||||
led* new_led = new led();
|
||||
|
||||
char led_idx_str[3];
|
||||
sprintf(led_idx_str, "%d", led_slot_idx);
|
||||
new_led->name = "HyperX Slot ";
|
||||
new_led->name.append(slot_idx_str);
|
||||
new_led->name.append(", LED ");
|
||||
new_led->name.append(led_idx_str);
|
||||
|
||||
leds.push_back(*new_led);
|
||||
|
||||
new_zone_map->push_back(led_idx);
|
||||
led_idx++;
|
||||
}
|
||||
|
||||
new_zone->map.push_back(*new_zone_map);
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
}
|
||||
@@ -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,89 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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";
|
||||
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
|
||||
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 (std::size_t i = 0; i < colors.size(); i++)
|
||||
{
|
||||
colors[i] = color;
|
||||
}
|
||||
|
||||
strip->SetLEDs(colors);
|
||||
}
|
||||
|
||||
void RGBController_LEDStrip::SetAllZoneLEDs(int /*zone*/, RGBColor color)
|
||||
{
|
||||
for (std::size_t 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,423 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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>
|
||||
#include <unistd.h>
|
||||
int RGBController_OpenRazer::GetMode()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetMode(int mode)
|
||||
{
|
||||
char update_value = 1;
|
||||
|
||||
switch(matrix_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(matrix_type)
|
||||
{
|
||||
case RAZER_TYPE_MATRIX_FRAME:
|
||||
case RAZER_TYPE_MATRIX_NOFRAME:
|
||||
case RAZER_TYPE_MATRIX_STATIC:
|
||||
{
|
||||
char update_value = 1;
|
||||
|
||||
for (unsigned int row = 0; row < matrix_rows; row++)
|
||||
{
|
||||
unsigned int output_array_size;
|
||||
unsigned int output_offset;
|
||||
unsigned int row_offset = (row * matrix_cols);
|
||||
|
||||
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
|
||||
{
|
||||
output_array_size = 3 + (matrix_cols* 3);
|
||||
output_offset = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
output_array_size = 3;
|
||||
output_offset = 0;
|
||||
}
|
||||
|
||||
char output_array[output_array_size];
|
||||
|
||||
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
|
||||
{
|
||||
output_array[0] = row;
|
||||
output_array[1] = 0;
|
||||
output_array[2] = matrix_cols - 1;
|
||||
}
|
||||
|
||||
for(unsigned 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(matrix_type == RAZER_TYPE_MATRIX_FRAME)
|
||||
{
|
||||
matrix_custom_frame.write(output_array, output_array_size);
|
||||
matrix_custom_frame.flush();
|
||||
}
|
||||
else if(matrix_type == RAZER_TYPE_MATRIX_NOFRAME)
|
||||
{
|
||||
matrix_effect_custom.write(output_array, output_array_size);
|
||||
matrix_effect_custom.flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
matrix_effect_static.write(output_array, output_array_size);
|
||||
matrix_effect_static.flush();
|
||||
}
|
||||
}
|
||||
|
||||
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
|
||||
{
|
||||
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(std::size_t i = 0; i < colors.size(); i++)
|
||||
{
|
||||
colors[i] = color;
|
||||
}
|
||||
|
||||
UpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
for (std::size_t x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (std::size_t 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);
|
||||
}
|
||||
|
||||
static std::string GetFirmwareVersionString(std::string dev_path)
|
||||
{
|
||||
// Read firmware_version for firmware version string
|
||||
std::string firm_ver_path = dev_path + "/firmware_version";
|
||||
std::ifstream firm_ver_file;
|
||||
std::string ret_str;
|
||||
|
||||
firm_ver_file.open(firm_ver_path);
|
||||
std::getline(firm_ver_file, ret_str);
|
||||
firm_ver_file.close();
|
||||
|
||||
return(ret_str);
|
||||
}
|
||||
|
||||
static std::string GetSerialNumberString(std::string dev_path)
|
||||
{
|
||||
// Read device_serial for serial number string
|
||||
std::string ser_num_path = dev_path + "/device_serial";
|
||||
std::ifstream ser_num_file;
|
||||
std::string ret_str;
|
||||
|
||||
ser_num_file.open(ser_num_path);
|
||||
std::getline(ser_num_file, ret_str);
|
||||
ser_num_file.close();
|
||||
|
||||
return(ret_str);
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetupMatrixDevice(std::string dev_path, unsigned int rows, unsigned int cols)
|
||||
{
|
||||
matrix_custom_frame.open(dev_path + "/matrix_custom_frame");
|
||||
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)
|
||||
{
|
||||
if(!matrix_effect_custom)
|
||||
{
|
||||
matrix_type = RAZER_TYPE_MATRIX_STATIC;
|
||||
}
|
||||
else
|
||||
{
|
||||
matrix_type = RAZER_TYPE_MATRIX_NOFRAME;
|
||||
}
|
||||
|
||||
matrix_rows = 1;
|
||||
matrix_cols = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
matrix_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");
|
||||
|
||||
matrix_type = RAZER_TYPE_NOMATRIX;
|
||||
}
|
||||
|
||||
RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
|
||||
{
|
||||
unsigned int led_count = 0;
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Start device at -1. This indicates the device was not detected |
|
||||
\*-----------------------------------------------------------------*/
|
||||
device = -1;
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Get the device name from the OpenRazer driver |
|
||||
\*-----------------------------------------------------------------*/
|
||||
name = GetDeviceTypeString(dev_path);
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Set the description to indicate this is an OpenRazer device |
|
||||
\*-----------------------------------------------------------------*/
|
||||
description = "OpenRazer Device";
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Set the device path as the location |
|
||||
\*-----------------------------------------------------------------*/
|
||||
location = dev_path;
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Get the serial number from the dev path |
|
||||
\*-----------------------------------------------------------------*/
|
||||
serial = GetSerialNumberString(dev_path);
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Get the firmware version from the dev path |
|
||||
\*-----------------------------------------------------------------*/
|
||||
version = GetFirmwareVersionString(dev_path);
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Loop through all known devices to look for a name match |
|
||||
\*-----------------------------------------------------------------*/
|
||||
for (std::size_t i = 0; i < RAZER_NUM_DEVICES; i++)
|
||||
{
|
||||
if (device_list[i]->name == name)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set device ID |
|
||||
\*---------------------------------------------------------*/
|
||||
device = i;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set device type |
|
||||
\*---------------------------------------------------------*/
|
||||
type = device_list[i]->type;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize modes |
|
||||
\*---------------------------------------------------------*/
|
||||
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]);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize file descriptors |
|
||||
\*---------------------------------------------------------*/
|
||||
if(device_list[i]->matrix_type == true)
|
||||
{
|
||||
SetupMatrixDevice(dev_path, device_list[i]->rows, device_list[i]->cols);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetupNonMatrixDevice(dev_path);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in zone information based on device table |
|
||||
\*---------------------------------------------------------*/
|
||||
for (int zone_id = 0; zone_id < RAZER_MAX_ZONES; zone_id++)
|
||||
{
|
||||
if (device_list[i]->zones[zone_id] != NULL)
|
||||
{
|
||||
zone new_zone;
|
||||
new_zone.name = device_list[i]->zones[zone_id]->name;
|
||||
new_zone.type = device_list[i]->zones[zone_id]->type;
|
||||
|
||||
for (unsigned int row_id = 0; row_id < device_list[i]->zones[zone_id]->rows; row_id++)
|
||||
{
|
||||
std::vector<int> new_zone_map;
|
||||
|
||||
for (unsigned int col_id = 0; col_id < device_list[i]->zones[zone_id]->cols; col_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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,956 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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>
|
||||
|
||||
#define RAZER_MAX_ZONES 6
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::string name;
|
||||
unsigned int type;
|
||||
unsigned int rows;
|
||||
unsigned int cols;
|
||||
} razer_zone;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::string name;
|
||||
device_type type;
|
||||
bool matrix_type;
|
||||
unsigned int rows;
|
||||
unsigned int cols;
|
||||
const razer_zone* zones[RAZER_MAX_ZONES];
|
||||
} razer_device;
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| KEYBOARDS |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer BlackWidow Chroma |
|
||||
| |
|
||||
| Zone "Keyboard" |
|
||||
| Matrix |
|
||||
| 6 Rows, 22 Columns |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone blackwidow_chroma_zone =
|
||||
{
|
||||
"Keyboard",
|
||||
ZONE_TYPE_MATRIX,
|
||||
6,
|
||||
22
|
||||
};
|
||||
|
||||
static const razer_device blackwidow_chroma_device =
|
||||
{
|
||||
"Razer BlackWidow Chroma",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
22,
|
||||
{
|
||||
&blackwidow_chroma_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer BlackWidow Chroma Tournament Edition |
|
||||
| |
|
||||
| Zone "Keyboard" |
|
||||
| Matrix |
|
||||
| 6 Rows, 22 Columns |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone blackwidow_chroma_te_zone =
|
||||
{
|
||||
"Keyboard",
|
||||
ZONE_TYPE_MATRIX,
|
||||
6,
|
||||
22
|
||||
};
|
||||
|
||||
static const razer_device blackwidow_chroma_te_device =
|
||||
{
|
||||
"Razer BlackWidow Chroma Tournament Edition",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
22,
|
||||
{
|
||||
&blackwidow_chroma_te_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Ornata Chroma |
|
||||
| |
|
||||
| Zone "Keyboard" |
|
||||
| Matrix |
|
||||
| 6 Rows, 22 Columns |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone ornata_chroma_zone =
|
||||
{
|
||||
"Keyboard",
|
||||
ZONE_TYPE_MATRIX,
|
||||
6,
|
||||
22
|
||||
};
|
||||
|
||||
static const razer_device ornata_chroma_device =
|
||||
{
|
||||
"Razer Ornata Chroma",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
22,
|
||||
{
|
||||
&ornata_chroma_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer DeathStalker Chroma |
|
||||
| |
|
||||
| Zone "Keyboard" |
|
||||
| Linear |
|
||||
| 12 LEDs |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone deathstalker_chroma_zone =
|
||||
{
|
||||
"Keyboard",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
12
|
||||
};
|
||||
|
||||
static const razer_device deathstalker_chroma_device =
|
||||
{
|
||||
"Razer DeathStalker Chroma",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
1,
|
||||
12,
|
||||
{
|
||||
&deathstalker_chroma_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| LAPTOPS |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Blade Stealth |
|
||||
| |
|
||||
| Zone "Keyboard" |
|
||||
| Matrix |
|
||||
| 6 Rows, 16 Columns |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone blade_stealth_zone =
|
||||
{
|
||||
"Keyboard",
|
||||
ZONE_TYPE_MATRIX,
|
||||
6,
|
||||
16
|
||||
};
|
||||
|
||||
static const razer_device blade_stealth_device =
|
||||
{
|
||||
"Razer Blade Stealth",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
16,
|
||||
{
|
||||
&blade_stealth_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Blade Pro (Late 2016) |
|
||||
| |
|
||||
| Zone "Keyboard" |
|
||||
| Matrix |
|
||||
| 6 Rows, 25 Columns |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone blade_pro_late_2016_zone =
|
||||
{
|
||||
"Keyboard",
|
||||
ZONE_TYPE_MATRIX,
|
||||
6,
|
||||
25
|
||||
};
|
||||
|
||||
static const razer_device blade_pro_late_2016_device =
|
||||
{
|
||||
"Razer Blade Pro (Late 2016)",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
25,
|
||||
{
|
||||
&blade_pro_late_2016_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Blade Pro (2017) |
|
||||
| |
|
||||
| Zone "Keyboard" |
|
||||
| Matrix |
|
||||
| 6 Rows, 25 Columns |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone blade_pro_2017_zone =
|
||||
{
|
||||
"Keyboard",
|
||||
ZONE_TYPE_MATRIX,
|
||||
6,
|
||||
25
|
||||
};
|
||||
|
||||
static const razer_device blade_pro_2017_device =
|
||||
{
|
||||
"Razer Blade Pro (2017)",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
25,
|
||||
{
|
||||
&blade_pro_2017_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| MICE |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Mamba Tournament Edition |
|
||||
| |
|
||||
| Zone "Left" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| |
|
||||
| Zone "Right" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
| |
|
||||
| Zone "Scroll Wheel" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone mamba_te_left_zone =
|
||||
{
|
||||
"Left LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
};
|
||||
|
||||
static const razer_zone mamba_te_right_zone =
|
||||
{
|
||||
"Right LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
};
|
||||
|
||||
static const razer_zone mamba_te_logo_zone =
|
||||
{
|
||||
"Logo",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_zone mamba_te_scroll_wheel_zone =
|
||||
{
|
||||
"Scroll Wheel",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_device mamba_te_device =
|
||||
{
|
||||
"Razer Mamba Tournament Edition",
|
||||
DEVICE_TYPE_MOUSE,
|
||||
true,
|
||||
1,
|
||||
16,
|
||||
{
|
||||
&mamba_te_left_zone,
|
||||
&mamba_te_right_zone,
|
||||
&mamba_te_logo_zone,
|
||||
&mamba_te_scroll_wheel_zone,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Diamondback Chroma |
|
||||
| |
|
||||
| Zone "Right" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| |
|
||||
| Zone "Bottom" |
|
||||
| Linear |
|
||||
| 5 LEDs |
|
||||
| |
|
||||
| Zone "Left" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
| |
|
||||
| Zone "Scroll Wheel" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone diamondback_chroma_right_zone =
|
||||
{
|
||||
"Right LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
};
|
||||
|
||||
static const razer_zone diamondback_chroma_bottom_zone =
|
||||
{
|
||||
"Bottom LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
5
|
||||
};
|
||||
|
||||
static const razer_zone diamondback_chroma_left_zone =
|
||||
{
|
||||
"Left LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
};
|
||||
|
||||
static const razer_zone diamondback_chroma_logo_zone =
|
||||
{
|
||||
"Logo",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_zone diamondback_chroma_scroll_wheel_zone =
|
||||
{
|
||||
"Scroll Wheel",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_device diamondback_chroma_device =
|
||||
{
|
||||
"Razer Diamondback Chroma",
|
||||
DEVICE_TYPE_MOUSE,
|
||||
true,
|
||||
1,
|
||||
21,
|
||||
{
|
||||
&diamondback_chroma_right_zone,
|
||||
&diamondback_chroma_bottom_zone,
|
||||
&diamondback_chroma_left_zone,
|
||||
&diamondback_chroma_logo_zone,
|
||||
&diamondback_chroma_scroll_wheel_zone,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer DeathAdder Chroma |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
| |
|
||||
| Zone "Scroll Wheel" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone deathadder_chroma_logo_zone =
|
||||
{
|
||||
"Logo",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_zone deathadder_chroma_scroll_wheel_zone =
|
||||
{
|
||||
"Scroll Wheel",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_device deathadder_chroma_device =
|
||||
{
|
||||
"Razer DeathAdder Chroma",
|
||||
DEVICE_TYPE_MOUSE,
|
||||
false,
|
||||
1,
|
||||
2,
|
||||
{
|
||||
&deathadder_chroma_logo_zone,
|
||||
&deathadder_chroma_scroll_wheel_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Naga Chroma |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
| |
|
||||
| Zone "Scroll Wheel" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
| |
|
||||
| Zone "Numpad" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone naga_chroma_logo_zone =
|
||||
{
|
||||
"Logo",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_zone naga_chroma_scroll_wheel_zone =
|
||||
{
|
||||
"Scroll Wheel",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_zone naga_chroma_numpad_zone =
|
||||
{
|
||||
"Numpad",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_device naga_chroma_device =
|
||||
{
|
||||
"Razer Naga Chroma",
|
||||
DEVICE_TYPE_MOUSE,
|
||||
false,
|
||||
1,
|
||||
3,
|
||||
{
|
||||
&naga_chroma_logo_zone,
|
||||
&naga_chroma_scroll_wheel_zone,
|
||||
&naga_chroma_numpad_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| KEYPADS |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Orbweaver Chroma |
|
||||
| |
|
||||
| Zone "Keypad" |
|
||||
| Matrix |
|
||||
| 4 Rows, 5 Columns |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone orbweaver_chroma_zone =
|
||||
{
|
||||
"Keypad",
|
||||
ZONE_TYPE_MATRIX,
|
||||
4,
|
||||
5
|
||||
};
|
||||
|
||||
static const razer_device orbweaver_chroma_device =
|
||||
{
|
||||
"Razer Orbweaver Chroma",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
25,
|
||||
{
|
||||
&orbweaver_chroma_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Tartarus Chroma |
|
||||
| |
|
||||
| Zone "Keypad" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone tartarus_chroma_zone =
|
||||
{
|
||||
"Keypad",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_device tartarus_chroma_device =
|
||||
{
|
||||
"Razer Tartarus Chroma",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
1,
|
||||
1,
|
||||
{
|
||||
&tartarus_chroma_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| MOUSEMATS |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Firefly |
|
||||
| |
|
||||
| Zone "LED Strip" |
|
||||
| Linear |
|
||||
| 15 LEDs |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone firefly_zone =
|
||||
{
|
||||
"LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
15
|
||||
};
|
||||
|
||||
static const razer_device firefly_device =
|
||||
{
|
||||
"Razer Firefly",
|
||||
DEVICE_TYPE_MOUSEMAT,
|
||||
true,
|
||||
1,
|
||||
15,
|
||||
{
|
||||
&firefly_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Goliathus Extended |
|
||||
| |
|
||||
| Zone "LED Strip" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone goliathus_extended_zone =
|
||||
{
|
||||
"LED Strip",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_device goliathus_extended_device =
|
||||
{
|
||||
"Razer Goliathus Extended",
|
||||
DEVICE_TYPE_MOUSEMAT,
|
||||
true,
|
||||
1,
|
||||
1,
|
||||
{
|
||||
&goliathus_extended_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| HEADSETS |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Kraken 7.1 Chroma |
|
||||
| |
|
||||
| Zone "Headset" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone kraken_chroma_zone =
|
||||
{
|
||||
"Headset",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_device kraken_chroma_device =
|
||||
{
|
||||
"Razer Kraken 7.1 Chroma",
|
||||
DEVICE_TYPE_HEADSET,
|
||||
true,
|
||||
1,
|
||||
1,
|
||||
{
|
||||
&kraken_chroma_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Kraken 7.1 V2 |
|
||||
| |
|
||||
| Zone "Headset" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone kraken_v2_zone =
|
||||
{
|
||||
"Headset",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_device kraken_v2_device =
|
||||
{
|
||||
"Razer Kraken 7.1 V2",
|
||||
DEVICE_TYPE_HEADSET,
|
||||
true,
|
||||
1,
|
||||
1,
|
||||
{
|
||||
&kraken_v2_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| OTHER |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Core |
|
||||
| |
|
||||
| Zone "Side Window Lights" |
|
||||
| Single |
|
||||
| 1 LED |
|
||||
| |
|
||||
| Zone "LED Strip" |
|
||||
| Linear |
|
||||
| 8 LEDs |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone core_side_zone =
|
||||
{
|
||||
"Side Window Lights",
|
||||
ZONE_TYPE_SINGLE,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
static const razer_zone core_led_strip_zone =
|
||||
{
|
||||
"LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_device core_device =
|
||||
{
|
||||
"Razer Core",
|
||||
DEVICE_TYPE_UNKNOWN,
|
||||
true,
|
||||
1,
|
||||
9,
|
||||
{
|
||||
&core_side_zone,
|
||||
&core_led_strip_zone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Razer Chroma Mug Holder |
|
||||
| |
|
||||
| Zone "LED Strip" |
|
||||
| Linear |
|
||||
| 15 LEDs |
|
||||
\*-------------------------------------------------------------*/
|
||||
static const razer_zone mug_holder_zone =
|
||||
{
|
||||
"LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
15
|
||||
};
|
||||
|
||||
static const razer_device mug_holder_device =
|
||||
{
|
||||
"Razer Chroma Mug Holder",
|
||||
DEVICE_TYPE_UNKNOWN,
|
||||
true,
|
||||
1,
|
||||
15,
|
||||
{
|
||||
&mug_holder_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,
|
||||
1,
|
||||
16
|
||||
};
|
||||
|
||||
static const razer_device chromahdk_device =
|
||||
{
|
||||
"Razer Chroma HDK",
|
||||
DEVICE_TYPE_LEDSTRIP,
|
||||
true,
|
||||
4,
|
||||
16,
|
||||
{
|
||||
&chromahdk_zone,
|
||||
&chromahdk_zone,
|
||||
&chromahdk_zone,
|
||||
&chromahdk_zone,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| DEVICE MASTER LIST |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
#define RAZER_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
|
||||
|
||||
static const razer_device* device_list[] =
|
||||
{
|
||||
/*-----------------------------------------------------------------*\
|
||||
| KEYBOARDS |
|
||||
\*-----------------------------------------------------------------*/
|
||||
&blackwidow_chroma_device,
|
||||
&blackwidow_chroma_te_device,
|
||||
&ornata_chroma_device,
|
||||
&deathstalker_chroma_device,
|
||||
/*-----------------------------------------------------------------*\
|
||||
| LAPTOPS |
|
||||
\*-----------------------------------------------------------------*/
|
||||
&blade_stealth_device,
|
||||
&blade_pro_late_2016_device,
|
||||
&blade_pro_2017_device,
|
||||
/*-----------------------------------------------------------------*\
|
||||
| MICE |
|
||||
\*-----------------------------------------------------------------*/
|
||||
&mamba_te_device,
|
||||
&diamondback_chroma_device,
|
||||
&deathadder_chroma_device,
|
||||
/*-----------------------------------------------------------------*\
|
||||
| KEYPADS |
|
||||
\*-----------------------------------------------------------------*/
|
||||
&orbweaver_chroma_device,
|
||||
&tartarus_chroma_device,
|
||||
/*-----------------------------------------------------------------*\
|
||||
| MOUSEMATS |
|
||||
\*-----------------------------------------------------------------*/
|
||||
&firefly_device,
|
||||
&goliathus_extended_device,
|
||||
/*-----------------------------------------------------------------*\
|
||||
| HEADSETS |
|
||||
\*-----------------------------------------------------------------*/
|
||||
&kraken_chroma_device,
|
||||
&kraken_v2_device,
|
||||
/*-----------------------------------------------------------------*\
|
||||
| OTHER |
|
||||
\*-----------------------------------------------------------------*/
|
||||
&core_device,
|
||||
&mug_holder_device,
|
||||
&chromahdk_device
|
||||
};
|
||||
|
||||
|
||||
class RGBController_OpenRazer : public RGBController
|
||||
{
|
||||
public:
|
||||
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_MATRIX_STATIC,
|
||||
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();
|
||||
|
||||
int device;
|
||||
|
||||
private:
|
||||
void SetupMatrixDevice(std::string dev_path, unsigned int rows, unsigned int cols);
|
||||
void SetupNonMatrixDevice(std::string dev_path);
|
||||
|
||||
unsigned int matrix_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,164 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_PatriotViper.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| Patriot Viper RGB interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/1/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_PatriotViper.h"
|
||||
|
||||
int RGBController_PatriotViper::GetMode()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void RGBController_PatriotViper::SetMode(int mode)
|
||||
{
|
||||
if(mode == 0)
|
||||
{
|
||||
viper->SetDirect();
|
||||
}
|
||||
else
|
||||
{
|
||||
viper->SetMode(mode - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_PatriotViper::SetCustomMode()
|
||||
{
|
||||
viper->SetDirect();
|
||||
}
|
||||
|
||||
void RGBController_PatriotViper::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
if(viper->direct == true)
|
||||
{
|
||||
viper->SetAllColors(red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
viper->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RGBController_PatriotViper::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
if(viper->direct == true)
|
||||
{
|
||||
for (std::size_t x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (std::size_t y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
viper->SetLEDColor(zones[zone].map[x][y], red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (std::size_t x = 0; x < zones[zone].map.size(); x++)
|
||||
{
|
||||
for (std::size_t y = 0; y < zones[zone].map[x].size(); y++)
|
||||
{
|
||||
viper->SetLEDEffectColor(zones[zone].map[x][y], red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_PatriotViper::SetLED(int led, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
if(viper->direct == true)
|
||||
{
|
||||
viper->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
viper->SetLEDEffectColor(led, red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_PatriotViper::UpdateLEDs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
RGBController_PatriotViper::RGBController_PatriotViper(PatriotViperController* viper_ptr)
|
||||
{
|
||||
viper = viper_ptr;
|
||||
|
||||
name = viper->GetDeviceName();
|
||||
location = viper->GetDeviceLocation();
|
||||
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
|
||||
mode viper_modes[10];
|
||||
|
||||
viper_modes[0].name = "Direct";
|
||||
viper_modes[1].name = "Dark";
|
||||
viper_modes[2].name = "Breathing";
|
||||
viper_modes[3].name = "Viper";
|
||||
viper_modes[4].name = "Heartbeat";
|
||||
viper_modes[5].name = "Marquee";
|
||||
viper_modes[6].name = "Raindrop";
|
||||
viper_modes[7].name = "Aurora";
|
||||
viper_modes[8].name = "Unknown";
|
||||
viper_modes[9].name = "Neon";
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
modes.push_back(viper_modes[i]);
|
||||
}
|
||||
|
||||
unsigned int led_idx = 0;
|
||||
|
||||
for(unsigned int slot = 0; slot < viper->GetSlotCount(); slot++)
|
||||
{
|
||||
zone* new_zone = new zone;
|
||||
|
||||
char slot_idx_str[3];
|
||||
sprintf(slot_idx_str, "%d", slot);
|
||||
new_zone->name = "Patriot Viper RGB Slot ";
|
||||
new_zone->name.append(slot_idx_str);
|
||||
|
||||
new_zone->type = ZONE_TYPE_LINEAR;
|
||||
|
||||
std::vector<int> *new_zone_map = new std::vector<int>();
|
||||
|
||||
for(int led_slot_idx = 0; led_slot_idx < 5; led_slot_idx++)
|
||||
{
|
||||
colors.push_back(0x00000000);
|
||||
|
||||
led* new_led = new led();
|
||||
|
||||
char led_idx_str[3];
|
||||
sprintf(led_idx_str, "%d", led_slot_idx);
|
||||
new_led->name = "Patriot Viper RGB Slot ";
|
||||
new_led->name.append(slot_idx_str);
|
||||
new_led->name.append(", LED ");
|
||||
new_led->name.append(led_idx_str);
|
||||
|
||||
leds.push_back(*new_led);
|
||||
|
||||
new_zone_map->push_back(led_idx);
|
||||
led_idx++;
|
||||
}
|
||||
|
||||
new_zone->map.push_back(*new_zone_map);
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_PatriotViper.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| Patriot Viper RGB interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/1/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "PatriotViperController.h"
|
||||
|
||||
class RGBController_PatriotViper : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_PatriotViper(PatriotViperController* viper_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:
|
||||
PatriotViperController* viper;
|
||||
};
|
||||
@@ -0,0 +1,112 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Polychrome.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| ASRock ASR LED and Polychrome RGB Driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/15/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_Polychrome.h"
|
||||
|
||||
int RGBController_Polychrome::GetMode()
|
||||
{
|
||||
return(polychrome->GetMode());
|
||||
}
|
||||
|
||||
void RGBController_Polychrome::SetMode(int mode)
|
||||
{
|
||||
polychrome->SetMode(mode);
|
||||
}
|
||||
|
||||
void RGBController_Polychrome::SetCustomMode()
|
||||
{
|
||||
polychrome->SetMode(POLYCHROME_MODE_STATIC);
|
||||
}
|
||||
|
||||
void RGBController_Polychrome::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
polychrome->SetAllColors(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_Polychrome::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
polychrome->SetLEDColor(zone, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_Polychrome::SetLED(int led, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
polychrome->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_Polychrome::UpdateLEDs()
|
||||
{
|
||||
for (std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[led]);
|
||||
unsigned char grn = RGBGetGValue(colors[led]);
|
||||
unsigned char blu = RGBGetBValue(colors[led]);
|
||||
|
||||
polychrome->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
static const char* polychrome_zone_names[] =
|
||||
{
|
||||
"Motherboard"
|
||||
};
|
||||
|
||||
RGBController_Polychrome::RGBController_Polychrome(PolychromeController* polychrome_ptr)
|
||||
{
|
||||
polychrome = polychrome_ptr;
|
||||
|
||||
name = polychrome->GetDeviceName();
|
||||
|
||||
mode polychrome_modes[POLYCHROME_NUM_MODES];
|
||||
|
||||
polychrome_modes[0].name = "Static";
|
||||
polychrome_modes[1].name = "Breathing";
|
||||
polychrome_modes[2].name = "Flashing";
|
||||
|
||||
for (int i = 0; i < POLYCHROME_NUM_MODES; i++)
|
||||
{
|
||||
modes.push_back(polychrome_modes[i]);
|
||||
}
|
||||
|
||||
// Search through all LEDs and create zones for each channel type
|
||||
for (unsigned int i = 0; i < polychrome->GetLEDCount(); i++)
|
||||
{
|
||||
zone* new_zone = new zone();
|
||||
led* new_led = new led();
|
||||
|
||||
std::vector<int>* zone_row = new std::vector<int>();
|
||||
|
||||
// Set zone name to channel name
|
||||
new_zone->name = polychrome_zone_names[i];
|
||||
new_led->name = polychrome_zone_names[i];
|
||||
|
||||
zone_row->push_back(i);
|
||||
|
||||
// Aura devices can be either single or linear, never matrix
|
||||
// That means only one row is needed
|
||||
new_zone->map.push_back(*zone_row);
|
||||
|
||||
// Push new LED to LEDs vector
|
||||
leds.push_back(*new_led);
|
||||
|
||||
// Push new zone to zones vector
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Polychrome.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| ASRock ASR LED and Polychrome RGB Driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/15/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "PolychromeController.h"
|
||||
|
||||
class RGBController_Polychrome : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_Polychrome(PolychromeController* polychrome_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:
|
||||
PolychromeController* polychrome;
|
||||
};
|
||||
@@ -0,0 +1,117 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_RGBFusion.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| Gigabyte RGB Fusion Driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/11/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_RGBFusion.h"
|
||||
|
||||
int RGBController_RGBFusion::GetMode()
|
||||
{
|
||||
return(rgb_fusion->GetMode());
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion::SetMode(int mode)
|
||||
{
|
||||
rgb_fusion->SetMode(mode);
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion::SetCustomMode()
|
||||
{
|
||||
rgb_fusion->SetMode(RGB_FUSION_MODE_STATIC);
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion::SetAllLEDs(RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
rgb_fusion->SetAllColors(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion::SetAllZoneLEDs(int zone, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
rgb_fusion->SetLEDColor(zone, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion::SetLED(int led, RGBColor color)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
rgb_fusion->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion::UpdateLEDs()
|
||||
{
|
||||
for (std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[led]);
|
||||
unsigned char grn = RGBGetGValue(colors[led]);
|
||||
unsigned char blu = RGBGetBValue(colors[led]);
|
||||
|
||||
rgb_fusion->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
static const char* rgb_fusion_zone_names[] =
|
||||
{
|
||||
"Motherboard",
|
||||
"RGB Header"
|
||||
};
|
||||
|
||||
RGBController_RGBFusion::RGBController_RGBFusion(RGBFusionController* rgb_fusion_ptr)
|
||||
{
|
||||
rgb_fusion = rgb_fusion_ptr;
|
||||
|
||||
name = rgb_fusion->GetDeviceName();
|
||||
description = "RGB Fusion 1.0";
|
||||
location = rgb_fusion->GetDeviceLocation();
|
||||
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
|
||||
mode rgb_fusion_modes[RGB_FUSION_NUMBER_MODES];
|
||||
|
||||
rgb_fusion_modes[0].name = "Static";
|
||||
rgb_fusion_modes[1].name = "Breathing";
|
||||
rgb_fusion_modes[2].name = "Flashing";
|
||||
|
||||
for (int i = 0; i < RGB_FUSION_NUMBER_MODES; i++)
|
||||
{
|
||||
modes.push_back(rgb_fusion_modes[i]);
|
||||
}
|
||||
|
||||
// Search through all LEDs and create zones for each channel type
|
||||
for (unsigned int i = 0; i < rgb_fusion->GetLEDCount(); i++)
|
||||
{
|
||||
zone* new_zone = new zone();
|
||||
led* new_led = new led();
|
||||
|
||||
std::vector<int>* zone_row = new std::vector<int>();
|
||||
|
||||
// Set zone name to channel name
|
||||
new_zone->name = rgb_fusion_zone_names[i];
|
||||
new_led->name = rgb_fusion_zone_names[i];
|
||||
|
||||
zone_row->push_back(i);
|
||||
|
||||
// Aura devices can be either single or linear, never matrix
|
||||
// That means only one row is needed
|
||||
new_zone->map.push_back(*zone_row);
|
||||
|
||||
// Push new LED to LEDs vector
|
||||
leds.push_back(*new_led);
|
||||
|
||||
// Push new zone to zones vector
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_RGBFusion.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| Gigabyte RGB Fusion Driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 12/11/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "RGBFusionController.h"
|
||||
|
||||
class RGBController_RGBFusion : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_RGBFusion(RGBFusionController* rgb_fusion_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:
|
||||
RGBFusionController* rgb_fusion;
|
||||
};
|
||||
@@ -0,0 +1,191 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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]->razer_type == device_type)
|
||||
{
|
||||
name = device_list[i]->name;
|
||||
type = device_list[i]->type;
|
||||
location = "Razer Chroma SDK";
|
||||
|
||||
for (int zone_id = 0; zone_id < RAZER_MAX_ZONES; zone_id++)
|
||||
{
|
||||
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->razer_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,249 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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 razer_type;
|
||||
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,
|
||||
DEVICE_TYPE_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,
|
||||
DEVICE_TYPE_MOUSE,
|
||||
{
|
||||
&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,
|
||||
DEVICE_TYPE_LEDSTRIP,
|
||||
{
|
||||
&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() */
|
||||
+1
Submodule dependencies/libe131 added at 930956795a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user