-
-
Notifications
You must be signed in to change notification settings - Fork 313
Expand file tree
/
Copy pathLogitechG522Controller.h
More file actions
48 lines (39 loc) · 1.57 KB
/
LogitechG522Controller.h
File metadata and controls
48 lines (39 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*---------------------------------------------------------*\
| LogitechG522Controller.h |
| |
| Driver for Logitech G522 headset |
| |
| fawmdev 03 Dec 2024 |
| |
| 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"
/*-----------------------------------------------------*\
| Logitech G522 Protocol Constants |
\*-----------------------------------------------------*/
#define LOGITECH_G522_REPORT_ID 0x50
#define LOGITECH_G522_PACKET_SIZE 65
enum
{
LOGITECH_G522_MODE_OFF = 0x00,
LOGITECH_G522_MODE_DIRECT = 0x01,
};
class LogitechG522Controller
{
public:
LogitechG522Controller(hid_device* dev_handle, const char* path, std::string dev_name);
~LogitechG522Controller();
std::string GetDeviceLocation();
std::string GetDeviceName();
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
void SetOff();
private:
hid_device* dev;
std::string location;
std::string name;
void SendColorPacket(unsigned char red, unsigned char green, unsigned char blue);
};