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

Class to control a simulated analog input. More...

#include <frc/simulation/AnalogInputSim.h>

Public Member Functions

 AnalogInputSim (const AnalogInput &analogInput)
 Constructs from an AnalogInput object.
 
 AnalogInputSim (int channel)
 Constructs from an analog input channel number.
 
std::unique_ptr< CallbackStoreRegisterInitializedCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on whether the analog input is initialized.
 
bool GetInitialized () const
 Check if this analog input has been initialized.
 
void SetInitialized (bool initialized)
 Change whether this analog input has been initialized.
 
std::unique_ptr< CallbackStoreRegisterAverageBitsCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on the number of average bits.
 
int GetAverageBits () const
 Get the number of average bits.
 
void SetAverageBits (int averageBits)
 Change the number of average bits.
 
std::unique_ptr< CallbackStoreRegisterOversampleBitsCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on the amount of oversampling bits.
 
int GetOversampleBits () const
 Get the amount of oversampling bits.
 
void SetOversampleBits (int oversampleBits)
 Change the amount of oversampling bits.
 
std::unique_ptr< CallbackStoreRegisterVoltageCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on the voltage.
 
double GetVoltage () const
 Get the voltage.
 
void SetVoltage (double voltage)
 Change the voltage.
 
void ResetData ()
 Reset all simulation data for this object.
 

Detailed Description

Class to control a simulated analog input.

Constructor & Destructor Documentation

◆ AnalogInputSim() [1/2]

frc::sim::AnalogInputSim::AnalogInputSim ( const AnalogInput & analogInput)
explicit

Constructs from an AnalogInput object.

Parameters
analogInputAnalogInput to simulate

◆ AnalogInputSim() [2/2]

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

Constructs from an analog input channel number.

Parameters
channelChannel number

Member Function Documentation

◆ GetAverageBits()

int frc::sim::AnalogInputSim::GetAverageBits ( ) const

Get the number of average bits.

Returns
the number of average bits

◆ GetInitialized()

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

Check if this analog input has been initialized.

Returns
true if initialized

◆ GetOversampleBits()

int frc::sim::AnalogInputSim::GetOversampleBits ( ) const

Get the amount of oversampling bits.

Returns
the amount of oversampling bits

◆ GetVoltage()

double frc::sim::AnalogInputSim::GetVoltage ( ) const

Get the voltage.

Returns
the voltage

◆ RegisterAverageBitsCallback()

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

Register a callback on the number of average bits.

Parameters
callbackthe callback that will be called whenever the number of average bits is changed
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ RegisterInitializedCallback()

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

Register a callback on whether the analog input is initialized.

Parameters
callbackthe callback that will be called whenever the analog input is initialized
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ RegisterOversampleBitsCallback()

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

Register a callback on the amount of oversampling bits.

Parameters
callbackthe callback that will be called whenever the oversampling bits are changed
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ RegisterVoltageCallback()

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

Register a callback on the voltage.

Parameters
callbackthe callback that will be called whenever the voltage is changed
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ ResetData()

void frc::sim::AnalogInputSim::ResetData ( )

Reset all simulation data for this object.

◆ SetAverageBits()

void frc::sim::AnalogInputSim::SetAverageBits ( int averageBits)

Change the number of average bits.

Parameters
averageBitsthe new value

◆ SetInitialized()

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

Change whether this analog input has been initialized.

Parameters
initializedthe new value

◆ SetOversampleBits()

void frc::sim::AnalogInputSim::SetOversampleBits ( int oversampleBits)

Change the amount of oversampling bits.

Parameters
oversampleBitsthe new value

◆ SetVoltage()

void frc::sim::AnalogInputSim::SetVoltage ( double voltage)

Change the voltage.

Parameters
voltagethe new value

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