2024-01-01 13:37:51 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "motorcontrol/MockPWMMotorController.hpp"
|
2024-01-01 13:37:51 -08:00
|
|
|
|
2025-11-07 20:00:05 -05:00
|
|
|
using namespace wpi;
|
2024-01-01 13:37:51 -08:00
|
|
|
|
2026-03-06 14:19:15 -08:00
|
|
|
void MockPWMMotorController::SetDutyCycle(double dutyCycle) {
|
|
|
|
|
m_dutyCycle = m_isInverted ? -dutyCycle : dutyCycle;
|
2024-01-01 13:37:51 -08:00
|
|
|
}
|
|
|
|
|
|
2026-03-06 14:19:15 -08:00
|
|
|
double MockPWMMotorController::GetDutyCycle() const {
|
|
|
|
|
return m_dutyCycle;
|
2024-01-01 13:37:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MockPWMMotorController::SetInverted(bool isInverted) {
|
|
|
|
|
m_isInverted = isInverted;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MockPWMMotorController::GetInverted() const {
|
|
|
|
|
return m_isInverted;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MockPWMMotorController::Disable() {
|
2026-03-06 14:19:15 -08:00
|
|
|
m_dutyCycle = 0;
|
2024-01-01 13:37:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MockPWMMotorController::StopMotor() {
|
|
|
|
|
Disable();
|
|
|
|
|
}
|