12 #include <HAL/Counter.h> 13 #include <HAL/Types.h> 15 #include "AnalogTrigger.h" 16 #include "CounterBase.h" 17 #include "ErrorBase.h" 18 #include "SmartDashboard/SendableBase.h" 22 class DigitalGlitchFilter;
40 kExternalDirection = 3
56 explicit Counter(Mode mode = kTwoPulse);
97 explicit Counter(std::shared_ptr<DigitalSource> source);
138 Counter(EncodingType encodingType, std::shared_ptr<DigitalSource> upSource,
139 std::shared_ptr<DigitalSource> downSource,
bool inverted);
169 void SetUpSource(std::shared_ptr<AnalogTrigger> analogTrigger,
170 AnalogTriggerType triggerType);
181 void SetUpSource(std::shared_ptr<DigitalSource> source);
224 AnalogTriggerType triggerType);
234 void SetDownSource(std::shared_ptr<AnalogTrigger> analogTrigger,
235 AnalogTriggerType triggerType);
337 int GetFPGAIndex()
const;
346 int Get()
const override;
354 void Reset()
override;
420 std::shared_ptr<DigitalSource> m_upSource;
423 std::shared_ptr<DigitalSource> m_downSource;
426 HAL_CounterHandle m_counter = HAL_kInvalidHandle;
int Get() const override
Read the current counter value.
Definition: Counter.cpp:277
void ClearDownSource()
Disable the down counting source to the counter.
Definition: Counter.cpp:214
void SetDownSourceEdge(bool risingEdge, bool fallingEdge)
Set the edge sensitivity on a down counting source.
Definition: Counter.cpp:202
Definition: Utility.cpp:119
Counter(Mode mode=kTwoPulse)
Create an instance of a counter where no sources are selected.
Definition: Counter.cpp:19
bool GetDirection() const override
The last direction the counter value changed.
Definition: Counter.cpp:322
Class to enable glitch filtering on a set of digital inputs.
Definition: DigitalGlitchFilter.h:32
void Reset() override
Reset the Counter to zero.
Definition: Counter.cpp:285
Interface for counting the number of ticks on a digital input channel.
Definition: CounterBase.h:21
void SetUpSourceEdge(bool risingEdge, bool fallingEdge)
Set the edge sensitivity on an up counting source.
Definition: Counter.cpp:138
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:229
void SetDownSource(int channel)
Set the down counting source to be a digital input channel.
Definition: Counter.cpp:158
void SetUpdateWhenEmpty(bool enabled)
Select whether you want to continue updating the event timer output when there are no samples capture...
Definition: Counter.cpp:307
DigitalSource Interface.
Definition: DigitalSource.h:25
void SetPulseLengthMode(double threshold)
Configure the counter to count in up or down based on the length of the input pulse.
Definition: Counter.cpp:243
Base class for most objects.
Definition: ErrorBase.h:74
Definition: SendableBase.h:19
Definition: AnalogTrigger.h:22
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:257
void SetUpDownCounterMode()
Set standard up / down counting mode on this counter.
Definition: Counter.cpp:222
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
Definition: Counter.cpp:330
Definition: SendableBuilder.h:23
double GetPeriod() const override
Get the Period of the most recent count.
Definition: Counter.cpp:292
void SetReverseDirection(bool reverseDirection)
Set the Counter to return reversed sensing on the direction.
Definition: Counter.cpp:250
void SetUpSource(int channel)
Set the upsource for the counter as a digital input channel.
Definition: Counter.cpp:94
bool GetStopped() const override
Determine if the clock is stopped.
Definition: Counter.cpp:314
void SetMaxPeriod(double maxPeriod) override
Set the maximum period where the device is still considered "moving".
Definition: Counter.cpp:300
int GetSamplesToAverage() const
Get the Samples to Average which specifies the number of samples of the timer to average when calcula...
Definition: Counter.cpp:268
void SetSemiPeriodMode(bool highSemiPeriod)
Set Semi-period mode on this counter.
Definition: Counter.cpp:236
void ClearUpSource()
Disable the up counting source to the counter.
Definition: Counter.cpp:150