jerrym | f157933 | 2013-02-07 01:56:28 +0000 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/
|
| 2 | /* Copyright (c) FIRST 2008. 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 $(WIND_BASE)/WPILib. */
|
| 5 | /*----------------------------------------------------------------------------*/
|
| 6 |
|
| 7 | #ifndef CPPCOUNTER_BASE_H_
|
| 8 | #define CPPCOUNTER_BASE_H_
|
| 9 |
|
| 10 | /**
|
| 11 | * Interface for counting the number of ticks on a digital input channel.
|
| 12 | * Encoders, Gear tooth sensors, and counters should all subclass this so it can be used to
|
| 13 | * build more advanced classes for control and driving.
|
| 14 | */
|
| 15 | class CounterBase
|
| 16 | {
|
| 17 | public:
|
| 18 | typedef enum {k1X, k2X, k4X} EncodingType;
|
| 19 |
|
| 20 | virtual ~CounterBase() {}
|
| 21 | virtual void Start() = 0;
|
| 22 | virtual INT32 Get() = 0;
|
| 23 | virtual void Reset() = 0;
|
| 24 | virtual void Stop() = 0;
|
| 25 | virtual double GetPeriod() = 0;
|
| 26 | virtual void SetMaxPeriod(double maxPeriod) = 0;
|
| 27 | virtual bool GetStopped() = 0;
|
| 28 | virtual bool GetDirection() = 0;
|
| 29 | };
|
| 30 |
|
| 31 | #endif
|