public interface I2cDeviceSynchSimple extends HardwareDevice, I2cAddrConfig
I2cDeviceSynch
,
I2cDeviceSynchImplOnSimple
Modifier and Type | Interface and Description |
---|---|
static class |
I2cDeviceSynchSimple.TimestampedData
TimestampedData pairs together data which has been read with the timestamp at which
the read occurred, as best that can be determined
|
HardwareDevice.Manufacturer
Modifier and Type | Method and Description |
---|---|
void |
enableWriteCoalescing(boolean enable)
Enables or disables an optimization wherein writes to two sets of adjacent register
ranges may be coalesced into a single I2c transaction if the second write comes along
while the first is still queued for writing.
|
I2cAddr |
getI2cAddr()
Deprecated.
Use
I2cAddressableDevice.getI2cAddress() instead. |
boolean |
isArmed()
Returns whether, as of this instant, this device client is alive and operational in
its normally expected mode; that is, whether it is currently in communication
with its underlying hardware or whether it is in some other state.
|
boolean |
isWriteCoalescingEnabled()
Answers as to whether write coalescing is currently enabled on this device.
|
byte[] |
read(int ireg,
int creg)
Read a contiguous set of device I2C registers.
|
byte |
read8(int ireg)
Read the byte at the indicated register.
|
I2cDeviceSynchSimple.TimestampedData |
readTimeStamped(int ireg,
int creg)
Reads and returns a contiguous set of device I2C registers, together with a best-available
timestamp of when the actual I2C read occurred.
|
void |
setI2cAddr(I2cAddr i2cAddr)
Deprecated.
Use
I2cAddrConfig.setI2cAddress(I2cAddr) instead. |
void |
setLogging(boolean enabled)
Turn logging on or off.
|
void |
setLoggingTag(java.lang.String loggingTag)
Set the tag to use when logging is on.
|
void |
waitForWriteCompletions()
Waits for any previously issued writes to be written to the USB controller module.
|
void |
write(int ireg,
byte[] data)
Writes data to a set of registers, beginning with the one indicated.
|
void |
write(int ireg,
byte[] data,
boolean waitForCompletion)
Writes data to a set of registers, beginning with the one indicated.
|
void |
write8(int ireg,
int bVal)
Writes a byte to the indicated register.
|
void |
write8(int ireg,
int bVal,
boolean waitForCompletion)
Writes a byte to the indicated register.
|
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
setI2cAddress
getI2cAddress
byte read8(int ireg)
readTimeStamped(int, int)
for a
complete description.ireg
- the register number to readread(int, int)
,
readTimeStamped(int, int)
,
I2cDeviceSynch.ensureReadWindow(I2cDeviceSynch.ReadWindow, I2cDeviceSynch.ReadWindow)
byte[] read(int ireg, int creg)
readTimeStamped(int, int)
for a
complete description.ireg
- the register number of the first byte register to readcreg
- the number of bytes / registers to readread8(int)
,
readTimeStamped(int, int)
,
I2cDeviceSynch.ensureReadWindow(I2cDeviceSynch.ReadWindow, I2cDeviceSynch.ReadWindow)
I2cDeviceSynchSimple.TimestampedData readTimeStamped(int ireg, int creg)
You can always just call this method without worrying at all about
read windows
,
that will work, but usually it is more efficient to take some thought and care as to what set
of registers the I2C device controller is being set up to read, as adjusting that window
of registers incurs significant extra time.
If the current read window can't be used to read the requested registers, then
a new read window will automatically be created as follows. If the current read window is non
null and wholly contains the registers to read but can't be read because it is a used-up
ReadMode#ONLY_ONCE
window,
a new read fresh window will be created with the same set of registers. Otherwise, a
window that exactly covers the requested set of registers will be created.
ireg
- the register number of the first byte register to readcreg
- the number of bytes / registers to readread(int, int)
,
read8(int)
,
I2cDeviceSynch.ensureReadWindow(I2cDeviceSynch.ReadWindow, I2cDeviceSynch.ReadWindow)
void write8(int ireg, int bVal)
write(int, byte[], boolean)
.ireg
- the register number that is to be writtenbVal
- the byte which is to be written to that registerwrite(int, byte[], boolean)
void write(int ireg, byte[] data)
write(int, byte[], boolean)
.ireg
- the first of the registers which is to be writtendata
- the data which is to be written to the registerswrite(int, byte[], boolean)
void write8(int ireg, int bVal, boolean waitForCompletion)
write(int, byte[], boolean)
.ireg
- the register number that is to be writtenbVal
- the byte which is to be written to that registerwaitForCompletion
- whether or not to wait until the write has been sent to the controllerwrite(int, byte[], boolean)
void write(int ireg, byte[] data, boolean waitForCompletion)
ireg
- the first of the registers which is to be writtendata
- the data which is to be written to the registerswaitForCompletion
- whether or not to wait until the write has been sent to the controllervoid waitForWriteCompletions()
void enableWriteCoalescing(boolean enable)
enable
- whether to enable write coalescing or notisWriteCoalescingEnabled()
boolean isWriteCoalescingEnabled()
enableWriteCoalescing(boolean)
boolean isArmed()
Engagable.engage()
@Deprecated void setI2cAddr(I2cAddr i2cAddr)
I2cAddrConfig.setI2cAddress(I2cAddr)
instead.i2cAddr
- the new I2C address@Deprecated I2cAddr getI2cAddr()
I2cAddressableDevice.getI2cAddress()
instead.void setLogging(boolean enabled)
enabled
- whether to enable logging or notvoid setLoggingTag(java.lang.String loggingTag)
loggingTag
- the logging tag to sue