public interface I2cDeviceSynchSimple extends HardwareDevice, HardwareDeviceHealth, I2cAddrConfig, RobotConfigNameable
I2cDeviceSynch
,
I2cDeviceSynchImplOnSimple
HardwareDeviceHealth.HealthStatus
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 |
getLogging() |
java.lang.String |
getLoggingTag() |
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.
|
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(I2cWaitControl waitControl)
Waits for the most recent write to complete according to the behavior specified in writeControl.
|
void |
write(int ireg,
byte[] data)
Writes data to a set of registers, beginning with the one indicated, using
I2cWaitControl.ATOMIC semantics. |
void |
write(int ireg,
byte[] data,
I2cWaitControl waitControl)
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 using
I2cWaitControl.ATOMIC semantics. |
void |
write8(int ireg,
int bVal,
I2cWaitControl waitControl)
Writes a byte to the indicated register.
|
getHealthStatus, setHealthStatus
setI2cAddress
getI2cAddress
getUserConfiguredName, setUserConfiguredName
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
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)
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)
I2cWaitControl.ATOMIC
semantics.ireg
- the register number that is to be writtenbVal
- the byte which is to be written to that registerwrite(int, byte[], I2cWaitControl)
void write(int ireg, byte[] data)
I2cWaitControl.ATOMIC
semantics.ireg
- the first of the registers which is to be writtendata
- the data which is to be written to the registerswrite(int, byte[], I2cWaitControl)
void write8(int ireg, int bVal, I2cWaitControl waitControl)
write(int, byte[], I2cWaitControl)
.ireg
- the register number that is to be writtenbVal
- the byte which is to be written to that registerwaitControl
- controls the behavior of waiting for the completion of the writewrite(int, byte[], I2cWaitControl)
void write(int ireg, byte[] data, I2cWaitControl waitControl)
ireg
- the first of the registers which is to be writtendata
- the data which is to be written to the registerswaitControl
- controls the behavior of waiting for the completion of the writevoid waitForWriteCompletions(I2cWaitControl waitControl)
waitControl
- controls the behavior of waiting for the completion of the write
Note that a value of I2cWaitControl.NONE
is essentially a no-op.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 notboolean getLogging()
setLogging(boolean)
void setLoggingTag(java.lang.String loggingTag)
loggingTag
- the logging tag to suejava.lang.String getLoggingTag()
setLoggingTag(String)