Publish LumaOps source
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| CougarControllerDetect.cpp |
|
||||
| |
|
||||
| Detector for Cougar devices |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "Detector.h"
|
||||
#include "RGBController_CougarKeyboard.h"
|
||||
#include "RGBController_CougarRevengerST.h"
|
||||
|
||||
/*----------------------------------------------------------*\
|
||||
| Cougar vendor ID |
|
||||
\*----------------------------------------------------------*/
|
||||
#define COUGAR_VID 0x12CF
|
||||
#define COUGAR_VID_2 0x060B
|
||||
|
||||
/*----------------------------------------------------------*\
|
||||
| Product ID |
|
||||
\*----------------------------------------------------------*/
|
||||
#define COUGAR_700K_EVO_PID 0x7010
|
||||
#define COUGAR_REVENGER_ST_PID 0x0412
|
||||
|
||||
void DetectCougarRevengerSTControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CougarRevengerSTController* controller = new CougarRevengerSTController(dev, *info, name);
|
||||
RGBController_CougarRevengerST* rgb_controller = new RGBController_CougarRevengerST(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectCougar700kEvo(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if (dev)
|
||||
{
|
||||
CougarKeyboardController* controller = new CougarKeyboardController(dev, info->path, name);
|
||||
RGBController_CougarKeyboard* rgb_controller = new RGBController_CougarKeyboard(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR_IPU("Cougar 700K EVO Gaming Keyboard", DetectCougar700kEvo, COUGAR_VID_2, COUGAR_700K_EVO_PID, 3, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_IPU("Cougar Revenger ST", DetectCougarRevengerSTControllers, COUGAR_VID, COUGAR_REVENGER_ST_PID, 0, 0x0001, 2);
|
||||
@@ -0,0 +1,216 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| CougarKeyboardController.cpp |
|
||||
| |
|
||||
| Driver for Cougar keyboard |
|
||||
| |
|
||||
| Chris M (DrNo) 05 Apr 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "CougarKeyboardController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
static uint8_t keyvalue_map[113] =
|
||||
{
|
||||
/*00 ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 */
|
||||
0, 9, 18, 27, 36, 45, 54, 63, 72, 81,
|
||||
|
||||
/*10 F10 F11 F12 PRT SLK PBK PLY VDN VUP MTE */
|
||||
90, 99, 108, 117, 126, 15, 135, 140, 141, 142,
|
||||
|
||||
/*20 ` 1 2 3 4 5 6 7 8 9 */
|
||||
1, 10, 19, 28, 37, 46, 55, 64, 73, 82,
|
||||
|
||||
/*30 0 - = BSP INS HME PUP NLK NM/ NM* */
|
||||
91, 100, 109, 127, 128, 24, 33, 42, 51, 60,
|
||||
|
||||
/*40 NM- TAB Q W E R T Y U I */
|
||||
69, 2, 11, 20, 29, 38, 47, 56, 65, 74,
|
||||
|
||||
/*50 O P [ ] \ DEL END PDN NM7 NM8 */
|
||||
83, 92, 101, 110, 119, 129, 78, 87, 96, 105,
|
||||
|
||||
/*60 NM9 NM+ CAP A S D F G H J */
|
||||
16, 25, 3, 12, 21, 30, 39, 48, 57, 66,
|
||||
|
||||
/*70 K L ; ' ENT NM4 NM5 NM6 LSH Z */
|
||||
75, 84, 93, 102, 120, 34, 43, 52, 4, 22,
|
||||
|
||||
/*80 X C V B N M , . / RSH */
|
||||
31, 40, 49, 58, 67, 76, 85, 94, 103, 121,
|
||||
|
||||
/*90 UP NM1 NM2 NM3 NETR LCTL LWIN LALT SPC RALT */
|
||||
130, 70, 79, 88, 106, 5, 14, 23, 50, 86,
|
||||
|
||||
/*100 RWIN RFNC RCTL LFT DWN RGT NM0 NM. G1 G2 */
|
||||
95, 104, 113, 122, 131, 132, 133, 97, 147, 148,
|
||||
|
||||
/*110 G3 G4 G5 */
|
||||
149, 150, 151
|
||||
};
|
||||
|
||||
CougarKeyboardController::CougarKeyboardController(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
CougarKeyboardController::~CougarKeyboardController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string CougarKeyboardController::GetDeviceName()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string CougarKeyboardController::GetSerial()
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
std::string CougarKeyboardController::GetLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
void CougarKeyboardController::SetMode(uint8_t mode, uint8_t speed, uint8_t brightness, uint8_t direction, std::vector<RGBColor> colours, bool random_colours)
|
||||
{
|
||||
uint8_t buffer[COUGARKEYBOARDCONTROLLER_WRITE_PACKET_SIZE] = { 0x00, 0x14, 0x2C };
|
||||
|
||||
buffer[COUGARKEYBOARDCONTROLLER_MODE_BYTE] = mode;
|
||||
buffer[COUGARKEYBOARDCONTROLLER_SPEED_BYTE] = speed;
|
||||
buffer[COUGARKEYBOARDCONTROLLER_BRIGHTNESS_BYTE] = brightness;
|
||||
buffer[COUGARKEYBOARDCONTROLLER_RANDOM_BYTE] = (random_colours) ? 1 : 0;
|
||||
buffer[COUGARKEYBOARDCONTROLLER_DIRECTION_BYTE] = direction;
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Off mode does not need any further settings & should |
|
||||
| skip the default case to avoid an indexing error |
|
||||
\*-----------------------------------------------------*/
|
||||
case COUGARKEYBOARDCONTROLLER_MODE_OFF:
|
||||
break;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Spectrum Cycle mode (Circle) always sets random |
|
||||
\*-----------------------------------------------------*/
|
||||
case COUGARKEYBOARDCONTROLLER_MODE_CIRCLE:
|
||||
buffer[COUGARKEYBOARDCONTROLLER_RANDOM_BYTE] = 1;
|
||||
break;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Wave mode does not have a true "random" colour and |
|
||||
| needs to set the "rainbow" mode (val = 2) instead |
|
||||
\*-----------------------------------------------------*/
|
||||
case COUGARKEYBOARDCONTROLLER_MODE_WAVE:
|
||||
buffer[COUGARKEYBOARDCONTROLLER_RANDOM_BYTE] = (random_colours) ? 2 : 0;
|
||||
buffer[COUGARKEYBOARDCONTROLLER_DATA_BYTE] = 2;
|
||||
|
||||
case COUGARKEYBOARDCONTROLLER_MODE_RIPPLE:
|
||||
case COUGARKEYBOARDCONTROLLER_MODE_SCAN:
|
||||
{
|
||||
uint8_t count = (uint8_t)colours.size();
|
||||
uint8_t timer = 100 / count;
|
||||
buffer[COUGARKEYBOARDCONTROLLER_DATA_BYTE + 1] = count;
|
||||
|
||||
for(uint8_t i = 0; i < count; i++)
|
||||
{
|
||||
uint8_t offset = 11 + (i * 4);
|
||||
|
||||
buffer[offset] = (i + 1) * timer;
|
||||
buffer[offset + 1] = RGBGetRValue(colours[i]);
|
||||
buffer[offset + 2] = RGBGetGValue(colours[i]);
|
||||
buffer[offset + 3] = RGBGetBValue(colours[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case COUGARKEYBOARDCONTROLLER_MODE_RHYTHM:
|
||||
buffer[COUGARKEYBOARDCONTROLLER_RANDOM_BYTE] = (random_colours) ? 2 : 0;
|
||||
|
||||
default:
|
||||
buffer[COUGARKEYBOARDCONTROLLER_DATA_BYTE + 1] = RGBGetRValue(colours[0]);
|
||||
buffer[COUGARKEYBOARDCONTROLLER_DATA_BYTE + 2] = RGBGetGValue(colours[0]);
|
||||
buffer[COUGARKEYBOARDCONTROLLER_DATA_BYTE + 3] = RGBGetBValue(colours[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
hid_write(dev, buffer, COUGARKEYBOARDCONTROLLER_WRITE_PACKET_SIZE);
|
||||
}
|
||||
|
||||
void CougarKeyboardController::SetLedsDirect(std::vector<RGBColor> colours)
|
||||
{
|
||||
uint8_t max_leds = 14;
|
||||
uint8_t leds_remaining = (uint8_t)colours.size();
|
||||
uint8_t packet_flag = COUGARKEYBOARDCONTROLLER_DIRECTION_BYTE;
|
||||
uint8_t buffer[COUGARKEYBOARDCONTROLLER_WRITE_PACKET_SIZE] = { 0x00, 0x14, 0x2C, 0x0B, 0x00, 0xFF, 0x64, 0x00, 0x01 };
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Set up Direct packet |
|
||||
| keyvalue_map is the index of the Key from full_matrix_map |
|
||||
\*-----------------------------------------------------------------*/
|
||||
for(uint8_t leds2send = 0; leds2send < leds_remaining; leds2send += max_leds)
|
||||
{
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Check if there is enough leds for another pass |
|
||||
\*-----------------------------------------------------------------*/
|
||||
if(leds2send + max_leds > leds_remaining)
|
||||
{
|
||||
max_leds = leds_remaining - leds2send;
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| The last packet flag should be 0x03 |
|
||||
\*-----------------------------------------------------------------*/
|
||||
buffer[packet_flag] = 3;
|
||||
}
|
||||
|
||||
for(uint8_t i = 0; i < max_leds; i++)
|
||||
{
|
||||
uint8_t offset = COUGARKEYBOARDCONTROLLER_DATA_BYTE + (i * 4);
|
||||
uint8_t led_num = leds2send + i;
|
||||
|
||||
buffer[offset] = keyvalue_map[led_num];
|
||||
buffer[offset + 1] = RGBGetRValue(colours[led_num]);
|
||||
buffer[offset + 2] = RGBGetGValue(colours[led_num]);
|
||||
buffer[offset + 3] = RGBGetBValue(colours[led_num]);
|
||||
}
|
||||
hid_write(dev, buffer, COUGARKEYBOARDCONTROLLER_WRITE_PACKET_SIZE);
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| After the first packet the packet flag should be 0x02 |
|
||||
\*-----------------------------------------------------------------*/
|
||||
buffer[packet_flag] = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void CougarKeyboardController::Save(uint8_t flag)
|
||||
{
|
||||
uint8_t buffer[COUGARKEYBOARDCONTROLLER_WRITE_PACKET_SIZE] = { 0x00, 0x12, flag, 0x00, 0x00 };
|
||||
|
||||
hid_write(dev, buffer, COUGARKEYBOARDCONTROLLER_WRITE_PACKET_SIZE);
|
||||
}
|
||||
|
||||
void CougarKeyboardController::SendProfile(uint8_t profile, uint8_t light)
|
||||
{
|
||||
uint8_t buffer[COUGARKEYBOARDCONTROLLER_WRITE_PACKET_SIZE] = { 0x00, 0x14, 0x00, 0x00, 0x00, profile, light, 0x00, 0x00};
|
||||
|
||||
hid_write(dev, buffer, COUGARKEYBOARDCONTROLLER_WRITE_PACKET_SIZE);
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| CougarKeyboardController.h |
|
||||
| |
|
||||
| Driver for Cougar keyboard |
|
||||
| |
|
||||
| Chris M (DrNo) 05 Apr 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
#define COUGARKEYBOARDCONTROLLER_WRITE_PACKET_SIZE 65 //Buffer requires a prepended ReportID hence + 1
|
||||
#define HID_MAX_STR 255
|
||||
|
||||
#define COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MIN 0
|
||||
#define COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX 100
|
||||
#define COUGARKEYBOARDCONTROLLER_MATRIX_WIDTH 23
|
||||
|
||||
static const uint8_t direction_map[6] =
|
||||
{
|
||||
4, 0, 6, 2, 11, 12 //Left, Right, Up, Down, Horizontal, Vertical
|
||||
};
|
||||
|
||||
enum Cougar_Keyboard_Controller_Modes
|
||||
{
|
||||
COUGARKEYBOARDCONTROLLER_MODE_OFF = 0x0C, //Turn off - All leds off
|
||||
COUGARKEYBOARDCONTROLLER_MODE_DIRECT = 0x0B, //Customize Mode
|
||||
COUGARKEYBOARDCONTROLLER_MODE_STATIC = 0x00, //Steady Mode
|
||||
COUGARKEYBOARDCONTROLLER_MODE_BREATHING = 0x01, //Breathing Mode - Fades between fully off and fully on.
|
||||
COUGARKEYBOARDCONTROLLER_MODE_CIRCLE = 0x02,
|
||||
COUGARKEYBOARDCONTROLLER_MODE_REACTIVE = 0x03, //Click Mode
|
||||
COUGARKEYBOARDCONTROLLER_MODE_WAVE = 0x04,
|
||||
COUGARKEYBOARDCONTROLLER_MODE_RIPPLE = 0x05,
|
||||
COUGARKEYBOARDCONTROLLER_MODE_STAR = 0x06,
|
||||
COUGARKEYBOARDCONTROLLER_MODE_SCAN = 0x07,
|
||||
COUGARKEYBOARDCONTROLLER_MODE_RHYTHM = 0x08,
|
||||
COUGARKEYBOARDCONTROLLER_MODE_RAIN = 0x09,
|
||||
COUGARKEYBOARDCONTROLLER_MODE_SNAKE = 0x0A,
|
||||
};
|
||||
|
||||
enum Cougar_Keyboard_Controller_Byte_Map
|
||||
{
|
||||
COUGARKEYBOARDCONTROLLER_REPORT_BYTE = 1,
|
||||
COUGARKEYBOARDCONTROLLER_COMMAND_BYTE = 2,
|
||||
COUGARKEYBOARDCONTROLLER_MODE_BYTE = 3,
|
||||
COUGARKEYBOARDCONTROLLER_SPEED_BYTE = 5,
|
||||
COUGARKEYBOARDCONTROLLER_BRIGHTNESS_BYTE = 6,
|
||||
COUGARKEYBOARDCONTROLLER_RANDOM_BYTE = 7,
|
||||
COUGARKEYBOARDCONTROLLER_DIRECTION_BYTE = 8,
|
||||
COUGARKEYBOARDCONTROLLER_DATA_BYTE = 9,
|
||||
};
|
||||
|
||||
enum Cougar_Keyboard_Controller_Speeds
|
||||
{
|
||||
COUGARKEYBOARDCONTROLLER_SPEED_SLOWEST = 0x0A, // Slowest speed
|
||||
COUGARKEYBOARDCONTROLLER_SPEED_NORMAL = 0x05, // Normal speed
|
||||
COUGARKEYBOARDCONTROLLER_SPEED_FASTEST = 0x01, // Fastest speed
|
||||
};
|
||||
|
||||
class CougarKeyboardController
|
||||
{
|
||||
public:
|
||||
CougarKeyboardController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~CougarKeyboardController();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetSerial();
|
||||
std::string GetLocation();
|
||||
|
||||
void SetMode(uint8_t mode, uint8_t speed, uint8_t brightness, uint8_t direction, std::vector<RGBColor> colours, bool random_colours);
|
||||
void SetLedsDirect(std::vector<RGBColor> colours);
|
||||
void Save(uint8_t flag);
|
||||
void SendProfile(uint8_t profile, uint8_t light);
|
||||
private:
|
||||
std::string serial;
|
||||
std::string location;
|
||||
std::string name;
|
||||
hid_device* dev;
|
||||
};
|
||||
+511
@@ -0,0 +1,511 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_CougarKeyboard.cpp |
|
||||
| |
|
||||
| RGBController for Cougar keyboard |
|
||||
| |
|
||||
| Chris M (DrNo) 05 Apr 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#define NA 0xFFFFFFFF
|
||||
|
||||
#include <chrono>
|
||||
#include "hsv.h"
|
||||
#include "RGBControllerKeyNames.h"
|
||||
#include "RGBController_CougarKeyboard.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
static unsigned int matrix_map[6][COUGARKEYBOARDCONTROLLER_MATRIX_WIDTH] =
|
||||
{
|
||||
{ NA, 0, NA, 1, 2, 3, 4, 5, 6, 7, 8, NA, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 },
|
||||
{ 108, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, NA, 34, 35, 36, 37, 38, 39, 40 },
|
||||
{ 109, 41, NA, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61 },
|
||||
{ 110, 62, NA, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, NA, 74, NA, NA, NA, 75, 76, 77, NA },
|
||||
{ 111, 78, NA, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, NA, 89, NA, NA, 90, NA, 91, 92, 93, 94 },
|
||||
{ 112, 95, 96, 97, NA, NA, NA, 98, NA, NA, NA, 99, 100, NA, 101, 102, 103, 104, 105, 106, NA, 107, NA }
|
||||
};
|
||||
|
||||
static const char *led_names[] =
|
||||
{
|
||||
KEY_EN_ESCAPE, //00
|
||||
KEY_EN_F1,
|
||||
KEY_EN_F2,
|
||||
KEY_EN_F3,
|
||||
KEY_EN_F4,
|
||||
KEY_EN_F5,
|
||||
KEY_EN_F6,
|
||||
KEY_EN_F7,
|
||||
KEY_EN_F8,
|
||||
KEY_EN_F9,
|
||||
KEY_EN_F10, //10
|
||||
KEY_EN_F11,
|
||||
KEY_EN_F12,
|
||||
KEY_EN_PRINT_SCREEN,
|
||||
KEY_EN_SCROLL_LOCK,
|
||||
KEY_EN_PAUSE_BREAK,
|
||||
KEY_EN_MEDIA_PLAY_PAUSE, //OPEN MEDIA
|
||||
KEY_EN_MEDIA_VOLUME_DOWN,
|
||||
KEY_EN_MEDIA_VOLUME_UP,
|
||||
KEY_EN_MEDIA_MUTE,
|
||||
|
||||
KEY_EN_BACK_TICK, //20
|
||||
KEY_EN_1,
|
||||
KEY_EN_2,
|
||||
KEY_EN_3,
|
||||
KEY_EN_4,
|
||||
KEY_EN_5,
|
||||
KEY_EN_6,
|
||||
KEY_EN_7,
|
||||
KEY_EN_8,
|
||||
KEY_EN_9,
|
||||
KEY_EN_0, //30
|
||||
KEY_EN_MINUS,
|
||||
KEY_EN_EQUALS,
|
||||
KEY_EN_BACKSPACE,
|
||||
KEY_EN_INSERT,
|
||||
KEY_EN_HOME,
|
||||
KEY_EN_PAGE_UP,
|
||||
KEY_EN_NUMPAD_LOCK,
|
||||
KEY_EN_NUMPAD_DIVIDE,
|
||||
KEY_EN_NUMPAD_TIMES,
|
||||
KEY_EN_NUMPAD_MINUS, //40
|
||||
|
||||
KEY_EN_TAB,
|
||||
KEY_EN_Q,
|
||||
KEY_EN_W,
|
||||
KEY_EN_E,
|
||||
KEY_EN_R,
|
||||
KEY_EN_T,
|
||||
KEY_EN_Y,
|
||||
KEY_EN_U,
|
||||
KEY_EN_I,
|
||||
KEY_EN_O, //50
|
||||
KEY_EN_P,
|
||||
KEY_EN_LEFT_BRACKET,
|
||||
KEY_EN_RIGHT_BRACKET,
|
||||
KEY_EN_ANSI_BACK_SLASH,
|
||||
KEY_EN_DELETE,
|
||||
KEY_EN_END,
|
||||
KEY_EN_PAGE_DOWN,
|
||||
KEY_EN_NUMPAD_7,
|
||||
KEY_EN_NUMPAD_8,
|
||||
KEY_EN_NUMPAD_9, //60
|
||||
KEY_EN_NUMPAD_PLUS,
|
||||
|
||||
KEY_EN_CAPS_LOCK,
|
||||
KEY_EN_A,
|
||||
KEY_EN_S,
|
||||
KEY_EN_D,
|
||||
KEY_EN_F,
|
||||
KEY_EN_G,
|
||||
KEY_EN_H,
|
||||
KEY_EN_J,
|
||||
KEY_EN_K, //70
|
||||
KEY_EN_L,
|
||||
KEY_EN_SEMICOLON,
|
||||
KEY_EN_QUOTE,
|
||||
KEY_EN_ANSI_ENTER,
|
||||
KEY_EN_NUMPAD_4,
|
||||
KEY_EN_NUMPAD_5,
|
||||
KEY_EN_NUMPAD_6,
|
||||
|
||||
KEY_EN_LEFT_SHIFT,
|
||||
KEY_EN_Z,
|
||||
KEY_EN_X, //80
|
||||
KEY_EN_C,
|
||||
KEY_EN_V,
|
||||
KEY_EN_B,
|
||||
KEY_EN_N,
|
||||
KEY_EN_M,
|
||||
KEY_EN_COMMA,
|
||||
KEY_EN_PERIOD,
|
||||
KEY_EN_FORWARD_SLASH,
|
||||
KEY_EN_RIGHT_SHIFT,
|
||||
KEY_EN_UP_ARROW, //90
|
||||
KEY_EN_NUMPAD_1,
|
||||
KEY_EN_NUMPAD_2,
|
||||
KEY_EN_NUMPAD_3,
|
||||
KEY_EN_NUMPAD_ENTER,
|
||||
|
||||
KEY_EN_LEFT_CONTROL,
|
||||
KEY_EN_LEFT_WINDOWS,
|
||||
KEY_EN_LEFT_ALT,
|
||||
KEY_EN_SPACE,
|
||||
KEY_EN_RIGHT_ALT,
|
||||
KEY_EN_RIGHT_WINDOWS, //100
|
||||
KEY_EN_RIGHT_FUNCTION,
|
||||
KEY_EN_RIGHT_CONTROL,
|
||||
KEY_EN_LEFT_ARROW,
|
||||
KEY_EN_DOWN_ARROW,
|
||||
KEY_EN_RIGHT_ARROW,
|
||||
KEY_EN_NUMPAD_0,
|
||||
KEY_EN_NUMPAD_PERIOD,
|
||||
|
||||
"Key: G1",
|
||||
"Key: G2",
|
||||
"Key: G3", //110
|
||||
"Key: G4",
|
||||
"Key: G5"
|
||||
};
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Cougar 700K Evo Keyboard
|
||||
@category Keyboard
|
||||
@type USB
|
||||
@save :white_check_mark:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectCougar700kEvo
|
||||
@comment The Cougar 700K Evo controller implements all hardware modes
|
||||
found in the OEM software but has not been able to include all
|
||||
options for some modes. eg. Rainbow colour mode. Music mode was
|
||||
deteremined to be a software driven effect which can be added with
|
||||
the (OpenRGB Effects Engine plugin)[https://gitlab.com/OpenRGBDevelopers/OpenRGBEffectsPlugin].
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_CougarKeyboard::RGBController_CougarKeyboard(CougarKeyboardController *controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "Cougar";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Cougar Keyboard Device";
|
||||
serial = controller->GetSerial();
|
||||
location = controller->GetLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = COUGARKEYBOARDCONTROLLER_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = COUGARKEYBOARDCONTROLLER_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.colors.resize(Static.colors_max);
|
||||
Static.brightness_min = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MIN;
|
||||
Static.brightness_max = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Static.brightness = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = COUGARKEYBOARDCONTROLLER_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR |
|
||||
MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.colors.resize(Breathing.colors_max);
|
||||
Breathing.brightness_min = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MIN;
|
||||
Breathing.brightness_max = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Breathing.brightness = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Breathing.speed_min = COUGARKEYBOARDCONTROLLER_SPEED_SLOWEST;
|
||||
Breathing.speed_max = COUGARKEYBOARDCONTROLLER_SPEED_FASTEST;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.speed = COUGARKEYBOARDCONTROLLER_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Circle;
|
||||
Circle.name = "Spectrum Cycle";
|
||||
Circle.value = COUGARKEYBOARDCONTROLLER_MODE_CIRCLE;
|
||||
Circle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
Circle.brightness_min = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MIN;
|
||||
Circle.brightness_max = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Circle.brightness = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Circle.speed_min = COUGARKEYBOARDCONTROLLER_SPEED_SLOWEST;
|
||||
Circle.speed_max = COUGARKEYBOARDCONTROLLER_SPEED_FASTEST;
|
||||
Circle.color_mode = MODE_COLORS_NONE;
|
||||
Circle.speed = COUGARKEYBOARDCONTROLLER_SPEED_NORMAL;
|
||||
modes.push_back(Circle);
|
||||
|
||||
mode Reactive;
|
||||
Reactive.name = "Reactive";
|
||||
Reactive.value = COUGARKEYBOARDCONTROLLER_MODE_REACTIVE;
|
||||
Reactive.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR |
|
||||
MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
Reactive.colors_min = 1;
|
||||
Reactive.colors_max = 1;
|
||||
Reactive.colors.resize(Reactive.colors_max);
|
||||
Reactive.brightness_min = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MIN;
|
||||
Reactive.brightness_max = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Reactive.brightness = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Reactive.speed_min = COUGARKEYBOARDCONTROLLER_SPEED_SLOWEST;
|
||||
Reactive.speed_max = COUGARKEYBOARDCONTROLLER_SPEED_FASTEST;
|
||||
Reactive.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Reactive.speed = COUGARKEYBOARDCONTROLLER_SPEED_NORMAL;
|
||||
modes.push_back(Reactive);
|
||||
|
||||
mode Wave;
|
||||
Wave.name = "Wave";
|
||||
Wave.value = COUGARKEYBOARDCONTROLLER_MODE_WAVE;
|
||||
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR |
|
||||
MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_MANUAL_SAVE;
|
||||
Wave.colors_min = 1;
|
||||
Wave.colors_max = 1;
|
||||
Wave.colors.resize(Wave.colors_max);
|
||||
Wave.brightness_min = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MIN;
|
||||
Wave.brightness_max = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Wave.brightness = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Wave.speed_min = COUGARKEYBOARDCONTROLLER_SPEED_SLOWEST;
|
||||
Wave.speed_max = COUGARKEYBOARDCONTROLLER_SPEED_FASTEST;
|
||||
Wave.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Wave.speed = COUGARKEYBOARDCONTROLLER_SPEED_NORMAL;
|
||||
modes.push_back(Wave);
|
||||
|
||||
mode Ripple;
|
||||
Ripple.name = "Ripple";
|
||||
Ripple.value = COUGARKEYBOARDCONTROLLER_MODE_RIPPLE;
|
||||
Ripple.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR |
|
||||
MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
Ripple.colors_min = 1;
|
||||
Ripple.colors_max = 1;
|
||||
Ripple.colors.resize(Ripple.colors_max);
|
||||
Ripple.brightness_min = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MIN;
|
||||
Ripple.brightness_max = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Ripple.brightness = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Ripple.speed_min = COUGARKEYBOARDCONTROLLER_SPEED_SLOWEST;
|
||||
Ripple.speed_max = COUGARKEYBOARDCONTROLLER_SPEED_FASTEST;
|
||||
Ripple.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Ripple.speed = COUGARKEYBOARDCONTROLLER_SPEED_NORMAL;
|
||||
modes.push_back(Ripple);
|
||||
|
||||
mode Star;
|
||||
Star.name = "Star";
|
||||
Star.value = COUGARKEYBOARDCONTROLLER_MODE_STAR;
|
||||
Star.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR |
|
||||
MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
Star.colors_min = 1;
|
||||
Star.colors_max = 1;
|
||||
Star.colors.resize(Star.colors_max);
|
||||
Star.brightness_min = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MIN;
|
||||
Star.brightness_max = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Star.brightness = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Star.speed_min = COUGARKEYBOARDCONTROLLER_SPEED_SLOWEST;
|
||||
Star.speed_max = COUGARKEYBOARDCONTROLLER_SPEED_FASTEST;
|
||||
Star.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Star.speed = COUGARKEYBOARDCONTROLLER_SPEED_NORMAL;
|
||||
modes.push_back(Star);
|
||||
|
||||
mode Scan;
|
||||
Scan.name = "Scan";
|
||||
Scan.value = COUGARKEYBOARDCONTROLLER_MODE_SCAN;
|
||||
Scan.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR |
|
||||
MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD |
|
||||
MODE_FLAG_HAS_DIRECTION_HV | MODE_FLAG_MANUAL_SAVE;
|
||||
Scan.colors_min = 1;
|
||||
Scan.colors_max = 1;
|
||||
Scan.colors.resize(Scan.colors_max);
|
||||
Scan.brightness_min = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MIN;
|
||||
Scan.brightness_max = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Scan.brightness = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Scan.speed_min = COUGARKEYBOARDCONTROLLER_SPEED_SLOWEST;
|
||||
Scan.speed_max = COUGARKEYBOARDCONTROLLER_SPEED_FASTEST;
|
||||
Scan.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Scan.speed = COUGARKEYBOARDCONTROLLER_SPEED_NORMAL;
|
||||
modes.push_back(Scan);
|
||||
|
||||
mode Rhythm;
|
||||
Rhythm.name = "Rhythm";
|
||||
Rhythm.value = COUGARKEYBOARDCONTROLLER_MODE_RHYTHM;
|
||||
Rhythm.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR |
|
||||
MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
Rhythm.colors_min = 1;
|
||||
Rhythm.colors_max = 1;
|
||||
Rhythm.colors.resize(Rhythm.colors_max);
|
||||
Rhythm.brightness_min = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MIN;
|
||||
Rhythm.brightness_max = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Rhythm.brightness = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Rhythm.speed_min = COUGARKEYBOARDCONTROLLER_SPEED_SLOWEST;
|
||||
Rhythm.speed_max = COUGARKEYBOARDCONTROLLER_SPEED_FASTEST;
|
||||
Rhythm.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Rhythm.speed = COUGARKEYBOARDCONTROLLER_SPEED_NORMAL;
|
||||
modes.push_back(Rhythm);
|
||||
|
||||
mode Rain;
|
||||
Rain.name = "Rain";
|
||||
Rain.value = COUGARKEYBOARDCONTROLLER_MODE_RAIN;
|
||||
Rain.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR |
|
||||
MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
Rain.colors_min = 1;
|
||||
Rain.colors_max = 1;
|
||||
Rain.colors.resize(Rain.colors_max);
|
||||
Rain.brightness_min = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MIN;
|
||||
Rain.brightness_max = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Rain.brightness = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Rain.speed_min = COUGARKEYBOARDCONTROLLER_SPEED_SLOWEST;
|
||||
Rain.speed_max = COUGARKEYBOARDCONTROLLER_SPEED_FASTEST;
|
||||
Rain.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Rain.speed = COUGARKEYBOARDCONTROLLER_SPEED_NORMAL;
|
||||
modes.push_back(Rain);
|
||||
|
||||
mode Snake;
|
||||
Snake.name = "Snake";
|
||||
Snake.value = COUGARKEYBOARDCONTROLLER_MODE_SNAKE;
|
||||
Snake.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR |
|
||||
MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
|
||||
Snake.colors_min = 1;
|
||||
Snake.colors_max = 1;
|
||||
Snake.colors.resize(Snake.colors_max);
|
||||
Snake.brightness_min = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MIN;
|
||||
Snake.brightness_max = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Snake.brightness = COUGARKEYBOARDCONTROLLER_BRIGHTNESS_MAX;
|
||||
Snake.speed_min = COUGARKEYBOARDCONTROLLER_SPEED_SLOWEST;
|
||||
Snake.speed_max = COUGARKEYBOARDCONTROLLER_SPEED_FASTEST;
|
||||
Snake.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Snake.speed = COUGARKEYBOARDCONTROLLER_SPEED_NORMAL;
|
||||
modes.push_back(Snake);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = COUGARKEYBOARDCONTROLLER_MODE_OFF;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CougarKeyboard::~RGBController_CougarKeyboard()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CougarKeyboard::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
zone KB_zone;
|
||||
KB_zone.name = ZONE_EN_KEYBOARD;
|
||||
KB_zone.type = ZONE_TYPE_MATRIX;
|
||||
KB_zone.leds_count = 113;
|
||||
KB_zone.leds_min = KB_zone.leds_count;
|
||||
KB_zone.leds_max = KB_zone.leds_count;
|
||||
|
||||
KB_zone.matrix_map = new matrix_map_type;
|
||||
KB_zone.matrix_map->height = 6;
|
||||
KB_zone.matrix_map->width = COUGARKEYBOARDCONTROLLER_MATRIX_WIDTH;
|
||||
KB_zone.matrix_map->map = (unsigned int *)&matrix_map;
|
||||
zones.push_back(KB_zone);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t zone_index = 0; zone_index < zones.size(); zone_index++)
|
||||
{
|
||||
for(unsigned int led_index = 0; led_index < zones[zone_index].leds_count; led_index++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names[led_index];
|
||||
new_led.value = led_index;
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CougarKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CougarKeyboard::DeviceUpdateLEDs()
|
||||
{
|
||||
controller->SetLedsDirect(colors);
|
||||
}
|
||||
|
||||
void RGBController_CougarKeyboard::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
std::vector<RGBColor> colour;
|
||||
for(size_t i = 0; i < zones[zone].leds_count; i++)
|
||||
{
|
||||
colour.push_back(zones[zone].colors[i]);
|
||||
}
|
||||
|
||||
controller->SetLedsDirect(colour);
|
||||
}
|
||||
|
||||
void RGBController_CougarKeyboard::UpdateSingleLED(int led)
|
||||
{
|
||||
std::vector<RGBColor> colour;
|
||||
colour.push_back(colors[led]);
|
||||
|
||||
controller->SetLedsDirect(colour);
|
||||
}
|
||||
|
||||
void RGBController_CougarKeyboard::DeviceUpdateMode()
|
||||
{
|
||||
mode set_mode = modes[active_mode];
|
||||
std::vector<RGBColor> colours = (set_mode.colors);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| No mode set packets required for Direct mode |
|
||||
| Wave mode requires 5 colours based on the selected colour |
|
||||
\*---------------------------------------------------------*/
|
||||
switch(set_mode.value)
|
||||
{
|
||||
case COUGARKEYBOARDCONTROLLER_MODE_DIRECT:
|
||||
return;
|
||||
case COUGARKEYBOARDCONTROLLER_MODE_WAVE:
|
||||
if(set_mode.color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
hsv_t temp;
|
||||
colours.resize(1);
|
||||
rgb2hsv( colours[0], &temp);
|
||||
|
||||
temp.value = temp.value / 2;
|
||||
RGBColor half = hsv2rgb(&temp);
|
||||
|
||||
temp.value = temp.value / 4;
|
||||
RGBColor eighth = hsv2rgb(&temp);
|
||||
|
||||
colours.push_back(half);
|
||||
colours.push_back(eighth);
|
||||
colours.push_back(half);
|
||||
colours.push_back(colours[0]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t direction = direction_map[set_mode.direction];
|
||||
bool random_colours = (set_mode.color_mode == MODE_COLORS_RANDOM);
|
||||
|
||||
controller->SetMode( set_mode.value, set_mode.speed, set_mode.brightness, direction, colours, random_colours );
|
||||
}
|
||||
|
||||
void RGBController_CougarKeyboard::DeviceSaveMode()
|
||||
{
|
||||
const uint8_t start = 0x02;
|
||||
const uint8_t end = 0x03;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| The Keyboard has the ability to save 3 light modes across |
|
||||
| 3 profiles but currently we will only set the 1st of each |
|
||||
| Profiles = 1 thru 3 |
|
||||
| Lights = 0 thru 2 |
|
||||
\*---------------------------------------------------------*/
|
||||
controller->Save(start);
|
||||
std::this_thread::sleep_for(10ms);
|
||||
controller->SendProfile(1, 0);
|
||||
std::this_thread::sleep_for(150ms);
|
||||
DeviceUpdateMode();
|
||||
std::this_thread::sleep_for(10ms);
|
||||
controller->Save(end);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_CougarKeyboard.h |
|
||||
| |
|
||||
| RGBController for Cougar keyboard |
|
||||
| |
|
||||
| Chris M (DrNo) 05 Apr 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "LogManager.h"
|
||||
#include "RGBController.h"
|
||||
#include "CougarKeyboardController.h"
|
||||
|
||||
class RGBController_CougarKeyboard : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CougarKeyboard(CougarKeyboardController* controller_ptr);
|
||||
~RGBController_CougarKeyboard();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
int GetDeviceMode();
|
||||
int GetLED_Zone(int led_idx);
|
||||
|
||||
CougarKeyboardController* controller;
|
||||
};
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| CougarRevengerSTController.cpp |
|
||||
| |
|
||||
| Driver for Cougar Revenger ST |
|
||||
| |
|
||||
| Morgan Guimard (morg) 17 Mar 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <string.h>
|
||||
#include "CougarRevengerSTController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
CougarRevengerSTController::CougarRevengerSTController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = info.path;
|
||||
name = dev_name;
|
||||
version = "";
|
||||
|
||||
ActivateMode(0, DIRECT_MODE_VALUE);
|
||||
ActivateMode(1, DIRECT_MODE_VALUE);
|
||||
ActivateMode(2, DIRECT_MODE_VALUE);
|
||||
}
|
||||
|
||||
CougarRevengerSTController::~CougarRevengerSTController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string CougarRevengerSTController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string CougarRevengerSTController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string CougarRevengerSTController::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));
|
||||
}
|
||||
|
||||
std::string CougarRevengerSTController::GetFirmwareVersion()
|
||||
{
|
||||
return(version);
|
||||
}
|
||||
|
||||
void CougarRevengerSTController::SetDirect(unsigned char zone, RGBColor color, unsigned char brightness)
|
||||
{
|
||||
const cougar_mode& m = modes_mapping.at(DIRECT_MODE_VALUE);
|
||||
|
||||
unsigned char usb_buf[PACKET_DATA_LENGTH];
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = PACKET_START;
|
||||
usb_buf[0x02] = ACTION_SET;
|
||||
usb_buf[0x05] = m.zone_mode_byte[zone];
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Set RGB Values |
|
||||
\*-----------------------------------------*/
|
||||
SendColourPacket(m.zone_rgb_mapping[zone], RGBGetRValue(color), usb_buf);
|
||||
SendColourPacket(m.zone_rgb_mapping[zone] + 1, RGBGetGValue(color), usb_buf);
|
||||
SendColourPacket(m.zone_rgb_mapping[zone] + 2, RGBGetBValue(color), usb_buf);
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Set Brightness |
|
||||
\*-----------------------------------------*/
|
||||
usb_buf[0x04] = m.zone_brightness_mapping[zone];
|
||||
usb_buf[0x06] = brightness;
|
||||
|
||||
hid_send_feature_report(dev,usb_buf, PACKET_DATA_LENGTH);
|
||||
}
|
||||
|
||||
void CougarRevengerSTController::SetModeData(unsigned char zone, unsigned char mode_value, std::vector<RGBColor> colors, unsigned char brightness, unsigned char speed)
|
||||
{
|
||||
unsigned char usb_buf[PACKET_DATA_LENGTH];
|
||||
|
||||
const cougar_mode& m = modes_mapping.at(mode_value);
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Define colors |
|
||||
\*-----------------------------------------*/
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = PACKET_START;
|
||||
usb_buf[0x02] = ACTION_SET;
|
||||
|
||||
unsigned char offset = m.zone_rgb_mapping[zone];
|
||||
|
||||
usb_buf[0x05] = m.zone_rgb_byte[zone];
|
||||
|
||||
for(unsigned int i = 0; i < COLORS_SIZE; i++)
|
||||
{
|
||||
if(mode_value == BREATHING_MODE_VALUE && i >= 3 && zone == 2)
|
||||
{
|
||||
usb_buf[0x05] = 0x01;
|
||||
}
|
||||
|
||||
SendColourPacket(offset, RGBGetRValue(colors[i]), usb_buf);
|
||||
SendColourPacket(offset + 1, RGBGetGValue(colors[i]), usb_buf);
|
||||
SendColourPacket(offset + 2, RGBGetBValue(colors[i]), usb_buf);
|
||||
|
||||
offset += 4;
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Define speed |
|
||||
\*-----------------------------------------*/
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = PACKET_START;
|
||||
usb_buf[0x02] = ACTION_SET;
|
||||
usb_buf[0x04] = m.zone_speed_mapping[zone];
|
||||
usb_buf[0x05] = m.zone_speed_byte[zone];
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Dirty hack here: |
|
||||
| The OEM app or firmware seems to be |
|
||||
| broken, at full speed it flashes on |
|
||||
| the bottom zone. Let's adjust a bit the |
|
||||
| value so it's almost consistent with |
|
||||
| the other zones at full speed. |
|
||||
\*-----------------------------------------*/
|
||||
if(mode_value == SWIFT_MODE_VALUE && zone == 0)
|
||||
{
|
||||
usb_buf[0x06] = (speed + 1) * 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
usb_buf[0x06] = speed;
|
||||
}
|
||||
|
||||
hid_send_feature_report(dev,usb_buf, PACKET_DATA_LENGTH);
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Define brightness |
|
||||
\*-----------------------------------------*/
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = PACKET_START;
|
||||
usb_buf[0x02] = ACTION_SET;
|
||||
|
||||
usb_buf[0x05] = m.zone_brightness_byte[zone];
|
||||
usb_buf[0x06] = brightness;
|
||||
|
||||
offset = m.zone_brightness_mapping[zone];
|
||||
|
||||
for(unsigned int i = 0; i < COLORS_SIZE; i++)
|
||||
{
|
||||
if(mode_value == BREATHING_MODE_VALUE && i >= 4 && zone == 2)
|
||||
{
|
||||
usb_buf[0x05] = 0x01;
|
||||
}
|
||||
|
||||
usb_buf[0x04] = offset;
|
||||
hid_send_feature_report(dev,usb_buf, PACKET_DATA_LENGTH);
|
||||
|
||||
offset += 4;
|
||||
}
|
||||
|
||||
Apply();
|
||||
}
|
||||
|
||||
void CougarRevengerSTController::SendColourPacket(unsigned char address, unsigned char value, unsigned char *buffer)
|
||||
{
|
||||
buffer[0x04] = address;
|
||||
buffer[0x06] = value;
|
||||
|
||||
hid_send_feature_report(dev, buffer, PACKET_DATA_LENGTH);
|
||||
}
|
||||
|
||||
void CougarRevengerSTController::ActivateMode(unsigned char zone, unsigned char mode_value)
|
||||
{
|
||||
const cougar_mode& m = modes_mapping.at(mode_value);
|
||||
|
||||
unsigned char usb_buf[PACKET_DATA_LENGTH];
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = PACKET_START;
|
||||
usb_buf[0x02] = ACTION_SET;
|
||||
usb_buf[0x04] = m.zone_mode_mapping[zone]; // zone dependent?
|
||||
usb_buf[0x05] = m.zone_mode_byte[zone];
|
||||
usb_buf[0x06] = mode_value;
|
||||
|
||||
hid_send_feature_report(dev,usb_buf, PACKET_DATA_LENGTH);
|
||||
}
|
||||
|
||||
void CougarRevengerSTController::Apply()
|
||||
{
|
||||
unsigned char usb_buf[PACKET_DATA_LENGTH];
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = PACKET_START;
|
||||
usb_buf[0x02] = 0x03;
|
||||
usb_buf[0x03] = 0x03;
|
||||
usb_buf[0x04] = 0x03;
|
||||
|
||||
hid_send_feature_report(dev,usb_buf, PACKET_DATA_LENGTH);
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| CougarRevengerSTController.h |
|
||||
| |
|
||||
| Driver for Cougar Revenger ST |
|
||||
| |
|
||||
| Morgan Guimard (morg) 17 Mar 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <hidapi.h>
|
||||
|
||||
#define PACKET_DATA_LENGTH 9
|
||||
|
||||
enum
|
||||
{
|
||||
PACKET_START = 0xC4,
|
||||
ACTION_SET = 0x0F
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MIN_BRIGHTNESS = 0x00,
|
||||
MAX_BRIGHTNESS = 0xFF,
|
||||
MIN_SPEED_SWIFT = 0x2F,
|
||||
MIN_SPEED = 0x0F,
|
||||
MAX_SPEED = 0x00,
|
||||
COLORS_SIZE = 0x07
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
OFF_MODE_VALUE = 0x00,
|
||||
DIRECT_MODE_VALUE = 0x01,
|
||||
BREATHING_MODE_VALUE = 0x02,
|
||||
FLOW_MODE_VALUE = 0x03,
|
||||
SWIFT_MODE_VALUE = 0x04,
|
||||
FLOW_LEFT_MODE_VALUE = 0x09,
|
||||
FLOW_RIGHT_MODE_VALUE = 0x0B
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char zone_mode_mapping[3];
|
||||
unsigned char zone_mode_byte[3];
|
||||
unsigned char zone_rgb_mapping[3];
|
||||
unsigned char zone_rgb_byte[3];
|
||||
unsigned char zone_brightness_mapping[3];
|
||||
unsigned char zone_brightness_byte[3];
|
||||
unsigned char zone_speed_mapping[3];
|
||||
unsigned char zone_speed_byte[3];
|
||||
} cougar_mode;
|
||||
|
||||
const cougar_mode DIRECT_MODE =
|
||||
{
|
||||
{
|
||||
0x77, 0x55, 0xE6
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x79, 0x57, 0xE8
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x78, 0x56, 0xE7
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
}
|
||||
};
|
||||
|
||||
const cougar_mode OFF_MODE =
|
||||
{
|
||||
{
|
||||
0x77, 0x55, 0xE6
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
}
|
||||
};
|
||||
|
||||
const cougar_mode BREATHING_MODE =
|
||||
{
|
||||
{
|
||||
0x77, 0x55, 0xE6
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x85, 0x63, 0xF4
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x84, 0x62, 0xF3
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x7C, 0x5A, 0xEB
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
}
|
||||
};
|
||||
|
||||
const cougar_mode SWIFT_MODE =
|
||||
{
|
||||
{
|
||||
0x77, 0x55, 0xE6
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0xB0, 0x8E, 0x1F
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x01
|
||||
},
|
||||
{
|
||||
0xAF, 0x8D, 0x1E
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x01
|
||||
},
|
||||
{
|
||||
0xAD, 0x8B, 0x1C
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x01
|
||||
}
|
||||
};
|
||||
|
||||
const cougar_mode FLOW_MODE =
|
||||
{
|
||||
{
|
||||
0x77, 0x00, 0xE6
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0xB0, 0x00, 0x1F
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x01
|
||||
},
|
||||
{
|
||||
0xAF, 0x00, 0x1E
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x01
|
||||
},
|
||||
{
|
||||
0xAD, 0x00, 0x1C
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x01
|
||||
}
|
||||
};
|
||||
|
||||
static const std::map<unsigned char, cougar_mode> modes_mapping =
|
||||
{
|
||||
{
|
||||
DIRECT_MODE_VALUE,
|
||||
DIRECT_MODE
|
||||
},
|
||||
{
|
||||
OFF_MODE_VALUE,
|
||||
OFF_MODE
|
||||
},
|
||||
{
|
||||
BREATHING_MODE_VALUE,
|
||||
BREATHING_MODE
|
||||
},
|
||||
{
|
||||
SWIFT_MODE_VALUE,
|
||||
SWIFT_MODE
|
||||
},
|
||||
{
|
||||
FLOW_LEFT_MODE_VALUE,
|
||||
FLOW_MODE
|
||||
},
|
||||
{
|
||||
FLOW_RIGHT_MODE_VALUE,
|
||||
FLOW_MODE
|
||||
}
|
||||
};
|
||||
|
||||
class CougarRevengerSTController
|
||||
{
|
||||
public:
|
||||
CougarRevengerSTController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
|
||||
~CougarRevengerSTController();
|
||||
|
||||
std::string GetSerialString();
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetFirmwareVersion();
|
||||
std::string GetNameString();
|
||||
|
||||
void ActivateMode(unsigned char zone, unsigned char mode_value);
|
||||
void SetDirect(unsigned char zone, RGBColor color, unsigned char brightness);
|
||||
void SetModeData(unsigned char zone, unsigned char mode_value, std::vector<RGBColor> colors, unsigned char brightness, unsigned char speed);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
std::string version;
|
||||
|
||||
void Apply();
|
||||
void SendColourPacket(unsigned char address, unsigned char value, unsigned char * buffer);
|
||||
};
|
||||
+199
@@ -0,0 +1,199 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_CougarRevengerST.cpp |
|
||||
| |
|
||||
| RGBController for Cougar Revenger ST |
|
||||
| |
|
||||
| Morgan Guimard (morg) 17 Mar 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include "RGBController_CougarRevengerST.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Cougar Revenger ST
|
||||
@category Mouse
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectCougarRevengerSTControllers
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_CougarRevengerST::RGBController_CougarRevengerST(CougarRevengerSTController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "Cougar";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Cougar Revenger ST Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
version = controller->GetFirmwareVersion();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = DIRECT_MODE_VALUE;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.brightness_min = MIN_BRIGHTNESS;
|
||||
Direct.brightness_max = MAX_BRIGHTNESS;
|
||||
Direct.brightness = MAX_BRIGHTNESS;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = OFF_MODE_VALUE;
|
||||
Off.flags = MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = BREATHING_MODE_VALUE;
|
||||
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.brightness = MAX_BRIGHTNESS;
|
||||
Breathing.brightness_min = MIN_BRIGHTNESS;
|
||||
Breathing.brightness_max = MAX_BRIGHTNESS;
|
||||
Breathing.speed = MAX_SPEED;
|
||||
Breathing.speed_min = MIN_SPEED;
|
||||
Breathing.speed_max = MAX_SPEED;
|
||||
Breathing.colors_min = COLORS_SIZE;
|
||||
Breathing.colors_max = COLORS_SIZE;
|
||||
Breathing.colors.resize(COLORS_SIZE);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Swift;
|
||||
Swift.name = "Swift";
|
||||
Swift.value = SWIFT_MODE_VALUE;
|
||||
Swift.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Swift.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Swift.brightness = MAX_BRIGHTNESS;
|
||||
Swift.brightness_min = MIN_BRIGHTNESS;
|
||||
Swift.brightness_max = MAX_BRIGHTNESS;
|
||||
Swift.speed = MAX_SPEED;
|
||||
Swift.speed_min = MIN_SPEED_SWIFT;
|
||||
Swift.speed_max = MAX_SPEED;
|
||||
Swift.colors_min = COLORS_SIZE;
|
||||
Swift.colors_max = COLORS_SIZE;
|
||||
Swift.colors.resize(COLORS_SIZE);
|
||||
modes.push_back(Swift);
|
||||
|
||||
mode Flow;
|
||||
Flow.name = "Flow";
|
||||
Flow.value = FLOW_MODE_VALUE;
|
||||
Flow.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_DIRECTION_LR;
|
||||
Flow.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Flow.brightness = MAX_BRIGHTNESS;
|
||||
Flow.brightness_min = MIN_BRIGHTNESS;
|
||||
Flow.brightness_max = MAX_BRIGHTNESS;
|
||||
Flow.speed = MAX_SPEED;
|
||||
Flow.speed_min = MIN_SPEED;
|
||||
Flow.speed_max = MAX_SPEED;
|
||||
Flow.colors_min = COLORS_SIZE;
|
||||
Flow.colors_max = COLORS_SIZE;
|
||||
Flow.direction = MODE_DIRECTION_LEFT;
|
||||
Flow.colors.resize(COLORS_SIZE);
|
||||
modes.push_back(Flow);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CougarRevengerST::~RGBController_CougarRevengerST()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::SetupZones()
|
||||
{
|
||||
zone new_zone;
|
||||
|
||||
new_zone.name = "Bottom";
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
new_zone.leds_min = 1;
|
||||
new_zone.leds_max = 1;
|
||||
new_zone.leds_count = 1;
|
||||
new_zone.matrix_map = nullptr;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
new_zone.name = "Mouse wheel";
|
||||
zones.push_back(new_zone);
|
||||
|
||||
new_zone.name = "Logo";
|
||||
zones.push_back(new_zone);
|
||||
|
||||
leds.resize(zones.size());
|
||||
|
||||
for(unsigned int i = 0; i < leds.size(); i++)
|
||||
{
|
||||
leds[i].name = "LED " + std::to_string(i+1);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::DeviceUpdateLEDs()
|
||||
{
|
||||
for(unsigned int i = 0; i < colors.size(); i++)
|
||||
{
|
||||
UpdateZoneLEDs(i);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
controller->SetDirect(zone, colors[zone], modes[active_mode].brightness);
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::DeviceUpdateMode()
|
||||
{
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case DIRECT_MODE_VALUE:
|
||||
case OFF_MODE_VALUE:
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
controller->ActivateMode(zone_idx, modes[active_mode].value);
|
||||
}
|
||||
break;
|
||||
case BREATHING_MODE_VALUE:
|
||||
case SWIFT_MODE_VALUE:
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
controller->ActivateMode(zone_idx, modes[active_mode].value);
|
||||
controller->SetModeData(zone_idx, modes[active_mode].value, modes[active_mode].colors, modes[active_mode].brightness, modes[active_mode].speed);
|
||||
}
|
||||
break;
|
||||
|
||||
case FLOW_MODE_VALUE:
|
||||
|
||||
unsigned char mode_value = modes[active_mode].direction == MODE_DIRECTION_LEFT ? FLOW_LEFT_MODE_VALUE : FLOW_RIGHT_MODE_VALUE;
|
||||
|
||||
controller->ActivateMode(0, mode_value);
|
||||
controller->ActivateMode(1, OFF_MODE_VALUE);
|
||||
controller->ActivateMode(2, mode_value);
|
||||
|
||||
controller->SetModeData(0, mode_value, modes[active_mode].colors, modes[active_mode].brightness, modes[active_mode].speed);
|
||||
controller->SetModeData(2, mode_value, modes[active_mode].colors, modes[active_mode].brightness, modes[active_mode].speed);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_CougarRevengerST.h |
|
||||
| |
|
||||
| RGBController for Cougar Revenger ST |
|
||||
| |
|
||||
| Morgan Guimard (morg) 17 Mar 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CougarRevengerSTController.h"
|
||||
|
||||
class RGBController_CougarRevengerST : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CougarRevengerST(CougarRevengerSTController* controller_ptr);
|
||||
~RGBController_CougarRevengerST();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CougarRevengerSTController* controller;
|
||||
};
|
||||
Reference in New Issue
Block a user