|
SunSPOT API V5.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.spot.peripheral.AT91_I2C
public class AT91_I2C
Class for communicating with devices using the I2C protocol using the ARM9 TWI hardware. Uses the I2C_DATA and I2C_CLK pins in the top connector for SDA and SCK of the TWI interface.
Constructor Summary | |
---|---|
AT91_I2C()
|
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 class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AT91_I2C()
Method Detail |
---|
public void open() throws IOException
open
in interface II2C
IOException
public void close() throws IOException
close
in interface II2C
IOException
public void setClockSpeed(int clockSpeed)
setClockSpeed
in interface II2C
clockSpeed
- I2C bus clock in Hertzpublic void write(int slaveAddress, byte[] data, int off, int len) throws IOException
write
in interface II2C
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
IOException
public void write(int slaveAddress, int internalAddress, int internalAddressSize, byte[] data, int off, int len) throws IOException
write
in interface II2C
slaveAddress
- 7-bit slave address, shifted left one bit so LSB is not usedinternalAddress
- 0-3 bytes of internal address information sent to the slave
device before any data.internalAddressSize
- 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
IOException
public void read(int slaveAddress, byte[] data, int off, int len) throws IOException
read
in interface II2C
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
IOException
public void read(int slaveAddress, int internalAddress, int internalAddressSize, byte[] data, int off, int len) throws IOException
read
in interface II2C
slaveAddress
- 7-bit slave address, shifted left one bit so LSB is not usedinternalAddress
- 0-3 bytes of internal address information sent to the slave
device before any datainternalAddressSize
- 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
IOException
public boolean isBusy()
isBusy
in interface II2C
public boolean probe(int slaveAddress, int probeData)
probe
in interface II2C
slaveAddress
- 7-bit slave address, shifted left one bit so LSB is not usedprobeData
- - byte value to try writing to device
|
SunSPOT API V5.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |