Ejemplo n.º 1
0
        /// <inheritdoc />
        public IEnumerable <IRGBDevice> CreateDevices()
        {
            DeviceUpdateTrigger updateTrigger = new DeviceUpdateTrigger();

            BitwizardWS2812USBUpdateQueue queue = new BitwizardWS2812USBUpdateQueue(updateTrigger, Port, BaudRate);
            string name = Name ?? $"Bitwizard WS2812 USB ({Port})";
            BitwizardWS2812USBDevice device = new BitwizardWS2812USBDevice(new BitwizardWS2812USBDeviceInfo(name), queue);

            device.Initialize(StripLength);
            yield return(device);

            updateTrigger.Start();
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public IEnumerable <IRGBDevice> CreateDevices()
        {
            DeviceUpdateTrigger updateTrigger = new DeviceUpdateTrigger();

            ArduinoWS2812USBUpdateQueue queue = new ArduinoWS2812USBUpdateQueue(updateTrigger, Port, BaudRate);
            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);
            }

            updateTrigger.Start();
        }