Skip to main content

Class Cp2112I2cBus

Represents an I2C bus implementation using the Cp2112 device.

Assembly: Cp2112.dll
View Source
Declaration
public sealed class Cp2112I2cBus : II2cBus, IDisposable

Implements:
Meadow.Hardware.II2cBus, System.IDisposable

Properties

BusSpeed

Gets or sets the bus clock speed.

View Source
Declaration
public I2cBusSpeed BusSpeed { get; set; }

Methods

~Cp2112I2cBus()

Finalizer for the Cp2112I2cBus class, used to release unmanaged resources.

View Source
Declaration
protected ~Cp2112I2cBus()

Dispose()

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

View Source
Declaration
public void Dispose()

Exchange(byte, Span<byte>, Span<byte>)

Writes data from the write buffer to a peripheral on the bus, then resets the bus and reads the return data into the read buffer.

View Source
Declaration
public void Exchange(byte peripheralAddress, Span<byte> writeBuffer, Span<byte> readBuffer)
Parameters
TypeNameDescription
System.ByteperipheralAddressThe address of the I2C peripheral.
System.Span<System.Byte>writeBufferThe buffer to read data from.
System.Span<System.Byte>readBufferThe buffer to read returning data into.

Read(byte, Span<byte>)

Reads bytes from a peripheral.

View Source
Declaration
public void Read(byte peripheralAddress, Span<byte> readBuffer)
Parameters
TypeNameDescription
System.ByteperipheralAddressThe I2C address to read.
System.Span<System.Byte>readBufferThe buffer used for data reception.

Write(byte, Span<byte>)

Writes a number of bytes to the bus.

View Source
Declaration
public void Write(byte peripheralAddress, Span<byte> writeBuffer)
Parameters
TypeNameDescription
System.ByteperipheralAddressThe address of the I2C peripheral.
System.Span<System.Byte>writeBufferThe data to be written.

Implements

  • Meadow.Hardware.II2cBus
  • System.IDisposable