Publish LumaOps source
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| HyperXMouseControllerDetect.cpp |
|
||||
| |
|
||||
| Detector for HyperX mouse |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <hidapi.h>
|
||||
#include "Detector.h"
|
||||
#include "HyperXPulsefireFPSProController.h"
|
||||
#include "HyperXPulsefireSurgeController.h"
|
||||
#include "HyperXPulsefireDartController.h"
|
||||
#include "HyperXPulsefireRaidController.h"
|
||||
#include "RGBController_HyperXPulsefireFPSPro.h"
|
||||
#include "RGBController_HyperXPulsefireHaste.h"
|
||||
#include "RGBController_HyperXPulsefireSurge.h"
|
||||
#include "RGBController_HyperXPulsefireDart.h"
|
||||
#include "RGBController_HyperXPulsefireRaid.h"
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| HyperX mouse vendor IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define HYPERX_VID 0x0951 //Kingston Technology
|
||||
#define HYPERX_VID_2 0x03F0 //HP, Hewlett-Packard Company
|
||||
#define HYPERX_PULSEFIRE_SURGE_PID 0x16D3
|
||||
#define HYPERX_PULSEFIRE_SURGE_PID_2 0x0490
|
||||
#define HYPERX_PULSEFIRE_FPS_PRO_PID 0x16D7
|
||||
#define HYPERX_PULSEFIRE_CORE_PID 0x16DE
|
||||
#define HYPERX_PULSEFIRE_CORE_PID_2 0x0D8F
|
||||
#define HYPERX_PULSEFIRE_DART_WIRELESS_PID 0x16E1
|
||||
#define HYPERX_PULSEFIRE_DART_WIRELESS_PID_2 0x068E
|
||||
#define HYPERX_PULSEFIRE_DART_WIRED_PID 0x16E2
|
||||
#define HYPERX_PULSEFIRE_DART_WIRED_PID_2 0x088E
|
||||
#define HYPERX_PULSEFIRE_RAID_PID 0x16E4
|
||||
#define HYPERX_PULSEFIRE_HASTE_PID 0x1727
|
||||
#define HYPERX_PULSEFIRE_HASTE_PID_2 0x0F8F
|
||||
|
||||
void DetectHyperXPulsefireSurgeControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
HyperXPulsefireSurgeController* controller = new HyperXPulsefireSurgeController(dev, info->path, name);
|
||||
RGBController_HyperXPulsefireSurge* rgb_controller = new RGBController_HyperXPulsefireSurge(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectHyperXPulsefireSurgeControllers() */
|
||||
|
||||
void DetectHyperXPulsefireFPSProControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
HyperXPulsefireFPSProController* controller = new HyperXPulsefireFPSProController(dev, info->path, name);
|
||||
RGBController_HyperXPulsefireFPSPro* rgb_controller = new RGBController_HyperXPulsefireFPSPro(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectHyperXPulsefireFPSProControllers() */
|
||||
|
||||
void DetectHyperXPulsefireHasteControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
HyperXPulsefireHasteController* controller = new HyperXPulsefireHasteController(dev, info->path, name);
|
||||
RGBController_HyperXPulsefireHaste* rgb_controller = new RGBController_HyperXPulsefireHaste(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectHyperXPulsefireFPSProControllers() */
|
||||
|
||||
void DetectHyperXPulsefireDartControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
HyperXPulsefireDartController* controller = new HyperXPulsefireDartController(dev, info->path, name);
|
||||
RGBController_HyperXPulsefireDart* rgb_controller = new RGBController_HyperXPulsefireDart(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectHyperXPulsefireDartControllers() */
|
||||
|
||||
void DetectHyperXPulsefireRaidControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
HyperXPulsefireRaidController* controller = new HyperXPulsefireRaidController(dev, *info, name);
|
||||
RGBController_HyperXPulsefireRaid* rgb_controller = new RGBController_HyperXPulsefireRaid(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectHyperXPulsefireRaidControllers() */
|
||||
|
||||
REGISTER_HID_DETECTOR_IP("HyperX Pulsefire Surge", DetectHyperXPulsefireSurgeControllers, HYPERX_VID, HYPERX_PULSEFIRE_SURGE_PID, 1, 0xFF01);
|
||||
REGISTER_HID_DETECTOR_IP("HyperX Pulsefire Surge (HP)", DetectHyperXPulsefireSurgeControllers, HYPERX_VID_2, HYPERX_PULSEFIRE_SURGE_PID_2, 1, 0xFF01);
|
||||
REGISTER_HID_DETECTOR_IP("HyperX Pulsefire FPS Pro", DetectHyperXPulsefireFPSProControllers, HYPERX_VID, HYPERX_PULSEFIRE_FPS_PRO_PID, 1, 0xFF01);
|
||||
REGISTER_HID_DETECTOR_IP("HyperX Pulsefire Core", DetectHyperXPulsefireFPSProControllers, HYPERX_VID, HYPERX_PULSEFIRE_CORE_PID, 1, 0xFF01);
|
||||
REGISTER_HID_DETECTOR_IP("HyperX Pulsefire Core (HP)", DetectHyperXPulsefireFPSProControllers, HYPERX_VID_2, HYPERX_PULSEFIRE_CORE_PID_2, 1, 0xFF01);
|
||||
REGISTER_HID_DETECTOR_IP("HyperX Pulsefire Dart (Wireless)", DetectHyperXPulsefireDartControllers, HYPERX_VID, HYPERX_PULSEFIRE_DART_WIRELESS_PID, 2, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("HyperX Pulsefire Dart (Wireless)", DetectHyperXPulsefireDartControllers, HYPERX_VID_2, HYPERX_PULSEFIRE_DART_WIRELESS_PID_2, 2, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("HyperX Pulsefire Dart (Wired)", DetectHyperXPulsefireDartControllers, HYPERX_VID, HYPERX_PULSEFIRE_DART_WIRED_PID, 1, 0xFF13);
|
||||
REGISTER_HID_DETECTOR_IP("HyperX Pulsefire Dart (Wired)", DetectHyperXPulsefireDartControllers, HYPERX_VID_2, HYPERX_PULSEFIRE_DART_WIRED_PID_2, 1, 0xFF13);
|
||||
|
||||
REGISTER_HID_DETECTOR_IPU("HyperX Pulsefire Raid", DetectHyperXPulsefireRaidControllers, HYPERX_VID, HYPERX_PULSEFIRE_RAID_PID, 1, 0xFF01, 0x01);
|
||||
|
||||
REGISTER_HID_DETECTOR_IP("HyperX Pulsefire Haste", DetectHyperXPulsefireHasteControllers, HYPERX_VID_2, HYPERX_PULSEFIRE_HASTE_PID_2, 3, 0xFF90);
|
||||
|
||||
#ifdef _WIN32
|
||||
REGISTER_HID_DETECTOR_IP("HyperX Pulsefire Haste", DetectHyperXPulsefireHasteControllers, HYPERX_VID, HYPERX_PULSEFIRE_HASTE_PID, 3, 0xFF90);
|
||||
#else
|
||||
REGISTER_HID_DETECTOR_IPU("HyperX Pulsefire Haste", DetectHyperXPulsefireHasteControllers, HYPERX_VID_2, HYPERX_PULSEFIRE_HASTE_PID_2, 0, 0x0001, 0x01);
|
||||
REGISTER_HID_DETECTOR_PU("HyperX Pulsefire Haste", DetectHyperXPulsefireHasteControllers, HYPERX_VID, HYPERX_PULSEFIRE_HASTE_PID, 1, 2);
|
||||
#endif
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| HyperXPulsefireDartController.cpp |
|
||||
| |
|
||||
| Driver for HyperX Pulsefire Dart |
|
||||
| |
|
||||
| Santeri Pikarinen (santeri3700) 26 Dec 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "HyperXPulsefireDartController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
HyperXPulsefireDartController::HyperXPulsefireDartController(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
HyperXPulsefireDartController::~HyperXPulsefireDartController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireDartController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireDartController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireDartController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
| Private packet sending functions. |
|
||||
\*-------------------------------------------------------------------------------------------------*/
|
||||
|
||||
void HyperXPulsefireDartController::SendDirect
|
||||
(
|
||||
RGBColor color,
|
||||
int led,
|
||||
int mode,
|
||||
int brightness,
|
||||
int speed
|
||||
)
|
||||
{
|
||||
unsigned char buf[HYPERX_PULSEFIRE_DART_PACKET_SIZE];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Direct Mode packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x00;
|
||||
buf[0x01] = HYPERX_PULSEFIRE_DART_PACKET_ID_DIRECT;
|
||||
buf[0x02] = led;
|
||||
buf[0x03] = mode;
|
||||
buf[0x04] = 0x08; // 8 bytes after buffer index 0x04
|
||||
|
||||
buf[0x05] = RGBGetRValue(color);
|
||||
buf[0x06] = RGBGetGValue(color);
|
||||
buf[0x07] = RGBGetBValue(color);
|
||||
|
||||
buf[0x08] = RGBGetRValue(color);
|
||||
buf[0x09] = RGBGetGValue(color);
|
||||
buf[0x0a] = RGBGetBValue(color);
|
||||
|
||||
buf[0x0b] = brightness;
|
||||
buf[0x0c] = speed;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, (unsigned char *)buf, sizeof(buf));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2));
|
||||
}
|
||||
|
||||
void HyperXPulsefireDartController::Save()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Save current settings to the on-board memory |
|
||||
\*-----------------------------------------------------*/
|
||||
unsigned char buf[HYPERX_PULSEFIRE_DART_PACKET_SIZE];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Save packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x00;
|
||||
buf[0x01] = 0xde;
|
||||
buf[0x02] = 0xff;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, (unsigned char *)buf, sizeof(buf));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2));
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| HyperXPulsefireDartController.h |
|
||||
| |
|
||||
| Driver for HyperX Pulsefire Dart |
|
||||
| |
|
||||
| Santeri Pikarinen (santeri3700) 26 Dec 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_PULSEFIRE_DART_PACKET_ID_DIRECT = 0xd2, /* Direct control packet */
|
||||
HYPERX_PULSEFIRE_DART_PACKET_SIZE = 65, /* Report ID padding + 64 byte payload */
|
||||
|
||||
HYPERX_PULSEFIRE_DART_MODE_STATIC = 0x00, /* Static color mode */
|
||||
HYPERX_PULSEFIRE_DART_MODE_CYCLE = 0x12, /* Spectrum cycle mode */
|
||||
HYPERX_PULSEFIRE_DART_MODE_BREATHING = 0x20, /* Single color breathing mode */
|
||||
HYPERX_PULSEFIRE_DART_MODE_REACTIVE = 0x30, /* Reactive/Trigger fade mode */
|
||||
|
||||
HYPERX_PULSEFIRE_DART_SPEED_MIN = 0x64,
|
||||
HYPERX_PULSEFIRE_DART_SPEED_MAX = 0x00,
|
||||
HYPERX_PULSEFIRE_DART_SPEED_MED = 0x32,
|
||||
HYPERX_PULSEFIRE_DART_SPEED_NONE = 0x00, /* For static color mode */
|
||||
|
||||
HYPERX_PULSEFIRE_DART_BRIGHTNESS_MIN = 0x00,
|
||||
HYPERX_PULSEFIRE_DART_BRIGHTNESS_MAX = 0x64,
|
||||
|
||||
HYPERX_PULSEFIRE_DART_LED_LOGO = 0x00,
|
||||
HYPERX_PULSEFIRE_DART_LED_SCROLL = 0x10,
|
||||
HYPERX_PULSEFIRE_DART_LED_ALL = 0x20
|
||||
};
|
||||
|
||||
class HyperXPulsefireDartController
|
||||
{
|
||||
public:
|
||||
HyperXPulsefireDartController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~HyperXPulsefireDartController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendDirect
|
||||
(
|
||||
RGBColor color_data,
|
||||
int led,
|
||||
int mode,
|
||||
int brightness,
|
||||
int speed
|
||||
);
|
||||
|
||||
void Save();
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
};
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_HyperXPulsefireDart.cpp |
|
||||
| |
|
||||
| RGBController for HyperX Pulsefire Dart |
|
||||
| |
|
||||
| Santeri Pikarinen (santeri3700) 26 Dec 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_HyperXPulsefireDart.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name HyperX Pulsefire Dart
|
||||
@category Mouse
|
||||
@type USB
|
||||
@save :white_check_mark:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectHyperXPulsefireDartControllers
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_HyperXPulsefireDart::RGBController_HyperXPulsefireDart(HyperXPulsefireDartController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "HyperX Pulsefire Dart Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = HYPERX_PULSEFIRE_DART_MODE_STATIC;
|
||||
Direct.speed = HYPERX_PULSEFIRE_DART_SPEED_NONE;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.brightness_min = HYPERX_PULSEFIRE_DART_BRIGHTNESS_MIN;
|
||||
Direct.brightness_max = HYPERX_PULSEFIRE_DART_BRIGHTNESS_MAX;
|
||||
Direct.brightness = HYPERX_PULSEFIRE_DART_BRIGHTNESS_MAX;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = HYPERX_PULSEFIRE_DART_MODE_BREATHING;
|
||||
Breathing.speed = HYPERX_PULSEFIRE_DART_SPEED_MED;
|
||||
Breathing.speed_min = HYPERX_PULSEFIRE_DART_SPEED_MIN;
|
||||
Breathing.speed_max = HYPERX_PULSEFIRE_DART_SPEED_MAX;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.brightness_min = HYPERX_PULSEFIRE_DART_BRIGHTNESS_MIN;
|
||||
Breathing.brightness_max = HYPERX_PULSEFIRE_DART_BRIGHTNESS_MAX;
|
||||
Breathing.brightness = HYPERX_PULSEFIRE_DART_BRIGHTNESS_MAX;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode SpectrumCycle;
|
||||
SpectrumCycle.name = "Spectrum Cycle";
|
||||
SpectrumCycle.value = HYPERX_PULSEFIRE_DART_MODE_CYCLE;
|
||||
SpectrumCycle.speed = HYPERX_PULSEFIRE_DART_SPEED_MED;
|
||||
SpectrumCycle.speed_min = HYPERX_PULSEFIRE_DART_SPEED_MIN;
|
||||
SpectrumCycle.speed_max = HYPERX_PULSEFIRE_DART_SPEED_MAX;
|
||||
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
SpectrumCycle.color_mode = MODE_COLORS_NONE;
|
||||
SpectrumCycle.brightness_min = HYPERX_PULSEFIRE_DART_BRIGHTNESS_MIN;
|
||||
SpectrumCycle.brightness_max = HYPERX_PULSEFIRE_DART_BRIGHTNESS_MAX;
|
||||
SpectrumCycle.brightness = HYPERX_PULSEFIRE_DART_BRIGHTNESS_MAX;
|
||||
modes.push_back(SpectrumCycle);
|
||||
|
||||
mode Reactive;
|
||||
Reactive.name = "Reactive";
|
||||
Reactive.value = HYPERX_PULSEFIRE_DART_MODE_REACTIVE;
|
||||
Reactive.speed = HYPERX_PULSEFIRE_DART_SPEED_MED;
|
||||
Reactive.speed_min = HYPERX_PULSEFIRE_DART_SPEED_MIN;
|
||||
Reactive.speed_max = HYPERX_PULSEFIRE_DART_SPEED_MAX;
|
||||
Reactive.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
Reactive.color_mode = MODE_COLORS_PER_LED;
|
||||
Reactive.brightness_min = HYPERX_PULSEFIRE_DART_BRIGHTNESS_MIN;
|
||||
Reactive.brightness_max = HYPERX_PULSEFIRE_DART_BRIGHTNESS_MAX;
|
||||
Reactive.brightness = HYPERX_PULSEFIRE_DART_BRIGHTNESS_MAX;
|
||||
modes.push_back(Reactive);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_HyperXPulsefireDart::~RGBController_HyperXPulsefireDart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireDart::SetupZones()
|
||||
{
|
||||
zone scroll_zone;
|
||||
scroll_zone.name = "Scroll Wheel";
|
||||
scroll_zone.type = ZONE_TYPE_SINGLE;
|
||||
scroll_zone.leds_min = 1;
|
||||
scroll_zone.leds_max = 1;
|
||||
scroll_zone.leds_count = 1;
|
||||
scroll_zone.matrix_map = NULL;
|
||||
zones.push_back(scroll_zone);
|
||||
|
||||
led scroll_led;
|
||||
scroll_led.name = "Scroll Wheel";
|
||||
scroll_led.value = HYPERX_PULSEFIRE_DART_LED_SCROLL;
|
||||
leds.push_back(scroll_led);
|
||||
|
||||
zone logo_zone;
|
||||
logo_zone.name = "Logo";
|
||||
logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
logo_zone.leds_min = 1;
|
||||
logo_zone.leds_max = 1;
|
||||
logo_zone.leds_count = 1;
|
||||
logo_zone.matrix_map = NULL;
|
||||
zones.push_back(logo_zone);
|
||||
|
||||
led logo_led;
|
||||
logo_led.name = "Logo";
|
||||
logo_led.value = HYPERX_PULSEFIRE_DART_LED_LOGO;
|
||||
leds.push_back(logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireDart::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireDart::DeviceUpdateLEDs()
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireDart::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
UpdateSingleLED(zone);
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireDart::UpdateSingleLED(int led)
|
||||
{
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_PER_LED)
|
||||
{
|
||||
controller->SendDirect(colors[led], leds[led].value, modes[active_mode].value, modes[active_mode].brightness, modes[active_mode].speed);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller->SendDirect(colors[led], HYPERX_PULSEFIRE_DART_LED_ALL, modes[active_mode].value, modes[active_mode].brightness, modes[active_mode].speed);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireDart::DeviceUpdateMode()
|
||||
{
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_PER_LED)
|
||||
{
|
||||
controller->SendDirect(colors[0], HYPERX_PULSEFIRE_DART_LED_SCROLL, modes[active_mode].value, modes[active_mode].brightness, modes[active_mode].speed);
|
||||
controller->SendDirect(colors[1], HYPERX_PULSEFIRE_DART_LED_LOGO, modes[active_mode].value, modes[active_mode].brightness, modes[active_mode].speed);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller->SendDirect(colors[0], HYPERX_PULSEFIRE_DART_LED_ALL, modes[active_mode].value, modes[active_mode].brightness, modes[active_mode].speed);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireDart::DeviceSaveMode()
|
||||
{
|
||||
controller->Save();
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_HyperXPulsefireDart.h |
|
||||
| |
|
||||
| RGBController for HyperX Pulsefire Dart |
|
||||
| |
|
||||
| Santeri Pikarinen (santeri3700) 26 Dec 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include "RGBController.h"
|
||||
#include "HyperXPulsefireDartController.h"
|
||||
|
||||
class RGBController_HyperXPulsefireDart : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXPulsefireDart(HyperXPulsefireDartController* controller_ptr);
|
||||
~RGBController_HyperXPulsefireDart();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
HyperXPulsefireDartController* controller;
|
||||
};
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| HyperXPulsefireFPSProController.cpp |
|
||||
| |
|
||||
| Driver for HyperX Pulsefire FPS Pro |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 26 Dec 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "HyperXPulsefireFPSProController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
HyperXPulsefireFPSProController::HyperXPulsefireFPSProController(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
HyperXPulsefireFPSProController::~HyperXPulsefireFPSProController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireFPSProController::GetDeviceLocation()
|
||||
{
|
||||
return("HID " + location);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireFPSProController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireFPSProController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
| Private packet sending functions. |
|
||||
\*-------------------------------------------------------------------------------------------------*/
|
||||
|
||||
void HyperXPulsefireFPSProController::SendDirect
|
||||
(
|
||||
RGBColor* color_data
|
||||
)
|
||||
{
|
||||
unsigned char buf[264];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Direct Mode packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x07;
|
||||
buf[0x01] = HYPERX_PULSEFIRE_FPS_PRO_PACKET_ID_DIRECT;
|
||||
|
||||
buf[0x02] = RGBGetRValue(color_data[0]);
|
||||
buf[0x03] = RGBGetGValue(color_data[0]);
|
||||
buf[0x04] = RGBGetBValue(color_data[0]);
|
||||
|
||||
buf[0x08] = 0xA0;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 264);
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| HyperXPulsefireFPSProController.h |
|
||||
| |
|
||||
| Driver for HyperX Pulsefire FPS Pro |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 26 Dec 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_PULSEFIRE_FPS_PRO_PACKET_ID_DIRECT = 0x0A, /* Direct control packet */
|
||||
};
|
||||
|
||||
class HyperXPulsefireFPSProController
|
||||
{
|
||||
public:
|
||||
HyperXPulsefireFPSProController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~HyperXPulsefireFPSProController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendDirect
|
||||
(
|
||||
RGBColor* color_data
|
||||
);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
};
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_HyperXPulsefireFPSPro.cpp |
|
||||
| |
|
||||
| RGBController for HyperX Pulsefire FPS Pro |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 26 Dec 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_HyperXPulsefireFPSPro.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name HyperX Pulsefire FPS
|
||||
@category Mouse
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :x:
|
||||
@detectors DetectHyperXPulsefireFPSProControllers
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_HyperXPulsefireFPSPro::RGBController_HyperXPulsefireFPSPro(HyperXPulsefireFPSProController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "HyperX Pulsefire FPS Pro Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| The Corsair Lighting Node Pro requires a packet within|
|
||||
| 20 seconds of sending the lighting change in order |
|
||||
| to not revert back into rainbow mode. Start a thread |
|
||||
| to continuously send a keepalive packet every 5s |
|
||||
\*-----------------------------------------------------*/
|
||||
keepalive_thread_run = 1;
|
||||
keepalive_thread = new std::thread(&RGBController_HyperXPulsefireFPSPro::KeepaliveThread, this);
|
||||
};
|
||||
|
||||
RGBController_HyperXPulsefireFPSPro::~RGBController_HyperXPulsefireFPSPro()
|
||||
{
|
||||
keepalive_thread_run = 0;
|
||||
keepalive_thread->join();
|
||||
delete keepalive_thread;
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireFPSPro::SetupZones()
|
||||
{
|
||||
zone logo;
|
||||
logo.name = "Logo";
|
||||
logo.type = ZONE_TYPE_SINGLE;
|
||||
logo.leds_min = 1;
|
||||
logo.leds_max = 1;
|
||||
logo.leds_count = 1;
|
||||
logo.matrix_map = NULL;
|
||||
zones.push_back(logo);
|
||||
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
|
||||
new_led.name = zones[zone_idx].name;
|
||||
|
||||
if(zones[zone_idx].leds_count > 1)
|
||||
{
|
||||
new_led.name.append(" LED ");
|
||||
new_led.name.append(std::to_string(led_idx + 1));
|
||||
}
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireFPSPro::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireFPSPro::DeviceUpdateLEDs()
|
||||
{
|
||||
last_update_time = std::chrono::steady_clock::now();
|
||||
|
||||
if(active_mode == 0)
|
||||
{
|
||||
controller->SendDirect(&colors[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireFPSPro::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireFPSPro::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireFPSPro::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireFPSPro::KeepaliveThread()
|
||||
{
|
||||
while(keepalive_thread_run.load())
|
||||
{
|
||||
if(active_mode == 0)
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
|
||||
{
|
||||
UpdateLEDs();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_HyperXPulsefireFPSPro.h |
|
||||
| |
|
||||
| RGBController for HyperX Pulsefire FPS Pro |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 26 Dec 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include "RGBController.h"
|
||||
#include "HyperXPulsefireFPSProController.h"
|
||||
|
||||
class RGBController_HyperXPulsefireFPSPro : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXPulsefireFPSPro(HyperXPulsefireFPSProController* controller_ptr);
|
||||
~RGBController_HyperXPulsefireFPSPro();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
HyperXPulsefireFPSProController* controller;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| HyperXPulsefireHasteController.cpp |
|
||||
| |
|
||||
| Driver for HyperX Pulsefire Haste |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 19 Aug 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "HyperXPulsefireHasteController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
HyperXPulsefireHasteController::HyperXPulsefireHasteController(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
HyperXPulsefireHasteController::~HyperXPulsefireHasteController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireHasteController::GetDeviceLocation()
|
||||
{
|
||||
return("HID " + location);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireHasteController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireHasteController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
void HyperXPulsefireHasteController::SendDirect
|
||||
(
|
||||
RGBColor* color_data
|
||||
)
|
||||
{
|
||||
SendDirectSetup();
|
||||
SendDirectColor(color_data);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
| Private packet sending functions. |
|
||||
\*-------------------------------------------------------------------------------------------------*/
|
||||
|
||||
void HyperXPulsefireHasteController::SendDirectSetup()
|
||||
{
|
||||
unsigned char buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Direct Mode Setup packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x00;
|
||||
buf[0x01] = HYPERX_PULSEFIRE_HASTE_PACKET_ID_SETUP;
|
||||
buf[0x02] = 0xF2;
|
||||
|
||||
buf[0x08] = 0x02;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 65);
|
||||
}
|
||||
|
||||
void HyperXPulsefireHasteController::SendDirectColor
|
||||
(
|
||||
RGBColor* color_data
|
||||
)
|
||||
{
|
||||
unsigned char buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Direct Mode packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x00;
|
||||
buf[0x01] = HYPERX_PULSEFIRE_HASTE_PACKET_ID_COLOR;
|
||||
|
||||
buf[0x02] = RGBGetRValue(color_data[0]);
|
||||
buf[0x03] = RGBGetGValue(color_data[0]);
|
||||
buf[0x04] = RGBGetBValue(color_data[0]);
|
||||
|
||||
buf[0x08] = 0x02;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 65);
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| HyperXPulsefireHasteController.h |
|
||||
| |
|
||||
| Driver for HyperX Pulsefire Haste |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 19 Aug 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_PULSEFIRE_HASTE_PACKET_ID_SETUP = 0x04, /* Direct setup packet */
|
||||
HYPERX_PULSEFIRE_HASTE_PACKET_ID_COLOR = 0x81, /* Direct color packet */
|
||||
};
|
||||
|
||||
class HyperXPulsefireHasteController
|
||||
{
|
||||
public:
|
||||
HyperXPulsefireHasteController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~HyperXPulsefireHasteController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendDirect
|
||||
(
|
||||
RGBColor* color_data
|
||||
);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
|
||||
void SendDirectSetup();
|
||||
void SendDirectColor
|
||||
(
|
||||
RGBColor* color_data
|
||||
);
|
||||
};
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_HyperXPulsefireHaste.cpp |
|
||||
| |
|
||||
| RGBController for HyperX Pulsefire Haste |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 19 Aug 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_HyperXPulsefireHaste.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name HyperX Pulsefire Haste
|
||||
@category Mouse
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :x:
|
||||
@detectors DetectHyperXPulsefireHasteControllers
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_HyperXPulsefireHaste::RGBController_HyperXPulsefireHaste(HyperXPulsefireHasteController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "HyperX Pulsefire Haste Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| The Corsair Lighting Node Pro requires a packet within|
|
||||
| 20 seconds of sending the lighting change in order |
|
||||
| to not revert back into rainbow mode. Start a thread |
|
||||
| to continuously send a keepalive packet every 5s |
|
||||
\*-----------------------------------------------------*/
|
||||
keepalive_thread_run = 1;
|
||||
keepalive_thread = new std::thread(&RGBController_HyperXPulsefireHaste::KeepaliveThread, this);
|
||||
};
|
||||
|
||||
RGBController_HyperXPulsefireHaste::~RGBController_HyperXPulsefireHaste()
|
||||
{
|
||||
keepalive_thread_run = 0;
|
||||
keepalive_thread->join();
|
||||
delete keepalive_thread;
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireHaste::SetupZones()
|
||||
{
|
||||
zone logo;
|
||||
logo.name = "Logo";
|
||||
logo.type = ZONE_TYPE_SINGLE;
|
||||
logo.leds_min = 1;
|
||||
logo.leds_max = 1;
|
||||
logo.leds_count = 1;
|
||||
logo.matrix_map = NULL;
|
||||
zones.push_back(logo);
|
||||
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
|
||||
new_led.name = zones[zone_idx].name;
|
||||
|
||||
if(zones[zone_idx].leds_count > 1)
|
||||
{
|
||||
new_led.name.append(" LED ");
|
||||
new_led.name.append(std::to_string(led_idx + 1));
|
||||
}
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireHaste::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireHaste::DeviceUpdateLEDs()
|
||||
{
|
||||
last_update_time = std::chrono::steady_clock::now();
|
||||
|
||||
if(active_mode == 0)
|
||||
{
|
||||
controller->SendDirect(&colors[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireHaste::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireHaste::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireHaste::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireHaste::KeepaliveThread()
|
||||
{
|
||||
while(keepalive_thread_run.load())
|
||||
{
|
||||
if(active_mode == 0)
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
|
||||
{
|
||||
UpdateLEDs();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_HyperXPulsefireHaste.h |
|
||||
| |
|
||||
| RGBController for HyperX Pulsefire Haste |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 19 Aug 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include "RGBController.h"
|
||||
#include "HyperXPulsefireHasteController.h"
|
||||
|
||||
class RGBController_HyperXPulsefireHaste : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXPulsefireHaste(HyperXPulsefireHasteController* controller_ptr);
|
||||
~RGBController_HyperXPulsefireHaste();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
HyperXPulsefireHasteController* controller;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| HyperXPulsefireRaidController.cpp |
|
||||
| |
|
||||
| Driver for HyperX Pulsefire Raid |
|
||||
| |
|
||||
| Morgan Guimard (morg) 06 Apr 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "HyperXPulsefireRaidController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
HyperXPulsefireRaidController::HyperXPulsefireRaidController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = info.path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
HyperXPulsefireRaidController::~HyperXPulsefireRaidController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireRaidController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireRaidController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireRaidController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
void HyperXPulsefireRaidController::SendColors(std::vector<RGBColor> colors)
|
||||
{
|
||||
unsigned char usb_buf[HYPERX_PULSFIRE_RAID_PACKET_DATA_LENGTH];
|
||||
memset(usb_buf, 0x00, HYPERX_PULSFIRE_RAID_PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0] = HYPERX_PULSFIRE_RAID_REPORT_ID;
|
||||
usb_buf[1] = HYPERX_PULSFIRE_RAID_DIRECT_MODE_START_PACKET;
|
||||
|
||||
for(unsigned int i = 0; i < 2; i++)
|
||||
{
|
||||
usb_buf[3 * i + 2] = RGBGetRValue(colors[i]);
|
||||
usb_buf[3 * i + 3] = RGBGetGValue(colors[i]);
|
||||
usb_buf[3 * i + 4] = RGBGetBValue(colors[i]);
|
||||
}
|
||||
|
||||
usb_buf[8] = HYPERX_PULSFIRE_RAID_DIRECT_MODE_END_PACKET;
|
||||
|
||||
Send(usb_buf);
|
||||
}
|
||||
|
||||
|
||||
void HyperXPulsefireRaidController::Send(unsigned char* packet)
|
||||
{
|
||||
hid_send_feature_report(dev, packet, HYPERX_PULSFIRE_RAID_PACKET_DATA_LENGTH);
|
||||
std::this_thread::sleep_for(10ms);
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| HyperXPulsefireRaidController.h |
|
||||
| |
|
||||
| Driver for HyperX Pulsefire Raid |
|
||||
| |
|
||||
| Morgan Guimard (morg) 06 Apr 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
#define HYPERX_PULSFIRE_RAID_PACKET_DATA_LENGTH 264
|
||||
#define HYPERX_PULSFIRE_RAID_REPORT_ID 0x07
|
||||
#define HYPERX_PULSFIRE_RAID_LEDS_COUNT 2
|
||||
#define HYPERX_PULSFIRE_RAID_DIRECT_MODE_START_PACKET 0x0A
|
||||
#define HYPERX_PULSFIRE_RAID_DIRECT_MODE_END_PACKET 0xA0
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_PULSFIRE_RAID_BRIGHTNESS_MIN = 0x00,
|
||||
HYPERX_PULSFIRE_RAID_BRIGHTNESS_MAX = 0x64
|
||||
};
|
||||
|
||||
class HyperXPulsefireRaidController
|
||||
{
|
||||
public:
|
||||
HyperXPulsefireRaidController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
|
||||
~HyperXPulsefireRaidController();
|
||||
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
std::string GetDeviceLocation();
|
||||
|
||||
void SendColors(std::vector<RGBColor> colors);
|
||||
void SetBrightness(unsigned char brightness);
|
||||
|
||||
protected:
|
||||
hid_device* dev;
|
||||
|
||||
private:
|
||||
std::string location;
|
||||
std::string name;
|
||||
|
||||
void Send(unsigned char* packet);
|
||||
};
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_HyperXPulsefireRaid.cpp |
|
||||
| |
|
||||
| RGBController for HyperX Pulsefire Raid |
|
||||
| |
|
||||
| Morgan Guimard (morg) 06 Apr 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_HyperXPulsefireRaid.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name HyperX Pulsefire Raid
|
||||
@category Mouse
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :x:
|
||||
@detectors DetectHyperXPulsefireRaidControllers
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
RGBController_HyperXPulsefireRaid::RGBController_HyperXPulsefireRaid(HyperXPulsefireRaidController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "HyperX Pulsefire Raid Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0x00;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.brightness = HYPERX_PULSFIRE_RAID_BRIGHTNESS_MAX;
|
||||
Direct.brightness_min = HYPERX_PULSFIRE_RAID_BRIGHTNESS_MIN;
|
||||
Direct.brightness_max = HYPERX_PULSFIRE_RAID_BRIGHTNESS_MAX;
|
||||
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| This devices requires a keepalive thread or it will |
|
||||
| reset to default (flash) |
|
||||
\*-----------------------------------------------------*/
|
||||
keepalive_thread_run = 1;
|
||||
keepalive_thread = new std::thread(&RGBController_HyperXPulsefireRaid::KeepaliveThread, this);
|
||||
}
|
||||
|
||||
RGBController_HyperXPulsefireRaid::~RGBController_HyperXPulsefireRaid()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireRaid::SetupZones()
|
||||
{
|
||||
std::string led_names[HYPERX_PULSFIRE_RAID_LEDS_COUNT] =
|
||||
{
|
||||
"Scroll Wheel", "Logo"
|
||||
};
|
||||
|
||||
for(unsigned int i = 0; i < HYPERX_PULSFIRE_RAID_LEDS_COUNT; i++)
|
||||
{
|
||||
zone new_zone;
|
||||
new_zone.name = led_names[i];
|
||||
new_zone.type = ZONE_TYPE_SINGLE;
|
||||
new_zone.leds_min = 1;
|
||||
new_zone.leds_max = 1;
|
||||
new_zone.leds_count = 1;
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
led new_led;
|
||||
new_led.name = led_names[i];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireRaid::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireRaid::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateSingleLED(0);
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireRaid::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
UpdateSingleLED(zone);
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireRaid::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
last_update_time = std::chrono::steady_clock::now();
|
||||
controller->SendColors(colors);
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireRaid::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireRaid::DeviceSaveMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireRaid::KeepaliveThread()
|
||||
{
|
||||
while(keepalive_thread_run.load())
|
||||
{
|
||||
if(active_mode == 0)
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > 1s)
|
||||
{
|
||||
UpdateLEDs();
|
||||
}
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(10ms);
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_HyperXPulsefireRaid.h |
|
||||
| |
|
||||
| RGBController for HyperX Pulsefire Raid |
|
||||
| |
|
||||
| Morgan Guimard (morg) 06 Apr 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include "RGBController.h"
|
||||
#include "HyperXPulsefireRaidController.h"
|
||||
|
||||
class RGBController_HyperXPulsefireRaid : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXPulsefireRaid(HyperXPulsefireRaidController* controller_ptr);
|
||||
~RGBController_HyperXPulsefireRaid();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
HyperXPulsefireRaidController* controller;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
void KeepaliveThread();
|
||||
};
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| HyperXPulsefireSurgeController.cpp |
|
||||
| |
|
||||
| Driver for HyperX Pulsefire Surge |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 25 Jul 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "HyperXPulsefireSurgeController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
HyperXPulsefireSurgeController::HyperXPulsefireSurgeController(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
HyperXPulsefireSurgeController::~HyperXPulsefireSurgeController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireSurgeController::GetDeviceLocation()
|
||||
{
|
||||
return("HID " + location);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireSurgeController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string HyperXPulsefireSurgeController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
| Private packet sending functions. |
|
||||
\*-------------------------------------------------------------------------------------------------*/
|
||||
|
||||
void HyperXPulsefireSurgeController::SelectProfile
|
||||
(
|
||||
unsigned char profile
|
||||
)
|
||||
{
|
||||
unsigned char buf[264];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Select Profile packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x07;
|
||||
buf[0x01] = HYPERX_PULSEFIRE_SURGE_PACKET_ID_SELECT_PROFILE;
|
||||
buf[0x02] = profile;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 264);
|
||||
}
|
||||
|
||||
void HyperXPulsefireSurgeController::SetProfileBrightness
|
||||
(
|
||||
unsigned char profile,
|
||||
unsigned char brightness
|
||||
)
|
||||
{
|
||||
unsigned char buf[264];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Select Profile packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x07;
|
||||
buf[0x01] = HYPERX_PULSEFIRE_SURGE_PACKET_ID_SET_BRIGHTNESS;
|
||||
buf[0x02] = profile;
|
||||
buf[0x03] = 0x01;
|
||||
buf[0x04] = 0x01;
|
||||
buf[0x05] = 0x01;
|
||||
buf[0x06] = brightness;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 264);
|
||||
}
|
||||
|
||||
void HyperXPulsefireSurgeController::SendDirect
|
||||
(
|
||||
RGBColor* color_data
|
||||
)
|
||||
{
|
||||
unsigned char buf[264];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Select Profile packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x07;
|
||||
buf[0x01] = HYPERX_PULSEFIRE_SURGE_PACKET_ID_DIRECT;
|
||||
buf[0x03] = 0xA0;
|
||||
|
||||
for(int red_idx = 0; red_idx < 32; red_idx++)
|
||||
{
|
||||
buf[0x08 + red_idx] = RGBGetRValue(color_data[red_idx]);
|
||||
}
|
||||
|
||||
for(int grn_idx = 0; grn_idx < 32; grn_idx++)
|
||||
{
|
||||
buf[0x28 + grn_idx] = RGBGetGValue(color_data[grn_idx]);
|
||||
}
|
||||
|
||||
for(int blu_idx = 0; blu_idx < 32; blu_idx++)
|
||||
{
|
||||
buf[0x48 + blu_idx] = RGBGetBValue(color_data[blu_idx]);
|
||||
}
|
||||
|
||||
buf[0x6C] = RGBGetRValue(color_data[32]);
|
||||
buf[0x6D] = RGBGetGValue(color_data[32]);
|
||||
buf[0x6E] = RGBGetBValue(color_data[32]);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 264);
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| HyperXPulsefireSurgeController.h |
|
||||
| |
|
||||
| Driver for HyperX Pulsefire Surge |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 25 Jul 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_PULSEFIRE_SURGE_PACKET_ID_SET_CONFIGURATION = 0x01, /* Set profile configuration packet */
|
||||
HYPERX_PULSEFIRE_SURGE_PACKET_ID_SET_BRIGHTNESS = 0x03, /* Set profile settings and brightness */
|
||||
HYPERX_PULSEFIRE_SURGE_PACKET_ID_SELECT_PROFILE = 0x07, /* Select profile */
|
||||
HYPERX_PULSEFIRE_SURGE_PACKET_ID_DIRECT = 0x14, /* Direct control packet */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_PULSEFIRE_SURGE_MODE_SOLID = 0x00, /* Solid color mode */
|
||||
HYPERX_PULSEFIRE_SURGE_MODE_CYCLE = 0x01, /* Spectrum cycle mode */
|
||||
HYPERX_PULSEFIRE_SURGE_MODE_BREATHING = 0x02, /* Breathing mode */
|
||||
HYPERX_PULSEFIRE_SURGE_MODE_WAVE = 0x03, /* Wave mode */
|
||||
HYPERX_PULSEFIRE_SURGE_MODE_TRIGGER = 0x04, /* Trigger mode */
|
||||
};
|
||||
|
||||
class HyperXPulsefireSurgeController
|
||||
{
|
||||
public:
|
||||
HyperXPulsefireSurgeController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~HyperXPulsefireSurgeController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SelectProfile
|
||||
(
|
||||
unsigned char profile
|
||||
);
|
||||
|
||||
void SetProfileBrightness
|
||||
(
|
||||
unsigned char profile,
|
||||
unsigned char brightness
|
||||
);
|
||||
|
||||
void SendDirect
|
||||
(
|
||||
RGBColor* color_data
|
||||
);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
};
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_HyperXPulsefireSurge.cpp |
|
||||
| |
|
||||
| RGBController for HyperX Pulsefire Surge |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 25 Jul 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_HyperXPulsefireSurge.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name HyperX Pulsefire Surge
|
||||
@category Mouse
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :x:
|
||||
@detectors DetectHyperXPulsefireSurgeControllers
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_HyperXPulsefireSurge::RGBController_HyperXPulsefireSurge(HyperXPulsefireSurgeController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "HyperX Pulsefire Surge Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| The Corsair Lighting Node Pro requires a packet within|
|
||||
| 20 seconds of sending the lighting change in order |
|
||||
| to not revert back into rainbow mode. Start a thread |
|
||||
| to continuously send a keepalive packet every 5s |
|
||||
\*-----------------------------------------------------*/
|
||||
keepalive_thread_run = 1;
|
||||
keepalive_thread = new std::thread(&RGBController_HyperXPulsefireSurge::KeepaliveThread, this);
|
||||
};
|
||||
|
||||
RGBController_HyperXPulsefireSurge::~RGBController_HyperXPulsefireSurge()
|
||||
{
|
||||
keepalive_thread_run = 0;
|
||||
keepalive_thread->join();
|
||||
delete keepalive_thread;
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::SetupZones()
|
||||
{
|
||||
zone led_strip;
|
||||
led_strip.name = "LED Strip";
|
||||
led_strip.type = ZONE_TYPE_LINEAR;
|
||||
led_strip.leds_min = 32;
|
||||
led_strip.leds_max = 32;
|
||||
led_strip.leds_count = 32;
|
||||
led_strip.matrix_map = NULL;
|
||||
zones.push_back(led_strip);
|
||||
|
||||
zone logo;
|
||||
logo.name = "Logo";
|
||||
logo.type = ZONE_TYPE_SINGLE;
|
||||
logo.leds_min = 1;
|
||||
logo.leds_max = 1;
|
||||
logo.leds_count = 1;
|
||||
logo.matrix_map = NULL;
|
||||
zones.push_back(logo);
|
||||
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
|
||||
new_led.name = zones[zone_idx].name;
|
||||
|
||||
if(zones[zone_idx].leds_count > 1)
|
||||
{
|
||||
new_led.name.append(" LED ");
|
||||
new_led.name.append(std::to_string(led_idx + 1));
|
||||
}
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::DeviceUpdateLEDs()
|
||||
{
|
||||
last_update_time = std::chrono::steady_clock::now();
|
||||
|
||||
if(active_mode == 0)
|
||||
{
|
||||
controller->SendDirect(&colors[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::KeepaliveThread()
|
||||
{
|
||||
while(keepalive_thread_run.load())
|
||||
{
|
||||
if(active_mode == 0)
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
|
||||
{
|
||||
UpdateLEDs();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_HyperXPulsefireSurge.h |
|
||||
| |
|
||||
| RGBController for HyperX Pulsefire Surge |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 25 Jul 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include "RGBController.h"
|
||||
#include "HyperXPulsefireSurgeController.h"
|
||||
|
||||
class RGBController_HyperXPulsefireSurge : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXPulsefireSurge(HyperXPulsefireSurgeController* controller_ptr);
|
||||
~RGBController_HyperXPulsefireSurge();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
HyperXPulsefireSurgeController* controller;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
Reference in New Issue
Block a user