mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Fixed issue with digital outputs used as pwm on mxp (#14)
When a digital output object that was tied to an mxp pin had enable pwm called on it it would pwm on a pin 6 lower (although if this wasn't an mxp pin it wouldn't do anything at all.) Fixed in Digital.cpp by adding 6 if it is an MXP pin in setPWMOutputChannel() This should fix the CanJaguar test because when digitalOutputs used as PWM were freed, the PWM generator was set to the number of pins, which meant it was actually outputing on pin 20. Change-Id: Ib48db3e6e3bf78659622145969d24011cc231ea6 Updated Hal to include some documentation about swaping mxp pins. Cannot find NI related documentation as to the pin numbers being wrong though Change-Id: I71d84431dc9bc7bf22aa29b6633e49723311b5f7 fixed formatting on changed files Change-Id: I5b7c16cd798132b6b20c1d03f334a95b42d2ee11
This commit is contained in:
committed by
Peter Johnson
parent
aa22d4c33b
commit
95d40ed01f
@@ -126,6 +126,10 @@ void setPWMDutyCycle(void* pwmGenerator, double dutyCycle, int32_t* status) {
|
||||
void setPWMOutputChannel(void* pwmGenerator, uint32_t pin, int32_t* status) {
|
||||
uint32_t id = (uint32_t)pwmGenerator;
|
||||
if (id > 5) return;
|
||||
if (pin >= kNumHeaders) { // if it is on the MXP
|
||||
pin += kMXPDigitalPWMOffset; // then to write as a digital PWM pin requires
|
||||
// an offset to write on the correct pin
|
||||
}
|
||||
digitalSystem->writePWMOutputSelect(id, pin, status);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user