Code cleanup round 5
This commit is contained in:
parent
e448143377
commit
a219ac693c
21 changed files with 815 additions and 808 deletions
|
|
@ -6,17 +6,15 @@
|
|||
|
||||
#include "RGBController_HPOmen30L.h"
|
||||
|
||||
RGBController_HPOmen30L::RGBController_HPOmen30L(HPOmen30LController* omen_ptr)
|
||||
RGBController_HPOmen30L::RGBController_HPOmen30L(HPOmen30LController* controller_ptr)
|
||||
{
|
||||
omen = omen_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HP Omen 30L";
|
||||
vendor = "HP";
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
description = "HP Omen 30L Device";
|
||||
version = "";
|
||||
location = omen->GetLocationString();
|
||||
serial = "";
|
||||
location = controller->GetLocationString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -91,7 +89,7 @@ RGBController_HPOmen30L::RGBController_HPOmen30L(HPOmen30LController* omen_ptr)
|
|||
|
||||
RGBController_HPOmen30L::~RGBController_HPOmen30L()
|
||||
{
|
||||
delete omen;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HPOmen30L::SetupZones()
|
||||
|
|
@ -109,12 +107,12 @@ void RGBController_HPOmen30L::SetupZones()
|
|||
zones.push_back(logo_zone);
|
||||
|
||||
zone light_bar;
|
||||
light_bar.name = "Light Bar";
|
||||
light_bar.type = ZONE_TYPE_SINGLE;
|
||||
light_bar.leds_min = 1;
|
||||
light_bar.leds_max = 1;
|
||||
light_bar.leds_count = 1;
|
||||
light_bar.matrix_map = NULL;
|
||||
light_bar.name = "Light Bar";
|
||||
light_bar.type = ZONE_TYPE_SINGLE;
|
||||
light_bar.leds_min = 1;
|
||||
light_bar.leds_max = 1;
|
||||
light_bar.leds_count = 1;
|
||||
light_bar.matrix_map = NULL;
|
||||
zones.push_back(light_bar);
|
||||
|
||||
zone ring_zone;
|
||||
|
|
@ -127,31 +125,31 @@ void RGBController_HPOmen30L::SetupZones()
|
|||
zones.push_back(ring_zone);
|
||||
|
||||
zone cpu_zone;
|
||||
cpu_zone.name = "CPU Cooler";
|
||||
cpu_zone.type = ZONE_TYPE_SINGLE;
|
||||
cpu_zone.leds_min = 1;
|
||||
cpu_zone.leds_max = 1;
|
||||
cpu_zone.leds_count = 1;
|
||||
cpu_zone.matrix_map = NULL;
|
||||
cpu_zone.name = "CPU Cooler";
|
||||
cpu_zone.type = ZONE_TYPE_SINGLE;
|
||||
cpu_zone.leds_min = 1;
|
||||
cpu_zone.leds_max = 1;
|
||||
cpu_zone.leds_count = 1;
|
||||
cpu_zone.matrix_map = NULL;
|
||||
zones.push_back(cpu_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
led logo_led;
|
||||
logo_led.name = "Logo LED";
|
||||
logo_led.name = "Logo LED";
|
||||
leds.push_back(logo_led);
|
||||
|
||||
led bar_led;
|
||||
bar_led.name = "Bar LED";
|
||||
bar_led.name = "Bar LED";
|
||||
leds.push_back(bar_led);
|
||||
|
||||
led fan_led;
|
||||
fan_led.name = "Fan LED";
|
||||
fan_led.name = "Fan LED";
|
||||
leds.push_back(fan_led);
|
||||
|
||||
led cpu_led;
|
||||
cpu_led.name = "CPU LED";
|
||||
cpu_led.name = "CPU LED";
|
||||
leds.push_back(cpu_led);
|
||||
|
||||
SetupColors();
|
||||
|
|
@ -170,18 +168,18 @@ void RGBController_HPOmen30L::DeviceUpdateLEDs()
|
|||
{
|
||||
if(modes[active_mode].value == HP_OMEN_30L_STATIC || modes[active_mode].value == HP_OMEN_30L_DIRECT)
|
||||
{
|
||||
omen->SetZoneColor(i, colors);
|
||||
controller->SetZoneColor(i, colors);
|
||||
}
|
||||
else
|
||||
{
|
||||
omen->SetZoneColor(i, modes[active_mode].colors);
|
||||
controller->SetZoneColor(i, modes[active_mode].colors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HPOmen30L::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
omen->SetZoneColor(zone,colors);
|
||||
controller->SetZoneColor(zone,colors);
|
||||
}
|
||||
|
||||
void RGBController_HPOmen30L::UpdateSingleLED(int led)
|
||||
|
|
@ -198,7 +196,7 @@ void RGBController_HPOmen30L::DeviceUpdateMode()
|
|||
{
|
||||
for(int i = 0; i < zones.size(); i++)
|
||||
{
|
||||
omen->SetZoneMode(i, modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness);
|
||||
controller->SetZoneMode(i, modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness);
|
||||
}
|
||||
|
||||
DeviceUpdateLEDs();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
class RGBController_HPOmen30L : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HPOmen30L(HPOmen30LController* omen_ptr);
|
||||
RGBController_HPOmen30L(HPOmen30LController* controller_ptr);
|
||||
~RGBController_HPOmen30L();
|
||||
|
||||
void SetupZones();
|
||||
|
|
@ -27,5 +27,5 @@ public:
|
|||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
HPOmen30LController* omen;
|
||||
HPOmen30LController* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,48 +1,52 @@
|
|||
#include "Detector.h"
|
||||
#include "HoltekA070Controller.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_HoltekA070.h"
|
||||
#include "HoltekA1FAController.h"
|
||||
#include "RGBController_HoltekA1FA.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Holtek Semiconductor Inc. vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define HOLTEK_VID 0x04D9
|
||||
/*-----------------------------------------------------*\
|
||||
| Mouse product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define HOLTEK_A070_PID 0xA070
|
||||
/*-----------------------------------------------------*\
|
||||
| Mousemats product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define HOLTEK_A1FA_PID 0xA1FA
|
||||
|
||||
void DetectHoltekControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
HoltekA070Controller* controller = new HoltekA070Controller(dev, info->path);
|
||||
RGBController_HoltekA070* rgb_controller = new RGBController_HoltekA070(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectHoltekControllers() */
|
||||
|
||||
void DetectHoltekMousemats(hid_device_info *info, const std::string &name)
|
||||
{
|
||||
hid_device *dev = hid_open_path(info->path);
|
||||
if (dev)
|
||||
{
|
||||
HoltekA1FAController *controller = new HoltekA1FAController(dev, info->path);
|
||||
RGBController_HoltekA1FA *rgb_controller = new RGBController_HoltekA1FA(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectHoltekMousemats() */
|
||||
|
||||
REGISTER_HID_DETECTOR_IPU("Holtek USB Gaming Mouse", DetectHoltekControllers, HOLTEK_VID, HOLTEK_A070_PID, 1, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Holtek Mousemat", DetectHoltekMousemats, HOLTEK_VID, HOLTEK_A1FA_PID, 2, 0xFF00, 0xFF00);
|
||||
#include "Detector.h"
|
||||
#include "HoltekA070Controller.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_HoltekA070.h"
|
||||
#include "HoltekA1FAController.h"
|
||||
#include "RGBController_HoltekA1FA.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Holtek Semiconductor Inc. vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define HOLTEK_VID 0x04D9
|
||||
/*-----------------------------------------------------*\
|
||||
| Mouse product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define HOLTEK_A070_PID 0xA070
|
||||
/*-----------------------------------------------------*\
|
||||
| Mousemats product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define HOLTEK_A1FA_PID 0xA1FA
|
||||
|
||||
void DetectHoltekControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
HoltekA070Controller* controller = new HoltekA070Controller(dev, info->path);
|
||||
RGBController_HoltekA070* rgb_controller = new RGBController_HoltekA070(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectHoltekControllers() */
|
||||
|
||||
void DetectHoltekMousemats(hid_device_info *info, const std::string &name)
|
||||
{
|
||||
hid_device *dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
HoltekA1FAController* controller = new HoltekA1FAController(dev, info->path);
|
||||
RGBController_HoltekA1FA* rgb_controller = new RGBController_HoltekA1FA(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectHoltekMousemats() */
|
||||
|
||||
REGISTER_HID_DETECTOR_IPU("Holtek USB Gaming Mouse", DetectHoltekControllers, HOLTEK_VID, HOLTEK_A070_PID, 1, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Holtek Mousemat", DetectHoltekMousemats, HOLTEK_VID, HOLTEK_A1FA_PID, 2, 0xFF00, 0xFF00);
|
||||
|
|
|
|||
|
|
@ -1,98 +1,98 @@
|
|||
/*--------------------------------------------------------------*\
|
||||
| RGBController_HoltekA070.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Holtek USB Gaming Mouse [04d9:a070] |
|
||||
| |
|
||||
| Santeri Pikarinen (santeri3700) 8/01/2020 |
|
||||
\*--------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_HoltekA070.h"
|
||||
|
||||
RGBController_HoltekA070::RGBController_HoltekA070(HoltekA070Controller* holtek_ptr)
|
||||
{
|
||||
holtek = holtek_ptr;
|
||||
|
||||
name = "Holtek USB Gaming Mouse Device";
|
||||
vendor = "Holtek";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Holtek USB Gaming Mouse Device";
|
||||
location = holtek->GetDeviceLocation();
|
||||
serial = holtek->GetSerialString();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.speed = HOLTEK_A070_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = HOLTEK_A070_MODE_BREATHING_SLOW;
|
||||
Breathing.speed_max = HOLTEK_A070_MODE_BREATHING_FAST;
|
||||
Breathing.speed = HOLTEK_A070_MODE_BREATHING_MEDIUM;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_HoltekA070::~RGBController_HoltekA070()
|
||||
{
|
||||
delete holtek;
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::SetupZones()
|
||||
{
|
||||
zone mouse_zone;
|
||||
mouse_zone.name = "Mouse";
|
||||
mouse_zone.type = ZONE_TYPE_SINGLE;
|
||||
mouse_zone.leds_min = 1;
|
||||
mouse_zone.leds_max = 1;
|
||||
mouse_zone.leds_count = 1;
|
||||
mouse_zone.matrix_map = NULL;
|
||||
zones.push_back(mouse_zone);
|
||||
|
||||
led mouse_led;
|
||||
mouse_led.name = "Mouse";
|
||||
leds.push_back(mouse_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char green = RGBGetGValue(colors[0]);
|
||||
unsigned char blue = RGBGetBValue(colors[0]);
|
||||
|
||||
holtek->SendCustomColor(red, green, blue);
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::DeviceUpdateMode()
|
||||
{
|
||||
holtek->SendMode(modes[active_mode].speed);
|
||||
}
|
||||
/*--------------------------------------------------------------*\
|
||||
| RGBController_HoltekA070.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Holtek USB Gaming Mouse [04d9:a070] |
|
||||
| |
|
||||
| Santeri Pikarinen (santeri3700) 8/01/2020 |
|
||||
\*--------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_HoltekA070.h"
|
||||
|
||||
RGBController_HoltekA070::RGBController_HoltekA070(HoltekA070Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Holtek USB Gaming Mouse Device";
|
||||
vendor = "Holtek";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Holtek USB Gaming Mouse Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.speed = HOLTEK_A070_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = HOLTEK_A070_MODE_BREATHING_SLOW;
|
||||
Breathing.speed_max = HOLTEK_A070_MODE_BREATHING_FAST;
|
||||
Breathing.speed = HOLTEK_A070_MODE_BREATHING_MEDIUM;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_HoltekA070::~RGBController_HoltekA070()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::SetupZones()
|
||||
{
|
||||
zone mouse_zone;
|
||||
mouse_zone.name = "Mouse";
|
||||
mouse_zone.type = ZONE_TYPE_SINGLE;
|
||||
mouse_zone.leds_min = 1;
|
||||
mouse_zone.leds_max = 1;
|
||||
mouse_zone.leds_count = 1;
|
||||
mouse_zone.matrix_map = NULL;
|
||||
zones.push_back(mouse_zone);
|
||||
|
||||
led mouse_led;
|
||||
mouse_led.name = "Mouse";
|
||||
leds.push_back(mouse_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char green = RGBGetGValue(colors[0]);
|
||||
unsigned char blue = RGBGetBValue(colors[0]);
|
||||
|
||||
controller->SendCustomColor(red, green, blue);
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HoltekA070::DeviceUpdateMode()
|
||||
{
|
||||
controller->SendMode(modes[active_mode].speed);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,31 @@
|
|||
/*--------------------------------------------------------------*\
|
||||
| RGBController_HoltekA070.h |
|
||||
| |
|
||||
| Generic RGB Interface for Holtek USB Gaming Mouse [04d9:a070] |
|
||||
| |
|
||||
| Santeri Pikarinen (santeri3700) 8/01/2020 |
|
||||
\*--------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "HoltekA070Controller.h"
|
||||
|
||||
class RGBController_HoltekA070 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HoltekA070(HoltekA070Controller* holtek_ptr);
|
||||
~RGBController_HoltekA070();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
HoltekA070Controller* holtek;
|
||||
};
|
||||
/*--------------------------------------------------------------*\
|
||||
| RGBController_HoltekA070.h |
|
||||
| |
|
||||
| Generic RGB Interface for Holtek USB Gaming Mouse [04d9:a070] |
|
||||
| |
|
||||
| Santeri Pikarinen (santeri3700) 8/01/2020 |
|
||||
\*--------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "HoltekA070Controller.h"
|
||||
|
||||
class RGBController_HoltekA070 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HoltekA070(HoltekA070Controller* controller_ptr);
|
||||
~RGBController_HoltekA070();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
HoltekA070Controller* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,141 +1,141 @@
|
|||
/*--------------------------------------------------------------*\
|
||||
| RGBController_HoltekA1FA.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Holtek based Mousemat [04d9:a1fa] |
|
||||
| |
|
||||
| Edoardo Ridolfi (edo2313) 26/12/2020 |
|
||||
\*--------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_HoltekA1FA.h"
|
||||
|
||||
RGBController_HoltekA1FA::RGBController_HoltekA1FA(HoltekA1FAController* holtek_ptr)
|
||||
{
|
||||
holtek = holtek_ptr;
|
||||
|
||||
name = "Holtek Mousemat Device";
|
||||
vendor = "Holtek";
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = "Holtek Mousemat Device";
|
||||
location = holtek->GetDeviceLocation();
|
||||
serial = holtek->GetSerialString();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = HOLTEK_A1FA_MODE_STATIC;
|
||||
Static.speed = HOLTEK_A1FA_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 7;
|
||||
Static.colors.resize(7);
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = HOLTEK_A1FA_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = HOLTEK_A1FA_SPEED_SLOWEST;
|
||||
Breathing.speed_max = HOLTEK_A1FA_SPEED_FASTEST;
|
||||
Breathing.speed = HOLTEK_A1FA_SPEED_NORMAL;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 7;
|
||||
Breathing.colors.resize(7);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Neon;
|
||||
Neon.name = "Neon";
|
||||
Neon.value = HOLTEK_A1FA_MODE_NEON;
|
||||
Neon.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Neon.color_mode = MODE_COLORS_NONE;
|
||||
Neon.speed_min = HOLTEK_A1FA_SPEED_SLOWEST;
|
||||
Neon.speed_max = HOLTEK_A1FA_SPEED_FASTEST;
|
||||
Neon.speed = HOLTEK_A1FA_SPEED_NORMAL;
|
||||
modes.push_back(Neon);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = HOLTEK_A1FA_MODE_RAINBOW;
|
||||
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
Rainbow.speed_min = HOLTEK_A1FA_SPEED_SLOWEST;
|
||||
Rainbow.speed_max = HOLTEK_A1FA_SPEED_FASTEST;
|
||||
Rainbow.speed = HOLTEK_A1FA_SPEED_NORMAL;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_HoltekA1FA::~RGBController_HoltekA1FA()
|
||||
{
|
||||
delete holtek;
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::SetupZones()
|
||||
{
|
||||
zone mouse_zone;
|
||||
mouse_zone.name = "Mousemat";
|
||||
mouse_zone.type = ZONE_TYPE_SINGLE;
|
||||
mouse_zone.leds_min = 1;
|
||||
mouse_zone.leds_max = 1;
|
||||
mouse_zone.leds_count = 1;
|
||||
mouse_zone.matrix_map = NULL;
|
||||
zones.push_back(mouse_zone);
|
||||
|
||||
led mouse_led;
|
||||
mouse_led.name = "Mousemat";
|
||||
leds.push_back(mouse_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char mode = modes[active_mode].value;
|
||||
unsigned char brightness = 0x20; /*When brightness support is added, change this */
|
||||
unsigned char speed = modes[active_mode].speed;
|
||||
unsigned char preset = (modes[active_mode].color_mode == MODE_COLORS_RANDOM) ? 0x70 : 0x00;
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char green = RGBGetGValue(colors[0]);
|
||||
unsigned char blue = RGBGetBValue(colors[0]);
|
||||
|
||||
holtek->SendData(mode, brightness, speed, preset, red, green, blue);
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::DeviceUpdateMode()
|
||||
{
|
||||
if((active_mode < HOLTEK_A1FA_MODE_NEON) && (previous_mode < HOLTEK_A1FA_MODE_NEON))
|
||||
{
|
||||
//If we're switching from and to static and breathing then sync the mode colors
|
||||
for(unsigned int i = 0; i < modes[active_mode].colors_max; i++)
|
||||
{
|
||||
modes[active_mode].colors[i] = modes[previous_mode].colors[i];
|
||||
}
|
||||
}
|
||||
|
||||
previous_mode = active_mode;
|
||||
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
/*--------------------------------------------------------------*\
|
||||
| RGBController_HoltekA1FA.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Holtek based Mousemat [04d9:a1fa] |
|
||||
| |
|
||||
| Edoardo Ridolfi (edo2313) 26/12/2020 |
|
||||
\*--------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_HoltekA1FA.h"
|
||||
|
||||
RGBController_HoltekA1FA::RGBController_HoltekA1FA(HoltekA1FAController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Holtek Mousemat Device";
|
||||
vendor = "Holtek";
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = "Holtek Mousemat Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = HOLTEK_A1FA_MODE_STATIC;
|
||||
Static.speed = HOLTEK_A1FA_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 7;
|
||||
Static.colors.resize(7);
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = HOLTEK_A1FA_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = HOLTEK_A1FA_SPEED_SLOWEST;
|
||||
Breathing.speed_max = HOLTEK_A1FA_SPEED_FASTEST;
|
||||
Breathing.speed = HOLTEK_A1FA_SPEED_NORMAL;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 7;
|
||||
Breathing.colors.resize(7);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Neon;
|
||||
Neon.name = "Neon";
|
||||
Neon.value = HOLTEK_A1FA_MODE_NEON;
|
||||
Neon.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Neon.color_mode = MODE_COLORS_NONE;
|
||||
Neon.speed_min = HOLTEK_A1FA_SPEED_SLOWEST;
|
||||
Neon.speed_max = HOLTEK_A1FA_SPEED_FASTEST;
|
||||
Neon.speed = HOLTEK_A1FA_SPEED_NORMAL;
|
||||
modes.push_back(Neon);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = HOLTEK_A1FA_MODE_RAINBOW;
|
||||
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
Rainbow.speed_min = HOLTEK_A1FA_SPEED_SLOWEST;
|
||||
Rainbow.speed_max = HOLTEK_A1FA_SPEED_FASTEST;
|
||||
Rainbow.speed = HOLTEK_A1FA_SPEED_NORMAL;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_HoltekA1FA::~RGBController_HoltekA1FA()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::SetupZones()
|
||||
{
|
||||
zone mouse_zone;
|
||||
mouse_zone.name = "Mousemat";
|
||||
mouse_zone.type = ZONE_TYPE_SINGLE;
|
||||
mouse_zone.leds_min = 1;
|
||||
mouse_zone.leds_max = 1;
|
||||
mouse_zone.leds_count = 1;
|
||||
mouse_zone.matrix_map = NULL;
|
||||
zones.push_back(mouse_zone);
|
||||
|
||||
led mouse_led;
|
||||
mouse_led.name = "Mousemat";
|
||||
leds.push_back(mouse_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char mode = modes[active_mode].value;
|
||||
unsigned char brightness = 0x20; /*When brightness support is added, change this */
|
||||
unsigned char speed = modes[active_mode].speed;
|
||||
unsigned char preset = (modes[active_mode].color_mode == MODE_COLORS_RANDOM) ? 0x70 : 0x00;
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char green = RGBGetGValue(colors[0]);
|
||||
unsigned char blue = RGBGetBValue(colors[0]);
|
||||
|
||||
controller->SendData(mode, brightness, speed, preset, red, green, blue);
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_HoltekA1FA::DeviceUpdateMode()
|
||||
{
|
||||
if((active_mode < HOLTEK_A1FA_MODE_NEON) && (previous_mode < HOLTEK_A1FA_MODE_NEON))
|
||||
{
|
||||
//If we're switching from and to static and breathing then sync the mode colors
|
||||
for(unsigned int i = 0; i < modes[active_mode].colors_max; i++)
|
||||
{
|
||||
modes[active_mode].colors[i] = modes[previous_mode].colors[i];
|
||||
}
|
||||
}
|
||||
|
||||
previous_mode = active_mode;
|
||||
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
/*--------------------------------------------------------------*\
|
||||
| RGBController_HoltekA1FA.h |
|
||||
| |
|
||||
| Generic RGB Interface for Holtek based Mousemat [04d9:a1fa] |
|
||||
| |
|
||||
| Edoardo Ridolfi (edo2313) 26/12/2020 |
|
||||
\*--------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "HoltekA1FAController.h"
|
||||
|
||||
class RGBController_HoltekA1FA : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HoltekA1FA(HoltekA1FAController* holtek_ptr);
|
||||
~RGBController_HoltekA1FA();
|
||||
|
||||
int previous_mode = 0; /* previous mode */
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
HoltekA1FAController* holtek;
|
||||
};
|
||||
/*--------------------------------------------------------------*\
|
||||
| RGBController_HoltekA1FA.h |
|
||||
| |
|
||||
| Generic RGB Interface for Holtek based Mousemat [04d9:a1fa] |
|
||||
| |
|
||||
| Edoardo Ridolfi (edo2313) 26/12/2020 |
|
||||
\*--------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "HoltekA1FAController.h"
|
||||
|
||||
class RGBController_HoltekA1FA : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HoltekA1FA(HoltekA1FAController* controller_ptr);
|
||||
~RGBController_HoltekA1FA();
|
||||
|
||||
int previous_mode = 0; /* previous mode */
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
HoltekA1FAController* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -61,14 +61,11 @@ bool TestForHyperXDRAMController(i2c_smbus_interface* bus, unsigned char address
|
|||
|
||||
void DetectHyperXDRAMControllers(std::vector<i2c_smbus_interface*> &busses)
|
||||
{
|
||||
HyperXDRAMController* new_hyperx;
|
||||
RGBController_HyperXDRAM* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
for(unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
unsigned char slots_valid = 0x00;
|
||||
bool fury_detected = false;
|
||||
bool pred_detected = false;
|
||||
unsigned char slots_valid = 0x00;
|
||||
bool fury_detected = false;
|
||||
bool pred_detected = false;
|
||||
|
||||
LOG_DEBUG("[%s] Checking VID/PID on bus %d...", HYPERX_CONTROLLER_NAME, bus);
|
||||
|
||||
|
|
@ -76,7 +73,8 @@ void DetectHyperXDRAMControllers(std::vector<i2c_smbus_interface*> &busses)
|
|||
{
|
||||
// Check for HyperX controller at 0x27
|
||||
LOG_DEBUG("[%s] Testing bus %d at address 0x27", HYPERX_CONTROLLER_NAME, bus);
|
||||
if (TestForHyperXDRAMController(busses[bus], 0x27))
|
||||
|
||||
if(TestForHyperXDRAMController(busses[bus], 0x27))
|
||||
{
|
||||
busses[bus]->i2c_smbus_write_byte_data(0x37, 0x00, 0xFF);
|
||||
|
||||
|
|
@ -113,8 +111,6 @@ void DetectHyperXDRAMControllers(std::vector<i2c_smbus_interface*> &busses)
|
|||
LOG_DEBUG("[%s] SPD check failed", HYPERX_CONTROLLER_NAME);
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
}
|
||||
|
||||
|
|
@ -123,19 +119,19 @@ void DetectHyperXDRAMControllers(std::vector<i2c_smbus_interface*> &busses)
|
|||
|
||||
if(slots_valid != 0)
|
||||
{
|
||||
new_hyperx = new HyperXDRAMController(busses[bus], 0x27, slots_valid);
|
||||
new_controller = new RGBController_HyperXDRAM(new_hyperx);
|
||||
HyperXDRAMController* controller = new HyperXDRAMController(busses[bus], 0x27, slots_valid);
|
||||
RGBController_HyperXDRAM* rgb_controller = new RGBController_HyperXDRAM(controller);
|
||||
|
||||
if(fury_detected && !pred_detected)
|
||||
{
|
||||
new_controller->name = "HyperX Fury RGB";
|
||||
rgb_controller->name = "HyperX Fury RGB";
|
||||
}
|
||||
else if(!fury_detected && pred_detected)
|
||||
{
|
||||
new_controller->name = "HyperX Predator RGB";
|
||||
rgb_controller->name = "HyperX Predator RGB";
|
||||
}
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,262 +1,266 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXDRAM.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| HyperX Predator and Fury RGB interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/29/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_HyperXDRAM.h"
|
||||
|
||||
|
||||
RGBController_HyperXDRAM::RGBController_HyperXDRAM(HyperXDRAMController* hyperx_ptr)
|
||||
{
|
||||
hyperx = hyperx_ptr;
|
||||
|
||||
name = "HyperX DRAM";
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "HyperX DRAM Device";
|
||||
location = hyperx->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = HYPERX_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = HYPERX_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = HYPERX_MODE_RAINBOW;
|
||||
Rainbow.flags = MODE_FLAG_HAS_SPEED;
|
||||
Rainbow.speed_min = HYPERX_SPEED_RAINBOW_SLOW;
|
||||
Rainbow.speed_max = HYPERX_SPEED_RAINBOW_FAST;
|
||||
Rainbow.speed = HYPERX_SPEED_RAINBOW_NORMAL;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode Comet;
|
||||
Comet.name = "Comet";
|
||||
Comet.value = HYPERX_MODE_COMET;
|
||||
Comet.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Comet.speed_min = HYPERX_SPEED_COMET_SLOW;
|
||||
Comet.speed_max = HYPERX_SPEED_COMET_FAST;
|
||||
Comet.colors_min = 1;
|
||||
Comet.colors_max = 1;
|
||||
Comet.speed = HYPERX_SPEED_COMET_NORMAL;
|
||||
Comet.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Comet.colors.resize(1);
|
||||
modes.push_back(Comet);
|
||||
|
||||
mode Heartbeat;
|
||||
Heartbeat.name = "Heartbeat";
|
||||
Heartbeat.value = HYPERX_MODE_HEARTBEAT;
|
||||
Heartbeat.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Heartbeat.speed_min = HYPERX_SPEED_COMET_SLOW;
|
||||
Heartbeat.speed_max = HYPERX_SPEED_COMET_FAST;
|
||||
Heartbeat.colors_min = 1;
|
||||
Heartbeat.colors_max = 1;
|
||||
Heartbeat.speed = HYPERX_SPEED_COMET_NORMAL;
|
||||
Heartbeat.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Heartbeat.colors.resize(1);
|
||||
modes.push_back(Heartbeat);
|
||||
|
||||
mode SpectrumCycle;
|
||||
SpectrumCycle.name = "Spectrum Cycle";
|
||||
SpectrumCycle.value = HYPERX_MODE_CYCLE;
|
||||
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
SpectrumCycle.speed_min = HYPERX_SPEED_CYCLE_SLOW;
|
||||
SpectrumCycle.speed_max = HYPERX_SPEED_CYCLE_FAST;
|
||||
SpectrumCycle.speed = HYPERX_SPEED_CYCLE_NORMAL;
|
||||
SpectrumCycle.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(SpectrumCycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = HYPERX_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Breathing.speed_min = HYPERX_SPEED_BREATHING_SLOW;
|
||||
Breathing.speed_max = HYPERX_SPEED_BREATHING_FAST;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.speed = HYPERX_SPEED_BREATHING_NORMAL;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.colors.resize(1);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Bounce;
|
||||
Bounce.name = "Bounce";
|
||||
Bounce.value = HYPERX_MODE_BOUNCE;
|
||||
Bounce.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Bounce.speed_min = HYPERX_SPEED_BOUNCE_SLOW;
|
||||
Bounce.speed_max = HYPERX_SPEED_BOUNCE_FAST;
|
||||
Bounce.colors_min = 1;
|
||||
Bounce.colors_max = 1;
|
||||
Bounce.speed = HYPERX_SPEED_BOUNCE_NORMAL;
|
||||
Bounce.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Bounce.colors.resize(1);
|
||||
modes.push_back(Bounce);
|
||||
|
||||
mode Blink;
|
||||
Blink.name = "Blink";
|
||||
Blink.value = HYPERX_MODE_BLINK;
|
||||
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Blink.speed_min = HYPERX_SPEED_BLINK_SLOW;
|
||||
Blink.speed_max = HYPERX_SPEED_BLINK_FAST;
|
||||
Blink.colors_min = 1;
|
||||
Blink.colors_max = 1;
|
||||
Blink.speed = HYPERX_SPEED_BLINK_NORMAL;
|
||||
Blink.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Blink.colors.resize(1);
|
||||
modes.push_back(Blink);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_HyperXDRAM::~RGBController_HyperXDRAM()
|
||||
{
|
||||
delete hyperx;
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::SetupZones()
|
||||
{
|
||||
for(unsigned int slot = 0; slot < hyperx->GetSlotCount(); slot++)
|
||||
{
|
||||
zone* new_zone = new zone;
|
||||
|
||||
new_zone->name = "HyperX Slot ";
|
||||
new_zone->name.append(std::to_string(slot + 1));
|
||||
new_zone->type = ZONE_TYPE_LINEAR;
|
||||
new_zone->leds_min = 5;
|
||||
new_zone->leds_max = 5;
|
||||
new_zone->leds_count = 5;
|
||||
new_zone->matrix_map = NULL;
|
||||
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
|
||||
new_led->name = "HyperX Slot ";
|
||||
new_led->name.append(std::to_string(zone_idx + 1));
|
||||
new_led->name.append(", LED ");
|
||||
new_led->name.append(std::to_string(led_idx + 1));
|
||||
|
||||
new_led->value = leds.size();
|
||||
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::DeviceUpdateLEDs()
|
||||
{
|
||||
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
for (std::size_t led_idx = 0; led_idx < colors.size(); led_idx++ )
|
||||
{
|
||||
RGBColor color = colors[led_idx];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
hyperx->SetLEDColor(led_idx, red, grn, blu);
|
||||
}
|
||||
hyperx->SendApply();
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
hyperx->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
for (std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++ )
|
||||
{
|
||||
unsigned int led = zones[zone].leds[led_idx].value;
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
hyperx->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
hyperx->SendApply();
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
hyperx->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::UpdateSingleLED(int led)
|
||||
{
|
||||
RGBColor color = colors[led];
|
||||
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);
|
||||
}
|
||||
hyperx->SendApply();
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::DeviceUpdateMode()
|
||||
{
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
|
||||
hyperx->SetMode(modes[active_mode].value, random, modes[active_mode].speed);
|
||||
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
unsigned char grn = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
unsigned char blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
|
||||
hyperx->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXDRAM.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| HyperX Predator and Fury RGB interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/29/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_HyperXDRAM.h"
|
||||
|
||||
|
||||
RGBController_HyperXDRAM::RGBController_HyperXDRAM(HyperXDRAMController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX DRAM";
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "HyperX DRAM Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = HYPERX_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = HYPERX_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = HYPERX_MODE_RAINBOW;
|
||||
Rainbow.flags = MODE_FLAG_HAS_SPEED;
|
||||
Rainbow.speed_min = HYPERX_SPEED_RAINBOW_SLOW;
|
||||
Rainbow.speed_max = HYPERX_SPEED_RAINBOW_FAST;
|
||||
Rainbow.speed = HYPERX_SPEED_RAINBOW_NORMAL;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode Comet;
|
||||
Comet.name = "Comet";
|
||||
Comet.value = HYPERX_MODE_COMET;
|
||||
Comet.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Comet.speed_min = HYPERX_SPEED_COMET_SLOW;
|
||||
Comet.speed_max = HYPERX_SPEED_COMET_FAST;
|
||||
Comet.colors_min = 1;
|
||||
Comet.colors_max = 1;
|
||||
Comet.speed = HYPERX_SPEED_COMET_NORMAL;
|
||||
Comet.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Comet.colors.resize(1);
|
||||
modes.push_back(Comet);
|
||||
|
||||
mode Heartbeat;
|
||||
Heartbeat.name = "Heartbeat";
|
||||
Heartbeat.value = HYPERX_MODE_HEARTBEAT;
|
||||
Heartbeat.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Heartbeat.speed_min = HYPERX_SPEED_COMET_SLOW;
|
||||
Heartbeat.speed_max = HYPERX_SPEED_COMET_FAST;
|
||||
Heartbeat.colors_min = 1;
|
||||
Heartbeat.colors_max = 1;
|
||||
Heartbeat.speed = HYPERX_SPEED_COMET_NORMAL;
|
||||
Heartbeat.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Heartbeat.colors.resize(1);
|
||||
modes.push_back(Heartbeat);
|
||||
|
||||
mode SpectrumCycle;
|
||||
SpectrumCycle.name = "Spectrum Cycle";
|
||||
SpectrumCycle.value = HYPERX_MODE_CYCLE;
|
||||
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
SpectrumCycle.speed_min = HYPERX_SPEED_CYCLE_SLOW;
|
||||
SpectrumCycle.speed_max = HYPERX_SPEED_CYCLE_FAST;
|
||||
SpectrumCycle.speed = HYPERX_SPEED_CYCLE_NORMAL;
|
||||
SpectrumCycle.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(SpectrumCycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = HYPERX_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Breathing.speed_min = HYPERX_SPEED_BREATHING_SLOW;
|
||||
Breathing.speed_max = HYPERX_SPEED_BREATHING_FAST;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.speed = HYPERX_SPEED_BREATHING_NORMAL;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.colors.resize(1);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Bounce;
|
||||
Bounce.name = "Bounce";
|
||||
Bounce.value = HYPERX_MODE_BOUNCE;
|
||||
Bounce.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Bounce.speed_min = HYPERX_SPEED_BOUNCE_SLOW;
|
||||
Bounce.speed_max = HYPERX_SPEED_BOUNCE_FAST;
|
||||
Bounce.colors_min = 1;
|
||||
Bounce.colors_max = 1;
|
||||
Bounce.speed = HYPERX_SPEED_BOUNCE_NORMAL;
|
||||
Bounce.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Bounce.colors.resize(1);
|
||||
modes.push_back(Bounce);
|
||||
|
||||
mode Blink;
|
||||
Blink.name = "Blink";
|
||||
Blink.value = HYPERX_MODE_BLINK;
|
||||
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Blink.speed_min = HYPERX_SPEED_BLINK_SLOW;
|
||||
Blink.speed_max = HYPERX_SPEED_BLINK_FAST;
|
||||
Blink.colors_min = 1;
|
||||
Blink.colors_max = 1;
|
||||
Blink.speed = HYPERX_SPEED_BLINK_NORMAL;
|
||||
Blink.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Blink.colors.resize(1);
|
||||
modes.push_back(Blink);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_HyperXDRAM::~RGBController_HyperXDRAM()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::SetupZones()
|
||||
{
|
||||
for(unsigned int slot = 0; slot < controller->GetSlotCount(); slot++)
|
||||
{
|
||||
zone* new_zone = new zone;
|
||||
|
||||
new_zone->name = "HyperX Slot ";
|
||||
new_zone->name.append(std::to_string(slot + 1));
|
||||
new_zone->type = ZONE_TYPE_LINEAR;
|
||||
new_zone->leds_min = 5;
|
||||
new_zone->leds_max = 5;
|
||||
new_zone->leds_count = 5;
|
||||
new_zone->matrix_map = NULL;
|
||||
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
|
||||
new_led->name = "HyperX Slot ";
|
||||
new_led->name.append(std::to_string(zone_idx + 1));
|
||||
new_led->name.append(", LED ");
|
||||
new_led->name.append(std::to_string(led_idx + 1));
|
||||
|
||||
new_led->value = leds.size();
|
||||
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::DeviceUpdateLEDs()
|
||||
{
|
||||
if(controller->GetMode() == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
for (std::size_t led_idx = 0; led_idx < colors.size(); led_idx++ )
|
||||
{
|
||||
RGBColor color = colors[led_idx];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
controller->SetLEDColor(led_idx, red, grn, blu);
|
||||
}
|
||||
controller->SendApply();
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
|
||||
controller->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
if(controller->GetMode() == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
for (std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++ )
|
||||
{
|
||||
unsigned int led = zones[zone].leds[led_idx].value;
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
controller->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
controller->SendApply();
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
|
||||
controller->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::UpdateSingleLED(int led)
|
||||
{
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
if(controller->GetMode() == HYPERX_MODE_DIRECT)
|
||||
{
|
||||
controller->SetLEDColor(led, red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
controller->SendApply();
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::DeviceUpdateMode()
|
||||
{
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
|
||||
controller->SetMode(modes[active_mode].value, random, modes[active_mode].speed);
|
||||
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
unsigned char grn = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
unsigned char blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
|
||||
controller->SetEffectColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXDRAM.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| HyperX Predator and Fury RGB interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/29/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "HyperXDRAMController.h"
|
||||
|
||||
class RGBController_HyperXDRAM : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXDRAM(HyperXDRAMController* hyperx_ptr);
|
||||
~RGBController_HyperXDRAM();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
HyperXDRAMController* hyperx;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXDRAM.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| HyperX Predator and Fury RGB interface |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/29/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "HyperXDRAMController.h"
|
||||
|
||||
class RGBController_HyperXDRAM : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXDRAM(HyperXDRAMController* controller_ptr);
|
||||
~RGBController_HyperXDRAM();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
HyperXDRAMController* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ void DetectHyperXAlloyElite(hid_device_info* info, const std::string& name)
|
|||
{
|
||||
HyperXAlloyEliteController* controller = new HyperXAlloyEliteController(dev, info->path);
|
||||
RGBController_HyperXAlloyElite* rgb_controller = new RGBController_HyperXAlloyElite(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
@ -46,7 +47,8 @@ void DetectHyperXAlloyElite2(hid_device_info* info, const std::string& name)
|
|||
{
|
||||
HyperXAlloyElite2Controller* controller = new HyperXAlloyElite2Controller(dev, info->path);
|
||||
RGBController_HyperXAlloyElite2* rgb_controller = new RGBController_HyperXAlloyElite2(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
@ -57,9 +59,10 @@ void DetectHyperXAlloyFPS(hid_device_info* info, const std::string& name)
|
|||
|
||||
if(dev)
|
||||
{
|
||||
HyperXAlloyFPSController* controller = new HyperXAlloyFPSController(dev, info->path);
|
||||
HyperXAlloyFPSController* controller = new HyperXAlloyFPSController(dev, info->path);
|
||||
RGBController_HyperXAlloyFPS* rgb_controller = new RGBController_HyperXAlloyFPS(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
@ -72,7 +75,8 @@ void DetectHyperXAlloyOrigins(hid_device_info* info, const std::string& name)
|
|||
{
|
||||
HyperXAlloyOriginsController* controller = new HyperXAlloyOriginsController(dev, info->path);
|
||||
RGBController_HyperXAlloyOrigins* rgb_controller = new RGBController_HyperXAlloyOrigins(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
@ -85,7 +89,8 @@ void DetectHyperXAlloyOriginsCore(hid_device_info* info, const std::string& name
|
|||
{
|
||||
HyperXAlloyOriginsCoreController* controller = new HyperXAlloyOriginsCoreController(dev, info);
|
||||
RGBController_HyperXAlloyOriginsCore* rgb_controller = new RGBController_HyperXAlloyOriginsCore(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,9 +175,9 @@ static const char *led_names[] =
|
|||
"Key: Media Mute"
|
||||
};
|
||||
|
||||
RGBController_HyperXAlloyElite::RGBController_HyperXAlloyElite(HyperXAlloyEliteController* hyperx_ptr)
|
||||
RGBController_HyperXAlloyElite::RGBController_HyperXAlloyElite(HyperXAlloyEliteController* controller_ptr)
|
||||
{
|
||||
controller = hyperx_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy Elite";
|
||||
vendor = "HyperX";
|
||||
|
|
@ -290,7 +290,7 @@ void RGBController_HyperXAlloyElite::SetupZones()
|
|||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names[led_idx];
|
||||
new_led.name = led_names[led_idx];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
class RGBController_HyperXAlloyElite : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyElite(HyperXAlloyEliteController* hyperx_ptr);
|
||||
RGBController_HyperXAlloyElite(HyperXAlloyEliteController* controller_ptr);
|
||||
~RGBController_HyperXAlloyElite();
|
||||
|
||||
void SetupZones();
|
||||
|
|
|
|||
|
|
@ -192,16 +192,16 @@ static const char *led_names[] =
|
|||
"RGB Strip 18",
|
||||
};
|
||||
|
||||
RGBController_HyperXAlloyElite2::RGBController_HyperXAlloyElite2(HyperXAlloyElite2Controller* hyperx_ptr)
|
||||
RGBController_HyperXAlloyElite2::RGBController_HyperXAlloyElite2(HyperXAlloyElite2Controller* controller_ptr)
|
||||
{
|
||||
hyperx = hyperx_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy Elite 2 Keyboard Device";
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "HyperX Alloy Elite 2 Keyboard Device";
|
||||
location = hyperx->GetDeviceLocation();
|
||||
serial = hyperx->GetSerialString();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -239,7 +239,7 @@ RGBController_HyperXAlloyElite2::~RGBController_HyperXAlloyElite2()
|
|||
}
|
||||
}
|
||||
|
||||
delete hyperx;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyElite2::SetupZones()
|
||||
|
|
@ -277,7 +277,7 @@ void RGBController_HyperXAlloyElite2::SetupZones()
|
|||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names[led_idx];
|
||||
new_led.name = led_names[led_idx];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ void RGBController_HyperXAlloyElite2::DeviceUpdateLEDs()
|
|||
|
||||
if(active_mode == 0)
|
||||
{
|
||||
hyperx->SetLEDsDirect(colors);
|
||||
controller->SetLEDsDirect(colors);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,42 +1,42 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXAlloyElite2.h |
|
||||
| |
|
||||
| Generic RGB Interface for HyperX Alloy |
|
||||
| Elite2 RGB Keyboard |
|
||||
| |
|
||||
| KundaPanda (vojdo) 02/04/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "HyperXAlloyElite2Controller.h"
|
||||
|
||||
class RGBController_HyperXAlloyElite2 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyElite2(HyperXAlloyElite2Controller* hyperx_ptr);
|
||||
~RGBController_HyperXAlloyElite2();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThreadFunction();
|
||||
|
||||
private:
|
||||
HyperXAlloyElite2Controller* hyperx;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::thread* keepalive_thread;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXAlloyElite2.h |
|
||||
| |
|
||||
| Generic RGB Interface for HyperX Alloy |
|
||||
| Elite2 RGB Keyboard |
|
||||
| |
|
||||
| KundaPanda (vojdo) 02/04/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "HyperXAlloyElite2Controller.h"
|
||||
|
||||
class RGBController_HyperXAlloyElite2 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyElite2(HyperXAlloyElite2Controller* controller_ptr);
|
||||
~RGBController_HyperXAlloyElite2();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThreadFunction();
|
||||
|
||||
private:
|
||||
HyperXAlloyElite2Controller* controller;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::thread* keepalive_thread;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -147,9 +147,9 @@ static const char *led_names[] =
|
|||
"Key: Number Pad ."
|
||||
};
|
||||
|
||||
RGBController_HyperXAlloyFPS::RGBController_HyperXAlloyFPS(HyperXAlloyFPSController* hyperx_ptr)
|
||||
RGBController_HyperXAlloyFPS::RGBController_HyperXAlloyFPS(HyperXAlloyFPSController* controller_ptr)
|
||||
{
|
||||
controller = hyperx_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy FPS";
|
||||
vendor = "HyperX";
|
||||
|
|
@ -231,7 +231,7 @@ void RGBController_HyperXAlloyFPS::SetupZones()
|
|||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names[led_idx];
|
||||
new_led.name = led_names[led_idx];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
class RGBController_HyperXAlloyFPS : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyFPS(HyperXAlloyFPSController* hyperx_ptr);
|
||||
RGBController_HyperXAlloyFPS(HyperXAlloyFPSController* controller_ptr);
|
||||
~RGBController_HyperXAlloyFPS();
|
||||
|
||||
void SetupZones();
|
||||
|
|
|
|||
|
|
@ -167,16 +167,16 @@ static const char *led_names[] =
|
|||
"Key: Number Pad Enter",
|
||||
};
|
||||
|
||||
RGBController_HyperXAlloyOrigins::RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* hyperx_ptr)
|
||||
RGBController_HyperXAlloyOrigins::RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* controller_ptr)
|
||||
{
|
||||
hyperx = hyperx_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy Origins Keyboard Device";
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "HyperX Alloy Origins Keyboard Device";
|
||||
location = hyperx->GetDeviceLocation();
|
||||
serial = hyperx->GetSerialString();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -214,7 +214,7 @@ RGBController_HyperXAlloyOrigins::~RGBController_HyperXAlloyOrigins()
|
|||
}
|
||||
}
|
||||
|
||||
delete hyperx;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyOrigins::SetupZones()
|
||||
|
|
@ -268,7 +268,7 @@ void RGBController_HyperXAlloyOrigins::ResizeZone(int /*zone*/, int /*new_size*/
|
|||
|
||||
void RGBController_HyperXAlloyOrigins::DeviceUpdateLEDs()
|
||||
{
|
||||
hyperx->SetLEDsDirect(colors);
|
||||
controller->SetLEDsDirect(colors);
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyOrigins::UpdateZoneLEDs(int /*zone*/)
|
||||
|
|
|
|||
|
|
@ -1,40 +1,40 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXAlloyOrigins.h |
|
||||
| |
|
||||
| Generic RGB Interface for HyperX Alloy |
|
||||
| Origins RGB Keyboard |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/11/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include <chrono>
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "HyperXAlloyOriginsController.h"
|
||||
|
||||
class RGBController_HyperXAlloyOrigins : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* hyperx_ptr);
|
||||
~RGBController_HyperXAlloyOrigins();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
HyperXAlloyOriginsController* hyperx;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXAlloyOrigins.h |
|
||||
| |
|
||||
| Generic RGB Interface for HyperX Alloy |
|
||||
| Origins RGB Keyboard |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/11/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include <chrono>
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "HyperXAlloyOriginsController.h"
|
||||
|
||||
class RGBController_HyperXAlloyOrigins : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* controller_ptr);
|
||||
~RGBController_HyperXAlloyOrigins();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
HyperXAlloyOriginsController* controller;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -145,17 +145,17 @@ static const char *led_names[] =
|
|||
"Key: Right Arrow"
|
||||
};
|
||||
|
||||
RGBController_HyperXAlloyOriginsCore::RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* hyperx_ptr)
|
||||
RGBController_HyperXAlloyOriginsCore::RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* controller_ptr)
|
||||
{
|
||||
hyperx = hyperx_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy Origins Core Keyboard Device";
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "HyperX Alloy Origins Core Keyboard Device";
|
||||
location = hyperx->GetDeviceLocation();
|
||||
serial = hyperx->GetSerialString();
|
||||
version = hyperx->GetFirmwareVersion();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
version = controller->GetFirmwareVersion();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -193,7 +193,7 @@ RGBController_HyperXAlloyOriginsCore::~RGBController_HyperXAlloyOriginsCore()
|
|||
}
|
||||
}
|
||||
|
||||
delete hyperx;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyOriginsCore::SetupZones()
|
||||
|
|
@ -244,7 +244,7 @@ void RGBController_HyperXAlloyOriginsCore::ResizeZone(int /*zone*/, int /*new_si
|
|||
|
||||
void RGBController_HyperXAlloyOriginsCore::DeviceUpdateLEDs()
|
||||
{
|
||||
hyperx->SetLEDsDirect(colors);
|
||||
controller->SetLEDsDirect(colors);
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyOriginsCore::UpdateZoneLEDs(int /*zone*/)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
class RGBController_HyperXAlloyOriginsCore : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* hyperx_ptr);
|
||||
RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* controller_ptr);
|
||||
~RGBController_HyperXAlloyOriginsCore();
|
||||
|
||||
void SetupZones();
|
||||
|
|
@ -33,7 +33,7 @@ public:
|
|||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
HyperXAlloyOriginsCoreController* hyperx;
|
||||
HyperXAlloyOriginsCoreController* controller;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue