Add Logitech Powerplay mat and add speed opt GPW
This commit is contained in:
parent
d19b5bc87d
commit
f741cb7c6b
8 changed files with 303 additions and 7 deletions
109
RGBController/RGBController_LogitechGPowerPlay.cpp
Normal file
109
RGBController/RGBController_LogitechGPowerPlay.cpp
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechGPowerPlay.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for |
|
||||
| Logitech G PowerPlay Wireless Mousemat |
|
||||
| |
|
||||
| TheRogueZeta 8/31/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LogitechGPowerPlay.h"
|
||||
|
||||
RGBController_LogitechGPowerPlay::RGBController_LogitechGPowerPlay(LogitechGPowerPlayController* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech G PowerPlay Wireless Charging System";
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = "Logitech G PowerPlay Wireless Charging System";
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G_POWERPLAY_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G_POWERPLAY_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Cycle;
|
||||
Cycle.name = "Cycle";
|
||||
Cycle.value = LOGITECH_G_POWERPLAY_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycle.color_mode = MODE_COLORS_PER_LED;
|
||||
Cycle.speed_min = LOGITECH_G_POWERPLAY_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G_POWERPLAY_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G_POWERPLAY_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G_POWERPLAY_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G_POWERPLAY_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G_POWERPLAY_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G_POWERPLAY_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
void RGBController_LogitechGPowerPlay::SetupZones()
|
||||
{
|
||||
zone GPowerPlay_logo_zone;
|
||||
GPowerPlay_logo_zone.name = "Logo Zone";
|
||||
GPowerPlay_logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
GPowerPlay_logo_zone.leds_min = 1;
|
||||
GPowerPlay_logo_zone.leds_max = 1;
|
||||
GPowerPlay_logo_zone.leds_count = 1;
|
||||
GPowerPlay_logo_zone.matrix_map = NULL;
|
||||
zones.push_back(GPowerPlay_logo_zone);
|
||||
|
||||
led GPowerPlay_logo_led;
|
||||
GPowerPlay_logo_led.name = "Logo LED";
|
||||
leds.push_back(GPowerPlay_logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LogitechGPowerPlay::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LogitechGPowerPlay::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGPowerPlay::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[zone]);
|
||||
unsigned char grn = RGBGetGValue(colors[zone]);
|
||||
unsigned char blu = RGBGetBValue(colors[zone]);
|
||||
|
||||
logitech->SendMouseMatMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGPowerPlay::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGPowerPlay::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LogitechGPowerPlay::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
32
RGBController/RGBController_LogitechGPowerPlay.h
Normal file
32
RGBController/RGBController_LogitechGPowerPlay.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechGPowerPlay.h |
|
||||
| |
|
||||
| Generic RGB Interface for |
|
||||
| Logitech G PowerPlay Wireless Mousemat |
|
||||
| |
|
||||
| TheRogueZeta 8/31/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "LogitechGPowerPlayController.h"
|
||||
|
||||
class RGBController_LogitechGPowerPlay : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LogitechGPowerPlay(LogitechGPowerPlayController* logitech_ptr);
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechGPowerPlayController* logitech;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue