Skip to main content

Class DigitalInterruptPortBase

A base class for IDigitalInterruptPort implementations

Assembly: Meadow.Contracts.dll
View Source
public abstract class DigitalInterruptPortBase : DigitalInputPortBase, IDigitalInterruptPort, IDigitalInputPort, IDigitalPort, IPort<IDigitalChannelInfo>, IDisposable, IObservable<IChangeResult<DigitalState>>

Inheritance: System.Object -> Meadow.Hardware.PortBase<C> -> Meadow.Hardware.DigitalPortBase -> Meadow.Hardware.DigitalInputPortBase

Derived:
Meadow.Hardware.DigitalInterruptPort

Implements:
Meadow.Hardware.IDigitalInterruptPort, Meadow.Hardware.IDigitalInputPort, Meadow.Hardware.IDigitalPort, Meadow.Hardware.IPort<C>, System.IDisposable, System.IObservable<Meadow.IChangeResult<Meadow.Hardware.DigitalState>>

Properties

InterruptMode

Gets or sets a value indicating the type of interrupt monitoring this input.

View Source
public InterruptMode InterruptMode { get; protected set; }

DebounceDuration

Gets or sets the debounce duration for the port

View Source
public abstract TimeSpan DebounceDuration { get; set; }

GlitchDuration

Gets or sets the glitch filter duration for the port

View Source
public abstract TimeSpan GlitchDuration { get; set; }

Observers

Gets a list of port State observers

View Source
protected List<IObserver<IChangeResult<DigitalState>>> Observers { get; }

Methods

RaiseChangedAndNotify(DigitalPortResult)

Raises the Changed event and notifies all observers of a state change

View Source
protected void RaiseChangedAndNotify(DigitalPortResult changeResult)
Parameters
TypeName
Meadow.Hardware.DigitalPortResultchangeResult

Subscribe(IObserver<IChangeResult<DigitalState>>)

Adds a state observer to the port

View Source
public IDisposable Subscribe(IObserver<IChangeResult<DigitalState>> observer)
Returns

System.IDisposable

Parameters
TypeName
System.IObserver<Meadow.IChangeResult<Meadow.Hardware.DigitalState>>observer

Dispose(bool)

Releases allocated port resources

View Source
protected override void Dispose(bool disposing)
Parameters
TypeName
System.Booleandisposing

Events

Changed

Occurs when the state is changed. To enable this, set the InterruptMode at construction

View Source
public event EventHandler<DigitalPortResult> Changed
Event Type

System.EventHandler<Meadow.Hardware.DigitalPortResult>

Implements