WPILibC++ 2025.2.1
|
#include <frc/counter/UpDownCounter.h>
Public Member Functions | |
UpDownCounter (DigitalSource &upSource, DigitalSource &downSource) | |
Constructs a new UpDown Counter. | |
UpDownCounter (std::shared_ptr< DigitalSource > upSource, std::shared_ptr< DigitalSource > downSource) | |
Constructs a new UpDown Counter. | |
UpDownCounter (UpDownCounter &&)=default | |
UpDownCounter & | operator= (UpDownCounter &&)=default |
~UpDownCounter () override=default | |
int | GetCount () const |
Gets the current count. | |
void | SetReverseDirection (bool reverseDirection) |
Sets to revert the counter direction. | |
void | Reset () |
Resets the current count. | |
void | SetUpEdgeConfiguration (EdgeConfiguration configuration) |
Sets the configuration for the up source. | |
void | SetDownEdgeConfiguration (EdgeConfiguration configuration) |
Sets the configuration for the down source. | |
Public Member Functions inherited from wpi::Sendable | |
virtual constexpr | ~Sendable ()=default |
Public Member Functions inherited from wpi::SendableHelper< UpDownCounter > | |
constexpr | SendableHelper (const SendableHelper &rhs)=default |
constexpr | SendableHelper (SendableHelper &&rhs) |
constexpr SendableHelper & | operator= (const SendableHelper &rhs)=default |
constexpr SendableHelper & | operator= (SendableHelper &&rhs) |
Protected Member Functions | |
void | InitSendable (wpi::SendableBuilder &builder) override |
Initializes this Sendable object. | |
Protected Member Functions inherited from wpi::SendableHelper< UpDownCounter > | |
constexpr | SendableHelper ()=default |
constexpr | ~SendableHelper () |
Up Down Counter.
This class can count edges on a single digital input or count up based on an edge from one digital input and down on an edge from another digital input.
frc::UpDownCounter::UpDownCounter | ( | DigitalSource & | upSource, |
DigitalSource & | downSource ) |
Constructs a new UpDown Counter.
upSource | The up count source (can be null). |
downSource | The down count source (can be null). |
frc::UpDownCounter::UpDownCounter | ( | std::shared_ptr< DigitalSource > | upSource, |
std::shared_ptr< DigitalSource > | downSource ) |
Constructs a new UpDown Counter.
upSource | The up count source (can be null). |
downSource | The down count source (can be null). |
|
default |
|
overridedefault |
int frc::UpDownCounter::GetCount | ( | ) | const |
Gets the current count.
|
overrideprotectedvirtual |
|
default |
void frc::UpDownCounter::Reset | ( | ) |
Resets the current count.
void frc::UpDownCounter::SetDownEdgeConfiguration | ( | EdgeConfiguration | configuration | ) |
Sets the configuration for the down source.
configuration | The down source configuration. |
void frc::UpDownCounter::SetReverseDirection | ( | bool | reverseDirection | ) |
Sets to revert the counter direction.
reverseDirection | True to reverse counting direction. |
void frc::UpDownCounter::SetUpEdgeConfiguration | ( | EdgeConfiguration | configuration | ) |
Sets the configuration for the up source.
configuration | The up source configuration. |