blob: a56b646c81dfa3090380ad61b0e538541a67def8 [file] [log] [blame]
Austin Schuh812d0d12021-11-04 20:16:48 -07001// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
Brian Silverman8fce7482020-01-05 13:18:21 -08004
5#include "hal/Counter.h"
6
7#include "CounterInternal.h"
8#include "HALInitializer.h"
9#include "PortsInternal.h"
Brian Silverman8fce7482020-01-05 13:18:21 -080010#include "hal/handles/HandlesInternal.h"
11#include "hal/handles/LimitedHandleResource.h"
12
13namespace hal {
14
15LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters,
16 HAL_HandleEnum::Counter>* counterHandles;
17} // namespace hal
18
Austin Schuh812d0d12021-11-04 20:16:48 -070019namespace hal::init {
Brian Silverman8fce7482020-01-05 13:18:21 -080020void InitializeCounter() {
21 static LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters,
22 HAL_HandleEnum::Counter>
23 cH;
24 counterHandles = &cH;
25}
Austin Schuh812d0d12021-11-04 20:16:48 -070026} // namespace hal::init
Brian Silverman8fce7482020-01-05 13:18:21 -080027
28extern "C" {
29HAL_CounterHandle HAL_InitializeCounter(HAL_Counter_Mode mode, int32_t* index,
30 int32_t* status) {
31 hal::init::CheckInit();
32 return 0;
33}
34void HAL_FreeCounter(HAL_CounterHandle counterHandle, int32_t* status) {}
35void HAL_SetCounterAverageSize(HAL_CounterHandle counterHandle, int32_t size,
36 int32_t* status) {}
37void HAL_SetCounterUpSource(HAL_CounterHandle counterHandle,
38 HAL_Handle digitalSourceHandle,
39 HAL_AnalogTriggerType analogTriggerType,
40 int32_t* status) {}
41void HAL_SetCounterUpSourceEdge(HAL_CounterHandle counterHandle,
42 HAL_Bool risingEdge, HAL_Bool fallingEdge,
43 int32_t* status) {}
44void HAL_ClearCounterUpSource(HAL_CounterHandle counterHandle,
45 int32_t* status) {}
46void HAL_SetCounterDownSource(HAL_CounterHandle counterHandle,
47 HAL_Handle digitalSourceHandle,
48 HAL_AnalogTriggerType analogTriggerType,
49 int32_t* status) {}
50void HAL_SetCounterDownSourceEdge(HAL_CounterHandle counterHandle,
51 HAL_Bool risingEdge, HAL_Bool fallingEdge,
52 int32_t* status) {}
53void HAL_ClearCounterDownSource(HAL_CounterHandle counterHandle,
54 int32_t* status) {}
55void HAL_SetCounterUpDownMode(HAL_CounterHandle counterHandle,
56 int32_t* status) {}
57void HAL_SetCounterExternalDirectionMode(HAL_CounterHandle counterHandle,
58 int32_t* status) {}
59void HAL_SetCounterSemiPeriodMode(HAL_CounterHandle counterHandle,
60 HAL_Bool highSemiPeriod, int32_t* status) {}
61void HAL_SetCounterPulseLengthMode(HAL_CounterHandle counterHandle,
62 double threshold, int32_t* status) {}
63int32_t HAL_GetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
64 int32_t* status) {
65 return 0;
66}
67void HAL_SetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
68 int32_t samplesToAverage, int32_t* status) {
69}
70void HAL_ResetCounter(HAL_CounterHandle counterHandle, int32_t* status) {}
71int32_t HAL_GetCounter(HAL_CounterHandle counterHandle, int32_t* status) {
72 return 0;
73}
74double HAL_GetCounterPeriod(HAL_CounterHandle counterHandle, int32_t* status) {
75 return 0.0;
76}
77void HAL_SetCounterMaxPeriod(HAL_CounterHandle counterHandle, double maxPeriod,
78 int32_t* status) {}
79void HAL_SetCounterUpdateWhenEmpty(HAL_CounterHandle counterHandle,
80 HAL_Bool enabled, int32_t* status) {}
81HAL_Bool HAL_GetCounterStopped(HAL_CounterHandle counterHandle,
82 int32_t* status) {
83 return false;
84}
85HAL_Bool HAL_GetCounterDirection(HAL_CounterHandle counterHandle,
86 int32_t* status) {
87 return false;
88}
89void HAL_SetCounterReverseDirection(HAL_CounterHandle counterHandle,
90 HAL_Bool reverseDirection,
91 int32_t* status) {}
92} // extern "C"