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