mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-01-19 04:27:51 -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
112 lines
3.2 KiB
C++
112 lines
3.2 KiB
C++
/*---------------------------------------------------------*\
|
|
| RGBController_HYTEMousemat.cpp |
|
|
| |
|
|
| RGBController for HYTE mousemat |
|
|
| |
|
|
| Adam Honse (calcprogrammer1@gmail.com) 18 Jul 2023 |
|
|
| |
|
|
| This file is part of the OpenRGB project |
|
|
| SPDX-License-Identifier: GPL-2.0-or-later |
|
|
\*---------------------------------------------------------*/
|
|
|
|
#include "RGBController_HYTEMousemat.h"
|
|
|
|
/**------------------------------------------------------------------*\
|
|
@name HYTE Mousemat
|
|
@category Mousemat
|
|
@type USB
|
|
@save :x:
|
|
@direct :white_check_mark:
|
|
@effects :x:
|
|
@detectors DetectHYTEMousematControllers
|
|
@comment
|
|
\*-------------------------------------------------------------------*/
|
|
|
|
RGBController_HYTEMousemat::RGBController_HYTEMousemat(HYTEMousematController* controller_ptr)
|
|
{
|
|
controller = controller_ptr;
|
|
|
|
name = controller->GetName();
|
|
vendor = "HYTE";
|
|
description = "HYTE Mousemat Device";
|
|
type = DEVICE_TYPE_MOUSEMAT;
|
|
location = controller->GetLocation();
|
|
|
|
mode Direct;
|
|
Direct.name = "Direct";
|
|
Direct.value = HYTE_CNVS_MODE_DIRECT;
|
|
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
|
Direct.color_mode = MODE_COLORS_PER_LED;
|
|
modes.push_back(Direct);
|
|
|
|
// HYTE CNVS does not seem to be able to transfer back into firmware animation
|
|
// after streaming command has been used
|
|
//mode Rainbow;
|
|
//Rainbow.name = "Rainbow Wave";
|
|
//Rainbow.value = HYTE_CNVS_MODE_RAINBOW;
|
|
//Rainbow.flags = MODE_FLAG_HAS_RANDOM_COLOR;
|
|
//Rainbow.color_mode = MODE_COLORS_RANDOM;
|
|
//modes.push_back(Rainbow);
|
|
|
|
SetupZones();
|
|
}
|
|
|
|
RGBController_HYTEMousemat::~RGBController_HYTEMousemat()
|
|
{
|
|
delete controller;
|
|
}
|
|
|
|
void RGBController_HYTEMousemat::SetupZones()
|
|
{
|
|
zone mousemat_zone;
|
|
|
|
mousemat_zone.name = "Mousemat";
|
|
mousemat_zone.type = ZONE_TYPE_LINEAR;
|
|
mousemat_zone.leds_min = 50;
|
|
mousemat_zone.leds_max = 50;
|
|
mousemat_zone.leds_count = 50;
|
|
|
|
zones.push_back(mousemat_zone);
|
|
|
|
for(unsigned int led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
|
|
{
|
|
led mousemat_led;
|
|
|
|
mousemat_led.name = "Mousemat LED ";
|
|
mousemat_led.name.append(std::to_string(led_idx));
|
|
|
|
leds.push_back(mousemat_led);
|
|
}
|
|
|
|
SetupColors();
|
|
}
|
|
|
|
void RGBController_HYTEMousemat::DeviceUpdateLEDs()
|
|
{
|
|
controller->StreamingCommand(&colors[0]);
|
|
}
|
|
|
|
void RGBController_HYTEMousemat::DeviceUpdateZoneLEDs(int /*zone*/)
|
|
{
|
|
|
|
}
|
|
|
|
void RGBController_HYTEMousemat::DeviceUpdateSingleLED(int /*led*/)
|
|
{
|
|
|
|
}
|
|
|
|
void RGBController_HYTEMousemat::DeviceUpdateMode()
|
|
{
|
|
switch(modes[active_mode].value)
|
|
{
|
|
case HYTE_CNVS_MODE_DIRECT:
|
|
controller->FirmwareAnimationControl(false);
|
|
break;
|
|
|
|
case HYTE_CNVS_MODE_RAINBOW:
|
|
controller->FirmwareAnimationControl(true);
|
|
break;
|
|
}
|
|
}
|