I2cDevice
I2cDevice
I2cDevice
I2cDevice
Class
Definition
Represents a communications channel to a device on an inter-integrated circuit (I2 C) bus.
public : sealed class I2cDevice : II2cDevice, IClosablepublic sealed class I2cDevice : II2cDevice, IDisposablePublic NotInheritable Class I2cDevice Implements II2cDevice, IDisposable// You can use this class in JavaScript.
- Attributes
| Device family |
Windows IoT Extension SDK (introduced v10.0.10240.0)
|
| API contract |
Windows.Devices.DevicesLowLevelContract (introduced v1)
|
Remarks
To get an instance of I2cDevice, use the I2cDevice.FromIdAsync method.
Properties
ConnectionSettings ConnectionSettings ConnectionSettings ConnectionSettings
Gets the connection settings used for communication with the inter-integrated circuit (I2 C) device.
public : I2cConnectionSettings ConnectionSettings { get; }public I2cConnectionSettings ConnectionSettings { get; }Public ReadOnly Property ConnectionSettings As I2cConnectionSettings// You can use this property in JavaScript.
The connection settings used for communication with the inter-integrated circuit (I2 C) device.
| Device family |
Windows IoT Extension SDK (introduced v10.0.10240.0)
|
| API contract |
Windows.Devices.DevicesLowLevelContract (introduced v1)
|
| Capabilities |
lowLevelDevices
|
Remarks
If you try to change the values of the I2cConnectionSettings object that you get through this property, those changes will have no effect. You cannot change the connection settings after you create the I2cDevice object. To specify the connection settings, use the I2cConnectionSettings(Int32) constructor to create an I2cConnectionSettings object, and set the property values for that I2cConnectionSettings object before you pass it to the FromIdAsync method to create the I2cDevice object.
- See Also
DeviceId DeviceId DeviceId DeviceId
Gets the plug and play device identifier of the inter-integrated circuit (I2 C) bus controller for the device.
public : PlatForm::String DeviceId { get; }public string DeviceId { get; }Public ReadOnly Property DeviceId As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The plug and play device identifier of the inter-integrated circuit (I2 C) bus controller for the device.
| Device family |
Windows IoT Extension SDK (introduced v10.0.10240.0)
|
| API contract |
Windows.Devices.DevicesLowLevelContract (introduced v1)
|
| Capabilities |
lowLevelDevices
|
- See Also
Methods
Close() Close() Close() Close()
Closes the connection to the inter-integrated circuit (I2 C) device.
public : void Close()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Remarks
You cannot call Close methods through Visual C++ component extensions (C++/CX) on Windows Runtime class instances where the class implemented IClosable. Instead, Visual C++ component extensions (C++/CX) code for runtime classes should call the destructor or set the last reference to null.
- See Also
Dispose() Dispose() Dispose() Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
This member is not implemented in C++void Dispose()Sub Disposevoid Dispose()
FromIdAsync(String, I2cConnectionSettings) FromIdAsync(String, I2cConnectionSettings) FromIdAsync(String, I2cConnectionSettings) 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.
public : static IAsyncOperation<I2cDevice> FromIdAsync(PlatForm::String deviceId, I2cConnectionSettings settings)public static IAsyncOperation<I2cDevice> FromIdAsync(String deviceId, I2cConnectionSettings settings)Public Static Function FromIdAsync(deviceId As String, settings As I2cConnectionSettings) As IAsyncOperation( Of I2cDevice )// You can use this method in JavaScript.
- deviceId
- PlatForm::String String String String
The plug and play device identifier of the I2 C bus controller for which you want to create an I2cDevice object.
The connection settings to use for communication with the I2 C bus controller that deviceId specifies.
An asynchronous operation that returns the I2cDevice object.
| Device family |
Windows IoT Extension SDK (introduced v10.0.10240.0)
|
| API contract |
Windows.Devices.DevicesLowLevelContract (introduced v1)
|
| Capabilities |
lowLevelDevices
|
- See Also
GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() 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.
public : static PlatForm::String GetDeviceSelector()public static string GetDeviceSelector()Public Static Function GetDeviceSelector() As string// You can use this method in JavaScript.
An AQS string for all of the I2 C bus controllers on the system, which you can use with the DeviceInformation.FindAllAsync method to get DeviceInformation objects for those bus controllers.
- See Also
GetDeviceSelector(String) GetDeviceSelector(String) GetDeviceSelector(String) 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.
public : static PlatForm::String GetDeviceSelector(PlatForm::String friendlyName)public static string GetDeviceSelector(String friendlyName)Public Static Function GetDeviceSelector(friendlyName As String) As string// You can use this method in JavaScript.
- friendlyName
- PlatForm::String String String String
A friendly name for the particular I2 C bus on a particular hardware platform for which you want to get the AQS string.
An AQS string for the I2 C bus that friendlyName specifies, which you can use with the DeviceInformation.FindAllAsync method to get a DeviceInformation object for that bus.
- See Also
Read(Byte[]) Read(Byte[]) Read(Byte[]) Read(Byte[])
Reads data from the inter-integrated circuit (I2 C) bus on which the device is connected into the specified buffer.
public : void Read(Byte[] buffer)public void Read(Byte[] buffer)Public Function Read(buffer As Byte[]) As void// You can use this method in JavaScript.
- buffer
- Byte[] Byte[] Byte[] Byte[]
The buffer to which you want to read the data from the I2 C bus. The length of the buffer determines how much data to request from the device.
| Device family |
Windows IoT Extension SDK (introduced v10.0.10240.0)
|
| API contract |
Windows.Devices.DevicesLowLevelContract (introduced v1)
|
| Capabilities |
lowLevelDevices
|
Remarks
Error Codes
0x80070002
The bus address was not acknowledged.
0x8007045D
The I2 C device negatively acknowledged the data transfer before the entire buffer was read.
- See Also
ReadPartial(Byte[]) ReadPartial(Byte[]) ReadPartial(Byte[]) 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.
public : I2cTransferResult ReadPartial(Byte[] buffer)public I2cTransferResult ReadPartial(Byte[] buffer)Public Function ReadPartial(buffer As Byte[]) As I2cTransferResult// You can use this method in JavaScript.
- buffer
- Byte[] Byte[] Byte[] Byte[]
The buffer to which you want to read the data from the I2 C bus. The length of the buffer determines how much data to request from the device.
A structure that contains information about the success of the read operation and the actual number of bytes that the operation read into the buffer.
| Device family |
Windows IoT Extension SDK (introduced v10.0.10240.0)
|
| API contract |
Windows.Devices.DevicesLowLevelContract (introduced v1)
|
| Capabilities |
lowLevelDevices
|
- See Also
-
Write(Byte[]) Write(Byte[]) Write(Byte[]) 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 I2cConnectionSetting s object that you used to create the I2cDevice object.
public : void Write(Byte[] buffer)public void Write(Byte[] buffer)Public Function Write(buffer As Byte[]) As void// You can use this method in JavaScript.
- buffer
- Byte[] Byte[] Byte[] Byte[]
A buffer that contains the data that you want to write to the I2 C device. This data should not include the bus address.
| Device family |
Windows IoT Extension SDK (introduced v10.0.10240.0)
|
| API contract |
Windows.Devices.DevicesLowLevelContract (introduced v1)
|
| Capabilities |
lowLevelDevices
|
Remarks
Error Codes
0x80070002
The bus address was not acknowledged.
0x8007045D
The I2 C device negatively acknowledged the data transfer before the entire buffer was written.
WritePartial(Byte[]) WritePartial(Byte[]) WritePartial(Byte[]) 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.
public : I2cTransferResult WritePartial(Byte[] buffer)public I2cTransferResult WritePartial(Byte[] buffer)Public Function WritePartial(buffer As Byte[]) As I2cTransferResult// You can use this method in JavaScript.
- buffer
- Byte[] Byte[] Byte[] Byte[]
A buffer that contains the data that you want to write to the I2 C device. This data should not include the bus address.
A structure that contains information about the success of the write operation and the actual number of bytes that the operation wrote into the buffer.
| Device family |
Windows IoT Extension SDK (introduced v10.0.10240.0)
|
| API contract |
Windows.Devices.DevicesLowLevelContract (introduced v1)
|
| Capabilities |
lowLevelDevices
|
WriteRead(Byte[], Byte[]) WriteRead(Byte[], Byte[]) WriteRead(Byte[], Byte[]) 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.
public : void WriteRead(Byte[] writeBuffer, Byte[] readBuffer)public void WriteRead(Byte[] writeBuffer, Byte[] readBuffer)Public Function WriteRead(writeBuffer As Byte[], readBuffer As Byte[]) As void// You can use this method in JavaScript.
- writeBuffer
- Byte[] Byte[] Byte[] Byte[]
A buffer that contains the data that you want to write to the I2 C device. This data should not include the bus address.
- readBuffer
- Byte[] Byte[] Byte[] Byte[]
The buffer to which you want to read the data from the I2 C bus. The length of the buffer determines how much data to request from the device.
| Device family |
Windows IoT Extension SDK (introduced v10.0.10240.0)
|
| API contract |
Windows.Devices.DevicesLowLevelContract (introduced v1)
|
| Capabilities |
lowLevelDevices
|
Remarks
Error Codes
0x80070002
The bus address was not acknowledged.
0x8007045D
The I2 C device negatively acknowledged the data transfer before the entire buffer was read.
- See Also
WriteReadPartial(Byte[], Byte[]) WriteReadPartial(Byte[], Byte[]) WriteReadPartial(Byte[], Byte[]) 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.
public : I2cTransferResult WriteReadPartial(Byte[] writeBuffer, Byte[] readBuffer)public I2cTransferResult WriteReadPartial(Byte[] writeBuffer, Byte[] readBuffer)Public Function WriteReadPartial(writeBuffer As Byte[], readBuffer As Byte[]) As I2cTransferResult// You can use this method in JavaScript.
- writeBuffer
- Byte[] Byte[] Byte[] Byte[]
A buffer that contains the data that you want to write to the I2 C device. This data should not include the bus address.
- readBuffer
- Byte[] Byte[] Byte[] Byte[]
The buffer to which you want to read the data from the I2 C bus. The length of the buffer determines how much data to request from the device.
A structure that contains information about whether both the read and write parts of the operation succeeded and the sum of the actual number of bytes that the operation wrote and the actual number of bytes that the operation read.
| Device family |
Windows IoT Extension SDK (introduced v10.0.10240.0)
|
| API contract |
Windows.Devices.DevicesLowLevelContract (introduced v1)
|
| Capabilities |
lowLevelDevices
|