Formatting and organizational cleanup for controllers through CoolerMasterController
This commit is contained in:
parent
b6d5c64c5b
commit
9c2d30bbbd
56 changed files with 606 additions and 591 deletions
|
|
@ -6,12 +6,11 @@
|
|||
| Matt Mets (matt@blinkinlabs.com), 07/01/2021 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "BlinkyTapeController.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "BlinkyTapeController.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#define LPSTR char *
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
| Matt Mets (matt@blinkinlabs.com), 07/01/2021 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#ifndef BLINKYTAPE_H
|
||||
#define BLINKYTAPE_H
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "serial_port.h"
|
||||
|
|
@ -34,5 +33,3 @@ private:
|
|||
std::string port_name;
|
||||
serial_port *serialport = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,14 +1,17 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
#include "Detector.h"
|
||||
#include "BlinkyTapeController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_BlinkyTape.h"
|
||||
#include "find_usb_serial_port.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define BLINKINLABS_VID 0x1D50
|
||||
#define BLINKYTAPE_PID 0x605E
|
||||
/*-----------------------------------------------------*\
|
||||
| BlinkyTape VID and PID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define BLINKINLABS_VID 0x1D50
|
||||
#define BLINKYTAPE_PID 0x605E
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -21,19 +21,19 @@
|
|||
|
||||
RGBController_BlinkyTape::RGBController_BlinkyTape(BlinkyTapeController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "BlinkyTape";
|
||||
vendor = "Blinkinlabs";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = "BlinkyTape Controller Device";
|
||||
location = controller->GetLocation();
|
||||
name = "BlinkyTape";
|
||||
vendor = "Blinkinlabs";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = "BlinkyTape Controller Device";
|
||||
location = controller->GetLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "serial_port.h"
|
||||
#include "BlinkyTapeController.h"
|
||||
|
|
|
|||
|
|
@ -7,9 +7,8 @@
|
|||
| Sebastian Kraus 12/25/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "CherryKeyboardController.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "CherryKeyboardController.h"
|
||||
|
||||
CherryKeyboardController::CherryKeyboardController(hid_device* dev_handle, const char* path)
|
||||
{
|
||||
|
|
@ -62,7 +61,7 @@ void CherryKeyboardController::SetKeyboardColors
|
|||
{
|
||||
packet_size = size;
|
||||
}
|
||||
|
||||
|
||||
SendKeyboardData
|
||||
(
|
||||
&color_data[packet_offset],
|
||||
|
|
@ -148,7 +147,7 @@ void CherryKeyboardController::SendKeyboardBegin()
|
|||
usb_buf[0x01] = CHERRY_KB_COMMAND_BEGIN;
|
||||
usb_buf[0x02] = 0x00;
|
||||
usb_buf[0x03] = CHERRY_KB_COMMAND_BEGIN;
|
||||
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
|
|
@ -174,7 +173,7 @@ void CherryKeyboardController::SendKeyboardEnd()
|
|||
usb_buf[0x01] = CHERRY_KB_COMMAND_END;
|
||||
usb_buf[0x02] = 0x00;
|
||||
usb_buf[0x03] = CHERRY_KB_COMMAND_END;
|
||||
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
|
|
@ -210,7 +209,7 @@ void CherryKeyboardController::SendKeyboardData
|
|||
| Copy in data bytes |
|
||||
\*-----------------------------------------------------*/
|
||||
memcpy(&usb_buf[0x08], data, data_size);
|
||||
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Compute Checksum |
|
||||
\*-----------------------------------------------------*/
|
||||
|
|
|
|||
|
|
@ -7,12 +7,11 @@
|
|||
| Sebastian Kraus 12/25/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
|
||||
#define CHERRY_KB_PACKET_SIZE 64
|
||||
#define CHERRY_KB_MAX_PACKET_SIZE ( 0x36 )/* max packet size for color*/
|
||||
|
|
@ -85,7 +84,7 @@ enum
|
|||
CHERRY_KB_MODE_RADIATION = 0x12,
|
||||
CHERRY_KB_MODE_RIPPLES = 0x13,
|
||||
CHERRY_KB_MODE_SINGLE_KEY = 0x15,
|
||||
|
||||
|
||||
};
|
||||
|
||||
enum
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
#include "Detector.h"
|
||||
#include "CherryKeyboardController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CherryKeyboard.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Cherry keyboard VID and usage page |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CHERRY_KEYBOARD_VID 0x046A
|
||||
#define CHERRY_KEYBOARD_USAGE_PAGE 0xFF1C
|
||||
#define CHERRY_KEYBOARD_VID 0x046A
|
||||
#define CHERRY_KEYBOARD_USAGE_PAGE 0xFF1C
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CherryKeyboardController.h"
|
||||
|
||||
|
|
@ -20,7 +21,7 @@ public:
|
|||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "ColorfulGPUController.h"
|
||||
#include <cstring>
|
||||
#include "ColorfulGPUController.h"
|
||||
#include "pci_ids.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
#include "RGBController.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char colorful_gpu_dev_id;
|
||||
|
||||
#define COLORFUL_PACKET_LENGTH_V1 11
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#include "Detector.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
#include "Detector.h"
|
||||
#include "LogManager.h"
|
||||
#include "ColorfulGPUController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_ColorfulGPU.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "pci_ids.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
bool TestForColorfulGPU(i2c_smbus_interface* bus, uint8_t i2c_addr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "RGBController_ColorfulGPU.h"
|
||||
#include <array>
|
||||
#include "RGBController_ColorfulGPU.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Colorful GPU
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "ColorfulTuringGPUController.h"
|
||||
#include <cstring>
|
||||
#include "ColorfulTuringGPUController.h"
|
||||
|
||||
ColorfulTuringGPUController::ColorfulTuringGPUController(i2c_smbus_interface* bus, colorful_gpu_dev_id dev)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
#include "RGBController.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char colorful_gpu_dev_id;
|
||||
|
||||
#define COLORFUL_COLOR_PACKET_LENGTH 8
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#include "Detector.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
#include "Detector.h"
|
||||
#include "ColorfulTuringGPUController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_ColorfulTuringGPU.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "pci_ids.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void DetectColorfulTuringGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const std::string& name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "RGBController_ColorfulTuringGPU.h"
|
||||
#include <array>
|
||||
#include "RGBController_ColorfulTuringGPU.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Colorful GPU
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ public:
|
|||
private:
|
||||
ColorfulTuringGPUController* controller;
|
||||
int getModeIndex(int mode_value);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -85,12 +85,12 @@ void CMARGBController::GetStatus()
|
|||
|
||||
std::string CMARGBController::GetDeviceName()
|
||||
{
|
||||
return device_name;
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string CMARGBController::GetSerial()
|
||||
{
|
||||
return serial;
|
||||
return(serial);
|
||||
}
|
||||
|
||||
std::string CMARGBController::GetLocation()
|
||||
|
|
@ -100,37 +100,37 @@ std::string CMARGBController::GetLocation()
|
|||
|
||||
unsigned char CMARGBController::GetZoneIndex()
|
||||
{
|
||||
return zone_index;
|
||||
return(zone_index);
|
||||
}
|
||||
|
||||
unsigned char CMARGBController::GetMode()
|
||||
{
|
||||
return current_mode;
|
||||
return(current_mode);
|
||||
}
|
||||
|
||||
unsigned char CMARGBController::GetLedRed()
|
||||
{
|
||||
return current_red;
|
||||
return(current_red);
|
||||
}
|
||||
|
||||
unsigned char CMARGBController::GetLedGreen()
|
||||
{
|
||||
return current_green;
|
||||
return(current_green);
|
||||
}
|
||||
|
||||
unsigned char CMARGBController::GetLedBlue()
|
||||
{
|
||||
return current_blue;
|
||||
return(current_blue);
|
||||
}
|
||||
|
||||
unsigned char CMARGBController::GetLedSpeed()
|
||||
{
|
||||
return current_speed;
|
||||
return(current_speed);
|
||||
}
|
||||
|
||||
bool CMARGBController::GetRandomColours()
|
||||
{
|
||||
return bool_random;
|
||||
return(bool_random);
|
||||
}
|
||||
|
||||
void CMARGBController::SetLedCount(int zone, int led_count)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <array>
|
||||
|
|
@ -16,8 +18,6 @@
|
|||
#include <hidapi/hidapi.h>
|
||||
#include "RGBController.h" //Needed to set the direct mode
|
||||
|
||||
#pragma once
|
||||
|
||||
#define CM_ARGB_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
|
||||
#define CM_ARGB_HEADER_DATA_SIZE (sizeof(argb_header_data) / sizeof(argb_headers) )
|
||||
#define CM_ARGB_INTERRUPT_TIMEOUT 250
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "RGBController.h"
|
||||
#include "CMARGBController.h"
|
||||
#include <vector>
|
||||
|
||||
#define first_zone(zn) ((zones.size() > 1) ? 1 : 0)
|
||||
#define last_zone(zn) ((zones.size() > 1) ? 4 : 1)
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "CMARGBGen2A1Controller.h"
|
||||
#include <cstring>
|
||||
#include "CMARGBGen2A1Controller.h"
|
||||
|
||||
CMARGBGen2A1controller::CMARGBGen2A1controller(hid_device* dev_handle, const hid_device_info& info)
|
||||
{
|
||||
|
|
@ -288,7 +288,7 @@ std::vector<unsigned char> CMARGBGen2A1controller::CreateColorData(std::vector<R
|
|||
color_data.push_back(RGBGetBValue(colors[c]));
|
||||
}
|
||||
|
||||
return color_data;
|
||||
return(color_data);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
|
||||
#define CM_ARGB_GEN2_A1_PACKET_LENGTH 65
|
||||
#define CM_ARGB_GEN2_A1_CHANNEL_MAX_SIZE 48
|
||||
|
|
|
|||
|
|
@ -7,10 +7,9 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_CMARGBGen2A1Controller.h"
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include "RGBController_CMARGBGen2A1Controller.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Coolermaster ARGB A1
|
||||
|
|
@ -245,7 +244,7 @@ void RGBController_CMARGBGen2A1Controller::DeviceUpdateLEDs()
|
|||
}
|
||||
|
||||
void RGBController_CMARGBGen2A1Controller::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
{
|
||||
if(zones[zone].leds_count > 0)
|
||||
{
|
||||
unsigned int start = zones[zone].start_idx;
|
||||
|
|
@ -265,7 +264,7 @@ void RGBController_CMARGBGen2A1Controller::UpdateZoneLEDs(int zone)
|
|||
}
|
||||
|
||||
void RGBController_CMARGBGen2A1Controller::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "RGBController.h"
|
||||
#include "CMARGBGen2A1Controller.h"
|
||||
#include <vector>
|
||||
|
||||
class RGBController_CMARGBGen2A1Controller : public RGBController
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
| Tam D (too.manyhobbies) 30th Nov 2023 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "CMKeyboardAbstractController.h"
|
||||
|
||||
CMKeyboardAbstractController::CMKeyboardAbstractController(hid_device* dev_handle, hid_device_info* dev_info)
|
||||
|
|
@ -31,16 +32,15 @@ CMKeyboardAbstractController::CMKeyboardAbstractController(hid_device* dev_handl
|
|||
{
|
||||
if(cm_kb_device_list[i]->product_id == m_productId)
|
||||
{
|
||||
bNotFound = false;
|
||||
m_deviceIndex = i;
|
||||
bNotFound = false;
|
||||
m_deviceIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(bNotFound)
|
||||
{
|
||||
LOG_ERROR("[%s] device capabilities not found. Please creata a new device request.",
|
||||
m_deviceName.c_str());
|
||||
LOG_ERROR("[%s] device capabilities not found. Please creata a new device request.", m_deviceName.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ CMKeyboardAbstractController::~CMKeyboardAbstractController()
|
|||
|
||||
std::string CMKeyboardAbstractController::GetDeviceName()
|
||||
{
|
||||
return m_deviceName;
|
||||
return(m_deviceName);
|
||||
}
|
||||
|
||||
void CMKeyboardAbstractController::SetDeviceName(std::string name)
|
||||
|
|
@ -64,32 +64,32 @@ void CMKeyboardAbstractController::SetDeviceName(std::string name)
|
|||
|
||||
std::string CMKeyboardAbstractController::GetDeviceVendor()
|
||||
{
|
||||
return m_vendorName;
|
||||
return(m_vendorName);
|
||||
}
|
||||
|
||||
std::string CMKeyboardAbstractController::GetDeviceSerial()
|
||||
{
|
||||
return m_serialNumber;
|
||||
return(m_serialNumber);
|
||||
}
|
||||
|
||||
const cm_kb_device* CMKeyboardAbstractController::GetDeviceData()
|
||||
{
|
||||
return cm_kb_device_list[m_deviceIndex];
|
||||
return(cm_kb_device_list[m_deviceIndex]);
|
||||
}
|
||||
|
||||
std::string CMKeyboardAbstractController::GetLocation()
|
||||
{
|
||||
return m_sLocation;
|
||||
return(m_sLocation);
|
||||
}
|
||||
|
||||
std::string CMKeyboardAbstractController::GetFirmwareVersion()
|
||||
{
|
||||
return m_sFirmwareVersion;
|
||||
return(m_sFirmwareVersion);
|
||||
}
|
||||
|
||||
int CMKeyboardAbstractController::GetProductID()
|
||||
{
|
||||
return m_productId;
|
||||
return(m_productId);
|
||||
}
|
||||
|
||||
std::vector<uint8_t> CMKeyboardAbstractController::SendCommand(std::vector<uint8_t> buf, uint8_t fill)
|
||||
|
|
@ -112,7 +112,7 @@ std::vector<uint8_t> CMKeyboardAbstractController::SendCommand(std::vector<uint8
|
|||
if(status < 0)
|
||||
{
|
||||
LOG_ERROR("[%s] SendCommand() failed code %d.", m_deviceName.c_str(), status);
|
||||
return read;
|
||||
return(read);
|
||||
}
|
||||
|
||||
memset(data, 0, CM_KEYBOARD_WRITE_SIZE);
|
||||
|
|
@ -121,7 +121,7 @@ std::vector<uint8_t> CMKeyboardAbstractController::SendCommand(std::vector<uint8
|
|||
if(status < 0)
|
||||
{
|
||||
LOG_ERROR("[%s] SendCommand() failed code %d.", m_deviceName.c_str(), status);
|
||||
return read;
|
||||
return(read);
|
||||
}
|
||||
|
||||
for(i = 0; i < (size_t)status; i++)
|
||||
|
|
@ -129,7 +129,7 @@ std::vector<uint8_t> CMKeyboardAbstractController::SendCommand(std::vector<uint8
|
|||
read.push_back(data[i]);
|
||||
}
|
||||
|
||||
return read;
|
||||
return(read);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
@ -158,10 +158,10 @@ uint8_t CMKeyboardAbstractController::GetActiveProfile()
|
|||
|
||||
if(data.size() > 4)
|
||||
{
|
||||
return (int)data[4];
|
||||
return((int)data[4]);
|
||||
}
|
||||
|
||||
return 0xFF; // error
|
||||
return(0xFF); // error
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
@ -187,7 +187,8 @@ void CMKeyboardAbstractController::SaveProfile()
|
|||
uint8_t CMKeyboardAbstractController::GetModeStatus()
|
||||
{
|
||||
std::vector<uint8_t> data = SendCommand({0x52, 0x28});
|
||||
return data[4];
|
||||
|
||||
return(data[4]);
|
||||
};
|
||||
|
||||
std::string CMKeyboardAbstractController::GetHexString(std::vector<uint8_t> buf)
|
||||
|
|
@ -199,5 +200,5 @@ std::string CMKeyboardAbstractController::GetHexString(std::vector<uint8_t> buf)
|
|||
hexss << std::hex << b << " ";
|
||||
}
|
||||
|
||||
return hexss.str();
|
||||
return(hexss.str());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,15 +15,12 @@
|
|||
#include <sstream>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#include "CMKeyboardDevices.h"
|
||||
#include "KeyboardLayoutManager.h"
|
||||
#include "RGBController.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
|
||||
#define HID_MAX_STR 255
|
||||
#define CM_KEYBOARD_WRITE_SIZE 65
|
||||
#define CM_MAX_LEDS 255
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
| Tam D (too.manyhobbies) 30th Nov 2023 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "CMKeyboardDevices.h"
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
| Tam D (too.manyhobbies) 30th Nov 2023 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@
|
|||
| Tam D (too.manyhobbies) 30th Nov 2023 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include <cmath>
|
||||
#include "CMKeyboardV1Controller.h"
|
||||
#include "LogManager.h"
|
||||
#include <cmath>
|
||||
|
||||
CMKeyboardV1Controller::CMKeyboardV1Controller(hid_device* dev_handle, hid_device_info* dev_info) : CMKeyboardAbstractController(dev_handle, dev_info)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@
|
|||
| Tam D (too.manyhobbies) 30th Nov 2023 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CMKeyboardAbstractController.h"
|
||||
|
||||
class CMKeyboardV1Controller : public CMKeyboardAbstractController
|
||||
|
|
@ -35,5 +38,4 @@ public:
|
|||
|
||||
private:
|
||||
std::string _GetFirmwareVersion();
|
||||
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -6,6 +6,9 @@
|
|||
| Tam D (too.manyhobbies) 30th Nov 2023 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CMKeyboardAbstractController.h"
|
||||
|
||||
struct stCMKeyboardV2_mode
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "CMMM711Controller.h"
|
||||
#include <cstring>
|
||||
#include "CMMM711Controller.h"
|
||||
|
||||
CMMM711Controller::CMMM711Controller(hid_device* dev_handle, char *_path)
|
||||
{
|
||||
|
|
@ -87,12 +87,12 @@ void CMMM711Controller::GetModeStatus()
|
|||
|
||||
std::string CMMM711Controller::GetDeviceName()
|
||||
{
|
||||
return device_name;
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string CMMM711Controller::GetSerial()
|
||||
{
|
||||
return serial;
|
||||
return(serial);
|
||||
}
|
||||
|
||||
std::string CMMM711Controller::GetLocation()
|
||||
|
|
@ -102,37 +102,37 @@ std::string CMMM711Controller::GetLocation()
|
|||
|
||||
unsigned char CMMM711Controller::GetMode()
|
||||
{
|
||||
return current_mode;
|
||||
return(current_mode);
|
||||
}
|
||||
|
||||
unsigned char CMMM711Controller::GetLedRed()
|
||||
{
|
||||
return current_red;
|
||||
return(current_red);
|
||||
}
|
||||
|
||||
unsigned char CMMM711Controller::GetLedGreen()
|
||||
{
|
||||
return current_green;
|
||||
return(current_green);
|
||||
}
|
||||
|
||||
unsigned char CMMM711Controller::GetLedBlue()
|
||||
{
|
||||
return current_blue;
|
||||
return(current_blue);
|
||||
}
|
||||
|
||||
unsigned char CMMM711Controller::GetLedSpeed()
|
||||
{
|
||||
return current_speed;
|
||||
return(current_speed);
|
||||
}
|
||||
|
||||
RGBColor CMMM711Controller::GetWheelColour()
|
||||
{
|
||||
return wheel_colour;
|
||||
return(wheel_colour);
|
||||
}
|
||||
|
||||
RGBColor CMMM711Controller::GetLogoColour()
|
||||
{
|
||||
return logo_colour;
|
||||
return(logo_colour);
|
||||
}
|
||||
|
||||
void CMMM711Controller::SetLedsDirect(RGBColor wheel_colour, RGBColor logo_colour)
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
#define CM_MM711_PACKET_SIZE 65
|
||||
#define CM_MM711_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
|
||||
#define CM_MM711_HEADER_DATA_SIZE (sizeof(argb_header_data) / sizeof(argb_headers) )
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#define applyBrightness(c, bright) ((RGBColor) ((RGBGetBValue(c) * bright / CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT) << 16 | (RGBGetGValue(c) * bright / CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT) << 8 | (RGBGetRValue(c) * bright / CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT)))
|
||||
|
||||
#include "RGBController_CMMM711Controller.h"
|
||||
|
||||
#define applyBrightness(c, bright) ((RGBColor) ((RGBGetBValue(c) * bright / CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT) << 16 | (RGBGetGValue(c) * bright / CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT) << 8 | (RGBGetRValue(c) * bright / CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT)))
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Coolermaster Master Mouse
|
||||
@category Mouse
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "RGBController.h"
|
||||
#include "CMMM711Controller.h"
|
||||
#include <vector>
|
||||
|
||||
#define CM_MM_ARGB_BRIGHTNESS_MIN 0x00
|
||||
#define CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT 0xFF
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "CMMMController.h"
|
||||
#include <cstring>
|
||||
#include "CMMMController.h"
|
||||
|
||||
CMMMController::CMMMController(hid_device* dev_handle, char *_path, uint16_t pid) : product_id(pid)
|
||||
{
|
||||
|
|
@ -60,8 +60,8 @@ CMMMController::CMMMController(hid_device* dev_handle, char *_path, uint16_t pid
|
|||
wheel_bytes[0] = CM_MM_MODE_BYTE;
|
||||
wheel_bytes[1] = CM_MM_SPEED_BYTE;
|
||||
wheel_bytes[2] = CM_MM_NFI_1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
logo_bytes[0] = CM_MM_NFI_2;
|
||||
logo_bytes[1] = CM_MM_NFI_3;
|
||||
logo_bytes[2] = CM_MM_BRIGHTNESS_BYTE;
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
#define CM_MM_PACKET_SIZE 65
|
||||
#define CM_MM_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
|
||||
#define CM_MM_HEADER_DATA_SIZE (sizeof(argb_header_data) / sizeof(argb_headers) )
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#define applyBrightness(c, bright) ((RGBColor) ((RGBGetBValue(c) * bright / CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT) << 16 | (RGBGetGValue(c) * bright / CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT) << 8 | (RGBGetRValue(c) * bright / CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT)))
|
||||
|
||||
#include "RGBController_CMMMController.h"
|
||||
|
||||
#define applyBrightness(c, bright) ((RGBColor) ((RGBGetBValue(c) * bright / CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT) << 16 | (RGBGetGValue(c) * bright / CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT) << 8 | (RGBGetRValue(c) * bright / CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT)))
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Coolermaster Master Mouse
|
||||
@category Mouse
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@
|
|||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "RGBController.h"
|
||||
#include "CMMMController.h"
|
||||
#include <vector>
|
||||
|
||||
#define CM_MM_ARGB_BRIGHTNESS_MIN 0x00
|
||||
#define CM_MM_ARGB_BRIGHTNESS_MAX_DEFAULT 0xFF
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@
|
|||
| BYTE5 = Colour Modes: SPEED else ignored |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include <array>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define CM_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
|
||||
#define CM_INTERRUPT_TIMEOUT 250
|
||||
#define CM_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CMMP750Controller.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "CMMonitorController.h"
|
||||
#include <cstring>
|
||||
#include "CMMonitorController.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
|
||||
#define CM_MONITOR_PACKET_LENGTH 65
|
||||
#define CM_MONITOR_COLOR_DATA_LENGTH 436
|
||||
|
|
|
|||
|
|
@ -7,10 +7,9 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_CMMonitorController.h"
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include "RGBController_CMMonitorController.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Coolermaster Gaming Monitor
|
||||
|
|
@ -175,7 +174,7 @@ void RGBController_CMMonitorController::ResizeZone(int /*zone*/, int /*new_size*
|
|||
}
|
||||
|
||||
void RGBController_CMMonitorController::DeviceUpdateLEDs()
|
||||
{
|
||||
{
|
||||
if(modes[active_mode].value == CM_MONITOR_DIRECT_MODE)
|
||||
{
|
||||
controller->SendDirect(colors);
|
||||
|
|
@ -187,12 +186,12 @@ void RGBController_CMMonitorController::DeviceUpdateLEDs()
|
|||
}
|
||||
|
||||
void RGBController_CMMonitorController::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CMMonitorController::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,12 @@
|
|||
| morg (Morgan Guimard) 9/18/2023 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "RGBController.h"
|
||||
#include "CMMonitorController.h"
|
||||
#include <vector>
|
||||
|
||||
class RGBController_CMMonitorController : public RGBController
|
||||
{
|
||||
|
|
@ -25,6 +27,6 @@ public:
|
|||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
private:
|
||||
CMMonitorController* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
| Eric S (edbgon) 2nd Feb 2021 |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "CMR6000Controller.h"
|
||||
#include <cstring>
|
||||
#include "CMR6000Controller.h"
|
||||
|
||||
CMR6000Controller::CMR6000Controller(hid_device* dev_handle, char *_path, uint16_t _pid)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@
|
|||
| Eric S (edbgon) 2nd Feb 2021 |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
#define COOLERMASTER_RADEON_6000_PID 0x014D
|
||||
#define COOLERMASTER_RADEON_6900_PID 0x015B
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CMR6000Controller.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "RGBController_CMRGBController.h"
|
||||
#include "CMRGBController.h"
|
||||
#include <cstring>
|
||||
|
||||
CMRGBController::CMRGBController(hid_device* dev_handle, char* path)
|
||||
{
|
||||
|
|
@ -328,10 +328,10 @@ RGBColor CMRGBController::GetModeColor(int color_number)
|
|||
{
|
||||
case 0:
|
||||
return(current_mode_color_1);
|
||||
|
||||
|
||||
case 1:
|
||||
return(current_mode_color_2);
|
||||
|
||||
|
||||
default:
|
||||
return(ToRGBColor(0, 0, 0));
|
||||
}
|
||||
|
|
@ -343,16 +343,16 @@ RGBColor CMRGBController::GetPortColor(int port_number)
|
|||
{
|
||||
case 0:
|
||||
return(current_port1_color);
|
||||
|
||||
|
||||
case 1:
|
||||
return(current_port2_color);
|
||||
|
||||
|
||||
case 2:
|
||||
return(current_port3_color);
|
||||
|
||||
|
||||
case 3:
|
||||
return(current_port4_color);
|
||||
|
||||
|
||||
default:
|
||||
return(ToRGBColor(0, 0, 0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,12 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
#pragma once
|
||||
#define CM_RGBC_NUM_LEDS 4
|
||||
|
||||
#define REPORT_ID_OFFSET 1
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "RGBController.h"
|
||||
#include "CMRGBController.h"
|
||||
#include <vector>
|
||||
|
||||
class RGBController_CMRGBController : public RGBController
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "CMSmallARGBController.h"
|
||||
#include <cstring>
|
||||
#include "CMSmallARGBController.h"
|
||||
|
||||
cm_small_argb_headers cm_small_argb_header_data[1] =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@
|
|||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
#include "RGBController.h" //Needed to set the direct mode
|
||||
|
||||
#pragma once
|
||||
|
||||
#define CM_SMALL_ARGB_PACKET_SIZE 65
|
||||
#define CM_SMALL_ARGB_INTERRUPT_TIMEOUT 250
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "RGBController.h"
|
||||
#include "CMSmallARGBController.h"
|
||||
#include <vector>
|
||||
|
||||
#define CM_SMALL_ARGB_MIN_LEDS 4
|
||||
#define CM_SMALL_ARGB_MAX_LEDS 48
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue