Esempio n. 1
0
 /// <summary>
 ///     Construct a new chain of APA102-based smart LEDs.
 /// </summary>
 /// <param name="spi">The SPI port to use</param>
 /// <param name="numLeds">The number of APA102 smart LEDs in this chain</param>
 /// <param name="frequency">The frequency to use</param>
 public Apa102(Spi spi, int numLeds, double frequency = 6)
 {
     this.spi    = spi;
     spi.Enabled = true;
     this.freq   = frequency;
     for (var i = 0; i < numLeds; i++)
     {
         Leds.Add(new Led(this));
     }
 }
Esempio n. 2
0
 /// <summary>
 ///     Construct an LedDriver
 /// </summary>
 /// <param name="numLeds">The number of LEDs to construct</param>
 /// <param name="HasGlobalBrightnessControl">Whether the controller can globally adjust the LED brightness.</param>
 /// <param name="HasIndividualBrightnessControl">Whether the controller has individual LED brightness control</param>
 public LedDriver(int numLeds, bool HasGlobalBrightnessControl, bool HasIndividualBrightnessControl)
 {
     this.HasGlobalBrightnessControl     = HasGlobalBrightnessControl;
     this.HasIndividualBrightnessControl = HasIndividualBrightnessControl;
     for (var i = 0; i < numLeds; i++)
     {
         var led = new Led(this, i, HasIndividualBrightnessControl);
         Leds.Add(led);
     }
 }
 private void ZeilenSpaltenAblgeich(int rows, int cols)
 {
     if (rows * cols != Leds.Count)
     {
         Leds.Clear();
         for (int i = 0; i < rows * cols; i++)
         {
             Leds.Add(new LedVm()
             {
                 LedBrush = Brushes.Black
             });
         }
     }
 }