![]() |
WPILibC++ 2025.3.1
|
Class to read a duty cycle PWM input. More...
#include <frc/DutyCycle.h>
Public Member Functions | |
DutyCycle (DigitalSource &source) | |
Constructs a DutyCycle input from a DigitalSource input. | |
DutyCycle (DigitalSource *source) | |
Constructs a DutyCycle input from a DigitalSource input. | |
DutyCycle (std::shared_ptr< DigitalSource > source) | |
Constructs a DutyCycle input from a DigitalSource input. | |
DutyCycle (DutyCycle &&)=default | |
DutyCycle & | operator= (DutyCycle &&)=default |
~DutyCycle () override=default | |
Close the DutyCycle and free all resources. | |
int | GetFrequency () const |
Get the frequency of the duty cycle signal. | |
double | GetOutput () const |
Get the output ratio of the duty cycle signal. | |
units::second_t | GetHighTime () const |
Get the raw high time of the duty cycle signal. | |
unsigned int | GetOutputScaleFactor () const |
Get the scale factor of the output. | |
int | GetFPGAIndex () const |
Get the FPGA index for the DutyCycle. | |
int | GetSourceChannel () const |
Get the channel of the source. | |
![]() | |
virtual constexpr | ~Sendable ()=default |
![]() | |
constexpr | SendableHelper (const SendableHelper &rhs)=default |
constexpr | SendableHelper (SendableHelper &&rhs) |
constexpr SendableHelper & | operator= (const SendableHelper &rhs)=default |
constexpr SendableHelper & | operator= (SendableHelper &&rhs) |
Protected Member Functions | |
void | InitSendable (wpi::SendableBuilder &builder) override |
Initializes this Sendable object. | |
![]() | |
constexpr | SendableHelper ()=default |
constexpr | ~SendableHelper () |
Friends | |
class | AnalogTrigger |
class | DMA |
class | DMASample |
Class to read a duty cycle PWM input.
PWM input signals are specified with a frequency and a ratio of high to low in that frequency. There are 8 of these in the roboRIO, and they can be attached to any DigitalSource.
These can be combined as the input of an AnalogTrigger to a Counter in order to implement rollover checking.
|
explicit |
Constructs a DutyCycle input from a DigitalSource input.
This class does not own the inputted source.
source | The DigitalSource to use. |
|
explicit |
Constructs a DutyCycle input from a DigitalSource input.
This class does not own the inputted source.
source | The DigitalSource to use. |
|
explicit |
Constructs a DutyCycle input from a DigitalSource input.
This class does not own the inputted source.
source | The DigitalSource to use. |
|
default |
|
overridedefault |
Close the DutyCycle and free all resources.
int frc::DutyCycle::GetFPGAIndex | ( | ) | const |
Get the FPGA index for the DutyCycle.
int frc::DutyCycle::GetFrequency | ( | ) | const |
Get the frequency of the duty cycle signal.
units::second_t frc::DutyCycle::GetHighTime | ( | ) | const |
Get the raw high time of the duty cycle signal.
double frc::DutyCycle::GetOutput | ( | ) | const |
Get the output ratio of the duty cycle signal.
0 means always low, 1 means always high.
unsigned int frc::DutyCycle::GetOutputScaleFactor | ( | ) | const |
Get the scale factor of the output.
An output equal to this value is always high, and then linearly scales down to 0. Divide a raw result by this in order to get the percentage between 0 and 1. Used by DMA.
int frc::DutyCycle::GetSourceChannel | ( | ) | const |
Get the channel of the source.
|
overrideprotectedvirtual |
|
friend |
|
friend |
|
friend |