public class I2c
extends java.lang.Object
Constructor and Description |
---|
I2c(int i2cFrequency)
Creates the I2C interface at the specified frequency (tr = 0 and standard timeout).
|
I2c(int i2cPort,
int i2cFrequency,
int i2cTout)
Creates the I2C interface at the specified frequency.
|
Modifier and Type | Method and Description |
---|---|
int |
readBytes(int address,
byte[] buffer,
int length)
Read the requested bytes through the I2C connection and stores them in the given buffer.
|
int |
writeBytes(int address,
byte[] buffer,
int length)
Writes the given buffer through the I2C connection
|
public I2c(int i2cFrequency)
i2cFrequency
- the frequency of the I2C connectionpublic I2c(int i2cPort, int i2cFrequency, int i2cTout)
unit
- 0: standard port, 1: target port when availablei2cFrequency
- the frequency of the I2C connectiontout:
- timeout in ms (in case of clock stretching), -1 for default.public int readBytes(int address, byte[] buffer, int length)
address
- the address of the targetted slave devicebuffer
- the buffer that will receive the datalength
- the number of bytes to readpublic int writeBytes(int address, byte[] buffer, int length)
address
- the addresso of the targetted slave devicebuffer
- the buffer to writelength
- the number of bytes to write (should be less or equal to buffer.length)