This repository has been archived by the owner on Oct 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.cpp
77 lines (56 loc) · 1.51 KB
/
main.cpp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* main.cpp
* -------------------------
* Enter Description
* -------------------------
* Stavros Avramidis 3/7/2019
*/
#include <stdio.h>
#include "aura_hid.hpp"
#include "galax_hof_link.hpp"
int main() {
AuraHIDDevices aura_devs;
auto n = detectAuraHIDDevice(aura_devs);
if (!n) {
printf("Didn't found any AURA ARGB devices\n");
return 1;
} else {
printf("Found %d %s\n", n, (n==1 ? "device" : "devices"));
}
int res;
uint8_t buf[AURA_ARGB_MSG_LEN];
#define MAX_STR 255
wchar_t wstr[MAX_STR];
hid_device* handle;
printf("\nOpening Controller 1...\n");
handle = hid_open(aura_devs[0].vendor_id, aura_devs[0].product_id, nullptr);
if (!handle) {
printf("unable to open device\n");
return 1;
}
printf("Device Opened\n");
// Read the Manufacturer String
res = hid_get_manufacturer_string(handle, wstr, MAX_STR);
wprintf(L"\t%ls\n", wstr);
// Create msg in buffer
buf[0] = MSG_START;
buf[1] = AURA_EFFECT_MODE; // Control Mode
buf[2] = 0x0; // Device
buf[3] = 0x0; // Initial LED position
buf[4] = AURA_MODE_STATIC; // Effect
for (auto v = 5; v < AURA_ARGB_MSG_LEN; v += 3) {
buf[v] = 90;
buf[v + 1] = 60;
buf[v + 2] = 90;
}
// Write to device
hid_write(handle, buf, AURA_ARGB_MSG_LEN);
// Close connection to device
hid_close(handle);
/* HOF link */
HofLinks hof_links;
if (detectHOFLinks(hof_links)) {
hof_links[0].init();
hof_links[0].setColor(90, 60, 90);
}
}