[sim] Allow creating a PWMSim object from a PWMMotorController (#4039)

This commit is contained in:
Dustin Spicuzza
2022-05-06 11:44:59 -04:00
committed by GitHub
parent dc6f641fd2
commit 99424ad562
3 changed files with 22 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ package edu.wpi.first.wpilibj.simulation;
import edu.wpi.first.hal.simulation.NotifyCallback;
import edu.wpi.first.hal.simulation.PWMDataJNI;
import edu.wpi.first.wpilibj.PWM;
import edu.wpi.first.wpilibj.motorcontrol.PWMMotorController;
/** Class to control a simulated PWM output. */
public class PWMSim {
@@ -21,6 +22,15 @@ public class PWMSim {
m_index = pwm.getChannel();
}
/**
* Constructs from a PWMMotorController object.
*
* @param motorctrl PWMMotorController to simulate
*/
public PWMSim(PWMMotorController motorctrl) {
m_index = motorctrl.getChannel();
}
/**
* Constructs from a PWM channel number.
*