Пример #1
0
        /// <summary>
        ///     Construct a dual half bridge with PWM speed control
        /// </summary>
        /// <param name="A">The "A" channel half-bridge input</param>
        /// <param name="B">The "B" channel half-bridge input</param>
        /// <param name="Enable">The PWM input used to control the output enable</param>
        public DualHalfBridge(DigitalOut A, DigitalOut B, Pwm Enable)
        {
            Enable.EnablePwmAsync();
            Enable.DutyCycle = 0;
            Enable.EnablePwmAsync();
            A.MakeDigitalPushPullOutAsync();
            B.MakeDigitalPushPullOutAsync();

            enablePwm = Enable;
            this.A    = A;
            this.B    = B;
        }
Пример #2
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
        }