[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:
Thad House
2025-03-20 19:23:22 -07:00
committed by GitHub
parent 2e21a41f87
commit e2cc9e0059
96 changed files with 1037 additions and 2453 deletions

View File

@@ -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 }}");
}

View File

@@ -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,