From 62790c0f4717fb279971a9edd272b7f20c262a67 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 21 Oct 2014 14:15:50 -0400 Subject: [PATCH] Use either DO PWM A or B not A and B and update javadoc to reflect 6 generators (artf3698) Change-Id: Id8d29831c97accd54dd359c6f20a447d8eed59db --- hal/lib/Athena/Digital.cpp | 6 ++++-- wpilibc/wpilibC++Devices/src/DigitalOutput.cpp | 6 +++--- .../src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hal/lib/Athena/Digital.cpp b/hal/lib/Athena/Digital.cpp index 2528d52d55..0d3a714a58 100644 --- a/hal/lib/Athena/Digital.cpp +++ b/hal/lib/Athena/Digital.cpp @@ -296,8 +296,10 @@ void setPWMDutyCycle(void* pwmGenerator, double dutyCycle, int32_t *status) { // The resolution of the duty cycle drops close to the highest frequencies. rawDutyCycle = rawDutyCycle / pow(2.0, 4 - pwmPeriodPower); } - digitalSystem->writePWMDutyCycleA(id, (uint8_t)rawDutyCycle, status); - digitalSystem->writePWMDutyCycleB(id, (uint8_t)rawDutyCycle, status); + if(id < 4) + digitalSystem->writePWMDutyCycleA(id, (uint8_t)rawDutyCycle, status); + else + digitalSystem->writePWMDutyCycleB(id - 3, (uint8_t)rawDutyCycle, status); } } diff --git a/wpilibc/wpilibC++Devices/src/DigitalOutput.cpp b/wpilibc/wpilibC++Devices/src/DigitalOutput.cpp index 802363f401..62e78173c2 100644 --- a/wpilibc/wpilibC++Devices/src/DigitalOutput.cpp +++ b/wpilibc/wpilibC++Devices/src/DigitalOutput.cpp @@ -83,7 +83,7 @@ uint32_t DigitalOutput::GetChannel() /** * Output a single pulse on the digital output line. - * Send a single pulse on the digital output line where the pulse diration is specified in seconds. + * Send a single pulse on the digital output line where the pulse duration is specified in seconds. * Maximum pulse length is 0.0016 seconds. * @param length The pulselength in seconds */ @@ -131,7 +131,7 @@ void DigitalOutput::SetPWMRate(float rate) /** * Enable a PWM Output on this line. * - * Allocate one of the 4 DO PWM generator resources from this module. + * Allocate one of the 6 DO PWM generator resources from this module. * * Supply the initial duty-cycle to output so as to avoid a glitch when first starting. * @@ -162,7 +162,7 @@ void DigitalOutput::EnablePWM(float initialDutyCycle) /** * Change this line from a PWM output back to a static Digital Output line. * - * Free up one of the 4 DO PWM generator resources that were in use. + * Free up one of the 6 DO PWM generator resources that were in use. */ void DigitalOutput::DisablePWM() { diff --git a/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java b/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java index 988151cf15..f8d47ac0aa 100644 --- a/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java +++ b/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java @@ -150,7 +150,7 @@ public class DigitalOutput extends DigitalSource implements LiveWindowSendable { /** * Enable a PWM Output on this line. * - * Allocate one of the 4 DO PWM generator resources. + * Allocate one of the 6 DO PWM generator resources. * * Supply the initial duty-cycle to output so as to avoid a glitch when * first starting. @@ -178,7 +178,7 @@ public class DigitalOutput extends DigitalSource implements LiveWindowSendable { /** * Change this line from a PWM output back to a static Digital Output line. * - * Free up one of the 4 DO PWM generator resources that were in use. + * Free up one of the 6 DO PWM generator resources that were in use. */ public void disablePWM() { if (m_pwmGenerator == null)