مشاركة عبر


GpioPin Class

Definition

Represents a general-purpose I/O (GPIO) pin.

public ref class GpioPin sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Devices.DevicesLowLevelContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class GpioPin final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Devices.DevicesLowLevelContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class GpioPin : System.IDisposable
Public NotInheritable Class GpioPin
Implements IDisposable
Inheritance
Object Platform::Object IInspectable GpioPin
Attributes
Implements

Windows requirements

Device family
Windows IoT Extension SDK (introduced in 10.0.10240.0)
API contract
Windows.Devices.DevicesLowLevelContract (introduced in v1.0)

Remarks

To get a GpioPin object, use the GpioController.OpenPin or GpioController.TryOpenPin method.

Properties

DebounceTimeout

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.

PinNumber

Gets the pin number of the general-purpose I/O (GPIO) pin.

SharingMode

Gets the sharing mode in which the general-purpose I/O (GPIO) pin is open.

Methods

Close()

Closes the general-purpose I/O (GPIO) pin and releases the resources associated with it.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

GetDriveMode()

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.

IsDriveModeSupported(GpioPinDriveMode)

Gets whether the general-purpose I/O (GPIO) pin supports the specified drive mode.

Read()

Reads the current value of the general-purpose I/O (GPIO) pin.

SetDriveMode(GpioPinDriveMode)

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.

Write(GpioPinValue)

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.

Events

ValueChanged

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 is configured as an output.

Applies to

See also