Skip to main content

I2cDevice Class

NuGet: GHIElectronics.TinyCLR.Devices.I2c
Assembly: System.Device.I2c
Namespace: System.Device.I2c

.NET-style I²C device. Standard surface (Read / Write / WriteRead); internally TinyCLR routes calls through GHIElectronics.TinyCLR.Devices.I2c.I2cController.

public abstract class I2cDevice : IDisposable

Properties

ConnectionSettings

public abstract I2cConnectionSettings ConnectionSettings { get; }

The settings this device was created with.

Methods

Create(I2cConnectionSettings settings)

public static I2cDevice Create(I2cConnectionSettings settings)

Opens an I²C device with the given settings.

Returns I2cDevice

Read(byte[] buffer)

public abstract void Read(byte[] buffer)

Reads bytes from the device into the buffer.

Write(byte[] buffer)

public abstract void Write(byte[] buffer)

Writes the buffer to the device.

WriteRead(byte[] writeBuffer, byte[] readBuffer)

public abstract void WriteRead(byte[] writeBuffer, byte[] readBuffer)

Writes, then reads back in a single transaction.

Dispose()

public abstract void Dispose()

Closes the device and releases the bus.