コード例 #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 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;
        }
コード例 #3
0
        /// <summary>
        ///     Construct a dual half bridge with no 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">An optional Enable pin of the H-bridge</param>
        public DualHalfBridge(DigitalOut A, DigitalOut B, DigitalOut Enable = null)
        {
            if (Enable != null)
            {
                Enable.DigitalValue = false;
                Enable.MakeDigitalPushPullOutAsync();
                enable = Enable;
            }

            A.MakeDigitalPushPullOutAsync();
            B.MakeDigitalPushPullOutAsync();


            this.A = A;
            this.B = B;
        }
コード例 #4
0
ファイル: Adjds311.cs プロジェクト: ehailey1/treehopper-sdk
        /// <summary>
        ///     Create a ADJDS311 device
        /// </summary>
        /// <param name="I2CDevice">The I2c port to use</param>
        /// <param name="LedPin">The pin attached to the led</param>
        public Adjds311(I2C I2CDevice, DigitalOut LedPin) : base(0x74, I2CDevice)
        {
            _I2C         = I2CDevice;
            _I2C.Enabled = true;

            led = LedPin;
            led.MakeDigitalPushPullOutAsync();

            WriteByteDataAsync(CAP_RED, 15);
            WriteByteDataAsync(CAP_GREEN, 15);
            WriteByteDataAsync(CAP_BLUE, 15);
            WriteByteDataAsync(CAP_CLEAR, 15);

            WriteByteDataAsync(INT_RED_LO, 0x00);
            WriteByteDataAsync(INT_RED_HI, 0x4);
            WriteByteDataAsync(INT_GREEN_LO, 0x00);
            WriteByteDataAsync(INT_GREEN_HI, 0x5);
            WriteByteDataAsync(INT_BLUE_LO, 0x00);
            WriteByteDataAsync(INT_BLUE_HI, 0x9);
            WriteByteDataAsync(INT_CLEAR_LO, 0x00);
            WriteByteDataAsync(INT_CLEAR_HI, 0x2);
        }
コード例 #5
0
 /// <summary>
 ///     Construct a new instance of the Sn74hc166
 /// </summary>
 /// <param name="spiModule">SPI module to use</param>
 /// <param name="loadPin">latch pin</param>
 public Hc166(Spi spiModule, DigitalOut loadPin)
 {
     loadPin.MakeDigitalPushPullOutAsync();
     spiModule.Enabled = true;
 }