Files
allwpilib/hal/src/main/native/sim/Counter.cpp
2026-03-20 13:24:22 -06:00

52 lines
1.8 KiB
C++

// 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.
#include "wpi/hal/Counter.h"
#include "CounterInternal.hpp"
#include "HALInitializer.hpp"
#include "PortsInternal.hpp"
#include "wpi/hal/handles/HandlesInternal.hpp"
#include "wpi/hal/handles/LimitedHandleResource.hpp"
namespace wpi::hal {
LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters,
HAL_HandleEnum::COUNTER>* counterHandles;
} // namespace wpi::hal
namespace wpi::hal::init {
void InitializeCounter() {
static LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters,
HAL_HandleEnum::COUNTER>
cH;
counterHandles = &cH;
}
} // namespace wpi::hal::init
extern "C" {
HAL_CounterHandle HAL_InitializeCounter(int channel, HAL_Bool risingEdge,
const char* allocationLocation,
int32_t* status) {
wpi::hal::init::CheckInit();
return 0;
}
void HAL_FreeCounter(HAL_CounterHandle counterHandle) {}
void HAL_SetCounterEdgeConfiguration(HAL_CounterHandle counterHandle,
HAL_Bool risingEdge, 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;
}
void HAL_SetCounterMaxPeriod(HAL_CounterHandle counterHandle, double maxPeriod,
int32_t* status) {}
HAL_Bool HAL_GetCounterStopped(HAL_CounterHandle counterHandle,
int32_t* status) {
return false;
}
} // extern "C"