|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface II2C
Interface for communicating with devices using the I2C protocol.
| Method Summary | |
|---|---|
void |
close()
Release any resources associated with the I2C hardware. |
boolean |
isBusy()
Check if an I2C data transfer is currently in process. |
void |
open()
Initialize the I2C hardware. |
boolean |
probe(int slaveAddress,
int probeData)
Check if a slave device is present at the given address. |
void |
read(int slaveAddress,
byte[] data,
int off,
int len)
Read data from the specified I2C slave device. |
void |
read(int slaveAddress,
int internalAddress,
int internalAddressSize,
byte[] data,
int off,
int len)
Read data from the specified I2C slave device. |
void |
setClockSpeed(int clockSpeed)
Set the clock speed to use for I2C data transfers. |
void |
write(int slaveAddress,
byte[] data,
int off,
int len)
Write data to the specified I2C slave device. |
void |
write(int slaveAddress,
int internalAddress,
int internalAddressSize,
byte[] data,
int off,
int len)
Write data to the specified I2C slave device. |
| Methods inherited from interface com.sun.spot.resources.IResource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Method Detail |
|---|
void open()
throws IOException
IOException
void close()
throws IOException
IOExceptionvoid setClockSpeed(int clockSpeed)
clockSpeed - I2C bus clock in Hertz
void write(int slaveAddress,
byte[] data,
int off,
int len)
throws IOException
slaveAddress - 7-bit slave address, shifted left one bit so LSB is not useddata - Array of bytes to writeoff - Offset from which to start writing datalen - How many bytes of data to write. Note: some implementations may limit
the number of bytes that can be written in a single call, e.g. the
eDemo board firmware has a fixed buffer that can only hold 40 bytes.
IOException
void write(int slaveAddress,
int internalAddress,
int internalAddressSize,
byte[] data,
int off,
int len)
throws IOException
slaveAddress - 7-bit slave address, shifted left one bit so LSB is not usedinternalAddress - 0-4 bytes of internal address information sent to the slave
device before any data; Note: some implementations may not support
sending a full 4 bytes of data, e.g. the ARM9 can only send 0-3 bytesinternalAddressSize - how many bytes of internal address information are to be sentdata - Array of bytes to writeoff - Offset from which to start writing datalen - How many bytes of data to write. Note: some implementations may limit
the number of bytes that can be written in a single call, e.g. the
eDemo board firmware has a fixed buffer that can only hold 40 bytes.
IOException
void read(int slaveAddress,
byte[] data,
int off,
int len)
throws IOException
slaveAddress - 7-bit slave address, shifted left one bit so LSB is not useddata - Array of bytes to read intooff - Offset from which to start reading datalen - How many bytes of data to read. Note: some implementations may limit
the number of bytes that can be written in a single call, e.g. the
eDemo board firmware has a fixed buffer that can only hold 40 bytes.
IOException
void read(int slaveAddress,
int internalAddress,
int internalAddressSize,
byte[] data,
int off,
int len)
throws IOException
slaveAddress - 7-bit slave address, shifted left one bit so LSB is not usedinternalAddress - 0-4 bytes of internal address information sent to the slave
device before any data; Note: some implementations may not support
sending a full 4 bytes of data, e.g. the ARM9 can only send 0-3 bytesinternalAddressSize - how many bytes of internal address information are to be sentdata - Array of bytes to read intooff - Offset from which to start reading datalen - How many bytes of data to read. Note: some implementations may limit
the number of bytes that can be written in a single call, e.g. the
eDemo board firmware has a fixed buffer that can only hold 40 bytes.
IOExceptionboolean isBusy()
boolean probe(int slaveAddress,
int probeData)
slaveAddress - 7-bit slave address, shifted left one bit so LSB is not usedprobeData - - byte value to try writing to device
|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||