Add function to get effect string for a channel
This commit is contained in:
parent
7cea74e466
commit
b35c900fae
2 changed files with 120 additions and 1 deletions
|
|
@ -12,6 +12,17 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
static void Sleep(unsigned int milliseconds)
|
||||
{
|
||||
usleep(1000 * milliseconds);
|
||||
}
|
||||
#endif
|
||||
|
||||
AMDWraithPrismController::AMDWraithPrismController(libusb_device_handle* dev_handle)
|
||||
{
|
||||
dev = dev_handle;
|
||||
|
|
@ -20,7 +31,9 @@ AMDWraithPrismController::AMDWraithPrismController(libusb_device_handle* dev_han
|
|||
|
||||
SendEnableCommand();
|
||||
SendRemapCommand();
|
||||
SendEffectCommand();
|
||||
//SendEffectCommand();
|
||||
SetFanColor(0xFF, 0x00, 0xFF);
|
||||
SetLogoColor(0x00, 0xFF, 0xFF);
|
||||
}
|
||||
|
||||
AMDWraithPrismController::~AMDWraithPrismController()
|
||||
|
|
@ -33,6 +46,106 @@ 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);
|
||||
}
|
||||
|
||||
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::SendEnableCommand()
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
| Adam Honse (CalcProgrammer1) 12/6/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
|
||||
class AMDWraithPrismController
|
||||
|
|
@ -17,6 +18,11 @@ public:
|
|||
|
||||
char* GetDeviceName();
|
||||
|
||||
std::string GetEffectChannelString(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 SendEnableCommand();
|
||||
void SendRemapCommand();
|
||||
void SendEffectCommand();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue