blob: 8236db40fc9286ba5f185566dfad90bdd1e890c6 [file] [log] [blame]
Brian Silvermanf7f267a2017-02-04 16:16:08 -08001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2008-2017. All Rights Reserved. */
3/* Open Source Software - may be modified and shared by FRC teams. The code */
4/* must be accompanied by the FIRST BSD license file in the root directory of */
5/* the project. */
6/*----------------------------------------------------------------------------*/
7
8#pragma once
9
10#include <memory>
11#include <string>
12
13#include "Counter.h"
14
15namespace frc {
16
17/**
18 * Alias for counter class.
19 * Implement the gear tooth sensor supplied by FIRST. Currently there is no
20 * reverse sensing on the gear tooth sensor, but in future versions we might
21 * implement the necessary timing in the FPGA to sense direction.
22 */
23class GearTooth : public Counter {
24 public:
25 /// 55 uSec for threshold
26 static constexpr double kGearToothThreshold = 55e-6;
27 explicit GearTooth(int channel, bool directionSensitive = false);
28 explicit GearTooth(DigitalSource* source, bool directionSensitive = false);
29 explicit GearTooth(std::shared_ptr<DigitalSource> source,
30 bool directionSensitive = false);
31 virtual ~GearTooth() = default;
32 void EnableDirectionSensing(bool directionSensitive);
33
34 std::string GetSmartDashboardType() const override;
35};
36
37} // namespace frc