Share via


I2cDevice Class

Definition

Represents a communications channel to a device on an inter-integrated circuit (I2 C) bus.

public ref class I2cDevice sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Devices.DevicesLowLevelContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class I2cDevice final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Devices.DevicesLowLevelContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class I2cDevice : System.IDisposable
Public NotInheritable Class I2cDevice
Implements IDisposable
Inheritance
Object Platform::Object IInspectable I2cDevice
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 an instance of I2cDevice, use the I2cDevice.FromIdAsync method.

Properties

ConnectionSettings

Gets the connection settings used for communication with the inter-integrated circuit (I2 C) device.

DeviceId

Gets the plug and play device identifier of the inter-integrated circuit (I2 C) bus controller for the device.

Methods

Close()

Closes the connection to the inter-integrated circuit (I2 C) device.

Dispose()

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

FromIdAsync(String, I2cConnectionSettings)

Retrieves an I2cDevice object asynchronously for the inter-integrated circuit (I2 C) bus controller that has the specified plug and play device identifier, using the specified connection settings.

GetDeviceSelector()

Retrieves an Advanced Query Syntax (AQS) string for all of the inter-integrated circuit (I2 C) bus controllers on the system. You can use this string with the DeviceInformation.FindAllAsync method to get DeviceInformation objects for those bus controllers.

GetDeviceSelector(String)

Retrieves an Advanced Query Syntax (AQS) string for the inter-integrated circuit (I2 C) bus that has the specified friendly name. You can use this string with the DeviceInformation.FindAllAsync method to get a DeviceInformation object for that bus.

Read(Byte[])

Reads data from the inter-integrated circuit (I2 C) bus on which the device is connected into the specified buffer.

ReadPartial(Byte[])

Reads data from the inter-integrated circuit (I2 C) bus on which the device is connected into the specified buffer, and returns information about the success of the operation that you can use for error handling.

Write(Byte[])

Writes data to the inter-integrated circuit (I2 C) bus on which the device is connected, based on the bus address specified in the I2cConnectionSettings object that you used to create the I2cDevice object.

WritePartial(Byte[])

Writes data to the inter-integrated circuit (I2 C) bus on which the device is connected, and returns information about the success of the operation that you can use for error handling.

WriteRead(Byte[], Byte[])

Performs an atomic operation to write data to and then read data from the inter-integrated circuit (I2 C) bus on which the device is connected, and sends a restart condition between the write and read operations.

WriteReadPartial(Byte[], Byte[])

Performs an atomic operation to write data to and then read data from the inter-integrated circuit (I2 C) bus on which the device is connected, and returns information about the success of the operation that you can use for error handling.

Applies to

See also