using RGB.NET.Core;
namespace RGB.NET.Devices.PicoPi;
///
///
/// Represents a device based on an Raspberry Pi Pico.
///
public class PicoPiRGBDevice : AbstractRGBDevice
{
#region Properties & Fields
private readonly LedMapping _ledMapping;
#endregion
#region Constructors
///
///
/// Initializes a new instance of the class.
///
/// The device info of this device.
/// The queue used to update this device.
/// A mapping of leds this device is initialized with.
public PicoPiRGBDevice(PicoPiRGBDeviceInfo deviceInfo, IUpdateQueue updateQueue, LedMapping ledMapping)
: base(deviceInfo, updateQueue)
{
this._ledMapping = ledMapping;
}
#endregion
#region Methods
internal void Initialize()
{
for (int i = 0; i < DeviceInfo.LedCount; i++)
AddLed(_ledMapping[i], new Point(i * 10, 0), new Size(10, 10), i);
}
///
protected override object GetLedCustomData(LedId ledId) => _ledMapping.TryGetValue(ledId, out int index) ? index : -1;
#endregion
}