[wpilib][hal] PWM Raw using microseconds (#5283)

Co-authored-by: Joe <sciencewhiz@users.noreply.github.com>
This commit is contained in:
Thad House
2023-06-22 19:43:16 -07:00
committed by GitHub
parent 1fca519fb4
commit c1a01569b4
56 changed files with 374 additions and 466 deletions

View File

@@ -9,7 +9,7 @@
using namespace frc;
DMC60::DMC60(int channel) : PWMMotorController("DMC60", channel) {
m_pwm.SetBounds(2.004, 1.52, 1.50, 1.48, 0.997);
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.50_ms, 1.48_ms, 0.997_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -9,7 +9,7 @@
using namespace frc;
Jaguar::Jaguar(int channel) : PWMMotorController("Jaguar", channel) {
m_pwm.SetBounds(2.31, 1.55, 1.507, 1.454, 0.697);
m_pwm.SetBounds(2.31_ms, 1.55_ms, 1.507_ms, 1.454_ms, 0.697_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -30,7 +30,7 @@ void NidecBrushless::Set(double speed) {
if (!m_disabled) {
m_speed = speed;
m_dio.UpdateDutyCycle(0.5 + 0.5 * (m_isInverted ? -speed : speed));
m_pwm.SetRaw(0xffff);
m_pwm.SetAlwaysHighMode();
}
Feed();
}

View File

@@ -10,7 +10,7 @@ using namespace frc;
PWMSparkMax::PWMSparkMax(int channel)
: PWMMotorController("PWMSparkMax", channel) {
m_pwm.SetBounds(2.003, 1.55, 1.50, 1.46, 0.999);
m_pwm.SetBounds(2.003_ms, 1.55_ms, 1.50_ms, 1.46_ms, 0.999_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -10,7 +10,7 @@ using namespace frc;
PWMTalonFX::PWMTalonFX(int channel)
: PWMMotorController("PWMTalonFX", channel) {
m_pwm.SetBounds(2.004, 1.52, 1.50, 1.48, 0.997);
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.50_ms, 1.48_ms, 0.997_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -10,7 +10,7 @@ using namespace frc;
PWMTalonSRX::PWMTalonSRX(int channel)
: PWMMotorController("PWMTalonSRX", channel) {
m_pwm.SetBounds(2.004, 1.52, 1.50, 1.48, 0.997);
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.50_ms, 1.48_ms, 0.997_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -9,7 +9,7 @@
using namespace frc;
PWMVenom::PWMVenom(int channel) : PWMMotorController("PWMVenom", channel) {
m_pwm.SetBounds(2.004, 1.52, 1.50, 1.48, 0.997);
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.50_ms, 1.48_ms, 0.997_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -10,7 +10,7 @@ using namespace frc;
PWMVictorSPX::PWMVictorSPX(int channel)
: PWMMotorController("PWMVictorSPX", channel) {
m_pwm.SetBounds(2.004, 1.52, 1.50, 1.48, 0.997);
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.50_ms, 1.48_ms, 0.997_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -9,7 +9,7 @@
using namespace frc;
SD540::SD540(int channel) : PWMMotorController("SD540", channel) {
m_pwm.SetBounds(2.05, 1.55, 1.50, 1.44, 0.94);
m_pwm.SetBounds(2.05_ms, 1.55_ms, 1.50_ms, 1.44_ms, 0.94_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -9,7 +9,7 @@
using namespace frc;
Spark::Spark(int channel) : PWMMotorController("Spark", channel) {
m_pwm.SetBounds(2.003, 1.55, 1.50, 1.46, 0.999);
m_pwm.SetBounds(2.003_ms, 1.55_ms, 1.50_ms, 1.46_ms, 0.999_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -9,7 +9,7 @@
using namespace frc;
Talon::Talon(int channel) : PWMMotorController("Talon", channel) {
m_pwm.SetBounds(2.037, 1.539, 1.513, 1.487, 0.989);
m_pwm.SetBounds(2.037_ms, 1.539_ms, 1.513_ms, 1.487_ms, 0.989_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -9,7 +9,7 @@
using namespace frc;
Victor::Victor(int channel) : PWMMotorController("Victor", channel) {
m_pwm.SetBounds(2.027, 1.525, 1.507, 1.49, 1.026);
m_pwm.SetBounds(2.027_ms, 1.525_ms, 1.507_ms, 1.49_ms, 1.026_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_2X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -9,7 +9,7 @@
using namespace frc;
VictorSP::VictorSP(int channel) : PWMMotorController("VictorSP", channel) {
m_pwm.SetBounds(2.004, 1.52, 1.50, 1.48, 0.997);
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.50_ms, 1.48_ms, 0.997_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();