Example #1
0
 /// <summary>
 /// Initialize a new shift register connected through GPIO.
 /// </summary>
 /// <param name="pinMapping">The pin mapping to use by the binding.</param>
 /// <param name="bitLength">Bit length of register, including chained registers.</param>
 /// <param name="gpioController">The GPIO Controller used for interrupt handling.</param>
 /// <param name="shouldDispose">True (the default) if the GPIO controller shall be disposed when disposing this instance.</param>
 public ShiftRegister(ShiftRegisterPinMapping pinMapping, int bitLength, GpioController?gpioController = null, bool shouldDispose = true)
 {
     _shouldDispose = shouldDispose || gpioController is null;
     _controller    = gpioController ?? new GpioController();
     _pinMapping    = pinMapping;
     _serial        = _pinMapping.SerialDataInput;
     _clock         = _pinMapping.Clock;
     _latch         = _pinMapping.LatchEnable;
     _bitLength     = bitLength;
     SetupPins();
 }