Example #1
0
        /// <summary>
        /// Binds the pin to a given pin number.
        /// </summary>
        /// <param name="pinNumber">Number of the pin to bind this object to.</param>
        /// <returns>True if the pin was found and reserved; otherwise false.</returns>
        /// <remarks>If this method throws or returns false, there is no need to dispose the pin. </remarks>
        internal bool Init(int pinNumber)
        {
            bool foundPin = InitNative(pinNumber);

            if (foundPin)
            {
                s_eventListener.AddPin(pinNumber, this);
            }

            return(foundPin);
        }
        internal bool Init()
        {
            if (NativeInit(_pinNumber))
            {
                // add the pin to the event listener in order to receive the callbacks from the native interrupts
                s_eventListener.AddPin(this);

                return(true);
            }

            return(false);
        }