2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2016-05-25 20:23:37 -07:00
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/hal/Counter.h"
|
2016-05-25 22:38:11 -07:00
|
|
|
|
2026-01-04 00:41:53 -08:00
|
|
|
#include "CounterInternal.hpp"
|
|
|
|
|
#include "HALInitializer.hpp"
|
|
|
|
|
#include "PortsInternal.hpp"
|
|
|
|
|
#include "wpi/hal/handles/HandlesInternal.hpp"
|
|
|
|
|
#include "wpi/hal/handles/LimitedHandleResource.hpp"
|
2016-05-24 00:58:10 -07:00
|
|
|
|
2025-11-07 20:00:05 -05:00
|
|
|
namespace wpi::hal {
|
2016-07-01 00:29:08 -07:00
|
|
|
|
2017-08-18 21:35:53 -07:00
|
|
|
LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters,
|
2026-03-16 21:49:21 -07:00
|
|
|
HAL_HandleEnum::COUNTER>* counterHandles;
|
2025-11-07 20:00:05 -05:00
|
|
|
} // namespace wpi::hal
|
2017-12-10 19:38:53 -08:00
|
|
|
|
2025-11-07 20:00:05 -05:00
|
|
|
namespace wpi::hal::init {
|
2017-12-10 19:38:53 -08:00
|
|
|
void InitializeCounter() {
|
|
|
|
|
static LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters,
|
2026-03-16 21:49:21 -07:00
|
|
|
HAL_HandleEnum::COUNTER>
|
2017-12-10 19:38:53 -08:00
|
|
|
cH;
|
|
|
|
|
counterHandles = &cH;
|
|
|
|
|
}
|
2025-11-07 20:00:05 -05:00
|
|
|
} // namespace wpi::hal::init
|
2016-05-24 00:58:10 -07:00
|
|
|
|
|
|
|
|
extern "C" {
|
2025-01-28 08:58:34 -08:00
|
|
|
HAL_CounterHandle HAL_InitializeCounter(int channel, HAL_Bool risingEdge,
|
|
|
|
|
const char* allocationLocation,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {
|
2025-11-07 20:00:05 -05:00
|
|
|
wpi::hal::init::CheckInit();
|
2017-08-18 21:35:53 -07:00
|
|
|
return 0;
|
|
|
|
|
}
|
2024-09-07 13:58:15 -04:00
|
|
|
void HAL_FreeCounter(HAL_CounterHandle counterHandle) {}
|
2025-01-28 08:58:34 -08:00
|
|
|
void HAL_SetCounterEdgeConfiguration(HAL_CounterHandle counterHandle,
|
|
|
|
|
HAL_Bool risingEdge, int32_t* status) {}
|
2017-08-18 21:35:53 -07:00
|
|
|
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
|
|
|
HAL_Bool HAL_GetCounterStopped(HAL_CounterHandle counterHandle,
|
2017-08-18 21:35:53 -07:00
|
|
|
int32_t* status) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2017-10-16 19:56:08 -07:00
|
|
|
} // extern "C"
|