Class to control a simulated duty cycle digital input.
More...
#include <frc/simulation/DutyCycleSim.h>
Class to control a simulated duty cycle digital input.
◆ DutyCycleSim()
frc::sim::DutyCycleSim::DutyCycleSim |
( |
const DutyCycle & |
dutyCycle | ) |
|
|
explicit |
Constructs from a DutyCycle object.
- Parameters
-
◆ CreateForChannel()
static DutyCycleSim frc::sim::DutyCycleSim::CreateForChannel |
( |
int |
channel | ) |
|
|
static |
Creates a DutyCycleSim for a digital input channel.
- Parameters
-
channel | digital input channel |
- Returns
- Simulated object
- Exceptions
-
std::out_of_range | if no DutyCycle is configured for that channel |
◆ CreateForIndex()
static DutyCycleSim frc::sim::DutyCycleSim::CreateForIndex |
( |
int |
index | ) |
|
|
static |
Creates a DutyCycleSim for a simulated index.
The index is incremented for each simulated DutyCycle.
- Parameters
-
- Returns
- Simulated object
◆ GetFrequency()
int frc::sim::DutyCycleSim::GetFrequency |
( |
| ) |
const |
Measure the frequency.
- Returns
- the duty cycle frequency
◆ GetInitialized()
bool frc::sim::DutyCycleSim::GetInitialized |
( |
| ) |
const |
Check whether this duty cycle input has been initialized.
- Returns
- true if initialized
◆ GetOutput()
double frc::sim::DutyCycleSim::GetOutput |
( |
| ) |
const |
Measure the output from this duty cycle port.
- Returns
- the output value
◆ RegisterFrequencyCallback()
Register a callback to be run whenever the frequency changes.
- Parameters
-
callback | the callback |
initialNotify | whether to call the callback with the initial state |
- Returns
- the CallbackStore object associated with this callback
◆ RegisterInitializedCallback()
Register a callback to be run when this duty cycle input is initialized.
- Parameters
-
callback | the callback |
initialNotify | whether to run the callback with the initial state |
- Returns
- the CallbackStore object associated with this callback
◆ RegisterOutputCallback()
Register a callback to be run whenever the output changes.
- Parameters
-
callback | the callback |
initialNotify | whether to call the callback with the initial state |
- Returns
- the CallbackStore object associated with this callback
◆ ResetData()
void frc::sim::DutyCycleSim::ResetData |
( |
| ) |
|
Reset all simulation data for the duty cycle output.
◆ SetFrequency()
void frc::sim::DutyCycleSim::SetFrequency |
( |
int |
frequency | ) |
|
Change the duty cycle frequency.
- Parameters
-
frequency | the new frequency |
◆ SetInitialized()
void frc::sim::DutyCycleSim::SetInitialized |
( |
bool |
initialized | ) |
|
Define whether this duty cycle input has been initialized.
- Parameters
-
initialized | whether this object is initialized |
◆ SetOutput()
void frc::sim::DutyCycleSim::SetOutput |
( |
double |
output | ) |
|
Change the duty cycle output.
- Parameters
-
output | the new output value |
The documentation for this class was generated from the following file: