I2cControllerApiWrapper Class
Namespace: GHIElectronics.TinyCLR.Devices.I2c.Provider · Assembly: GHIElectronics.TinyCLR.Devices.I2c
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.
| Parameter | Type | Description |
|---|---|---|
api | NativeApi |
Properties
Api
public NativeApi Api { get; }
The underlying native API descriptor.
WriteBufferSize
public extern int WriteBufferSize { get; set; }
Size in bytes of the transmit buffer. (inherited)
ReadBufferSize
public extern int ReadBufferSize { get; set; }
Size in bytes of the receive buffer. (inherited)
BytesToWrite
public extern int BytesToWrite { get; }
The number of bytes that are in the process of being written. (inherited)
BytesToRead
public extern int BytesToRead { get; }
The number of bytes available to read. (inherited)
Timeout
public TimeSpan Timeout { get; set; }
Gets or sets the length of time, in milliseconds, before the request times out. (inherited)
Methods
Dispose()
public void Dispose()
Releases the native controller.
SetActiveSettings(I2cConnectionSettings connectionSettings)
public extern void SetActiveSettings(I2cConnectionSettings connectionSettings)
Applies a complete set of serial settings (baud, framing, handshake, polarity). (inherited)
| Parameter | Type | Description |
|---|---|---|
connectionSettings | I2cConnectionSettings |
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)
| Parameter | Type | Description |
|---|---|---|
writeBuffer | byte[] | |
writeOffset | int | |
writeLength | int | |
readBuffer | byte[] | |
readOffset | int | |
readLength | int | |
written | out int | |
read | out int |
Returns I2cTransferStatus
ClearWriteBuffer()
public extern void ClearWriteBuffer()
Empties the transmit buffer. (inherited)
ClearReadBuffer()
public extern void ClearReadBuffer()
Empties the receive 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
Raised when a frame/parity/overrun error is detected. (inherited)