Package edu.wpi.first.wpilibj.simulation
Class AnalogInputSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.AnalogInputSim
Class to control a simulated analog input.
-
Constructor Summary
ConstructorsConstructorDescriptionAnalogInputSim
(int channel) Constructs from an analog input channel number.AnalogInputSim
(AnalogInput analogInput) Constructs from an AnalogInput object. -
Method Summary
Modifier and TypeMethodDescriptionint
Get the number of average bits.boolean
Check if this analog input has been initialized.int
Get the amount of oversampling bits.double
Get the voltage.registerAverageBitsCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the number of average bits.registerInitializedCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on whether the analog input is initialized.registerOversampleBitsCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the amount of oversampling bits.registerVoltageCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the voltage.void
Reset all simulation data for this object.void
setAverageBits
(int averageBits) Change the number of average bits.void
setInitialized
(boolean initialized) Change whether this analog input has been initialized.void
setOversampleBits
(int oversampleBits) Change the amount of oversampling bits.void
setVoltage
(double voltage) Change the voltage.
-
Constructor Details
-
AnalogInputSim
Constructs from an AnalogInput object.- Parameters:
analogInput
- AnalogInput to simulate
-
AnalogInputSim
Constructs from an analog input channel number.- Parameters:
channel
- Channel number
-
-
Method Details
-
registerInitializedCallback
Register a callback on whether the analog input is initialized.- Parameters:
callback
- the callback that will be called whenever the analog input is initializedinitialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getInitialized
Check if this analog input has been initialized.- Returns:
- true if initialized
-
setInitialized
Change whether this analog input has been initialized.- Parameters:
initialized
- the new value
-
registerAverageBitsCallback
Register a callback on the number of average bits.- Parameters:
callback
- the callback that will be called whenever the number of average bits is changedinitialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getAverageBits
Get the number of average bits.- Returns:
- the number of average bits
-
setAverageBits
Change the number of average bits.- Parameters:
averageBits
- the new value
-
registerOversampleBitsCallback
Register a callback on the amount of oversampling bits.- Parameters:
callback
- the callback that will be called whenever the oversampling bits are changed.initialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getOversampleBits
Get the amount of oversampling bits.- Returns:
- the amount of oversampling bits
-
setOversampleBits
Change the amount of oversampling bits.- Parameters:
oversampleBits
- the new value
-
registerVoltageCallback
Register a callback on the voltage.- Parameters:
callback
- the callback that will be called whenever the voltage is changed.initialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getVoltage
Get the voltage.- Returns:
- the voltage
-
setVoltage
Change the voltage.- Parameters:
voltage
- the new value
-
resetData
Reset all simulation data for this object.
-