Files
allwpilib/hal/src/main/native/sim/Counter.cpp

52 lines
1.8 KiB
C++
Raw Normal View History

// 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.
2025-11-07 19:56:21 -05:00
#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"
2025-11-07 20:00:05 -05:00
namespace wpi::hal {
2016-07-01 00:29:08 -07:00
LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters,
HAL_HandleEnum::Counter>* counterHandles;
2025-11-07 20:00:05 -05:00
} // namespace wpi::hal
2025-11-07 20:00:05 -05:00
namespace wpi::hal::init {
void InitializeCounter() {
static LimitedHandleResource<HAL_CounterHandle, Counter, kNumCounters,
HAL_HandleEnum::Counter>
cH;
counterHandles = &cH;
}
2025-11-07 20:00:05 -05:00
} // namespace wpi::hal::init
extern "C" {
HAL_CounterHandle HAL_InitializeCounter(int channel, HAL_Bool risingEdge,
const char* allocationLocation,
int32_t* status) {
2025-11-07 20:00:05 -05:00
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"