.. _object_EdgeDetector: :index:`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 :ref:`DigitalIO.inputValue ` or :ref:`AnalogInput.analogFault ` and should be used in favor of :ref:`Polling ` wherever applicable. This object was introduced in InCore 2.2. :**› Inherits**: :ref:`PropertyModifier ` Overview ******** Properties ++++++++++ .. hlist:: :columns: 2 * :ref:`detectFallingEdges ` * :ref:`detectRisingEdges ` * :ref:`error ` * :ref:`errorString ` * :ref:`running ` * :ref:`PropertyModifier.targetValue ` * :ref:`Object.objectId ` * :ref:`Object.parent ` Methods +++++++ .. hlist:: :columns: 1 * :ref:`Object.deserializeProperties() ` * :ref:`Object.fromJson() ` * :ref:`Object.serializeProperties() ` * :ref:`Object.toJson() ` Signals +++++++ .. hlist:: :columns: 1 * :ref:`errorOccurred() ` * :ref:`fallingEdge() ` * :ref:`risingEdge() ` * :ref:`Object.completed() ` Enumerations ++++++++++++ .. hlist:: :columns: 1 * :ref:`Error ` Properties ********** .. _property_EdgeDetector_detectFallingEdges: .. _signal_EdgeDetector_detectFallingEdgesChanged: .. index:: single: detectFallingEdges detectFallingEdges ++++++++++++++++++ This property holds whether to react to falling edges and emit the :ref:`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 .. _property_EdgeDetector_detectRisingEdges: .. _signal_EdgeDetector_detectRisingEdgesChanged: .. index:: single: detectRisingEdges detectRisingEdges +++++++++++++++++ This property holds whether to react to rising edges and emit the :ref:`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 .. _property_EdgeDetector_error: .. _signal_EdgeDetector_errorChanged: .. index:: single: error error +++++ This property holds the most recently occurred error or :ref:`EdgeDetector.NoError ` if no error occurred. If the same error occurs multiple times this property does not change. Use the :ref:`errorOccurred() ` signal to detect multiple occurrences of the same error. :**› Type**: :ref:`Error ` :**› Signal**: errorChanged() :**› Attributes**: Readonly .. _property_EdgeDetector_errorString: .. _signal_EdgeDetector_errorStringChanged: .. index:: single: errorString errorString +++++++++++ This property holds the current human readable error string corresponding to the current value in the :ref:`error ` property. It may include additional information such as failure reasons or locations. :**› Type**: String :**› Signal**: errorStringChanged() :**› Attributes**: Readonly .. _property_EdgeDetector_running: .. _signal_EdgeDetector_runningChanged: .. index:: single: running 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 ******* .. _signal_EdgeDetector_errorOccurred: .. index:: single: errorOccurred errorOccurred() +++++++++++++++ This signal is emitted whenever an error has occurred, regardless of whether the :ref:`error ` property has changed or not. In contrast to the change notification signal of the :ref:`error ` property this signal is also emitted several times if a certain error occurs several times in succession. .. _signal_EdgeDetector_fallingEdge: .. index:: single: fallingEdge fallingEdge() +++++++++++++ This signal is emitted whenever a falling edge has been detected at the source pin. .. _signal_EdgeDetector_risingEdge: .. index:: single: risingEdge risingEdge() ++++++++++++ This signal is emitted whenever a rising edge has been detected at the source pin. Enumerations ************ .. _enum_EdgeDetector_Error: .. index:: single: Error Error +++++ This enumeration describes all errors which can occur in EdgeDetector objects. The most recently occurred error is stored in the :ref:`error ` property. .. index:: single: EdgeDetector.NoError .. index:: single: EdgeDetector.NotSupportedError .. list-table:: :widths: auto :header-rows: 1 * - Name - Value - Description .. _enumitem_EdgeDetector_NoError: * - ``EdgeDetector.NoError`` - ``0`` - No error occurred or was detected. .. _enumitem_EdgeDetector_NotSupportedError: * - ``EdgeDetector.NotSupportedError`` - ``1`` - EdgeDetector not supported for target property. Example ******* See :ref:`DigitalIO example ` on how to use EdgeDetector.