WPILibC++ 2023.4.3
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. More...
 
 ExternalDirectionCounter (std::shared_ptr< DigitalSource > countSource, std::shared_ptr< DigitalSource > directionSource)
 Constructs a new ExternalDirectionCounter. More...
 
 ~ExternalDirectionCounter () override
 
 ExternalDirectionCounter (ExternalDirectionCounter &&)=default
 
ExternalDirectionCounteroperator= (ExternalDirectionCounter &&)=default
 
int GetCount () const
 Gets the current count. More...
 
void SetReverseDirection (bool reverseDirection)
 Sets to reverse the counter direction. More...
 
void Reset ()
 Resets the current count. More...
 
void SetEdgeConfiguration (EdgeConfiguration configuration)
 Sets the edge configuration for counting. More...
 
- Public Member Functions inherited from wpi::Sendable
virtual ~Sendable ()=default
 
virtual void InitSendable (SendableBuilder &builder)=0
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from wpi::SendableHelper< ExternalDirectionCounter >
 SendableHelper (const SendableHelper &rhs)=default
 
 SendableHelper (SendableHelper &&rhs)
 
SendableHelperoperator= (const SendableHelper &rhs)=default
 
SendableHelperoperator= (SendableHelper &&rhs)
 

Protected Member Functions

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

frc::ExternalDirectionCounter::~ExternalDirectionCounter ( )
override

◆ ExternalDirectionCounter() [3/3]

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

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: