Package edu.wpi.first.wpilibj.simulation
Class SPISim
java.lang.Object
edu.wpi.first.wpilibj.simulation.SPISim
public class SPISim extends Object
A class for controlling a simulated SPI device.
-
Constructor Summary
Constructors Constructor Description SPISim()Create a new simulated SPI device. -
Method Summary
Modifier and Type Method Description booleangetInitialized()Check whether this device has been initialized.CallbackStoreregisterInitializedCallback(NotifyCallback callback, boolean initialNotify)Register a callback to be run when this device is initialized.CallbackStoreregisterReadAutoReceiveBufferCallback(SpiReadAutoReceiveBufferCallback callback)CallbackStoreregisterReadCallback(BufferCallback callback)Register a callback to be run whenever a `read` operation is executed.CallbackStoreregisterWriteCallback(ConstBufferCallback callback)Register a callback to be run whenever a `write` operation is executed.voidresetData()Reset all simulation data.voidsetInitialized(boolean initialized)Define whether this device has been initialized.
-
Constructor Details
-
Method Details
-
registerInitializedCallback
Register a callback to be run when this device is initialized.- Parameters:
callback- the callbackinitialNotify- whether to run the callback with the initial state- Returns:
- the
CallbackStoreobject associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
-
getInitialized
Check whether this device has been initialized.- Returns:
- true if initialized
-
setInitialized
Define whether this device has been initialized.- Parameters:
initialized- whether this object is initialized
-
registerReadCallback
Register a callback to be run whenever a `read` operation is executed.- Parameters:
callback- the callback- Returns:
- the
CallbackStoreobject associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
-
registerWriteCallback
Register a callback to be run whenever a `write` operation is executed.- Parameters:
callback- the callback- Returns:
- the
CallbackStoreobject associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
-
registerReadAutoReceiveBufferCallback
-
resetData
Reset all simulation data.
-