WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
frc::ExternalDirectionCounter Class Reference

Counter using external direction. More...

#include <frc/counter/ExternalDirectionCounter.h>

Inheritance diagram for frc::ExternalDirectionCounter:
wpi::Sendable wpi::SendableHelper< ExternalDirectionCounter >

Public Member Functions

 ExternalDirectionCounter (DigitalSource &countSource, DigitalSource &directionSource)
 Constructs a new ExternalDirectionCounter.
 
 ExternalDirectionCounter (std::shared_ptr< DigitalSource > countSource, std::shared_ptr< DigitalSource > directionSource)
 Constructs a new ExternalDirectionCounter.
 
 ExternalDirectionCounter (ExternalDirectionCounter &&)=default
 
ExternalDirectionCounteroperator= (ExternalDirectionCounter &&)=default
 
 ~ExternalDirectionCounter () override=default
 
int GetCount () const
 Gets the current count.
 
void SetReverseDirection (bool reverseDirection)
 Sets to reverse the counter direction.
 
void Reset ()
 Resets the current count.
 
void SetEdgeConfiguration (EdgeConfiguration configuration)
 Sets the edge configuration for counting.
 
- Public Member Functions inherited from wpi::Sendable
virtual constexpr ~Sendable ()=default
 
- Public Member Functions inherited from wpi::SendableHelper< ExternalDirectionCounter >
constexpr SendableHelper (const SendableHelper &rhs)=default
 
constexpr SendableHelper (SendableHelper &&rhs)
 
constexpr SendableHelperoperator= (const SendableHelper &rhs)=default
 
constexpr SendableHelperoperator= (SendableHelper &&rhs)
 

Protected Member Functions

void InitSendable (wpi::SendableBuilder &builder) override
 Initializes this Sendable object.
 
- Protected Member Functions inherited from wpi::SendableHelper< ExternalDirectionCounter >
constexpr SendableHelper ()=default
 
constexpr ~SendableHelper ()
 

Detailed Description

Counter using external direction.

This counts on an edge from one digital input and the whether it counts up or down based on the state of a second digital input.

Constructor & Destructor Documentation

◆ ExternalDirectionCounter() [1/3]

frc::ExternalDirectionCounter::ExternalDirectionCounter ( DigitalSource & countSource,
DigitalSource & directionSource )

Constructs a new ExternalDirectionCounter.

Parameters
countSourceThe source for counting.
directionSourceThe source for selecting count direction.

◆ ExternalDirectionCounter() [2/3]

frc::ExternalDirectionCounter::ExternalDirectionCounter ( std::shared_ptr< DigitalSource > countSource,
std::shared_ptr< DigitalSource > directionSource )

Constructs a new ExternalDirectionCounter.

Parameters
countSourceThe source for counting.
directionSourceThe source for selecting count direction.

◆ ExternalDirectionCounter() [3/3]

frc::ExternalDirectionCounter::ExternalDirectionCounter ( ExternalDirectionCounter && )
default

◆ ~ExternalDirectionCounter()

frc::ExternalDirectionCounter::~ExternalDirectionCounter ( )
overridedefault

Member Function Documentation

◆ GetCount()

int frc::ExternalDirectionCounter::GetCount ( ) const

Gets the current count.

Returns
The current count.

◆ InitSendable()

void frc::ExternalDirectionCounter::InitSendable ( wpi::SendableBuilder & builder)
overrideprotectedvirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements wpi::Sendable.

◆ operator=()

ExternalDirectionCounter & frc::ExternalDirectionCounter::operator= ( ExternalDirectionCounter && )
default

◆ Reset()

void frc::ExternalDirectionCounter::Reset ( )

Resets the current count.

◆ SetEdgeConfiguration()

void frc::ExternalDirectionCounter::SetEdgeConfiguration ( EdgeConfiguration configuration)

Sets the edge configuration for counting.

Parameters
configurationThe counting edge configuration.

◆ SetReverseDirection()

void frc::ExternalDirectionCounter::SetReverseDirection ( bool reverseDirection)

Sets to reverse the counter direction.

Parameters
reverseDirectionTrue to reverse counting direction.

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