Added animatrix control thanks to https://github.com/vddCore/Starlight

This commit is contained in:
seerge
2023-03-04 00:11:59 +01:00
parent e9fa181d4e
commit 43d2ed656a
14 changed files with 742 additions and 73 deletions

33
Communication/Device.cs Normal file
View File

@@ -0,0 +1,33 @@
// Source thanks to https://github.com/vddCore/Starlight :)
using Starlight.Communication.Platform;
namespace Starlight.Communication
{
public abstract class Device : IDisposable
{
private static UsbProvider _usbProvider;
protected Device(ushort vendorId, ushort productId, int maxFeatureReportLength)
{
_usbProvider = new WindowsUsbProvider(vendorId, productId, maxFeatureReportLength);
}
protected T Packet<T>(params byte[] command) where T : Packet
{
return (T)Activator.CreateInstance(typeof(T), command)!;
}
public void Set(Packet packet)
=> _usbProvider?.Set(packet.Data);
public byte[] Get(Packet packet)
=> _usbProvider?.Get(packet.Data);
public void Dispose()
{
_usbProvider?.Dispose();
}
}
}