Package edu.wpi.first.wpilibj.simulation
Class SPISim
java.lang.Object
edu.wpi.first.wpilibj.simulation.SPISim
A class for controlling a simulated SPI device.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck whether this device has been initialized.registerInitializedCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run when this device is initialized.Register a callback to be run whenever an auto receive buffer is received.registerReadCallback(BufferCallback callback) Register a callback to be run whenever a `read` operation is executed.registerWriteCallback(ConstBufferCallback callback) Register a callback to be run whenever a `write` operation is executed.voidReset all simulation data.voidsetInitialized(boolean initialized) Define whether this device has been initialized.
-
Constructor Details
-
SPISim
public SPISim()Create a new simulated SPI device.
-
-
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.
-
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.
-
registerWriteCallback
Register a callback to be run whenever a `write` operation is executed.- Parameters:
callback- the callback- Returns:
- the
CallbackStoreobject associated with this callback.
-
registerReadAutoReceiveBufferCallback
public CallbackStore registerReadAutoReceiveBufferCallback(SpiReadAutoReceiveBufferCallback callback) Register a callback to be run whenever an auto receive buffer is received.- Parameters:
callback- the callback- Returns:
- the
CallbackStoreobject associated with this callback.
-
resetData
Reset all simulation data.
-