Skip to main content

Class DigitalInterruptPortBase

A base class for IDigitalInterruptPort implementations

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

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

Derived:
Meadow.Hardware.DigitalInterruptPort

Implements:
Meadow.Hardware.IDigitalInterruptPort, 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
Declaration
public InterruptMode InterruptMode { get; protected set; }

DebounceDuration

Gets or sets the debounce duration for the port

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

GlitchDuration

Gets or sets the glitch filter duration for the port

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

Observers

Gets a list of port State observers

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

Methods

RaiseChangedAndNotify(DigitalPortResult)

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

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

Subscribe(IObserver<IChangeResult<DigitalState>>)

Adds a state observer to the port

View Source
Declaration
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
Declaration
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
Declaration
public event EventHandler<DigitalPortResult> Changed
Event Type

System.EventHandler<Meadow.Hardware.DigitalPortResult>

Implements