A helper class for implementing the IPushButton interface using a single GPIO pin.
Inheritance: IDisposable
Ejemplo n.º 1
0
 /// <inheritdoc/>
 public void Dispose()
 {
     if (helper != null)
     {
         helper.Dispose();
         helper = null;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new <see cref="PushButton"/> instance.
        /// </summary>
        public RotaryEncoder()
        {
            // Create helper
            buttonHelper = new PushButtonHelper(this);

            // Lower debounce timeout
            buttonHelper.DebounceTimeout = 10;

            // Create events
            rotatedEvent = new ObservableEvent<IRotaryEncoder, RotaryEncoderRotatedEventArgs>(firstAdded: EnsureInitialized);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new <see cref="PushButton"/> instance.
 /// </summary>
 public PushButton()
 {
     // Create helper
     helper = new PushButtonHelper(this);
 }
Ejemplo n.º 4
0
 /// <inheritdoc/>
 public void Dispose()
 {
     if (buttonHelper != null)
     {
         buttonHelper.Dispose();
         buttonHelper = null;
     }
     if (clockPin != null)
     {
         clockPin.Dispose();
         clockPin = null;
     }
 }