|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.system.I2CPort
Class allowing access to I2C bus.
This class uses the I2C protocol on one of two resources:
clockDelay
value.
clockDelay
value.
Field Summary | |
byte |
clockDelay
How long to wait between I2C edge transitions. |
int |
SCLAddress
Memory mapped address of the I2C clock line. |
byte |
SCLMask
Bit mask for clock line within byte at SCLAddress . |
int |
SDAAddress
Memory mapped address of the I2C data line. |
byte |
SDAMask
Bit mask for data line within byte at SDAAddress . |
byte |
slaveAddress
I2C address of slave. |
static byte |
STRETCH0
When in memory map mode, use to set the number of memory bus cycles to 2. |
static byte |
STRETCH1
When in memory map mode, use to set the number of memory bus cycles to 3. |
static byte |
STRETCH10
When in memory map mode, use to set the number of memory bus cycles to 12. |
static byte |
STRETCH2
When in memory map mode, use to set the number of memory bus cycles to 4. |
static byte |
STRETCH3
When in memory map mode, use to set the number of memory bus cycles to 5. |
static byte |
STRETCH7
When in memory map mode, use to set the number of memory bus cycles to 9. |
static byte |
STRETCH8
When in memory map mode, use to set the number of memory bus cycles to 10. |
static byte |
STRETCH9
When in memory map mode, use to set the number of memory bus cycles to 11. |
byte |
stretchCycles
Number of stretch memory cycles to use when accessing memory mapped IO. |
Constructor Summary | |
I2CPort()
Use processor port pin P5.0 for SCL and P5.1 for SDA. |
|
I2CPort(int SCLAddress,
byte SCLMask,
int SDAAddress,
byte SDAMask)
Use memory mapped IO address for SCL and SDA pins. |
Method Summary | |
int |
getStretchCycles()
Gets the number of stretch memory cycles to use when accessing memory mapped IO. |
int |
read(byte[] barr,
int off,
int len)
Reads into the byte array from the current slave address |
void |
setAddress(byte address)
Sets the I2C slave address. |
void |
setClockDelay(byte delay)
Sets how long to wait between I2C edge transitions. |
void |
setStretchCycles(byte stretch)
Sets the number of stretch memory cycles to use when accessing memory mapped IO. |
int |
write(byte[] barr,
int off,
int len)
Writes the byte array to the current slave address |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final byte STRETCH0
public static final byte STRETCH1
public static final byte STRETCH2
public static final byte STRETCH3
public static final byte STRETCH7
public static final byte STRETCH8
public static final byte STRETCH9
public static final byte STRETCH10
public byte stretchCycles
STRETCH0
STRETCH1
STRETCH2
STRETCH3
STRETCH7
STRETCH8
STRETCH9
STRETCH10
public byte slaveAddress
public byte clockDelay
public int SCLAddress
public byte SCLMask
SCLAddress
.public int SDAAddress
public byte SDAMask
SDAAddress
.Constructor Detail |
public I2CPort()
public I2CPort(int SCLAddress, byte SCLMask, int SDAAddress, byte SDAMask)
SCLAddress
- address of latch.SCLMask
- mask of bit or bits to use.SDAAddress
- address of latch.SDAMask
- mask of bit or bits to use.Method Detail |
public void setAddress(byte address)
address
- address of I2C slave device.public void setClockDelay(byte delay)
delay
- I2C Clock delaypublic void setStretchCycles(byte stretch) throws IllegalArgumentException
STRETCH0
STRETCH1
STRETCH2
STRETCH3
STRETCH7
STRETCH8
STRETCH9
STRETCH10
stretch
- stretch cycle valuepublic int getStretchCycles()
public int write(byte[] barr, int off, int len) throws IllegalAddressException
barr
- array of bytes to sendoff
- starting offset to sendlen
- length of bytes to sendSCLAddress
or SDAAddress
is out of rangepublic int read(byte[] barr, int off, int len) throws IllegalAddressException
barr
- array to fill from read operationoff
- starting offset to read intolen
- length of bytes to readSCLAddress
or SDAAddress
is out of range
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |