Class to control a simulated digital PWM output.
More...
#include <frc/simulation/DigitalPWMSim.h>
Class to control a simulated digital PWM output.
This is for duty cycle PWM outputs on a DigitalOutput, not for the servo style PWM outputs on a PWM channel.
◆ DigitalPWMSim()
frc::sim::DigitalPWMSim::DigitalPWMSim |
( |
const DigitalOutput & | digitalOutput | ) |
|
|
explicit |
◆ CreateForChannel()
static DigitalPWMSim frc::sim::DigitalPWMSim::CreateForChannel |
( |
int | channel | ) |
|
|
static |
Creates an DigitalPWMSim for a digital I/O channel.
- Parameters
-
- Returns
- Simulated object
- Throws:
- std::out_of_range if no Digital PWM is configured for that channel
◆ CreateForIndex()
static DigitalPWMSim frc::sim::DigitalPWMSim::CreateForIndex |
( |
int | index | ) |
|
|
static |
Creates an DigitalPWMSim for a simulated index.
The index is incremented for each simulated DigitalPWM.
- Parameters
-
- Returns
- Simulated object
◆ GetDutyCycle()
double frc::sim::DigitalPWMSim::GetDutyCycle |
( |
| ) |
const |
Read the duty cycle value.
- Returns
- the duty cycle value of this PWM output
◆ GetInitialized()
bool frc::sim::DigitalPWMSim::GetInitialized |
( |
| ) |
const |
Check whether this PWM output has been initialized.
- Returns
- true if initialized
◆ GetPin()
int frc::sim::DigitalPWMSim::GetPin |
( |
| ) |
const |
Check the pin number.
- Returns
- the pin number
◆ RegisterDutyCycleCallback()
Register a callback to be run whenever the duty cycle value 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 PWM output is initialized.
- Parameters
-
callback | the callback |
initialNotify | whether to run the callback with the initial state |
- Returns
- the CallbackStore object associated with this callback
◆ RegisterPinCallback()
Register a callback to be run whenever the pin 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::DigitalPWMSim::ResetData |
( |
| ) |
|
Reset all simulation data.
◆ SetDutyCycle()
void frc::sim::DigitalPWMSim::SetDutyCycle |
( |
double | dutyCycle | ) |
|
Set the duty cycle value of this PWM output.
- Parameters
-
◆ SetInitialized()
void frc::sim::DigitalPWMSim::SetInitialized |
( |
bool | initialized | ) |
|
Define whether this PWM output has been initialized.
- Parameters
-
initialized | whether this object is initialized |
◆ SetPin()
void frc::sim::DigitalPWMSim::SetPin |
( |
int | pin | ) |
|
Change the pin number.
- Parameters
-
The documentation for this class was generated from the following file: