diff --git a/wpilibc/src/main/native/cpp/GearTooth.cpp b/wpilibc/src/main/native/cpp/GearTooth.cpp deleted file mode 100644 index 59f5397b0b..0000000000 --- a/wpilibc/src/main/native/cpp/GearTooth.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -#include "frc/GearTooth.h" - -#include "frc/smartdashboard/SendableBuilder.h" -#include "frc/smartdashboard/SendableRegistry.h" - -using namespace frc; - -constexpr double GearTooth::kGearToothThreshold; - -GearTooth::GearTooth(int channel, bool directionSensitive) : Counter(channel) { - EnableDirectionSensing(directionSensitive); - SendableRegistry::GetInstance().SetName(this, "GearTooth", channel); -} - -GearTooth::GearTooth(DigitalSource* source, bool directionSensitive) - : Counter(source) { - EnableDirectionSensing(directionSensitive); - SendableRegistry::GetInstance().SetName(this, "GearTooth", - source->GetChannel()); -} - -GearTooth::GearTooth(std::shared_ptr source, - bool directionSensitive) - : Counter(source) { - EnableDirectionSensing(directionSensitive); - SendableRegistry::GetInstance().SetName(this, "GearTooth", - source->GetChannel()); -} - -void GearTooth::EnableDirectionSensing(bool directionSensitive) { - if (directionSensitive) { - SetPulseLengthMode(kGearToothThreshold); - } -} - -void GearTooth::InitSendable(SendableBuilder& builder) { - Counter::InitSendable(builder); - builder.SetSmartDashboardType("Gear Tooth"); -} diff --git a/wpilibc/src/main/native/include/frc/GearTooth.h b/wpilibc/src/main/native/include/frc/GearTooth.h deleted file mode 100644 index 1df5699c6a..0000000000 --- a/wpilibc/src/main/native/include/frc/GearTooth.h +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -#pragma once - -#include -#include - -#include - -#include "frc/Counter.h" - -namespace frc { - -/** - * Alias for counter class. - * - * Implements 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. - * - * @deprecated No longer used per FMS usage reporting - */ -class GearTooth : public Counter { - public: - // 55 uSec for threshold - static constexpr double kGearToothThreshold = 55e-6; - - /** - * Construct a GearTooth sensor given a channel. - * - * @param channel The DIO channel that the sensor is connected to. - * 0-9 are on-board, 10-25 are on the MXP. - * @param directionSensitive True to enable the pulse length decoding in - * hardware to specify count direction. - */ - WPI_DEPRECATED( - "The only sensor this works with is no longer available and no teams use " - "it according to FMS usage reporting.") - explicit GearTooth(int channel, bool directionSensitive = false); - - /** - * Construct a GearTooth sensor given a digital input. - * - * This should be used when sharing digital inputs. - * - * @param source A pointer to the existing DigitalSource object - * (such as a DigitalInput) - * @param directionSensitive True to enable the pulse length decoding in - * hardware to specify count direction. - */ - WPI_DEPRECATED( - "The only sensor this works with is no longer available and no teams use " - "it according to FMS usage reporting.") - explicit GearTooth(DigitalSource* source, bool directionSensitive = false); - - /** - * Construct a GearTooth sensor given a digital input. - * - * This should be used when sharing digital inputs. - * - * @param source A reference to the existing DigitalSource object - * (such as a DigitalInput) - * @param directionSensitive True to enable the pulse length decoding in - * hardware to specify count direction. - */ - WPI_DEPRECATED( - "The only sensor this works with is no longer available and no teams use " - "it according to FMS usage reporting.") - explicit GearTooth(std::shared_ptr source, - bool directionSensitive = false); - - GearTooth(GearTooth&&) = default; - GearTooth& operator=(GearTooth&&) = default; - - /** - * Common code called by the constructors. - */ - void EnableDirectionSensing(bool directionSensitive); - - void InitSendable(SendableBuilder& builder) override; -}; - -} // namespace frc diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/GearTooth.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/GearTooth.java deleted file mode 100644 index 15a999c4b0..0000000000 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/GearTooth.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package edu.wpi.first.wpilibj; - -import edu.wpi.first.hal.FRCNetComm.tResourceType; -import edu.wpi.first.hal.HAL; -import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder; -import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry; - -/** - * 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. - * - * @deprecated The only sensor this works with is no longer available and no teams use it according - * to FMS usage reporting. - */ -@Deprecated(since = "2020", forRemoval = true) -public class GearTooth extends Counter { - private static final double kGearToothThreshold = 55e-6; - - /** Common code called by the constructors. */ - public void enableDirectionSensing(boolean directionSensitive) { - if (directionSensitive) { - setPulseLengthMode(kGearToothThreshold); - } - } - - /** - * Construct a GearTooth sensor given a channel. - * - *

No direction sensing is assumed. - * - * @param channel The GPIO channel that the sensor is connected to. - */ - public GearTooth(final int channel) { - this(channel, false); - } - - /** - * Construct a GearTooth sensor given a channel. - * - * @param channel The DIO channel that the sensor is connected to. 0-9 are on-board, 10-25 are on - * the MXP port - * @param directionSensitive True to enable the pulse length decoding in hardware to specify count - * direction. - */ - public GearTooth(final int channel, boolean directionSensitive) { - super(channel); - enableDirectionSensing(directionSensitive); - if (directionSensitive) { - HAL.report(tResourceType.kResourceType_GearTooth, channel + 1, 0, "D"); - } else { - HAL.report(tResourceType.kResourceType_GearTooth, channel + 1, 0); - } - SendableRegistry.setName(this, "GearTooth", channel); - } - - /** - * Construct a GearTooth sensor given a digital input. This should be used when sharing digital - * inputs. - * - * @param source An existing DigitalSource object (such as a DigitalInput) - * @param directionSensitive True to enable the pulse length decoding in hardware to specify count - * direction. - */ - public GearTooth(DigitalSource source, boolean directionSensitive) { - super(source); - enableDirectionSensing(directionSensitive); - if (directionSensitive) { - HAL.report(tResourceType.kResourceType_GearTooth, source.getChannel() + 1, 0, "D"); - } else { - HAL.report(tResourceType.kResourceType_GearTooth, source.getChannel() + 1, 0); - } - SendableRegistry.setName(this, "GearTooth", source.getChannel()); - } - - /** - * Construct a GearTooth sensor given a digital input. This should be used when sharing digital - * inputs. - * - *

No direction sensing is assumed. - * - * @param source An object that fully describes the input that the sensor is connected to. - */ - public GearTooth(DigitalSource source) { - this(source, false); - } - - @Override - public void initSendable(SendableBuilder builder) { - super.initSendable(builder); - builder.setSmartDashboardType("Gear Tooth"); - } -}