EdgeDetector

Description

The EdgeDetector object provides an efficient mechanism for detecting digital signal changes on on a pin represented by the target property. The interrupt-based mechanism is only supported for properties associated with GPIO lines such as DigitalIO.inputValue or AnalogInput.analogFault and should be used in favor of Polling wherever applicable.

This object was introduced in InCore 2.2.

› Inherits:PropertyModifier

Properties

detectFallingEdges

This property holds whether to react to falling edges and emit the fallingEdge() signal. Set it to false to save CPU cycles if only rising edges are of interest.

This property was introduced in InCore 2.4.

› Type:Boolean
› Default:true
› Signal:detectFallingEdgesChanged()
› Attributes:Writable

detectRisingEdges

This property holds whether to react to rising edges and emit the risingEdge() signal. Set it to false to save CPU cycles if only falling edges are of interest.

This property was introduced in InCore 2.4.

› Type:Boolean
› Default:true
› Signal:detectRisingEdgesChanged()
› Attributes:Writable

error

This property holds the most recently occurred error or EdgeDetector.NoError if no error occurred. If the same error occurs multiple times this property does not change. Use the errorOccurred() signal to detect multiple occurrences of the same error.

› Type:Error
› Signal:errorChanged()
› Attributes:Readonly

errorString

This property holds the current human readable error string corresponding to the current value in the error property. It may include additional information such as failure reasons or locations.

› Type:String
› Signal:errorStringChanged()
› Attributes:Readonly

running

This property holds whether the edge detector is active. This can be used to switch the detector on or off corresponding to constraints.

This property was introduced in InCore 2.5.

› Type:Boolean
› Default:true
› Signal:runningChanged()
› Attributes:Writable

Signals

errorOccurred()

This signal is emitted whenever an error has occurred, regardless of whether the error property has changed or not. In contrast to the change notification signal of the error property this signal is also emitted several times if a certain error occurs several times in succession.

fallingEdge()

This signal is emitted whenever a falling edge has been detected at the source pin.

risingEdge()

This signal is emitted whenever a rising edge has been detected at the source pin.

Enumerations

Error

This enumeration describes all errors which can occur in EdgeDetector objects. The most recently occurred error is stored in the error property.

Name Value Description
EdgeDetector.NoError 0 No error occurred or was detected.
EdgeDetector.NotSupportedError 1 EdgeDetector not supported for target property.

Example

See DigitalIO example on how to use EdgeDetector.