mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[sim] Allow creating a PWMSim object from a PWMMotorController (#4039)
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user