mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-27 01:07:49 -05:00
70 lines
2.3 KiB
C++
70 lines
2.3 KiB
C++
/*-----------------------------------------*\
|
|
| LGMonitorController.h |
|
|
| |
|
|
| Driver for LG monitor lighting |
|
|
| controller - header file |
|
|
| |
|
|
| Guimard Morgan (morg) 10/11/2023 |
|
|
\*-----------------------------------------*/
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <hidapi/hidapi.h>
|
|
#include "RGBController.h"
|
|
|
|
#define LG_MONITOR_LEDS 48
|
|
#define LG_MONITOR_PACKET_SIZE 65
|
|
#define LG_MONITOR_READ_CMD 0x52 // R (Read)
|
|
#define LG_MONITOR_START_CMD_1 0x53 // S (Send)
|
|
#define LG_MONITOR_START_CMD_2 0x43 // C (Command)
|
|
#define LG_MONITOR_END_CMD_1 0x45 // E (End)
|
|
#define LG_MONITOR_END_CMD_2 0x44 // D (Data)
|
|
#define LG_MONITOR_READ_POWER_STATE 0xCE
|
|
#define LG_MONITOR_SET_POWER_STATE 0xCF
|
|
#define LG_MONITOR_SET_COLOR 0xCD
|
|
#define LG_MONITOR_SET_MODE 0xCA
|
|
#define LG_MONITOR_DIRECT_CTL 0xC1
|
|
#define LG_MONITOR_POWER_ON 0x01
|
|
#define LG_MONITOR_POWER_OFF 0x02
|
|
#define LG_MONITOR_MODE_CTL 0x03
|
|
#define LG_MONITOR_BRIGHTNESS_CTL 0x01
|
|
|
|
enum
|
|
{
|
|
LG_MONITOR_DIRECT_MODE_VALUE = 0x08,
|
|
LG_MONITOR_STATIC_SLOT_1_MODE_VALUE = 0x01,
|
|
LG_MONITOR_SPECTRUM_CYCLE_MODE_VALUE = 0x05,
|
|
LG_MONITOR_RAINBOW_MODE_VALUE = 0x06,
|
|
LG_MONITOR_OFF_MODE_VALUE = 0x00
|
|
};
|
|
|
|
class LGMonitorController
|
|
{
|
|
public:
|
|
LGMonitorController(hid_device* dev_handle, const hid_device_info& info);
|
|
~LGMonitorController();
|
|
|
|
std::string GetSerialString();
|
|
std::string GetDeviceLocation();
|
|
std::string GetFirmwareVersion();
|
|
|
|
void SetDirect(const std::vector<RGBColor> colors);
|
|
void SetMode(uint8_t mode_value, uint8_t brightness, const std::vector<RGBColor> colors);
|
|
|
|
private:
|
|
hid_device* dev;
|
|
std::string description;
|
|
std::string location;
|
|
std::string version;
|
|
std::string serial_number;
|
|
bool on = false;
|
|
bool direct_mode_enabled = false;
|
|
|
|
static uint8_t crc(const uint8_t data[], uint8_t start, uint8_t end);
|
|
void SetBrightness(uint8_t value);
|
|
void TurnOn(bool value);
|
|
void EnableDirectMode();
|
|
void EnableMode(uint8_t mode_value);
|
|
void SetSlotColor(uint8_t slot, const RGBColor color);
|
|
};
|