[hal] Add support for Pulse-Per-Second signal (#4819)

This commit is contained in:
Thad House
2022-12-14 18:15:34 -08:00
committed by GitHub
parent 518916ba02
commit ee02fb7ba7
7 changed files with 100 additions and 0 deletions

View File

@@ -113,6 +113,26 @@ public class DigitalOutput extends DigitalSource implements Sendable {
DIOJNI.setDigitalPWMRate(rate);
}
/**
* Enable a PWM PPS (Pulse Per Second) Output on this line.
*
* <p>Allocate one of the 6 DO PWM generator resources.
*
* <p>Supply the duty-cycle to output.
*
* <p>The resolution of the duty cycle is 8-bit.
*
* @param dutyCycle The duty-cycle to start generating. [0..1]
*/
public void enablePPS(double dutyCycle) {
if (m_pwmGenerator != invalidPwmGenerator) {
return;
}
m_pwmGenerator = DIOJNI.allocateDigitalPWM();
DIOJNI.setDigitalPWMPPS(m_pwmGenerator, dutyCycle);
DIOJNI.setDigitalPWMOutputChannel(m_pwmGenerator, m_channel);
}
/**
* Enable a PWM Output on this line.
*