Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Updating xml comments for documentation of IGpioController and IGpioPin interfaces. #31

Merged
merged 4 commits into from
Sep 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 33 additions & 14 deletions source/IGpioController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,55 @@ namespace Windows.Devices.Gpio
public interface IGpioController
{
/// <summary>
///
/// Gets the number of pins on the general-purpose I/O (GPIO) controller.
/// </summary>
/// <value>
/// The number of pins on the GPIO controller. 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.
/// </value>
int PinCount
{
get;
}

/// <summary>
///
/// Opens a connection to the specified general-purpose I/O (GPIO) pin in exclusive mode.
/// </summary>
/// <param name="pinNumber"></param>
/// <returns></returns>
/// <param name="pinNumber">The pin number of the GPIO pin that you want to open. The pin number must be
/// <list type="bullet">
/// <item><term>in range</term></item>
/// <item><term>available to usermode applications</term></item>
/// </list>
/// <para>Pin numbers start at 0, and increase to the maximum pin number, which is one less than the value returned by GpioController.PinCount.</para>
/// <para>Which pins are available to usermode depends on the circuit board on which the code is running.For information about how pin numbers correspond to physical pins, see the documentation for your circuit board.</para>
/// </param>
/// <returns>An interface to the opened GPIO pin.</returns>
IGpioPin OpenPin(int pinNumber);

/// <summary>
///
/// Opens a connection to the specified general-purpose I/O (GPIO) pin in exclusive mode.
/// </summary>
/// <param name="pinNumber"></param>
/// <param name="sharingMode"></param>
/// <returns></returns>
/// <param name="pinNumber">The pin number of the GPIO pin that you want to open. The pin number must be
/// <list type="bullet">
/// <item><term>in range</term></item>
/// <item><term>available to usermode applications</term></item>
/// </list>
/// <para>Pin numbers start at 0, and increase to the maximum pin number, which is one less than the value returned by GpioController.PinCount.</para>
/// <para>Which pins are available to usermode depends on the circuit board on which the code is running.For information about how pin numbers correspond to physical pins, see the documentation for your circuit board.</para>
/// </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>
/// <returns>An interface to the opened GPIO pin.</returns>
IGpioPin OpenPin(int pinNumber, GpioSharingMode sharingMode);

/// <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"></param>
/// <param name="sharingMode"></param>
/// <param name="pin"></param>
/// <param name="openStatus"></param>
/// <returns></returns>
/// <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>
bool TryOpenPin(int pinNumber, GpioSharingMode sharingMode, out IGpioPin pin, out GpioOpenStatus openStatus);
}
}
61 changes: 46 additions & 15 deletions source/IGpioPin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,64 +13,95 @@ namespace Windows.Devices.Gpio
public interface IGpioPin
{
/// <summary>
///
/// Gets or sets the debounce timeout for the general-purpose I/O (GPIO) pin, which is an interval during which changes to the value of the pin are filtered out and do not generate ValueChanged events.
/// </summary>
/// <value>
/// The debounce timeout for the GPIO pin, which is an interval during which changes to the value of the pin are filtered out and do not generate ValueChanged events.
/// If the length of this interval is 0, all changes to the value of the pin generate ValueChanged events.
/// </value>
TimeSpan DebounceTimeout
{
get;
set;
}

/// <summary>
///
/// Gets the pin number of the general-purpose I/O (GPIO) pin.
/// </summary>
/// <value>
/// The pin number of the GPIO pin.
/// </value>
int PinNumber
{
get;
}

/// <summary>
///
/// Gets the sharing mode in which the general-purpose I/O (GPIO) pin is open.
/// </summary>
/// <value>
/// The sharing mode in which the GPIO pin is open.
/// </value>
GpioSharingMode SharingMode
{
get;
}

/// <summary>
///
/// Occurs when the value of the general-purpose I/O (GPIO) pin changes, either because of an external stimulus when the pin is configured as an input, or when a value is written to the pin when the pin in configured as an output.
/// </summary>
event GpioPinValueChangedEventHandler ValueChanged;

/// <summary>
///
/// Gets whether the general-purpose I/O (GPIO) pin supports the specified drive mode.
/// </summary>
/// <param name="driveMode"></param>
/// <returns></returns>
/// <param name="driveMode">The drive mode that you want to check for support.</param>
/// <returns>
/// True if the GPIO pin supports the drive mode that driveMode specifies; otherwise false.
/// If you specify a drive mode for which this method returns false when you call <see cref="SetDriveMode"/>, <see cref="SetDriveMode"/> generates an exception.
/// </returns>
bool IsDriveModeSupported(GpioPinDriveMode driveMode);

/// <summary>
///
/// Gets the current drive mode for the general-purpose I/O (GPIO) pin. The drive mode specifies whether the pin is configured as an input or an output, and determines how values are driven onto the pin.
/// </summary>
/// <returns></returns>
/// <returns>An enumeration value that indicates the current drive mode for the GPIO pin.
/// The drive mode specifies whether the pin is configured as an input or an output, and determines how values are driven onto the pin.</returns>
GpioPinDriveMode GetDriveMode();

/// <summary>
///
/// Sets the drive mode of the general-purpose I/O (GPIO) pin.
/// The drive mode specifies whether the pin is configured as an input or an output, and determines how values are driven onto the pin.
/// </summary>
/// <param name="value"></param>
/// <param name="value">An enumeration value that specifies drive mode to use for the GPIO pin.
/// The drive mode specifies whether the pin is configured as an input or an output, and determines how values are driven onto the pin.</param>
/// <remarks>The following exceptions can be thrown by this method:
/// <list type="bullet">
/// <item><term>E_INVALIDARG : The GPIO pin does not support the specified drive mode.</term></item>
/// <item><term>E_ACCESSDENIED : The pin is open in shared read-only mode. Close the pin and reopen it in exclusive mode to change the drive mode of the pin.</term></item>
/// </list>
/// </remarks>
void SetDriveMode(GpioPinDriveMode value);

/// <summary>
///
/// Drives the specified value onto the general purpose I/O (GPIO) pin according to the current drive mode for the pin
/// if the pin is configured as an output, or updates the latched output value for the pin if the pin is configured as an input.
/// </summary>
/// <param name="value"></param>
/// <param name="value">The enumeration value to write to the GPIO pin.
/// <para>If the GPIO pin is configured as an output, the method drives the specified value onto the pin according to the current drive mode for the pin.</para>
/// <para>If the GPIO pin is configured as an input, the method updates the latched output value for the pin. The latched output value is driven onto the pin when the configuration for the pin changes to output.</para>
/// </param>
/// <remarks>The following exceptions can be thrown by this method:
/// <list type="bullet">
/// <item><term>E_ACCESSDENIED : The GPIO pin is open in shared read-only mode. To write to the pin, close the pin and reopen the pin in exclusive mode.</term></item>
/// </list>
/// </remarks>
void Write(GpioPinValue value);

/// <summary>
///
/// Reads the current value of the general-purpose I/O (GPIO) pin.
/// </summary>
/// <returns></returns>
/// <returns>The current value of the GPIO pin. If the pin is configured as an output, this value is the last value written to the pin.</returns>
GpioPinValue Read();
}
}