13 #include "AnalogTrigger.h"
14 #include "CounterBase.h"
15 #include "HAL/Counter.h"
16 #include "HAL/Types.h"
17 #include "LiveWindow/LiveWindowSendable.h"
18 #include "SensorBase.h"
42 kExternalDirection = 3
44 explicit Counter(Mode mode = kTwoPulse);
47 explicit Counter(std::shared_ptr<DigitalSource> source);
51 Counter(EncodingType encodingType, std::shared_ptr<DigitalSource> upSource,
52 std::shared_ptr<DigitalSource> downSource,
bool inverted);
57 void SetUpSource(std::shared_ptr<AnalogTrigger> analogTrigger,
58 AnalogTriggerType triggerType);
60 void SetUpSource(std::shared_ptr<DigitalSource> source);
67 AnalogTriggerType triggerType);
68 void SetDownSource(std::shared_ptr<AnalogTrigger> analogTrigger,
69 AnalogTriggerType triggerType);
84 int Get()
const override;
85 void Reset()
override;
94 int GetFPGAIndex()
const {
return m_index; }
100 void InitTable(std::shared_ptr<ITable> subTable)
override;
101 std::shared_ptr<ITable>
GetTable()
const override;
105 std::shared_ptr<DigitalSource> m_upSource;
107 std::shared_ptr<DigitalSource> m_downSource;
109 HAL_CounterHandle m_counter = HAL_kInvalidHandle;
114 std::shared_ptr<ITable> m_table;
int Get() const override
Read the current counter value.
Definition: Counter.cpp:480
void ClearDownSource()
Disable the down counting source to the counter.
Definition: Counter.cpp:379
void SetDownSourceEdge(bool risingEdge, bool fallingEdge)
Set the edge sensitivity on a down counting source.
Definition: Counter.cpp:364
Counter(Mode mode=kTwoPulse)
Create an instance of a counter where no sources are selected.
Definition: Counter.cpp:30
Live Window Sendable is a special type of object sendable to the live window.
Definition: LiveWindowSendable.h:17
Base class for all sensors.
Definition: SensorBase.h:20
void UpdateTable() override
Update the table for this sendable object with the latest values.
Definition: Counter.cpp:604
bool GetDirection() const override
The last direction the counter value changed.
Definition: Counter.cpp:581
Class to enable glitch filtering on a set of digital inputs.
Definition: DigitalGlitchFilter.h:28
void Reset() override
Reset the Counter to zero.
Definition: Counter.cpp:494
std::string GetSmartDashboardType() const override
Definition: Counter.cpp:614
Interface for counting the number of ticks on a digital input channel.
Definition: CounterBase.h:20
void SetUpSourceEdge(bool risingEdge, bool fallingEdge)
Set the edge sensitivity on an up counting source.
Definition: Counter.cpp:256
Class for counting the number of ticks on a digital input channel.
Definition: Counter.h:34
void SetExternalDirectionMode()
Set external direction mode on this counter.
Definition: Counter.cpp:405
void StopLiveWindowMode() override
Stop having this sendable object automatically respond to value changes.
Definition: Counter.cpp:612
void SetDownSource(int channel)
Set the down counting source to be a digital input channel.
Definition: Counter.cpp:285
void SetUpdateWhenEmpty(bool enabled)
Select whether you want to continue updating the event timer output when there are no samples capture...
Definition: Counter.cpp:551
DigitalSource Interface.
Definition: DigitalSource.h:25
virtual ~Counter()
Delete the Counter object.
Definition: Counter.cpp:164
void StartLiveWindowMode() override
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: Counter.cpp:610
void SetPulseLengthMode(double threshold)
Configure the counter to count in up or down based on the length of the input pulse.
Definition: Counter.cpp:433
Definition: AnalogTrigger.h:20
void SetSamplesToAverage(int samplesToAverage)
Set the Samples to Average which specifies the number of samples of the timer to average when calcula...
Definition: Counter.cpp:463
void SetUpDownCounterMode()
Set standard up / down counting mode on this counter.
Definition: Counter.cpp:392
std::shared_ptr< ITable > GetTable() const override
Definition: Counter.cpp:621
double GetPeriod() const override
Get the Period of the most recent count.
Definition: Counter.cpp:509
void SetReverseDirection(bool reverseDirection)
Set the Counter to return reversed sensing on the direction.
Definition: Counter.cpp:597
void InitTable(std::shared_ptr< ITable > subTable) override
Initializes a table for this sendable object.
Definition: Counter.cpp:616
void SetUpSource(int channel)
Set the upsource for the counter as a digital input channel.
Definition: Counter.cpp:179
bool GetStopped() const override
Determine if the clock is stopped.
Definition: Counter.cpp:568
void SetMaxPeriod(double maxPeriod) override
Set the maximum period where the device is still considered "moving".
Definition: Counter.cpp:527
int GetSamplesToAverage() const
Get the Samples to Average which specifies the number of samples of the timer to average when calcula...
Definition: Counter.cpp:449
void SetSemiPeriodMode(bool highSemiPeriod)
Set Semi-period mode on this counter.
Definition: Counter.cpp:417
void ClearUpSource()
Disable the up counting source to the counter.
Definition: Counter.cpp:271