/// <summary>
        ///     Set up a ChainableSHiftRegisterOutput connected to another ChainableShiftRegisterOutput device
        /// </summary>
        /// <param name="upstreamDevice">The upstream device this device is attached to</param>
        /// <param name="numBytes">The number of bytes this device occupies in the chain</param>
        public ChainableShiftRegisterOutput(ChainableShiftRegisterOutput upstreamDevice, int numBytes = 1)
        {
            if (upstreamDevice.Parent == null)
            {
                Parent = upstreamDevice;
            }
            else
            {
                Parent = upstreamDevice.Parent;
            }

            ((ChainableShiftRegisterOutput)Parent).Children.Add(this);
            this.numBytes = numBytes;
            CurrentValue  = new byte[numBytes];
            lastValues    = new byte[numBytes];
        }
Exemplo n.º 2
0
 /// <summary>
 ///     Construct a shift register attached to an upstream device
 /// </summary>
 /// <param name="upstreamDevice">The upstream device this shift register is attached to</param>
 /// <param name="numPins">The number of pins this shift register has</param>
 public ShiftOut(ChainableShiftRegisterOutput upstreamDevice, int numPins = 8) : base(upstreamDevice,
                                                                                      numPins / 8)
 {
     setup(numPins);
 }