-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDriver.AMDWraithPrism.cs
More file actions
154 lines (128 loc) · 4.29 KB
/
Driver.AMDWraithPrism.cs
File metadata and controls
154 lines (128 loc) · 4.29 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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using AMDWraith;
using SimpleLed;
namespace AMDWraithDriver
{
public class AMDWraithProvider : ISimpleLed
{
private ControlDevice.LedUnit[] leds;
CMRGBController cmrgb;
private bool disposing;
private bool pushRequested;
public AMDWraithProvider()
{
}
public void Dispose()
{
disposing = true;
}
public void Configure(DriverDetails driverDetails)
{
cmrgb = new CMRGBController();
Debug.WriteLine(cmrgb.getVersion());
var ring_leds = new LedChannel[15];
for (int r = 0; r < 5; r++)
{
for (int x = 0; x < 15; x++)
{
ring_leds[x] = AMDWraith.LedChannel.R_RAINBOW;
}
Debug.WriteLine(cmrgb
.assign_leds_to_channels(AMDWraith.LedChannel.OFF, AMDWraith.LedChannel.OFF, ring_leds)
.PrettyBytes());
Thread.Sleep(500);
for (int x = 0; x < 15; x++)
{
ring_leds[x] = AMDWraith.LedChannel.OFF;
}
Debug.WriteLine(cmrgb.assign_leds_to_channels(AMDWraith.LedChannel.OFF, AMDWraith.LedChannel.OFF, ring_leds).PrettyBytes());
Thread.Sleep(500);
}
leds = new ControlDevice.LedUnit[15];
for (int i = 0; i < 15; i++)
{
leds[i] = new ControlDevice.LedUnit
{
Color = new LEDColor(0, 0, 0),
LEDName = "Ring " + (i + 1)
};
}
pushRequested = true;
new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
ManagePOV();
}).Start();
}
public List<ControlDevice> GetDevices()
{
return new List<ControlDevice>
{
new ControlDevice
{
DeviceType = DeviceTypes.Fan,
Driver = this,
LEDs = leds,
Name = "Ring PoV"
}
};
}
public void Push(ControlDevice controlDevice)
{
pushRequested = true;
}
public void Pull(ControlDevice controlDevice)
{
}
public DriverProperties GetProperties()
{
return new DriverProperties
{
SupportsPush = true,
IsSource = false,
SupportsPull = false,
SupportsCustomConfig = false,
Id = Guid.Parse("49440cc2-8ca3-4e35-a9a3-88b024cc0e2d"),
Author = "mad ninja",
Blurb = "Basic driver for RGB AMD Wraith devices that uses persistence of vision to achieve full LED control",
CurrentVersion = new ReleaseNumber("1.1.0.4"),
GitHubLink = "https://github.com/SimpleLed/Driver.AMDWraithPrism",
IsPublicRelease = true
};
}
public T GetConfig<T>() where T : SLSConfigData
{
return null;
}
public void PutConfig<T>(T config) where T : SLSConfigData
{
}
public string Name()
{
return "AMD Wraith Prism";
}
public event EventHandler DeviceRescanRequired;
public void ManagePOV()
{
LEDColor[] myleds= new LEDColor[15];
while (!disposing)
{
if (pushRequested)
{
for (int i = 0; i < 15; i++)
{
myleds[i] = new LEDColor(leds[i].Color.Red, leds[i].Color.Green, leds[i].Color.Blue);
}
pushRequested = false;
}
if (!cmrgb.SetFrame(myleds))
{
Thread.Sleep(33);
}
}
}
}
}