Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Gpio​Change​Counter"/> class associated with the specified pin.
        /// Only a single <see cref="Gpio​Change​Counter"/> may be associated with a pin at any given time.
        /// </summary>
        /// <param name="pin">The pin on which to count changes.
        /// This pin must have been opened in Exclusive mode, and cannot be associated with another GpioChangeCounter.
        /// </param>
        /// <remarks>The following exceptions can be thrown by this method:
        /// <list type="bullet">
        /// <item><term>E_INVALIDARG : TThe pin is already associated with a change counter.That change counter must be disposed before the pin can be associated with a new change counter.</term></item>
        /// <item><term>E_ACCESSDENIED : The pin is not opened in Exclusive mode.</term></item>
        /// </list>
        /// </remarks>
        public Gpio​Change​Counter(Gpio​Pin pin)
        {
            if (pin.SharingMode != GpioSharingMode.Exclusive)
            {
                throw new  ArgumentException();
            }

            _pinNumber = pin.PinNumber;

            _inputMode = (pin.GetDriveMode() < GpioPinDriveMode.Output);

            NativeInit();
        }
 /// <summary>
 /// Creates a new GpioChangeReader associated with the specified pin. Only a single GpioChangeReader may be associated with a pin at any given time.
 /// </summary>
 /// <param name="pin">The pin on which to read changes. The pin must have been opened in Exclusive mode, and cannot be associated with another change reader.</param>
 /// <param name="minCapacity">The minimum number of change records that the reader must be able to hold.</param>
 /// <remarks>The following exceptions can be thrown by this method:
 /// <list type="bullet">
 /// <item><term>E_POINTER - The pin passed in is null.</term></item>
 /// <item><term>HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION) - The pin is already associated with a change reader.That change reader must be disposed before the pin can be associated with a new change reader.</term></item>
 /// <item><term>E_ACCESSDENIED - The pin is not opened in Exclusive mode.</term></item>
 /// </list>
 /// </remarks>
 public Gpio​Change​Reader(Gpio​Pin pin, Int32 minCapacity)
 /// <summary>
 /// Creates a new GpioChangeReader associated with the specified pin. Only a single GpioChangeReader may be associated with a pin at any given time.
 /// </summary>
 /// <param name="pin">The pin on which to read changes. The pin must have been opened in Exclusive mode, and cannot be associated with another change reader.</param>
 /// <remarks>The following exceptions can be thrown by this method:
 /// <list type="bullet">
 /// <item><term>E_POINTER - The pin passed in is null.</term></item>
 /// <item><term>HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION) - The pin is already associated with a change reader.That change reader must be disposed before the pin can be associated with a new change reader.</term></item>
 /// <item><term>E_ACCESSDENIED - The pin is not opened in Exclusive mode.</term></item>
 /// </list>
 /// </remarks>
 public Gpio​Change​Reader(Gpio​Pin pin)
 {
 }
Example #4
0
 /// <summary>
 /// Opens the specified general-purpose I/O (GPIO) pin in the specified mode, and gets a status value that you can use to handle a failure to open the pin programmatically.
 /// </summary>
 /// <param name="pinNumber">The pin number of the GPIO pin that you want to open. Some pins may not be available in user mode. For information about how the pin numbers correspond to physical pins, see the documentation for your circuit board.</param>
 /// <param name="sharingMode">The mode in which you want to open the GPIO pin, which determines whether other connections to the pin can be opened while you have the pin open.</param>
 /// <param name="pin">The opened GPIO pin if the return value is true; otherwise null.</param>
 /// <param name="openStatus">An enumeration value that indicates either that the attempt to open the GPIO pin succeeded, or the reason that the attempt to open the GPIO pin failed.</param>
 /// <returns>True if the method successfully opened the pin; otherwise false.
 /// <para>If the method returns true, the pin parameter receives an instance of a GpioPin, and the openStatus parameter receives GpioOpenStatus.PinOpened.If the method returns false, the pin parameter is null and the openStatus parameter receives the reason that the operation failed.</para></returns>
 public bool TryOpenPin(int pinNumber, GpioSharingMode sharingMode, out Gpio​Pin pin, out GpioOpenStatus openStatus)
 /// <summary>
 /// Sets the pin to the specified alternate function.
 /// </summary>
 /// <param name="pin"></param>
 /// <param name="alternateFunction">The value of the alternate function.</param>
 /// <remarks>
 /// This extension is exclusive of nanoFramework and it may not be supported in all platforms.
 /// WARNING: Use with caution! There is no validation on the execution of this call and there is the potential for breaking things,
 /// so be sure to know what you are doing when using it.
 /// Platforms supporting this feature: Cortex-M and ESP32.
 /// Platforms not supporting this feature: none.
 /// </remarks>
 public static void SetAlternateFunction(this Gpio​Pin pin, int alternateFunction)