/// <summary>
        /// Writes values of a given LED to the device.
        /// </summary>
        /// <param name="led">LED to write to the device.</param>
        private void WriteLED(APA102LED led)
        {
            var sendBright = (int)((31.0m * led.Brightness)) & 31;

            WriteByte(Convert.ToByte(224 | sendBright));
            WriteByte(Convert.ToByte(led.Blue));
            WriteByte(Convert.ToByte(led.Green));
            WriteByte(Convert.ToByte(led.Red));
        }
        /// <summary>
        /// Constructors.
        ///
        /// Configurates all required values.
        /// </summary>
        private APA102()
        {
            // Setup list.
            for (int i = 0; i < NUMBER_OF_LEDS; i++)
            {
                leds[i] = new APA102LED();
            }

            // Ensure required instance are set.
            if (gpioController == null)
            {
                throw new Exception("Default GPIO controller not found.");
            }

            // Setup pins.
            dataPin  = gpioController.OpenPin(GPIO_NUMBER_DATA);
            clockPin = gpioController.OpenPin(GPIO_NUMBER_CLOCK);
            dataPin.SetDriveMode(GpioPinDriveMode.Output);
            clockPin.SetDriveMode(GpioPinDriveMode.Output);

            // Write LED values to device.
            WriteLEDValues();
        }