mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-05-15 10:04:47 -04:00
60 lines
1.6 KiB
C++
60 lines
1.6 KiB
C++
/*-----------------------------------------*\
|
|
| N5312AController.h |
|
|
| |
|
|
| Driver for N5312A lighting |
|
|
| controller - header file |
|
|
| |
|
|
| Guimard Morgan (morg) 4/02/2022 |
|
|
\*-----------------------------------------*/
|
|
#pragma once
|
|
|
|
#include "RGBController.h"
|
|
#include <string>
|
|
#include <hidapi/hidapi.h>
|
|
|
|
#define N5312A_REPORT_ID 0x07
|
|
#define N5312A_PACKET_DATA_LENGTH 8
|
|
#define N5312A_NUMBER_OF_LEDS 1
|
|
#define N5312A_INIT_BYTE 0xA0
|
|
#define N5312A_SET_MODE_BYTE 0x0A
|
|
#define N5312A_SET_COLOR_BYTE 0x0B
|
|
|
|
enum
|
|
{
|
|
N5312A_BREATHING_MODE_VALUE = 0x00,
|
|
N5312A_SINGLE_BREATH_MODE_VALUE = 0x01,
|
|
N5312A_DIRECT_MODE_VALUE = 0x02,
|
|
N5312A_OFF_MODE_VALUE = 0x03
|
|
};
|
|
|
|
enum
|
|
{
|
|
N5312A_BRIGHTNESS_MIN = 0x0A,
|
|
N5312A_BRIGHTNESS_MAX = 0x64,
|
|
N5312A_SPEED_MIN = 0x01,
|
|
N5312A_SPEED_MAX = 0x0A
|
|
};
|
|
|
|
class N5312AController
|
|
{
|
|
public:
|
|
N5312AController(hid_device* dev_handle, const hid_device_info& info);
|
|
~N5312AController();
|
|
|
|
std::string GetSerialString();
|
|
std::string GetDeviceLocation();
|
|
std::string GetFirmwareVersion();
|
|
|
|
void SetColor(RGBColor color);
|
|
void SetMode(RGBColor color, unsigned char mode_value, unsigned char brightness, unsigned char speed);
|
|
|
|
private:
|
|
hid_device* dev;
|
|
|
|
std::string location;
|
|
std::string serial_number;
|
|
std::string version;
|
|
|
|
void SendInit();
|
|
};
|