Added brightness support for HyperX Origin Core
This commit is contained in:
parent
878e6c6d8b
commit
56e4f94be3
3 changed files with 26 additions and 5 deletions
|
|
@ -63,6 +63,19 @@ std::string HyperXAlloyOriginsCoreController::GetFirmwareVersion()
|
|||
return(firmware_version);
|
||||
}
|
||||
|
||||
void HyperXAlloyOriginsCoreController::SetBrightness(unsigned int brightness)
|
||||
{
|
||||
unsigned char packet[65];
|
||||
memset(packet, 0x00, sizeof(packet));
|
||||
|
||||
packet[1] = 0xA7;
|
||||
packet[4] = 0x01;
|
||||
packet[5] = brightness;
|
||||
|
||||
hid_write(dev, packet, 65);
|
||||
}
|
||||
|
||||
|
||||
void HyperXAlloyOriginsCoreController::SetLEDsDirect(std::vector<RGBColor> colors)
|
||||
{
|
||||
for(unsigned int skip_cnt = 0; skip_cnt < (sizeof(skip_idx) / sizeof(skip_idx[0])); skip_cnt++)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public:
|
|||
std::string GetFirmwareVersion();
|
||||
|
||||
void SetLEDsDirect(std::vector<RGBColor> colors);
|
||||
void SetBrightness(unsigned int brightness);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@
|
|||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
|
||||
#define HYPERX_MIN_BRIGHTNESS 0
|
||||
#define HYPERX_MAX_BRIGHTNESS 255
|
||||
|
||||
//0xFFFFFFFF indicates an unused entry in matrix
|
||||
#define NA 0xFFFFFFFF
|
||||
|
||||
|
|
@ -170,10 +174,13 @@ RGBController_HyperXAlloyOriginsCore::RGBController_HyperXAlloyOriginsCore(Hyper
|
|||
version = controller->GetFirmwareVersion();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Direct.brightness_min = HYPERX_MIN_BRIGHTNESS;
|
||||
Direct.brightness_max = HYPERX_MAX_BRIGHTNESS;
|
||||
Direct.brightness = HYPERX_MAX_BRIGHTNESS;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
|
|
@ -271,7 +278,7 @@ void RGBController_HyperXAlloyOriginsCore::UpdateSingleLED(int /*led*/)
|
|||
|
||||
void RGBController_HyperXAlloyOriginsCore::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
controller->SetBrightness(modes[active_mode].brightness);
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyOriginsCore::KeepaliveThread()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue