Brian Silverman | f7f267a | 2017-02-04 16:16:08 -0800 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 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 "SafePWM.h" |
| 11 | #include "SpeedController.h" |
| 12 | |
| 13 | namespace frc { |
| 14 | |
| 15 | /** |
| 16 | * Common base class for all PWM Speed Controllers |
| 17 | */ |
| 18 | class PWMSpeedController : public SafePWM, public SpeedController { |
| 19 | public: |
| 20 | virtual ~PWMSpeedController() = default; |
| 21 | void Set(double value) override; |
| 22 | double Get() const override; |
| 23 | void Disable() override; |
| 24 | void StopMotor() override; |
| 25 | |
| 26 | void PIDWrite(double output) override; |
| 27 | |
| 28 | void SetInverted(bool isInverted) override; |
| 29 | bool GetInverted() const override; |
| 30 | |
| 31 | protected: |
| 32 | explicit PWMSpeedController(int channel); |
| 33 | |
| 34 | private: |
| 35 | bool m_isInverted = false; |
| 36 | }; |
| 37 | |
| 38 | } // namespace frc |