WPILibC++ 2024.3.2
Counter.h File Reference
#include <stdint.h>
#include "hal/AnalogTrigger.h"
#include "hal/Types.h"

Go to the source code of this file.

Enumerations

enum  HAL_Counter_Mode : int32_t { HAL_Counter_kTwoPulse = 0 , HAL_Counter_kSemiperiod = 1 , HAL_Counter_kPulseLength = 2 , HAL_Counter_kExternalDirection = 3 }
 The counter mode. More...
 

Functions

HAL_CounterHandle HAL_InitializeCounter (HAL_Counter_Mode mode, int32_t *index, int32_t *status)
 Initializes a counter. More...
 
void HAL_FreeCounter (HAL_CounterHandle counterHandle, int32_t *status)
 Frees a counter. More...
 
void HAL_SetCounterAverageSize (HAL_CounterHandle counterHandle, int32_t size, int32_t *status)
 Sets the average sample size of a counter. More...
 
void HAL_SetCounterUpSource (HAL_CounterHandle counterHandle, HAL_Handle digitalSourceHandle, HAL_AnalogTriggerType analogTriggerType, int32_t *status)
 Sets the source object that causes the counter to count up. More...
 
void HAL_SetCounterUpSourceEdge (HAL_CounterHandle counterHandle, HAL_Bool risingEdge, HAL_Bool fallingEdge, int32_t *status)
 Sets the up source to either detect rising edges or falling edges. More...
 
void HAL_ClearCounterUpSource (HAL_CounterHandle counterHandle, int32_t *status)
 Disables the up counting source to the counter. More...
 
void HAL_SetCounterDownSource (HAL_CounterHandle counterHandle, HAL_Handle digitalSourceHandle, HAL_AnalogTriggerType analogTriggerType, int32_t *status)
 Sets the source object that causes the counter to count down. More...
 
void HAL_SetCounterDownSourceEdge (HAL_CounterHandle counterHandle, HAL_Bool risingEdge, HAL_Bool fallingEdge, int32_t *status)
 Sets the down source to either detect rising edges or falling edges. More...
 
void HAL_ClearCounterDownSource (HAL_CounterHandle counterHandle, int32_t *status)
 Disables the down counting source to the counter. More...
 
void HAL_SetCounterUpDownMode (HAL_CounterHandle counterHandle, int32_t *status)
 Sets standard up / down counting mode on this counter. More...
 
void HAL_SetCounterExternalDirectionMode (HAL_CounterHandle counterHandle, int32_t *status)
 Sets directional counting mode on this counter. More...
 
void HAL_SetCounterSemiPeriodMode (HAL_CounterHandle counterHandle, HAL_Bool highSemiPeriod, int32_t *status)
 Sets Semi-period mode on this counter. More...
 
void HAL_SetCounterPulseLengthMode (HAL_CounterHandle counterHandle, double threshold, int32_t *status)
 Configures the counter to count in up or down based on the length of the input pulse. More...
 
int32_t HAL_GetCounterSamplesToAverage (HAL_CounterHandle counterHandle, int32_t *status)
 Gets the Samples to Average which specifies the number of samples of the timer to average when calculating the period. More...
 
void HAL_SetCounterSamplesToAverage (HAL_CounterHandle counterHandle, int32_t samplesToAverage, int32_t *status)
 Sets the Samples to Average which specifies the number of samples of the timer to average when calculating the period. More...
 
void HAL_ResetCounter (HAL_CounterHandle counterHandle, int32_t *status)
 Resets the Counter to zero. More...
 
int32_t HAL_GetCounter (HAL_CounterHandle counterHandle, int32_t *status)
 Reads the current counter value. More...
 
double HAL_GetCounterPeriod (HAL_CounterHandle counterHandle, int32_t *status)
 Gets the Period of the most recent count. More...
 
void HAL_SetCounterMaxPeriod (HAL_CounterHandle counterHandle, double maxPeriod, int32_t *status)
 Sets the maximum period where the device is still considered "moving". More...
 
void HAL_SetCounterUpdateWhenEmpty (HAL_CounterHandle counterHandle, HAL_Bool enabled, int32_t *status)
 Selects whether you want to continue updating the event timer output when there are no samples captured. More...
 
HAL_Bool HAL_GetCounterStopped (HAL_CounterHandle counterHandle, int32_t *status)
 Determines if the clock is stopped. More...
 
HAL_Bool HAL_GetCounterDirection (HAL_CounterHandle counterHandle, int32_t *status)
 Gets the last direction the counter value changed. More...
 
void HAL_SetCounterReverseDirection (HAL_CounterHandle counterHandle, HAL_Bool reverseDirection, int32_t *status)
 Sets the Counter to return reversed sensing on the direction. More...