Class 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.
    • 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.