WPILibC++  2018.4.1-20180810231726-1152-g44099d9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
GearTooth.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2008-2018 FIRST. 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 "frc/Counter.h"
14 
15 namespace frc {
16 
24 class GearTooth : public Counter {
25  public:
26  // 55 uSec for threshold
27  static constexpr double kGearToothThreshold = 55e-6;
28 
37  explicit GearTooth(int channel, bool directionSensitive = false);
38 
49  explicit GearTooth(DigitalSource* source, bool directionSensitive = false);
50 
61  explicit GearTooth(std::shared_ptr<DigitalSource> source,
62  bool directionSensitive = false);
63 
67  void EnableDirectionSensing(bool directionSensitive);
68 
69  void InitSendable(SendableBuilder& builder) override;
70 };
71 
72 } // namespace frc
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
Class for counting the number of ticks on a digital input channel.
Definition: Counter.h:34
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
void EnableDirectionSensing(bool directionSensitive)
Common code called by the constructors.
DigitalSource Interface.
Definition: DigitalSource.h:25
Alias for counter class.
Definition: GearTooth.h:24
GearTooth(int channel, bool directionSensitive=false)
Construct a GearTooth sensor given a channel.
Definition: SendableBuilder.h:23