Characteristic Locus
Namespace Meadow.Hardware
Assembly Meadow.dll

Syntax

public interface II2cBus

Methods

View Source

ReadData(Byte, Int32)

Read the specified number of bytes from the I2C device.

Declaration
byte[] ReadData(byte peripheralAddress, int numberOfBytes)

Parameters

Type Name Description
System.Byte peripheralAddress

Address of the I2C peripheral.

System.Int32 numberOfBytes

Number of bytes.

Returns

Type Description
System.Byte[]

The bytes.

View Source

WriteData(Byte, Byte[])

Write a number of bytes to the device.

Declaration
void WriteData(byte peripheralAddress, params byte[] data)

Parameters

Type Name Description
System.Byte peripheralAddress

Address of the I2C peripheral.

System.Byte[] data

Data to be written.

Remarks

The number of bytes to be written will be determined by the length of the byte array.

View Source

WriteData(Byte, IEnumerable<Byte>)

Declaration
void WriteData(byte peripheralAddress, IEnumerable<byte> data)

Parameters

Type Name Description
System.Byte peripheralAddress
System.Collections.Generic.IEnumerable<System.Byte> data
View Source

WriteReadData(Byte, Int32, Byte[])

Writes data to the bus, followed by a restart and then reads a specified number of bytes

Declaration
byte[] WriteReadData(byte peripheralAddress, int byteCountToRead, params byte[] dataToWrite)

Parameters

Type Name Description
System.Byte peripheralAddress

Address of the I2C peripheral.

System.Int32 byteCountToRead

Number of bytes to read

System.Byte[] dataToWrite

Data to be written.

Returns

Type Description
System.Byte[]

The data read from the bus