Пример #1
0
        /// <summary>
        /// Removes a callback that was being invoked for pin at pinNumber.
        /// </summary>
        /// <param name="pinNumber">The pin number in the controller's numbering scheme.</param>
        /// <param name="callback">The callback method that will be invoked.</param>
        public void UnregisterCallbackForPinValueChangedEvent(int pinNumber, PinChangeEventHandler callback)
        {
            int logicalPinNumber = GetLogicalPinNumber(pinNumber);

            if (!_openPins.Contains(logicalPinNumber))
            {
                throw new InvalidOperationException("Can not add callback for a pin that is not open.");
            }
            _driver.RemoveCallbackForPinValueChangedEvent(logicalPinNumber, callback);
        }
Пример #2
0
        /// <summary>
        /// Removes a callback that was being invoked for pin at pinNumber.
        /// </summary>
        /// <param name="pinNumber">The pin number in the controller's numbering scheme.</param>
        /// <param name="callback">The callback method that will be invoked.</param>
        public virtual void UnregisterCallbackForPinValueChangedEvent(int pinNumber, PinChangeEventHandler callback)
        {
            if (!IsPinOpen(pinNumber))
            {
                throw new InvalidOperationException($"Can not remove callback for pin {pinNumber} because it is not open.");
            }

            int logicalPinNumber = GetLogicalPinNumber(pinNumber);

            _driver.RemoveCallbackForPinValueChangedEvent(logicalPinNumber, callback);
        }