WPILibC++ 2023.4.3-108-ge5452e3
|
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. More... | |
DutyCycle (DigitalSource *source) | |
Constructs a DutyCycle input from a DigitalSource input. More... | |
DutyCycle (std::shared_ptr< DigitalSource > source) | |
Constructs a DutyCycle input from a DigitalSource input. More... | |
~DutyCycle () override | |
Close the DutyCycle and free all resources. More... | |
DutyCycle (DutyCycle &&)=default | |
DutyCycle & | operator= (DutyCycle &&)=default |
int | GetFrequency () const |
Get the frequency of the duty cycle signal. More... | |
double | GetOutput () const |
Get the output ratio of the duty cycle signal. More... | |
units::second_t | GetHighTime () const |
Get the raw high time of the duty cycle signal. More... | |
unsigned int | GetOutputScaleFactor () const |
Get the scale factor of the output. More... | |
int | GetFPGAIndex () const |
Get the FPGA index for the DutyCycle. More... | |
int | GetSourceChannel () const |
Get the channel of the source. More... | |
Public Member Functions inherited from wpi::Sendable | |
virtual | ~Sendable ()=default |
virtual void | InitSendable (SendableBuilder &builder)=0 |
Initializes this Sendable object. More... | |
Public Member Functions inherited from wpi::SendableHelper< DutyCycle > | |
SendableHelper (const SendableHelper &rhs)=default | |
SendableHelper (SendableHelper &&rhs) | |
SendableHelper & | operator= (const SendableHelper &rhs)=default |
SendableHelper & | operator= (SendableHelper &&rhs) |
Protected Member Functions | |
void | InitSendable (wpi::SendableBuilder &builder) override |
Initializes this Sendable object. More... | |
Protected Member Functions inherited from wpi::SendableHelper< DutyCycle > | |
SendableHelper ()=default | |
~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. |
|
override |
Close the DutyCycle and free all resources.
|
default |
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 |