WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
Counter.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2016. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <stdint.h>
11 
12 #include "HAL/AnalogTrigger.h"
13 #include "HAL/Types.h"
14 
15 enum HAL_Counter_Mode : int32_t {
16  HAL_Counter_kTwoPulse = 0,
17  HAL_Counter_kSemiperiod = 1,
18  HAL_Counter_kPulseLength = 2,
19  HAL_Counter_kExternalDirection = 3
20 };
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 HAL_CounterHandle HAL_InitializeCounter(HAL_Counter_Mode mode, int32_t* index,
26  int32_t* status);
27 void HAL_FreeCounter(HAL_CounterHandle counterHandle, int32_t* status);
28 void HAL_SetCounterAverageSize(HAL_CounterHandle counterHandle, int32_t size,
29  int32_t* status);
30 void HAL_SetCounterUpSource(HAL_CounterHandle counterHandle,
31  HAL_Handle digitalSourceHandle,
32  HAL_AnalogTriggerType analogTriggerType,
33  int32_t* status);
34 void HAL_SetCounterUpSourceEdge(HAL_CounterHandle counterHandle,
35  HAL_Bool risingEdge, HAL_Bool fallingEdge,
36  int32_t* status);
37 void HAL_ClearCounterUpSource(HAL_CounterHandle counterHandle, int32_t* status);
38 void HAL_SetCounterDownSource(HAL_CounterHandle counterHandle,
39  HAL_Handle digitalSourceHandle,
40  HAL_AnalogTriggerType analogTriggerType,
41  int32_t* status);
42 void HAL_SetCounterDownSourceEdge(HAL_CounterHandle counterHandle,
43  HAL_Bool risingEdge, HAL_Bool fallingEdge,
44  int32_t* status);
45 void HAL_ClearCounterDownSource(HAL_CounterHandle counterHandle,
46  int32_t* status);
47 void HAL_SetCounterUpDownMode(HAL_CounterHandle counterHandle, int32_t* status);
48 void HAL_SetCounterExternalDirectionMode(HAL_CounterHandle counterHandle,
49  int32_t* status);
50 void HAL_SetCounterSemiPeriodMode(HAL_CounterHandle counterHandle,
51  HAL_Bool highSemiPeriod, int32_t* status);
52 void HAL_SetCounterPulseLengthMode(HAL_CounterHandle counterHandle,
53  double threshold, int32_t* status);
54 int32_t HAL_GetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
55  int32_t* status);
56 void HAL_SetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
57  int32_t samplesToAverage, int32_t* status);
58 void HAL_ResetCounter(HAL_CounterHandle counterHandle, int32_t* status);
59 int32_t HAL_GetCounter(HAL_CounterHandle counterHandle, int32_t* status);
60 double HAL_GetCounterPeriod(HAL_CounterHandle counterHandle, int32_t* status);
61 void HAL_SetCounterMaxPeriod(HAL_CounterHandle counterHandle, double maxPeriod,
62  int32_t* status);
63 void HAL_SetCounterUpdateWhenEmpty(HAL_CounterHandle counterHandle,
64  HAL_Bool enabled, int32_t* status);
65 HAL_Bool HAL_GetCounterStopped(HAL_CounterHandle counterHandle,
66  int32_t* status);
67 HAL_Bool HAL_GetCounterDirection(HAL_CounterHandle counterHandle,
68  int32_t* status);
69 void HAL_SetCounterReverseDirection(HAL_CounterHandle counterHandle,
70  HAL_Bool reverseDirection, int32_t* status);
71 #ifdef __cplusplus
72 }
73 #endif