public class I2C
extends Object
| Constructor and Description |
|---|
I2C(String dev)
Opens an I2C interface as master
|
| Modifier and Type | Method and Description |
|---|---|
void |
beginTransmission(int slave)
Begins a transmission to an attached device
|
void |
close()
Closes the I2C device
|
void |
endTransmission()
Ends the current transmissions
|
static String[] |
list()
Lists all available I2C interfaces
|
byte[] |
read(int len)
Reads bytes from the attached device
|
void |
write(byte out)
Adds a byte to be written to the attached device
|
void |
write(byte[] out)
Adds bytes to be written to the device
|
void |
write(int out)
Adds a byte to be written to the attached device
|
void |
write(String out)
Adds bytes to be written to the attached device
|
public I2C(String dev)
dev - interface namelistpublic void beginTransmission(int slave)
write,
read,
endTransmissionpublic void close()
public void endTransmission()
beginTransmission,
writepublic static String[] list()
public byte[] read(int len)
len - number of bytes to readbeginTransmission,
write,
endTransmissionpublic void write(byte[] out)
out - bytes to be writtenbeginTransmission,
read,
endTransmissionpublic void write(String out)
out - string to be writtenbeginTransmission,
read,
endTransmissionpublic void write(int out)
out - single byte to be written, e.g. numeric literal (0 to 255, or -128 to 127)beginTransmission,
read,
endTransmissionpublic void write(byte out)
out - single byte to be writtenbeginTransmission,
read,
endTransmission