|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.spot.resources.Resource
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 com.sun.spot.resources.Resource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sun.spot.resources.IResource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Constructor Detail |
|---|
public AT91_I2C()
| Method Detail |
|---|
public void open()
throws IOException
open in interface II2CIOException
public void close()
throws IOException
close in interface II2CIOExceptionpublic void setClockSpeed(int clockSpeed)
setClockSpeed in interface II2CclockSpeed - I2C bus clock in Hertz
public void write(int slaveAddress,
byte[] data,
int off,
int len)
throws IOException
write in interface II2CslaveAddress - 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 II2CslaveAddress - 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 II2CslaveAddress - 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 II2CslaveAddress - 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
IOExceptionpublic boolean isBusy()
isBusy in interface II2C
public boolean probe(int slaveAddress,
int probeData)
probe in interface II2CslaveAddress - 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 | |||||||||