10 #include "HAL/HAL.hpp"
11 #include "AnalogTriggerOutput.h"
12 #include "CounterBase.h"
13 #include "SensorBase.h"
14 #include "LiveWindow/LiveWindowSendable.h"
35 explicit Counter(Mode mode = kTwoPulse);
36 explicit Counter(int32_t channel);
38 explicit Counter(std::shared_ptr<DigitalSource> source);
39 DEPRECATED(
"Use pass-by-reference instead.")
44 Counter(EncodingType encodingType, std::shared_ptr<DigitalSource> upSource,
45 std::shared_ptr<DigitalSource> downSource,
bool inverted);
50 void SetUpSource(std::shared_ptr<AnalogTrigger> analogTrigger,
51 AnalogTriggerType triggerType);
53 void SetUpSource(std::shared_ptr<DigitalSource> source);
60 AnalogTriggerType triggerType);
61 void SetDownSource(std::shared_ptr<AnalogTrigger> analogTrigger,
62 AnalogTriggerType triggerType);
77 int32_t
Get()
const override;
78 void Reset()
override;
87 uint32_t GetFPGAIndex()
const {
return m_index; }
93 void InitTable(std::shared_ptr<ITable> subTable)
override;
94 std::shared_ptr<ITable>
GetTable()
const override;
98 std::shared_ptr<DigitalSource> m_upSource;
100 std::shared_ptr<DigitalSource> m_downSource;
104 uint32_t m_index = 0;
106 std::shared_ptr<ITable> m_table;
Definition: AnalogTrigger.h:16
bool GetStopped() const override
Determine if the clock is stopped.
Definition: Counter.cpp:539
void SetPulseLengthMode(float threshold)
Configure the counter to count in up or down based on the length of the input pulse.
Definition: Counter.cpp:402
void Reset() override
Reset the Counter to zero.
Definition: Counter.cpp:461
Class to enable glitch filtering on a set of digital inputs.
Definition: DigitalGlitchFilter.h:24
void * m_counter
The FPGA counter object.
Definition: Counter.h:102
void SetSemiPeriodMode(bool highSemiPeriod)
Set Semi-period mode on this counter.
Definition: Counter.cpp:388
DigitalSource Interface.
Definition: DigitalSource.h:22
Live Window Sendable is a special type of object sendable to the live window.
Definition: LiveWindowSendable.h:18
void ClearUpSource()
Disable the up counting source to the counter.
Definition: Counter.cpp:260
void SetUpSource(int32_t channel)
Set the upsource for the counter as a digital input channel.
Definition: Counter.cpp:178
double GetPeriod() const override
Get the Period of the most recent count.
Definition: Counter.cpp:475
void SetMaxPeriod(double maxPeriod) override
Set the maximum period where the device is still considered "moving".
Definition: Counter.cpp:492
int GetSamplesToAverage() const
Get the Samples to Average which specifies the number of samples of the timer to average when calcula...
Definition: Counter.cpp:416
void InitTable(std::shared_ptr< ITable > subTable) override
Initializes a table for this sendable object.
Definition: Counter.cpp:585
void SetDownSourceEdge(bool risingEdge, bool fallingEdge)
Set the edge sensitivity on a down counting source.
Definition: Counter.cpp:338
virtual ~Counter()
Delete the Counter object.
Definition: Counter.cpp:164
virtual std::string GetSmartDashboardType() const override
Definition: Counter.cpp:583
void ClearDownSource()
Disable the down counting source to the counter.
Definition: Counter.cpp:353
Interface for counting the number of ticks on a digital input channel.
Definition: CounterBase.h:20
Base class for all sensors.
Definition: SensorBase.h:20
void StopLiveWindowMode() override
Stop having this sendable object automatically respond to value changes.
Definition: Counter.cpp:581
void SetUpdateWhenEmpty(bool enabled)
Select whether you want to continue updating the event timer output when there are no samples capture...
Definition: Counter.cpp:521
bool GetDirection() const override
The last direction the counter value changed.
Definition: Counter.cpp:551
void SetUpSourceEdge(bool risingEdge, bool fallingEdge)
Set the edge sensitivity on an up counting source.
Definition: Counter.cpp:245
void StartLiveWindowMode() override
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: Counter.cpp:579
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:430
void SetReverseDirection(bool reverseDirection)
Set the Counter to return reversed sensing on the direction.
Definition: Counter.cpp:566
Class for counting the number of ticks on a digital input channel.
Definition: Counter.h:31
void SetDownSource(int32_t channel)
Set the down counting source to be a digital input channel.
Definition: Counter.cpp:273
std::shared_ptr< ITable > GetTable() const override
Definition: Counter.cpp:590
Counter(Mode mode=kTwoPulse)
Create an instance of a counter where no sources are selected.
Definition: Counter.cpp:26
void UpdateTable() override
Update the table for this sendable object with the latest values.
Definition: Counter.cpp:573
void SetUpDownCounterMode()
Set standard up / down counting mode on this counter.
Definition: Counter.cpp:365
void SetExternalDirectionMode()
Set external direction mode on this counter.
Definition: Counter.cpp:377
int32_t Get() const override
Read the current counter value.
Definition: Counter.cpp:447