WPILibC++ 2027.0.0-alpha-2
Loading...
Searching...
No Matches
frc::sim::PWMSim Class Reference

Class to control a simulated PWM output. More...

#include <frc/simulation/PWMSim.h>

Public Member Functions

 PWMSim (const PWM &pwm)
 Constructs from a PWM object.
 
 PWMSim (int channel)
 Constructs from a PWM channel number.
 
std::unique_ptr< CallbackStoreRegisterInitializedCallback (NotifyCallback callback, bool initialNotify)
 Register a callback to be run when the PWM is initialized.
 
bool GetInitialized () const
 Check whether the PWM has been initialized.
 
void SetInitialized (bool initialized)
 Define whether the PWM has been initialized.
 
std::unique_ptr< CallbackStoreRegisterPulseMicrosecondCallback (NotifyCallback callback, bool initialNotify)
 Register a callback to be run when the PWM pulse microsecond value changes.
 
int32_t GetPulseMicrosecond () const
 Get the PWM pulse microsecond value.
 
void SetPulseMicrosecond (int32_t microsecondPulseTime)
 Set the PWM pulse microsecond value.
 
std::unique_ptr< CallbackStoreRegisterOutputPeriodCallback (NotifyCallback callback, bool initialNotify)
 Register a callback to be run when the PWM period scale changes.
 
int GetOutputPeriod () const
 Get the PWM period scale.
 
void SetOutputPeriod (int period)
 Set the PWM period scale.
 
void ResetData ()
 Reset all simulation data.
 

Detailed Description

Class to control a simulated PWM output.

Constructor & Destructor Documentation

◆ PWMSim() [1/2]

frc::sim::PWMSim::PWMSim ( const PWM & pwm)
explicit

Constructs from a PWM object.

Parameters
pwmPWM to simulate

◆ PWMSim() [2/2]

frc::sim::PWMSim::PWMSim ( int channel)
explicit

Constructs from a PWM channel number.

Parameters
channelChannel number

Member Function Documentation

◆ GetInitialized()

bool frc::sim::PWMSim::GetInitialized ( ) const

Check whether the PWM has been initialized.

Returns
true if initialized

◆ GetOutputPeriod()

int frc::sim::PWMSim::GetOutputPeriod ( ) const

Get the PWM period scale.

Returns
the PWM period scale

◆ GetPulseMicrosecond()

int32_t frc::sim::PWMSim::GetPulseMicrosecond ( ) const

Get the PWM pulse microsecond value.

Returns
the PWM pulse microsecond value

◆ RegisterInitializedCallback()

std::unique_ptr< CallbackStore > frc::sim::PWMSim::RegisterInitializedCallback ( NotifyCallback callback,
bool initialNotify )
nodiscard

Register a callback to be run when the PWM is initialized.

Parameters
callbackthe callback
initialNotifywhether to run the callback with the initial state
Returns
the CallbackStore object associated with this callback

◆ RegisterOutputPeriodCallback()

std::unique_ptr< CallbackStore > frc::sim::PWMSim::RegisterOutputPeriodCallback ( NotifyCallback callback,
bool initialNotify )
nodiscard

Register a callback to be run when the PWM period scale changes.

Parameters
callbackthe callback
initialNotifywhether to run the callback with the initial value
Returns
the CallbackStore object associated with this callback

◆ RegisterPulseMicrosecondCallback()

std::unique_ptr< CallbackStore > frc::sim::PWMSim::RegisterPulseMicrosecondCallback ( NotifyCallback callback,
bool initialNotify )
nodiscard

Register a callback to be run when the PWM pulse microsecond value changes.

Parameters
callbackthe callback
initialNotifywhether to run the callback with the initial value
Returns
the CallbackStore object associated with this callback

◆ ResetData()

void frc::sim::PWMSim::ResetData ( )

Reset all simulation data.

◆ SetInitialized()

void frc::sim::PWMSim::SetInitialized ( bool initialized)

Define whether the PWM has been initialized.

Parameters
initializedwhether this object is initialized

◆ SetOutputPeriod()

void frc::sim::PWMSim::SetOutputPeriod ( int period)

Set the PWM period scale.

Parameters
periodthe PWM period scale

◆ SetPulseMicrosecond()

void frc::sim::PWMSim::SetPulseMicrosecond ( int32_t microsecondPulseTime)

Set the PWM pulse microsecond value.

Parameters
microsecondPulseTimethe PWM pulse microsecond value

The documentation for this class was generated from the following file: