mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[hal, wpilib] Remove relay (#7695)
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
// 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 "../PortsInternal.h"
|
||||
#include "RelayDataInternal.h"
|
||||
|
||||
using namespace hal;
|
||||
|
||||
namespace hal::init {
|
||||
void InitializeRelayData() {
|
||||
static RelayData srd[kNumRelayHeaders];
|
||||
::hal::SimRelayData = srd;
|
||||
}
|
||||
} // namespace hal::init
|
||||
|
||||
RelayData* hal::SimRelayData;
|
||||
void RelayData::ResetData() {
|
||||
initializedForward.Reset(false);
|
||||
initializedReverse.Reset(false);
|
||||
forward.Reset(false);
|
||||
reverse.Reset(false);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetRelayData(int32_t index) {
|
||||
SimRelayData[index].ResetData();
|
||||
}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, LOWERNAME) \
|
||||
HAL_SIMDATAVALUE_DEFINE_CAPI(TYPE, HALSIM, Relay##CAPINAME, SimRelayData, \
|
||||
LOWERNAME)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, InitializedForward, initializedForward)
|
||||
DEFINE_CAPI(HAL_Bool, InitializedReverse, initializedReverse)
|
||||
DEFINE_CAPI(HAL_Bool, Forward, forward)
|
||||
DEFINE_CAPI(HAL_Bool, Reverse, reverse)
|
||||
|
||||
#define REGISTER(NAME) \
|
||||
SimRelayData[index].NAME.RegisterCallback(callback, param, initialNotify)
|
||||
|
||||
void HALSIM_RegisterRelayAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback, void* param,
|
||||
HAL_Bool initialNotify) {
|
||||
REGISTER(initializedForward);
|
||||
REGISTER(initializedReverse);
|
||||
REGISTER(forward);
|
||||
REGISTER(reverse);
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -1,28 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "hal/simulation/RelayData.h"
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
namespace hal {
|
||||
class RelayData {
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(InitializedForward)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(InitializedReverse)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(Forward)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(Reverse)
|
||||
|
||||
public:
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedForwardName>
|
||||
initializedForward{false};
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedReverseName>
|
||||
initializedReverse{false};
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetForwardName> forward{false};
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetReverseName> reverse{false};
|
||||
|
||||
virtual void ResetData();
|
||||
};
|
||||
extern RelayData* SimRelayData;
|
||||
} // namespace hal
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <hal/simulation/PWMData.h>
|
||||
#include <hal/simulation/PowerDistributionData.h>
|
||||
#include <hal/simulation/REVPHData.h>
|
||||
#include <hal/simulation/RelayData.h>
|
||||
#include <hal/simulation/RoboRioData.h>
|
||||
#include <hal/simulation/SPIAccelerometerData.h>
|
||||
#include <hal/simulation/SPIData.h>
|
||||
@@ -88,10 +87,6 @@ extern "C" void HALSIM_ResetAllSimData(void) {
|
||||
HALSIM_ResetPWMData(i);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < hal::kNumRelayHeaders; i++) {
|
||||
HALSIM_ResetRelayData(i);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < hal::kNumREVPHModules; i++) {
|
||||
HALSIM_ResetREVPHData(i);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user