Package trclib.sensor
Class TrcDigitalInput
java.lang.Object
trclib.sensor.TrcDigitalInput
- Direct Known Subclasses:
FtcDigitalInput
,FtcTouchSensor
,TrcMotorLimitSwitch
This class implements a platform independent Digital Input device.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static TrcElapsedTimer
protected final String
private boolean
private static final String
-
Constructor Summary
ConstructorsConstructorDescriptionTrcDigitalInput
(String instanceName) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
This method is provided by the platform dependent digital input device to check the state of the input.boolean
isActive()
This method returns the state of the input device.static void
printElapsedTime
(TrcDbgTrace tracer) This method prints the elapsed time info using the given tracer.static void
setElapsedTimerEnabled
(boolean enabled) This method enables/disables the elapsed timers for performance monitoring.void
setInverted
(boolean inverted) This method inverts the digital input state.toString()
This method returns the instance name.
-
Field Details
-
moduleName
-
getInputElapsedTimer
-
instanceName
-
inverted
private boolean inverted
-
-
Constructor Details
-
TrcDigitalInput
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.
-
-
Method Details
-
getInputState
public abstract boolean getInputState()This method is provided by the platform dependent digital input device to check the state of the input.- Returns:
- true if the digital input is active, false otherwise.
-
toString
This method returns the instance name. -
setInverted
public void setInverted(boolean inverted) This method inverts the digital input state. It is useful for changing a limit switch from Normal Open to Normal Close, for example.- Parameters:
inverted
- specifies true to invert the digital input, false otherwise.
-
isActive
public boolean isActive()This method returns the state of the input device.- Returns:
- true if active, false otherwise.
-
setElapsedTimerEnabled
public static void setElapsedTimerEnabled(boolean enabled) This method enables/disables the elapsed timers for performance monitoring.- Parameters:
enabled
- specifies true to enable elapsed timers, false to disable.
-
printElapsedTime
This method prints the elapsed time info using the given tracer.- Parameters:
tracer
- specifies the tracer to be used to print the info.
-