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