mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
[hal, wpilib] PWM Rewrite (#7845)
The HAL will only contain the output period and the raw microseconds. Higher level things such as SimDevice can handle everything else.
This commit is contained in:
@@ -37,10 +37,9 @@ public class {{ name }} extends PWMMotorController {
|
||||
public {{ name }}(final int channel) {
|
||||
super("{{ name }}", channel);
|
||||
|
||||
m_pwm.setBoundsMicroseconds({{ (pulse_width_ms.max * 1000) | int }}, {{ (pulse_width_ms.deadbandMax * 1000) | int }}, {{ (pulse_width_ms.center * 1000) | int }}, {{ (pulse_width_ms.deadbandMin * 1000) | int }}, {{ (pulse_width_ms.min * 1000) | int }});
|
||||
m_pwm.setPeriodMultiplier(PWM.PeriodMultiplier.k{{ PeriodMultiplier | default("1", true)}}X);
|
||||
m_pwm.setSpeed(0.0);
|
||||
m_pwm.setZeroLatch();
|
||||
setBoundsMicroseconds({{ (pulse_width_ms.max * 1000) | int }}, {{ (pulse_width_ms.deadbandMax * 1000) | int }}, {{ (pulse_width_ms.center * 1000) | int }}, {{ (pulse_width_ms.deadbandMin * 1000) | int }}, {{ (pulse_width_ms.min * 1000) | int }});
|
||||
m_pwm.setOutputPeriod(PWM.OutputPeriod.k{{ OutputPeriod | default("5", true)}}Ms);
|
||||
setSpeed(0.0);
|
||||
|
||||
HAL.reportUsage("IO", getChannel(), "{{ ResourceName }}");
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
"Manufacturer": "Vex Robotics",
|
||||
"DisplayName": "Victor 888",
|
||||
"ResourceName": "Victor",
|
||||
"PeriodMultiplier": 2,
|
||||
"OutputPeriod": 10,
|
||||
"pulse_width_ms": {
|
||||
"max": 2.027,
|
||||
"deadbandMax": 1.525,
|
||||
@@ -174,7 +174,7 @@
|
||||
"Manufacturer": "AndyMark",
|
||||
"DisplayName": "Koors40",
|
||||
"ResourceName": "Koors40",
|
||||
"PeriodMultiplier": 4,
|
||||
"OutputPeriod": 20,
|
||||
"pulse_width_ms": {
|
||||
"max": 2.004,
|
||||
"deadbandMax": 1.520,
|
||||
|
||||
Reference in New Issue
Block a user