Skip to main content

I2cControllerApiWrapper Class

NuGet: GHIElectronics.TinyCLR.Devices.I2c
Assembly: GHIElectronics.TinyCLR.Devices.I2c
Namespace: GHIElectronics.TinyCLR.Devices.I2c.Provider

Concrete II2cControllerProvider backed by the native TinyCLR I²C HAL.

public sealed class I2cControllerApiWrapper : II2cControllerProvider

Constructors

I2cControllerApiWrapper(NativeApi api)

public I2cControllerApiWrapper(NativeApi api)

Wraps the given native API as a provider.

Properties

Api

public NativeApi Api { get; }

The underlying native API descriptor.

WriteBufferSize

public extern int WriteBufferSize { get; set; }

Slave-mode only: size in bytes of the controller's outgoing buffer. (inherited)

ReadBufferSize

public extern int ReadBufferSize { get; set; }

Slave-mode only: size in bytes of the controller's incoming buffer. (inherited)

BytesToWrite

public extern int BytesToWrite { get; }

Slave-mode only: bytes currently queued to transmit. (inherited)

BytesToRead

public extern int BytesToRead { get; }

Slave-mode only: bytes currently available to read. (inherited)

Timeout

public TimeSpan Timeout { get; set; }

Maximum time the controller will block on a single transfer. (inherited)

Methods

Dispose()

public void Dispose()

Releases the native controller.

SetActiveSettings(I2cConnectionSettings connectionSettings)

public extern void SetActiveSettings(I2cConnectionSettings connectionSettings)

Applies the given settings before the next transfer. (inherited)

WriteRead(byte[] writeBuffer, int writeOffset, int writeLength, byte[] readBuffer, int readOffset, int readLength, out int written, out int read)

public extern I2cTransferStatus WriteRead(byte[] writeBuffer, int writeOffset, int writeLength, byte[] readBuffer, int readOffset, int readLength, out int written, out int read)

Performs a write-then-read transaction. (inherited)

Returns I2cTransferStatus

ClearWriteBuffer()

public extern void ClearWriteBuffer()

Slave-mode only: empties the controller's outgoing buffer. (inherited)

ClearReadBuffer()

public extern void ClearReadBuffer()

Slave-mode only: empties the controller's incoming buffer. (inherited)

Events

FrameReceived

public event FrameReceivedEventHandler FrameReceived

Slave-mode only: raised when a master frame addressed to this slave is observed. (inherited)

ErrorReceived

public event ErrorReceivedEventHandler ErrorReceived

Slave-mode only: raised when the controller detects a bus error. (inherited)