Treehopper C# API
I2C Interface Reference

I2c master device More...

Inheritance diagram for I2C:
HardwareI2C I2cMuxPort

Public Member Functions

Task< byte[]> SendReceiveAsync (byte address, byte[] dataToWrite, byte numBytesToRead)
 Perform an I2c transaction to a peripheral slave device using this port. More...
 

Properties

double Speed [get, set]
 The speed, in KHz, that the bus should be operated at. More...
 
bool Enabled [get, set]
 Whether this I2c port should be enabled or disabled More...
 

Detailed Description

I2c master device

This interface is used as a contract for I2C devices.

For documentation on Treehopper's I2C peripheral, consult HardwareI2C

Member Function Documentation

◆ SendReceiveAsync()

Task<byte[]> SendReceiveAsync ( byte  address,
byte []  dataToWrite,
byte  numBytesToRead 
)

Perform an I2c transaction to a peripheral slave device using this port.

Parameters
addressThe 7-bit address of the slave. Valid range is 0-127.
dataToWriteA byte array of the data to write to the device.
numBytesToReadThe number of bytes to read and return.
Returns
The bytes read from the device.

Implemented in HardwareI2C, and I2cMuxPort.

Property Documentation

◆ Speed

double Speed
getset

The speed, in KHz, that the bus should be operated at.

The default is 100 KHz for most modules.

◆ Enabled

bool Enabled
getset

Whether this I2c port should be enabled or disabled


The documentation for this interface was generated from the following file: