Package edu.wpi.first.wpilibj.simulation
Class I2CSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.I2CSim
A class to control a simulated I2C device.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Check whether this I2C device has been initialized.registerInitializedCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run when this I2C device is initialized.registerReadCallback
(BufferCallback callback) Register a callback to be run whenever a `read` operation is done.registerWriteCallback
(ConstBufferCallback callback) Register a callback to be run whenever a `write` operation is done.void
Reset all I2C simulation data.void
setInitialized
(boolean initialized) Define whether this I2C device has been initialized.
-
Constructor Details
-
I2CSim
Construct a new I2C simulation object.- Parameters:
index
- the HAL index of the I2C object
-
-
Method Details
-
registerInitializedCallback
Register a callback to be run when this I2C device is initialized.- Parameters:
callback
- the callbackinitialNotify
- whether to run the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getInitialized
Check whether this I2C device has been initialized.- Returns:
- true if initialized
-
setInitialized
Define whether this I2C device has been initialized.- Parameters:
initialized
- whether this device is initialized
-
registerReadCallback
Register a callback to be run whenever a `read` operation is done.- Parameters:
callback
- the callback that is run on `read` operations- Returns:
- the
CallbackStore
object associated with this callback.
-
registerWriteCallback
Register a callback to be run whenever a `write` operation is done.- Parameters:
callback
- the callback that is run on `write` operations- Returns:
- the
CallbackStore
object associated with this callback.
-
resetData
Reset all I2C simulation data.
-