Initial commit for the Corsair MM700 to resolve #1718
+ Adding CorsairPeripheralV2Controller base class + Adding CorsairPeripheralV2Devices.h metadata file + Renaming CorsairK55RGBPROController to CorsairPeripheralV2SWController + Adjusting CorsairPeripheralV2SWController to accomodate base class changes + Renaming RGBController_CorsairK55RGBPRO to RGBController_CorsairV2SW + Adjusting RGBController_CorsairV2SW to handle device set up from meta data + Adding PID `0x1B9B` and registering detector in CorsairPeripheralV2ControllerDetect.cpp
This commit is contained in:
parent
9caf7802ed
commit
3a71b76075
14 changed files with 970 additions and 350 deletions
|
|
@ -0,0 +1,95 @@
|
|||
/*---------------------------------------------------------------------*\
|
||||
| CorsairPeripheralV2Controller.h |
|
||||
| |
|
||||
| Base class for the 08 based Corsair protocol |
|
||||
| |
|
||||
| Chris M (Dr_No) 07 Aug 2022 |
|
||||
| |
|
||||
\*---------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
#include "LogManager.h"
|
||||
#include "RGBController.h"
|
||||
#include "CorsairPeripheralV2Devices.h"
|
||||
|
||||
#define NA 0xFFFFFFFF
|
||||
#define HID_MAX_STR 255
|
||||
|
||||
#define CORSAIR_V2_WRITE_ID 8
|
||||
#define CORSAIR_V2_VALUE_MODE 3
|
||||
#define CORSAIR_V2_WRITE_SIZE 65
|
||||
|
||||
#define CORSAIR_V2_BRIGHTNESS_MIN 0
|
||||
#define CORSAIR_V2_BRIGHTNESS_MAX 0xFF
|
||||
|
||||
enum corsair_v2_cmd
|
||||
{
|
||||
CORSAIR_V2_CMD_SET = 0x01, /* Command for setting values */
|
||||
CORSAIR_V2_CMD_GET = 0x02, /* Command for getting values */
|
||||
CORSAIR_V2_CMD_STOP_TX = 0x05, /* Finish Transaction */
|
||||
CORSAIR_V2_CMD_BLK_W1 = 0x06, /* Block write packet 1 */
|
||||
CORSAIR_V2_CMD_BLK_WN = 0x07, /* Block write remaining packets */
|
||||
CORSAIR_V2_CMD_START_TX = 0x0D, /* Start Transaction */
|
||||
};
|
||||
|
||||
enum corsair_v2_mode
|
||||
{
|
||||
CORSAIR_V2_MODE_DIRECT = 0x0000,
|
||||
CORSAIR_V2_MODE_STATIC = 0x207E,
|
||||
CORSAIR_V2_MODE_FLASHING = 0xAD4F,
|
||||
CORSAIR_V2_MODE_BREATHING = 0xA5FA,
|
||||
CORSAIR_V2_MODE_SPECTRUM = 0x7BFF,
|
||||
CORSAIR_V2_MODE_RAINBOW = 0xB94C,
|
||||
CORSAIR_V2_MODE_RAIN = 0xA07E,
|
||||
CORSAIR_V2_MODE_SPIRAL = 0xAB87,
|
||||
CORSAIR_V2_MODE_WATERCOLOR = 0x0022,
|
||||
CORSAIR_V2_MODE_REACTIVE = 0xB1F9,
|
||||
CORSAIR_V2_MODE_RIPPLE = 0x09A2,
|
||||
CORSAIR_V2_MODE_VISOR = 0x90C0
|
||||
};
|
||||
|
||||
enum corsair_v2_color
|
||||
{
|
||||
CORSAIR_V2_COLOR_NONE = 0x00,
|
||||
CORSAIR_V2_COLOR_SPECIFIC = 0x01,
|
||||
CORSAIR_V2_COLOR_RANDOM = 0x02,
|
||||
CORSAIR_V2_COLOR_UNKNOWN = 0x03
|
||||
};
|
||||
|
||||
|
||||
class CorsairPeripheralV2Controller
|
||||
{
|
||||
public:
|
||||
CorsairPeripheralV2Controller(hid_device* dev_handle, const char* path, std::string name, uint16_t pid);
|
||||
~CorsairPeripheralV2Controller();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetFirmwareString();
|
||||
std::string GetName();
|
||||
std::string GetSerialString();
|
||||
const corsair_device* GetDeviceData();
|
||||
|
||||
void SetRenderMode(corsair_v2_device_mode mode);
|
||||
void LightingControl(uint8_t opt1, uint8_t opt2);
|
||||
void SetLEDs(uint8_t *data, uint16_t data_size);
|
||||
void UpdateHWMode(uint16_t mode, corsair_v2_color color_mode, uint8_t speed,
|
||||
uint8_t direction, uint8_t brightness, std::vector<RGBColor> colors);
|
||||
|
||||
virtual void SetLedsDirect(std::vector<RGBColor> colors) = 0;
|
||||
private:
|
||||
void GetAddress(uint8_t address);
|
||||
void StartTransaction(uint8_t opt1);
|
||||
void StopTransaction(uint8_t opt1);
|
||||
|
||||
hid_device* dev;
|
||||
|
||||
uint8_t write_cmd;
|
||||
uint16_t device_index;
|
||||
std::string firmware_version;
|
||||
std::string location;
|
||||
std::string device_name;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue