Package edu.wpi.first.wpilibj
Class GearTooth
- java.lang.Object
-
- edu.wpi.first.wpilibj.SendableBase
-
- edu.wpi.first.wpilibj.Counter
-
- edu.wpi.first.wpilibj.GearTooth
-
- All Implemented Interfaces:
CounterBase
,PIDSource
,Sendable
,AutoCloseable
public class GearTooth extends Counter
Alias for counter class. Implement the gear tooth sensor supplied by FIRST. Currently there is no reverse sensing on the gear tooth sensor, but in future versions we might implement the necessary timing in the FPGA to sense direction.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class edu.wpi.first.wpilibj.Counter
Counter.Mode
-
Nested classes/interfaces inherited from interface edu.wpi.first.wpilibj.CounterBase
CounterBase.EncodingType
-
-
Field Summary
-
Fields inherited from class edu.wpi.first.wpilibj.Counter
m_downSource, m_upSource
-
-
Constructor Summary
Constructors Constructor Description GearTooth(int channel)
Construct a GearTooth sensor given a channel.GearTooth(int channel, boolean directionSensitive)
Construct a GearTooth sensor given a channel.GearTooth(DigitalSource source)
Construct a GearTooth sensor given a digital input.GearTooth(DigitalSource source, boolean directionSensitive)
Construct a GearTooth sensor given a digital input.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
enableDirectionSensing(boolean directionSensitive)
Common code called by the constructors.void
initSendable(SendableBuilder builder)
Initializes thisSendable
object.-
Methods inherited from class edu.wpi.first.wpilibj.Counter
clearDownSource, clearUpSource, close, get, getDirection, getDistance, getFPGAIndex, getPeriod, getPIDSourceType, getRate, getSamplesToAverage, getStopped, pidGet, reset, setDistancePerPulse, setDownSource, setDownSource, setDownSource, setDownSourceEdge, setExternalDirectionMode, setMaxPeriod, setPIDSourceType, setPulseLengthMode, setReverseDirection, setSamplesToAverage, setSemiPeriodMode, setUpdateWhenEmpty, setUpDownCounterMode, setUpSource, setUpSource, setUpSource, setUpSourceEdge
-
Methods inherited from class edu.wpi.first.wpilibj.SendableBase
addChild, free, getName, getSubsystem, setName, setName, setName, setSubsystem
-
-
-
-
Constructor Detail
-
GearTooth
public GearTooth(int channel)
Construct a GearTooth sensor given a channel.No direction sensing is assumed.
- Parameters:
channel
- The GPIO channel that the sensor is connected to.
-
GearTooth
public GearTooth(int channel, boolean directionSensitive)
Construct a GearTooth sensor given a channel.- Parameters:
channel
- The DIO channel that the sensor is connected to. 0-9 are on-board, 10-25 are on the MXP portdirectionSensitive
- True to enable the pulse length decoding in hardware to specify count direction.
-
GearTooth
public GearTooth(DigitalSource source, boolean directionSensitive)
Construct a GearTooth sensor given a digital input. This should be used when sharing digital inputs.- Parameters:
source
- An existing DigitalSource object (such as a DigitalInput)directionSensitive
- True to enable the pulse length decoding in hardware to specify count direction.
-
GearTooth
public GearTooth(DigitalSource source)
Construct a GearTooth sensor given a digital input. This should be used when sharing digital inputs.No direction sensing is assumed.
- Parameters:
source
- An object that fully describes the input that the sensor is connected to.
-
-
Method Detail
-
enableDirectionSensing
public void enableDirectionSensing(boolean directionSensitive)
Common code called by the constructors.
-
initSendable
public void initSendable(SendableBuilder builder)
Description copied from interface:Sendable
Initializes thisSendable
object.- Specified by:
initSendable
in interfaceSendable
- Overrides:
initSendable
in classCounter
- Parameters:
builder
- sendable builder
-
-