edu.wpi.first.wpilibj

## Class GearTooth

- java.lang.Object
- - edu.wpi.first.wpilibj.SensorBase
  - - edu.wpi.first.wpilibj.Counter
    - - edu.wpi.first.wpilibj.GearTooth

- All Implemented Interfaces:
    CounterBase, LiveWindowSendable, PIDSource, Sendable

      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`

    - ### Fields inherited from class edu.wpi.first.wpilibj.SensorBase

      `kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPCMModules, kPDPChannels, kPDPModules, kPwmChannels, kRelayChannels, kSolenoidChannels, kSystemClockTicksPerMicrosecond`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GearTooth(DigitalSource source)` Construct a GearTooth sensor given a digital input.
    `GearTooth(DigitalSource source, boolean directionSensitive)` Construct a GearTooth sensor given a digital input.
    `GearTooth(int channel)` Construct a GearTooth sensor given a channel.
    `GearTooth(int channel, boolean directionSensitive)` Construct a GearTooth sensor given a channel.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `enableDirectionSensing(boolean directionSensitive)` Common code called by the constructors.
    `java.lang.String` | `getSmartDashboardType()` The string representation of the named data type that will be used by the smart dashboard for this `Sendable`.

    - ### Methods inherited from class edu.wpi.first.wpilibj.Counter

      `clearDownSource, clearUpSource, free, get, getDirection, getDistance, getFPGAIndex, getPeriod, getPIDSourceType, getRate, getSamplesToAverage, getStopped, initTable, pidGet, reset, setDistancePerPulse, setDownSource, setDownSource, setDownSource, setDownSourceEdge, setExternalDirectionMode, setMaxPeriod, setPIDSourceType, setPulseLengthMode, setReverseDirection, setSamplesToAverage, setSemiPeriodMode, setUpdateWhenEmpty, setUpDownCounterMode, setUpSource, setUpSource, setUpSource, setUpSourceEdge, startLiveWindowMode, stopLiveWindowMode, updateTable`

    - ### Methods inherited from class edu.wpi.first.wpilibj.SensorBase

      `checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPDPModule, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, getDefaultSolenoidModule, setDefaultSolenoidModule`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 port
        `directionSensitive` - 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.

    - #### getSmartDashboardType

          public java.lang.String getSmartDashboardType()

      Description copied from interface: `Sendable`
      The string representation of the named data type that will be used by the smart dashboard for this `Sendable`.
      Specified by:
        `getSmartDashboardType` in interface `Sendable`
      Overrides:
        `getSmartDashboardType` in class `Counter`
      Returns:
        The type of this `Sendable`.