Publish LumaOps source
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| GenesisXenon200Controller.cpp |
|
||||
| |
|
||||
| Driver for Genesis Xenon 200 mouse |
|
||||
| |
|
||||
| chrabonszcz Jul 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "GenesisXenon200Controller.h"
|
||||
|
||||
GenesisXenon200Controller::GenesisXenon200Controller(hid_device* dev_handle, hid_device* cmd_dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
cmd_dev = cmd_dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
GenesisXenon200Controller::~GenesisXenon200Controller()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string GenesisXenon200Controller::GetLocationString()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string GenesisXenon200Controller::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
void GenesisXenon200Controller::SaveMode(unsigned char mode, unsigned char value, RGBColor color)
|
||||
{
|
||||
unsigned char usb_buf[154];
|
||||
|
||||
usb_buf[0] = 0x04;
|
||||
|
||||
hid_get_feature_report(dev, usb_buf, 154);
|
||||
|
||||
usb_buf[0x5D] = mode;
|
||||
usb_buf[0x60] = value;
|
||||
usb_buf[0x61] = RGBGetRValue(color);
|
||||
usb_buf[0x62] = RGBGetGValue(color);
|
||||
usb_buf[0x63] = RGBGetBValue(color);
|
||||
|
||||
hid_send_feature_report(dev, usb_buf, 154);
|
||||
|
||||
usb_buf[0] = 0x08;
|
||||
hid_get_feature_report(cmd_dev, usb_buf, 9);
|
||||
hid_send_feature_report(cmd_dev, usb_buf, 9);
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| GenesisXenon200Controller.h |
|
||||
| |
|
||||
| Driver for Genesis Xenon 200 mouse |
|
||||
| |
|
||||
| chrabonszcz Jul 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
class GenesisXenon200Controller
|
||||
{
|
||||
public:
|
||||
GenesisXenon200Controller(hid_device* dev_handle, hid_device* cmd_dev_handle, const char* path, std::string dev_name);
|
||||
~GenesisXenon200Controller();
|
||||
|
||||
std::string GetLocationString();
|
||||
std::string GetNameString();
|
||||
|
||||
void SaveMode(unsigned char mode, unsigned char value, RGBColor color);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
hid_device* cmd_dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
};
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_GenesisXenon200.cpp |
|
||||
| |
|
||||
| RGBController for Genesis Xenon 200 mouse |
|
||||
| |
|
||||
| chrabonszcz Jul 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Genesis Xenon 200
|
||||
@type USB
|
||||
@save :white_check_mark:
|
||||
@direct :x:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectSinowealthMouse
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_GenesisXenon200.h"
|
||||
|
||||
RGBController_GenesisXenon200::RGBController_GenesisXenon200(GenesisXenon200Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "Genesis";
|
||||
description = "Genesis Xenon 200 Mouse Device";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
location = controller->GetLocationString();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = GENESIS_XENON_200_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.brightness = 1;
|
||||
Static.brightness_min = 0;
|
||||
Static.brightness_max = 2;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = GENESIS_XENON_200_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.speed = 1;
|
||||
Breathing.speed_min = 0;
|
||||
Breathing.speed_max = 2;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.colors.resize(1);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode SpectrumCycle;
|
||||
SpectrumCycle.name = "Spectrum Cycle";
|
||||
SpectrumCycle.value = GENESIS_XENON_200_MODE_SPECTRUM_CYCLE;
|
||||
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
SpectrumCycle.color_mode = MODE_COLORS_NONE;
|
||||
SpectrumCycle.speed = 1;
|
||||
SpectrumCycle.speed_min = 0;
|
||||
SpectrumCycle.speed_max = 2;
|
||||
modes.push_back(SpectrumCycle);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = GENESIS_XENON_200_MODE_OFF;
|
||||
Off.flags = MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
RGBController_GenesisXenon200::~RGBController_GenesisXenon200()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_GenesisXenon200::DeviceUpdateMode()
|
||||
{
|
||||
RGBColor color = 0;
|
||||
unsigned char value = 0;
|
||||
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
color = modes[active_mode].colors[0];
|
||||
}
|
||||
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case GENESIS_XENON_200_MODE_STATIC:
|
||||
|
||||
value = GENESIS_XENON_200_STATIC_BRIGHTESS_VALUES[modes[active_mode].brightness];
|
||||
break;
|
||||
|
||||
case GENESIS_XENON_200_MODE_BREATHING:
|
||||
|
||||
value = GENESIS_XENON_200_BREATHING_SPEED_VALUES[modes[active_mode].speed];
|
||||
break;
|
||||
|
||||
case GENESIS_XENON_200_MODE_SPECTRUM_CYCLE:
|
||||
|
||||
value = GENESIS_XENON_200_SPECTRUM_CYCLE_SPEED_VALUES[modes[active_mode].speed];
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
controller->SaveMode(modes[active_mode].value, value, color);
|
||||
}
|
||||
|
||||
void RGBController_GenesisXenon200::DeviceUpdateLEDs()
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
|
||||
void RGBController_GenesisXenon200::DeviceSaveMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_GenesisXenon200::SetupZones()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_GenesisXenon200::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_GenesisXenon200::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_GenesisXenon200::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_GenesisXenon200.h |
|
||||
| |
|
||||
| RGBController for Genesis Xenon 200 mouse |
|
||||
| |
|
||||
| chrabonszcz Jul 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GenesisXenon200Controller.h"
|
||||
#include "RGBController.h"
|
||||
|
||||
#define GENESIS_XENON_200_MODE_STATIC 0x18
|
||||
#define GENESIS_XENON_200_MODE_BREATHING 0x12
|
||||
#define GENESIS_XENON_200_MODE_SPECTRUM_CYCLE 0x14
|
||||
#define GENESIS_XENON_200_MODE_OFF 0x11
|
||||
|
||||
const unsigned char GENESIS_XENON_200_STATIC_BRIGHTESS_VALUES[] {0x11, 0x51, 0xA1};
|
||||
const unsigned char GENESIS_XENON_200_BREATHING_SPEED_VALUES[] {0x51, 0x31, 0x11};
|
||||
const unsigned char GENESIS_XENON_200_SPECTRUM_CYCLE_SPEED_VALUES[] {0xC1, 0x81, 0x41};
|
||||
|
||||
class RGBController_GenesisXenon200 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_GenesisXenon200(GenesisXenon200Controller* controller_ptr);
|
||||
~RGBController_GenesisXenon200();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
GenesisXenon200Controller* controller;
|
||||
};
|
||||
Reference in New Issue
Block a user