2016-05-25 20:23:37 -07:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2018-01-02 09:20:21 -08:00
|
|
|
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
|
2016-05-25 20:23:37 -07:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2018-07-20 00:03:45 -07:00
|
|
|
#include "hal/Counter.h"
|
2016-05-25 22:38:11 -07:00
|
|
|
|
2017-08-18 21:35:53 -07:00
|
|
|
#include "CounterInternal.h"
|
2018-05-13 22:02:47 -07:00
|
|
|
#include "HALInitializer.h"
|
2017-08-18 21:35:53 -07:00
|
|
|
#include "PortsInternal.h"
|
2018-07-20 00:03:45 -07:00
|
|
|
#include "hal/Errors.h"
|
|
|
|
|
#include "hal/handles/HandlesInternal.h"
|
|
|
|
|
#include "hal/handles/LimitedHandleResource.h"
|
2016-05-24 00:58:10 -07:00
|
|
|
|
2017-08-18 21:35:53 -07:00
|
|
|
namespace hal {
|
2016-07-01 00:29:08 -07:00
|
|
|
|
2017-08-18 21:35:53 -07:00
|
|
|
LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters,
|
2017-12-10 19:38:53 -08:00
|
|
|
HAL_HandleEnum::Counter>* counterHandles;
|
|
|
|
|
} // namespace hal
|
|
|
|
|
|
|
|
|
|
namespace hal {
|
|
|
|
|
namespace init {
|
|
|
|
|
void InitializeCounter() {
|
|
|
|
|
static LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters,
|
|
|
|
|
HAL_HandleEnum::Counter>
|
|
|
|
|
cH;
|
|
|
|
|
counterHandles = &cH;
|
|
|
|
|
}
|
|
|
|
|
} // namespace init
|
2017-10-16 19:56:08 -07:00
|
|
|
} // namespace hal
|
2016-05-24 00:58:10 -07:00
|
|
|
|
|
|
|
|
extern "C" {
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_CounterHandle HAL_InitializeCounter(HAL_Counter_Mode mode, int32_t* index,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {
|
2018-05-13 22:02:47 -07:00
|
|
|
hal::init::CheckInit();
|
2017-08-18 21:35:53 -07:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
void HAL_FreeCounter(HAL_CounterHandle counterHandle, int32_t* status) {}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterAverageSize(HAL_CounterHandle counterHandle, int32_t size,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterUpSource(HAL_CounterHandle counterHandle,
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_Handle digitalSourceHandle,
|
|
|
|
|
HAL_AnalogTriggerType analogTriggerType,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterUpSourceEdge(HAL_CounterHandle counterHandle,
|
2016-07-12 10:45:14 -07:00
|
|
|
HAL_Bool risingEdge, HAL_Bool fallingEdge,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {}
|
|
|
|
|
void HAL_ClearCounterUpSource(HAL_CounterHandle counterHandle,
|
|
|
|
|
int32_t* status) {}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterDownSource(HAL_CounterHandle counterHandle,
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_Handle digitalSourceHandle,
|
|
|
|
|
HAL_AnalogTriggerType analogTriggerType,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterDownSourceEdge(HAL_CounterHandle counterHandle,
|
2016-07-12 10:45:14 -07:00
|
|
|
HAL_Bool risingEdge, HAL_Bool fallingEdge,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_ClearCounterDownSource(HAL_CounterHandle counterHandle,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {}
|
|
|
|
|
void HAL_SetCounterUpDownMode(HAL_CounterHandle counterHandle,
|
|
|
|
|
int32_t* status) {}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterExternalDirectionMode(HAL_CounterHandle counterHandle,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterSemiPeriodMode(HAL_CounterHandle counterHandle,
|
2017-08-18 21:35:53 -07:00
|
|
|
HAL_Bool highSemiPeriod, int32_t* status) {}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterPulseLengthMode(HAL_CounterHandle counterHandle,
|
2017-08-18 21:35:53 -07:00
|
|
|
double threshold, int32_t* status) {}
|
2016-08-12 13:45:28 -07:00
|
|
|
int32_t HAL_GetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t samplesToAverage, int32_t* status) {
|
|
|
|
|
}
|
|
|
|
|
void HAL_ResetCounter(HAL_CounterHandle counterHandle, int32_t* status) {}
|
|
|
|
|
int32_t HAL_GetCounter(HAL_CounterHandle counterHandle, int32_t* status) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
double HAL_GetCounterPeriod(HAL_CounterHandle counterHandle, int32_t* status) {
|
|
|
|
|
return 0.0;
|
|
|
|
|
}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterMaxPeriod(HAL_CounterHandle counterHandle, double maxPeriod,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterUpdateWhenEmpty(HAL_CounterHandle counterHandle,
|
2017-08-18 21:35:53 -07:00
|
|
|
HAL_Bool enabled, int32_t* status) {}
|
2016-08-12 13:45:28 -07:00
|
|
|
HAL_Bool HAL_GetCounterStopped(HAL_CounterHandle counterHandle,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-08-12 13:45:28 -07:00
|
|
|
HAL_Bool HAL_GetCounterDirection(HAL_CounterHandle counterHandle,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterReverseDirection(HAL_CounterHandle counterHandle,
|
2017-08-18 21:35:53 -07:00
|
|
|
HAL_Bool reverseDirection,
|
|
|
|
|
int32_t* status) {}
|
2017-10-16 19:56:08 -07:00
|
|
|
} // extern "C"
|