Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) 2017-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 | #include "MockSpeedController.h" |
| 9 | |
| 10 | using namespace frc; |
| 11 | |
| 12 | void MockSpeedController::Set(double speed) { |
| 13 | m_speed = m_isInverted ? -speed : speed; |
| 14 | } |
| 15 | |
| 16 | double MockSpeedController::Get() const { return m_speed; } |
| 17 | |
| 18 | void MockSpeedController::SetInverted(bool isInverted) { |
| 19 | m_isInverted = isInverted; |
| 20 | } |
| 21 | |
| 22 | bool MockSpeedController::GetInverted() const { return m_isInverted; } |
| 23 | |
| 24 | void MockSpeedController::Disable() { m_speed = 0; } |
| 25 | |
| 26 | void MockSpeedController::StopMotor() { Disable(); } |
| 27 | |
| 28 | void MockSpeedController::PIDWrite(double output) { Set(output); } |