Publish LumaOps source
This commit is contained in:
+148
@@ -0,0 +1,148 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_RoccatBurstProAir.cpp |
|
||||
| |
|
||||
| RGBController for Roccat Burst Pro Air |
|
||||
| |
|
||||
| Morgan Guimard (morg) 16 Jun 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_RoccatBurstProAir.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Roccat Burst Pro Air
|
||||
@category Mouse
|
||||
@type USB
|
||||
@save :warning:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectRoccatBurstProAirCoreControllers
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_RoccatBurstProAir::RGBController_RoccatBurstProAir(RoccatBurstProAirController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "Roccat";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Roccat Burst Pro Air Mouse Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = ROCCAT_BURST_PRO_AIR_DIRECT_MODE_VALUE;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.brightness = ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MAX;
|
||||
Direct.brightness_min = ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MIN;
|
||||
Direct.brightness_max = ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MAX;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Blink;
|
||||
Blink.name = "Blink";
|
||||
Blink.value = ROCCAT_BURST_PRO_AIR_BLINK_MODE_VALUE;
|
||||
Blink.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
|
||||
Blink.color_mode = MODE_COLORS_PER_LED;
|
||||
Blink.brightness = ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MAX;
|
||||
Blink.brightness_min = ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MIN;
|
||||
Blink.brightness_max = ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MAX;
|
||||
Blink.speed = ROCCAT_BURST_PRO_AIR_SPEED_MIN;
|
||||
Blink.speed_min = ROCCAT_BURST_PRO_AIR_SPEED_MIN;
|
||||
Blink.speed_max = ROCCAT_BURST_PRO_AIR_SPEED_MAX;
|
||||
modes.push_back(Blink);
|
||||
|
||||
mode Breath;
|
||||
Breath.name = "Breathing";
|
||||
Breath.value = ROCCAT_BURST_PRO_AIR_BREATH_MODE_VALUE;
|
||||
Breath.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
|
||||
Breath.color_mode = MODE_COLORS_PER_LED;
|
||||
Breath.brightness = ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MAX;
|
||||
Breath.brightness_min = ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MIN;
|
||||
Breath.brightness_max = ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MAX;
|
||||
Breath.speed = ROCCAT_BURST_PRO_AIR_SPEED_MIN;
|
||||
Breath.speed_min = ROCCAT_BURST_PRO_AIR_SPEED_MIN;
|
||||
Breath.speed_max = ROCCAT_BURST_PRO_AIR_SPEED_MAX;
|
||||
modes.push_back(Breath);
|
||||
|
||||
mode Wave;
|
||||
Wave.name = "Wave";
|
||||
Wave.value = ROCCAT_BURST_PRO_AIR_WAVE_MODE_VALUE;
|
||||
Wave.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
|
||||
Wave.color_mode = MODE_COLORS_PER_LED;
|
||||
Wave.brightness = ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MAX;
|
||||
Wave.brightness_min = ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MIN;
|
||||
Wave.brightness_max = ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MAX;
|
||||
Wave.speed = ROCCAT_BURST_PRO_AIR_SPEED_MIN;
|
||||
Wave.speed_min = ROCCAT_BURST_PRO_AIR_SPEED_MIN;
|
||||
Wave.speed_max = ROCCAT_BURST_PRO_AIR_SPEED_MAX;
|
||||
modes.push_back(Wave);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_RoccatBurstProAir::~RGBController_RoccatBurstProAir()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_RoccatBurstProAir::SetupZones()
|
||||
{
|
||||
zone new_zone;
|
||||
new_zone.name = "Mouse";
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
new_zone.leds_min = ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS;
|
||||
new_zone.leds_max = ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS;
|
||||
new_zone.leds_count = ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS;
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
std::string led_names[ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS] =
|
||||
{
|
||||
"Scroll Wheel",
|
||||
"Logo",
|
||||
"Left button",
|
||||
"Right button"
|
||||
};
|
||||
|
||||
for(unsigned int i = 0; i < ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS; i++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names[i];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_RoccatBurstProAir::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_RoccatBurstProAir::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
}
|
||||
|
||||
void RGBController_RoccatBurstProAir::UpdateZoneLEDs(int /*zone_idx*/)
|
||||
{
|
||||
controller->SetColors(colors);
|
||||
}
|
||||
|
||||
void RGBController_RoccatBurstProAir::UpdateSingleLED(int /*led_idx*/)
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
}
|
||||
|
||||
void RGBController_RoccatBurstProAir::DeviceUpdateMode()
|
||||
{
|
||||
const mode& active = modes[active_mode];
|
||||
controller->SetModeValues(active.value, active.speed, active.brightness);
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_RoccatBurstProAir.h |
|
||||
| |
|
||||
| RGBController for Roccat Burst Pro Air |
|
||||
| |
|
||||
| Morgan Guimard (morg) 16 Jun 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "RoccatBurstProAirController.h"
|
||||
|
||||
class RGBController_RoccatBurstProAir : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_RoccatBurstProAir(RoccatBurstProAirController* controller_ptr);
|
||||
~RGBController_RoccatBurstProAir();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
RoccatBurstProAirController* controller;
|
||||
};
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RoccatBurstProAirController.cpp |
|
||||
| |
|
||||
| Driver for Roccat Burst Pro Air |
|
||||
| |
|
||||
| Morgan Guimard (morg) 16 Jun 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "RoccatBurstProAirController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
RoccatBurstProAirController::RoccatBurstProAirController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = info.path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
RoccatBurstProAirController::~RoccatBurstProAirController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string RoccatBurstProAirController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string RoccatBurstProAirController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string RoccatBurstProAirController::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 RoccatBurstProAirController::SetColors(std::vector<RGBColor> colors)
|
||||
{
|
||||
unsigned char usb_buf[ROCCAT_BURST_PRO_AIR_REPORT_SIZE];
|
||||
memset(usb_buf, 0x00, ROCCAT_BURST_PRO_AIR_REPORT_SIZE);
|
||||
|
||||
usb_buf[0] = ROCCAT_BURST_PRO_AIR_REPORT_ID;
|
||||
|
||||
usb_buf[1] = 0x01;
|
||||
usb_buf[2] = 0x4C;
|
||||
usb_buf[3] = 0x06;
|
||||
usb_buf[4] = 0x14;
|
||||
|
||||
for(unsigned char i = 0; i < colors.size(); i++)
|
||||
{
|
||||
usb_buf[5 + 5 * i] = i + 1;
|
||||
usb_buf[6 + 5 * i] = 0xFF;
|
||||
usb_buf[7 + 5 * i] = RGBGetRValue(colors[i]);
|
||||
usb_buf[8 + 5 * i] = RGBGetGValue(colors[i]);
|
||||
usb_buf[9 + 5 * i] = RGBGetBValue(colors[i]);
|
||||
}
|
||||
|
||||
hid_send_feature_report(dev, usb_buf, ROCCAT_BURST_PRO_AIR_REPORT_SIZE);
|
||||
}
|
||||
|
||||
void RoccatBurstProAirController::SetModeValues(unsigned char mode_value, unsigned char speed, unsigned char brightness)
|
||||
{
|
||||
unsigned char usb_buf[ROCCAT_BURST_PRO_AIR_REPORT_SIZE];
|
||||
memset(usb_buf, 0x00, ROCCAT_BURST_PRO_AIR_REPORT_SIZE);
|
||||
|
||||
usb_buf[0] = ROCCAT_BURST_PRO_AIR_REPORT_ID;
|
||||
|
||||
usb_buf[1] = 0x01;
|
||||
usb_buf[2] = 0x4C;
|
||||
usb_buf[3] = 0x06;
|
||||
usb_buf[4] = 0x06;
|
||||
|
||||
usb_buf[5] = mode_value;
|
||||
usb_buf[6] = speed;
|
||||
usb_buf[7] = brightness;
|
||||
|
||||
usb_buf[8] = 0x0F;
|
||||
|
||||
hid_send_feature_report(dev, usb_buf, ROCCAT_BURST_PRO_AIR_REPORT_SIZE);
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RoccatBurstProAirController.h |
|
||||
| |
|
||||
| Driver for Roccat Burst Pro Air |
|
||||
| |
|
||||
| Morgan Guimard (morg) 16 Jun 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
#define ROCCAT_BURST_PRO_AIR_REPORT_ID 0x06
|
||||
#define ROCCAT_BURST_PRO_AIR_REPORT_SIZE 30
|
||||
#define ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS 4
|
||||
|
||||
enum
|
||||
{
|
||||
ROCCAT_BURST_PRO_AIR_DIRECT_MODE_VALUE = 0x01,
|
||||
ROCCAT_BURST_PRO_AIR_BLINK_MODE_VALUE = 0x02,
|
||||
ROCCAT_BURST_PRO_AIR_BREATH_MODE_VALUE = 0x03,
|
||||
ROCCAT_BURST_PRO_AIR_WAVE_MODE_VALUE = 0x04
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MIN = 0x00,
|
||||
ROCCAT_BURST_PRO_AIR_BRIGHTNESS_MAX = 0xFF,
|
||||
ROCCAT_BURST_PRO_AIR_SPEED_MIN = 0x00,
|
||||
ROCCAT_BURST_PRO_AIR_SPEED_MAX = 0x0B
|
||||
};
|
||||
|
||||
class RoccatBurstProAirController
|
||||
{
|
||||
public:
|
||||
RoccatBurstProAirController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
|
||||
~RoccatBurstProAirController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetColors(std::vector<RGBColor> colors);
|
||||
void SetModeValues(unsigned char mode_value, unsigned char speed, unsigned char brightness);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
};
|
||||
Reference in New Issue
Block a user