예제 #1
0
        private void Start(LedChannelCount channelCount)
        {
            channels     = (int)channelCount;
            currentValue = new BitArray(channels);
            for (var i = 0; i < channels; i++)
            {
                Leds.Add(new Led(this, i));
            }

            if (oe != null)
            {
                oe.MakeDigitalPushPullOutAsync();
                oe.DigitalValue            = false;
                HasGlobalBrightnessControl = false;
            }
            else if (oePwm != null)
            {
                oePwm.EnablePwmAsync();
                oePwm.PulseWidth           = 0;
                HasGlobalBrightnessControl = true;
            }
            else
            {
                HasGlobalBrightnessControl = false;
            }
            HasIndividualBrightnessControl = false;
            Brightness = 1.0; // turn on the display
        }
예제 #2
0
 /// <summary>
 ///     Construct an LED shift register attached to the output of another shift register
 /// </summary>
 /// <param name="upstreamDevice">The upstream device this shift register is attached to</param>
 /// <param name="OutputEnablePin">The digital pin to use, if any, to control the display state</param>
 /// <param name="ChannelCount">The number of channels this LED shift register has</param>
 public LedShiftRegister(ChainableShiftRegisterOutput upstreamDevice,
                         LedChannelCount ChannelCount = LedChannelCount.SixteenChannel, DigitalOut OutputEnablePin = null) : base(
         upstreamDevice, (int)ChannelCount / 8)
 {
     oe = OutputEnablePin;
     Start(ChannelCount);
 }
예제 #3
0
 /// <summary>
 ///     Construct an LED shift register attached to the output of another shift register
 /// </summary>
 /// <param name="upstreamDevice">The upstream device this shift register is attached to</param>
 /// <param name="OutputEnablePin">The PWM pin to use, if any, to control the display brightness</param>
 /// <param name="ChannelCount">The number of channels this LED shift register has</param>
 public LedShiftRegister(ChainableShiftRegisterOutput upstreamDevice, Pwm OutputEnablePin,
                         LedChannelCount ChannelCount = LedChannelCount.SixteenChannel) : base(upstreamDevice,
                                                                                               (int)ChannelCount / 8)
 {
     oePwm = OutputEnablePin;
     Start(ChannelCount);
 }
예제 #4
0
 /// <summary>
 ///     Construct an LED shift register attached directly to a board SPI module
 /// </summary>
 /// <param name="SpiModule">The board's SPI module</param>
 /// <param name="LatchPin">The pin to use for latches</param>
 /// <param name="OutputEnablePin">The PWM pin to use, allowing controllable global brightness.</param>
 /// <param name="ChannelCount">The number of channels this LED shift register has</param>
 /// <param name="speedMhz">The speed, in MHz, to use when communicating</param>
 public LedShiftRegister(Spi SpiModule, SpiChipSelectPin LatchPin, Pwm OutputEnablePin,
                         LedChannelCount ChannelCount = LedChannelCount.SixteenChannel, double speedMhz = 6) : base(SpiModule,
                                                                                                                    LatchPin, (int)ChannelCount / 8, speedMhz)
 {
     oePwm = OutputEnablePin;
     Start(ChannelCount);
 }