mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[hal, wpilib] Remove analog output (#7696)
This commit is contained in:
@@ -1,44 +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 "AnalogOutDataInternal.h"
|
||||
|
||||
using namespace hal;
|
||||
|
||||
namespace hal::init {
|
||||
void InitializeAnalogOutData() {
|
||||
static AnalogOutData siod[kNumAnalogOutputs];
|
||||
::hal::SimAnalogOutData = siod;
|
||||
}
|
||||
} // namespace hal::init
|
||||
|
||||
AnalogOutData* hal::SimAnalogOutData;
|
||||
void AnalogOutData::ResetData() {
|
||||
voltage.Reset(0.0);
|
||||
initialized.Reset(0);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetAnalogOutData(int32_t index) {
|
||||
SimAnalogOutData[index].ResetData();
|
||||
}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, LOWERNAME) \
|
||||
HAL_SIMDATAVALUE_DEFINE_CAPI(TYPE, HALSIM, AnalogOut##CAPINAME, \
|
||||
SimAnalogOutData, LOWERNAME)
|
||||
|
||||
DEFINE_CAPI(double, Voltage, voltage)
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, initialized)
|
||||
|
||||
#define REGISTER(NAME) \
|
||||
SimAnalogOutData[index].NAME.RegisterCallback(callback, param, initialNotify)
|
||||
|
||||
void HALSIM_RegisterAnalogOutAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify) {
|
||||
REGISTER(voltage);
|
||||
REGISTER(initialized);
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -1,22 +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/AnalogOutData.h"
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
namespace hal {
|
||||
class AnalogOutData {
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(Voltage)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(Initialized)
|
||||
|
||||
public:
|
||||
SimDataValue<double, HAL_MakeDouble, GetVoltageName> voltage{0.0};
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{0};
|
||||
|
||||
virtual void ResetData();
|
||||
};
|
||||
extern AnalogOutData* SimAnalogOutData;
|
||||
} // namespace hal
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <hal/simulation/AddressableLEDData.h>
|
||||
#include <hal/simulation/AnalogGyroData.h>
|
||||
#include <hal/simulation/AnalogInData.h>
|
||||
#include <hal/simulation/AnalogOutData.h>
|
||||
#include <hal/simulation/AnalogTriggerData.h>
|
||||
#include <hal/simulation/CTREPCMData.h>
|
||||
#include <hal/simulation/CanData.h>
|
||||
@@ -43,10 +42,6 @@ extern "C" void HALSIM_ResetAllSimData(void) {
|
||||
HALSIM_ResetAnalogInData(i);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < hal::kNumAnalogOutputs; i++) {
|
||||
HALSIM_ResetAnalogOutData(i);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < hal::kNumAnalogTriggers; i++) {
|
||||
HALSIM_ResetAnalogTriggerData(i);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user