public class I2cDevice extends java.lang.Object implements HardwareDevice
Constructor and Description |
---|
I2cDevice(I2cController controller,
int port)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this device
|
void |
copyBufferIntoWriteBuffer(byte[] buffer)
Copy a byte array into the buffer that is set to be written out to the device
|
void |
deregisterForPortReadyCallback()
Unregister for a port-ready callback
|
void |
enableI2cReadMode(int i2cAddress,
int memAddress,
int length)
Enable read mode for this I2C device
|
void |
enableI2cWriteMode(int i2cAddress,
int memAddress,
int length)
Enable write mode for this I2C device
|
java.lang.String |
getConnectionInfo()
Get connection information about this device in a human readable format
|
byte[] |
getCopyOfReadBuffer()
Get a copy of the most recent data read in from the device
|
byte[] |
getCopyOfWriteBuffer()
Get a copy of the data that is set to be written out to the device
|
java.lang.String |
getDeviceName()
Device Name
|
byte[] |
getI2cReadCache()
Get direct access to the read cache used by this I2C device
|
java.util.concurrent.locks.Lock |
getI2cReadCacheLock()
Get access to the read cache lock.
|
byte[] |
getI2cWriteCache()
Get direct access to the write cache used by this I2C device
|
java.util.concurrent.locks.Lock |
getI2cWriteCacheLock()
Get access to the write cache lock.
|
int |
getVersion()
Version
|
boolean |
isI2cPortActionFlagSet()
Check whether or not the action flag is set for this I2C port
|
boolean |
isI2cPortInReadMode()
Query whether or not the port is in Read mode
|
boolean |
isI2cPortInWriteMode()
Query whether or not this port is in write mode
|
boolean |
isI2cPortReady()
Query whether or not this I2c port is ready
|
void |
readI2cCacheFromController()
Trigger a read of the I2C cache
|
void |
readI2cCacheFromModule()
Deprecated.
|
void |
registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback callback)
The method used to register for a port-ready callback
|
void |
setI2cPortActionFlag()
Set the port action flag; this flag tells the controller to send the
current data in its buffer to the I2C device
|
void |
writeI2cCacheToController()
Trigger a write of the I2C cache
|
void |
writeI2cCacheToModule()
Deprecated.
|
void |
writeI2cPortFlagOnlyToController()
Write only the action flag
|
void |
writeI2cPortFlagOnlyToModule()
Deprecated.
|
public I2cDevice(I2cController controller, int port)
controller
- I2C controller this channel is attached toport
- port on the I2C controllerpublic void enableI2cReadMode(int i2cAddress, int memAddress, int length)
memAddress
- mem address at which to start readinglength
- number of bytes to readpublic void enableI2cWriteMode(int i2cAddress, int memAddress, int length)
memAddress
- mem address at which to start writinglength
- number of bytes to writepublic byte[] getCopyOfReadBuffer()
public byte[] getCopyOfWriteBuffer()
public void copyBufferIntoWriteBuffer(byte[] buffer)
buffer
- buffer to copypublic void setI2cPortActionFlag()
public boolean isI2cPortActionFlagSet()
public void readI2cCacheFromController()
public void writeI2cCacheToController()
public void writeI2cPortFlagOnlyToController()
public boolean isI2cPortInReadMode()
public boolean isI2cPortInWriteMode()
public boolean isI2cPortReady()
public java.util.concurrent.locks.Lock getI2cReadCacheLock()
This is needed if you are accessing the read cache directly. The read cache lock needs to be acquired before attempting to interact with the read cache
public java.util.concurrent.locks.Lock getI2cWriteCacheLock()
This is needed if you ace accessing the write cache directly. The write cache lock needs to be acquired before attempting to interact with the write cache
public byte[] getI2cReadCache()
Please lock the cache before accessing it.
public byte[] getI2cWriteCache()
Please lock the cache before accessing it.
public void registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback callback)
callback
- pass in the I2C callback that will be called when the device is readypublic void deregisterForPortReadyCallback()
public java.lang.String getDeviceName()
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()
HardwareDevice
getVersion
in interface HardwareDevice
public void close()
HardwareDevice
close
in interface HardwareDevice
@Deprecated public void readI2cCacheFromModule()
@Deprecated public void writeI2cCacheToModule()
@Deprecated public void writeI2cPortFlagOnlyToModule()