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