Exemple #1
0
        /// <inheritdoc />
        public IEnumerable <IRGBDevice> CreateDevices(IDeviceUpdateTrigger updateTrigger)
        {
            ArduinoWS2812USBUpdateQueue queue = new ArduinoWS2812USBUpdateQueue(updateTrigger, SerialConnection);
            IEnumerable <(int channel, int ledCount)> channels = queue.GetChannels();
            int counter = 0;

            foreach ((int channel, int ledCount) in channels)
            {
                string name = string.Format(Name ?? $"Arduino WS2812 USB ({Port}) [{{0}}]", ++counter);
                ArduinoWS2812USBDevice device = new ArduinoWS2812USBDevice(new ArduinoWS2812USBDeviceInfo(name), queue, channel);
                device.Initialize(ledCount);
                yield return(device);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ArduinoWS2812USBDevice"/> class.
 /// </summary>
 /// <param name="deviceInfo">The update trigger used by this queue.</param>
 /// <param name="updateQueue">The update queue performing updates for this device.</param>
 /// <param name="channel">The channel (as defined in the arduino-sketch) this device is attached to.</param>
 public ArduinoWS2812USBDevice(ArduinoWS2812USBDeviceInfo deviceInfo, ArduinoWS2812USBUpdateQueue updateQueue, int channel)
 {
     this.DeviceInfo  = deviceInfo;
     this.UpdateQueue = updateQueue;
     this.Channel     = channel;
 }