mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-01-14 10:07:49 -05:00
* Reorganize and clean up RGBController API functions
* Add functions to get protected RGBController member values
* Make NetworkClient, ProfileManager, and ResourceManager friend classes so they can access protected members
* Protected previously-public RGBController members
* Information strings (name, vendor, description, version, serial location)
* Device type
* Active mode
* Flags
* LEDs vector
* LED alternate names vector
* Modes vector
* Colors vector
* Zones vector
* Add CONTROLLER_FLAG_HIDDEN to allow plugins to hide controllers from control GUI
* Add update reason codes to RGBController update callback and signal updates on more RGBController events
* Add loop zone types and segmented zone type
* Add matrix map field to segments
* Rework matrix_map_type from using pointers to vector to prevent memory leaks
* Rework KeyboardLayoutManager to return new matrix_map_type
* Add access mutex to RGBController API
* Add per-zone modes ot RGBController API
* Add JSON description functions to RGBController API
114 lines
3.7 KiB
C++
114 lines
3.7 KiB
C++
/*---------------------------------------------------------*\
|
|
| RGBController_GainwardGPUv1.cpp |
|
|
| |
|
|
| RGBController for Gainward v1 GPU |
|
|
| |
|
|
| TheRogueZeta 05 Nov 2020 |
|
|
| |
|
|
| This file is part of the OpenRGB project |
|
|
| SPDX-License-Identifier: GPL-2.0-or-later |
|
|
\*---------------------------------------------------------*/
|
|
|
|
#include "RGBController_GainwardGPUv1.h"
|
|
|
|
int RGBController_GainwardGPUv1::GetDeviceMode()
|
|
{
|
|
active_mode = 1;
|
|
return(active_mode);
|
|
}
|
|
|
|
/**------------------------------------------------------------------*\
|
|
@name Gainward GPU v1
|
|
@category GPU
|
|
@type I2C
|
|
@save :x:
|
|
@direct :white_check_mark:
|
|
@effects :x:
|
|
@detectors DetectGainwardGPUControllers
|
|
@comment
|
|
\*-------------------------------------------------------------------*/
|
|
|
|
RGBController_GainwardGPUv1::RGBController_GainwardGPUv1(GainwardGPUv1Controller* controller_ptr)
|
|
{
|
|
controller = controller_ptr;
|
|
|
|
name = controller->GetDeviceName();
|
|
vendor = "Gainward";
|
|
type = DEVICE_TYPE_GPU;
|
|
description = "Gainward GPU V1 Device";
|
|
location = controller->GetDeviceLocation();
|
|
|
|
mode Direct;
|
|
Direct.name = "Direct";
|
|
Direct.value = 1;
|
|
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
|
Direct.color_mode = MODE_COLORS_PER_LED;
|
|
modes.push_back(Direct);
|
|
|
|
SetupZones();
|
|
}
|
|
|
|
RGBController_GainwardGPUv1::~RGBController_GainwardGPUv1()
|
|
{
|
|
delete controller;
|
|
}
|
|
|
|
void RGBController_GainwardGPUv1::SetupZones()
|
|
{
|
|
/*---------------------------------------------------------*\
|
|
| Set up zone |
|
|
\*---------------------------------------------------------*/
|
|
zone gainward_gpu_zone;
|
|
gainward_gpu_zone.name = "GPU";
|
|
gainward_gpu_zone.type = ZONE_TYPE_SINGLE;
|
|
gainward_gpu_zone.leds_min = 1;
|
|
gainward_gpu_zone.leds_max = 1;
|
|
gainward_gpu_zone.leds_count = 1;
|
|
zones.push_back(gainward_gpu_zone);
|
|
|
|
/*---------------------------------------------------------*\
|
|
| Set up LED |
|
|
\*---------------------------------------------------------*/
|
|
led gainward_gpu_led;
|
|
gainward_gpu_led.name = "GPU";
|
|
leds.push_back(gainward_gpu_led);
|
|
|
|
SetupColors();
|
|
|
|
/*---------------------------------------------------------*\
|
|
| Initialize color |
|
|
\*---------------------------------------------------------*/
|
|
unsigned char red = controller->GetLEDRed();
|
|
unsigned char grn = controller->GetLEDGreen();
|
|
unsigned char blu = controller->GetLEDBlue();
|
|
|
|
colors[0] = ToRGBColor(red, grn, blu);
|
|
}
|
|
|
|
void RGBController_GainwardGPUv1::DeviceUpdateLEDs()
|
|
{
|
|
for(std::size_t led = 0; led < colors.size(); led++)
|
|
{
|
|
unsigned char red = RGBGetRValue(colors[led]);
|
|
unsigned char grn = RGBGetGValue(colors[led]);
|
|
unsigned char blu = RGBGetBValue(colors[led]);
|
|
|
|
controller->SetLEDColors(red, grn, blu);
|
|
}
|
|
}
|
|
|
|
void RGBController_GainwardGPUv1::DeviceUpdateZoneLEDs(int /*zone*/)
|
|
{
|
|
DeviceUpdateLEDs();
|
|
}
|
|
|
|
void RGBController_GainwardGPUv1::DeviceUpdateSingleLED(int /*led*/)
|
|
{
|
|
DeviceUpdateLEDs();
|
|
}
|
|
|
|
void RGBController_GainwardGPUv1::DeviceUpdateMode()
|
|
{
|
|
|
|
}
|