Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/ |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame^] | 2 | /* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */ |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 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 | #include "hal/Counter.h" |
| 9 | |
| 10 | #include "CounterInternal.h" |
| 11 | #include "HALInitializer.h" |
| 12 | #include "PortsInternal.h" |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 13 | #include "hal/handles/HandlesInternal.h" |
| 14 | #include "hal/handles/LimitedHandleResource.h" |
| 15 | |
| 16 | namespace hal { |
| 17 | |
| 18 | LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters, |
| 19 | HAL_HandleEnum::Counter>* counterHandles; |
| 20 | } // namespace hal |
| 21 | |
| 22 | namespace hal { |
| 23 | namespace init { |
| 24 | void InitializeCounter() { |
| 25 | static LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters, |
| 26 | HAL_HandleEnum::Counter> |
| 27 | cH; |
| 28 | counterHandles = &cH; |
| 29 | } |
| 30 | } // namespace init |
| 31 | } // namespace hal |
| 32 | |
| 33 | extern "C" { |
| 34 | HAL_CounterHandle HAL_InitializeCounter(HAL_Counter_Mode mode, int32_t* index, |
| 35 | int32_t* status) { |
| 36 | hal::init::CheckInit(); |
| 37 | return 0; |
| 38 | } |
| 39 | void HAL_FreeCounter(HAL_CounterHandle counterHandle, int32_t* status) {} |
| 40 | void HAL_SetCounterAverageSize(HAL_CounterHandle counterHandle, int32_t size, |
| 41 | int32_t* status) {} |
| 42 | void HAL_SetCounterUpSource(HAL_CounterHandle counterHandle, |
| 43 | HAL_Handle digitalSourceHandle, |
| 44 | HAL_AnalogTriggerType analogTriggerType, |
| 45 | int32_t* status) {} |
| 46 | void HAL_SetCounterUpSourceEdge(HAL_CounterHandle counterHandle, |
| 47 | HAL_Bool risingEdge, HAL_Bool fallingEdge, |
| 48 | int32_t* status) {} |
| 49 | void HAL_ClearCounterUpSource(HAL_CounterHandle counterHandle, |
| 50 | int32_t* status) {} |
| 51 | void HAL_SetCounterDownSource(HAL_CounterHandle counterHandle, |
| 52 | HAL_Handle digitalSourceHandle, |
| 53 | HAL_AnalogTriggerType analogTriggerType, |
| 54 | int32_t* status) {} |
| 55 | void HAL_SetCounterDownSourceEdge(HAL_CounterHandle counterHandle, |
| 56 | HAL_Bool risingEdge, HAL_Bool fallingEdge, |
| 57 | int32_t* status) {} |
| 58 | void HAL_ClearCounterDownSource(HAL_CounterHandle counterHandle, |
| 59 | int32_t* status) {} |
| 60 | void HAL_SetCounterUpDownMode(HAL_CounterHandle counterHandle, |
| 61 | int32_t* status) {} |
| 62 | void HAL_SetCounterExternalDirectionMode(HAL_CounterHandle counterHandle, |
| 63 | int32_t* status) {} |
| 64 | void HAL_SetCounterSemiPeriodMode(HAL_CounterHandle counterHandle, |
| 65 | HAL_Bool highSemiPeriod, int32_t* status) {} |
| 66 | void HAL_SetCounterPulseLengthMode(HAL_CounterHandle counterHandle, |
| 67 | double threshold, int32_t* status) {} |
| 68 | int32_t HAL_GetCounterSamplesToAverage(HAL_CounterHandle counterHandle, |
| 69 | int32_t* status) { |
| 70 | return 0; |
| 71 | } |
| 72 | void HAL_SetCounterSamplesToAverage(HAL_CounterHandle counterHandle, |
| 73 | int32_t samplesToAverage, int32_t* status) { |
| 74 | } |
| 75 | void HAL_ResetCounter(HAL_CounterHandle counterHandle, int32_t* status) {} |
| 76 | int32_t HAL_GetCounter(HAL_CounterHandle counterHandle, int32_t* status) { |
| 77 | return 0; |
| 78 | } |
| 79 | double HAL_GetCounterPeriod(HAL_CounterHandle counterHandle, int32_t* status) { |
| 80 | return 0.0; |
| 81 | } |
| 82 | void HAL_SetCounterMaxPeriod(HAL_CounterHandle counterHandle, double maxPeriod, |
| 83 | int32_t* status) {} |
| 84 | void HAL_SetCounterUpdateWhenEmpty(HAL_CounterHandle counterHandle, |
| 85 | HAL_Bool enabled, int32_t* status) {} |
| 86 | HAL_Bool HAL_GetCounterStopped(HAL_CounterHandle counterHandle, |
| 87 | int32_t* status) { |
| 88 | return false; |
| 89 | } |
| 90 | HAL_Bool HAL_GetCounterDirection(HAL_CounterHandle counterHandle, |
| 91 | int32_t* status) { |
| 92 | return false; |
| 93 | } |
| 94 | void HAL_SetCounterReverseDirection(HAL_CounterHandle counterHandle, |
| 95 | HAL_Bool reverseDirection, |
| 96 | int32_t* status) {} |
| 97 | } // extern "C" |