From a5ef50c9e7c5042a967cb79e92c8caa3cae9750d Mon Sep 17 00:00:00 2001 From: sciencewhiz Date: Mon, 4 Sep 2017 22:03:02 -0700 Subject: [PATCH] Add documentation for PeriodMultiplier (#632) --- wpilibc/src/main/native/include/PWM.h | 14 +++++++++++++- .../src/main/java/edu/wpi/first/wpilibj/PWM.java | 8 ++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/wpilibc/src/main/native/include/PWM.h b/wpilibc/src/main/native/include/PWM.h index 62260baa9a..2df43b1d83 100644 --- a/wpilibc/src/main/native/include/PWM.h +++ b/wpilibc/src/main/native/include/PWM.h @@ -26,7 +26,7 @@ namespace frc { * The values supplied as arguments for PWM outputs range from -1.0 to 1.0. They * are mapped to the hardware dependent values, in this case 0-2000 for the * FPGA. Changes are immediately sent to the FPGA, and the update occurs at the - * next FPGA cycle. There is no delay. + * next FPGA cycle (5.005ms). There is no delay. * * As of revision 0.1.10 of the FPGA, the FPGA interprets the 0-2000 values as * follows: @@ -41,9 +41,21 @@ class PWM : public SensorBase, public ITableListener, public LiveWindowSendable { public: + /** + * Represents the amount to multiply the minimum servo-pulse pwm period by. + */ enum PeriodMultiplier { + /** + * Don't skip pulses. PWM pulses occur every 5.005 ms + */ kPeriodMultiplier_1X = 1, + /** + * Skip every other pulse. PWM pulses occur every 10.010 ms + */ kPeriodMultiplier_2X = 2, + /** + * Skip three out of four pulses. PWM pulses occur every 20.020 ms + */ kPeriodMultiplier_4X = 4 }; diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java index f55a8c467d..3efd077051 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java @@ -20,7 +20,7 @@ import edu.wpi.first.wpilibj.tables.ITableListener; * *

The values supplied as arguments for PWM outputs range from -1.0 to 1.0. They are mapped to * the hardware dependent values, in this case 0-2000 for the FPGA. Changes are immediately sent to - * the FPGA, and the update occurs at the next FPGA cycle. There is no delay. + * the FPGA, and the update occurs at the next FPGA cycle (5.005ms). There is no delay. * *

As of revision 0.1.10 of the FPGA, the FPGA interprets the 0-2000 values as follows: - 2000 = * maximum pulse width - 1999 to 1001 = linear scaling from "full forward" to "center" - 1000 = @@ -33,15 +33,15 @@ public class PWM extends SensorBase implements LiveWindowSendable { */ public enum PeriodMultiplier { /** - * Period Multiplier: don't skip pulses. + * Period Multiplier: don't skip pulses. PWM pulses occur every 5.005 ms */ k1X, /** - * Period Multiplier: skip every other pulse. + * Period Multiplier: skip every other pulse. PWM pulses occur every 10.010 ms */ k2X, /** - * Period Multiplier: skip three out of four pulses. + * Period Multiplier: skip three out of four pulses. PWM pulses occur every 20.020 ms */ k4X }