mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
[hal, wpilib] Remove analog output (#7696)
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <hal/Ports.h>
|
||||
#include <hal/simulation/AnalogInData.h>
|
||||
#include <hal/simulation/AnalogOutData.h>
|
||||
|
||||
#define REGISTER_AIN(halsim, jsonid, ctype, haltype) \
|
||||
HALSIM_RegisterAnalogIn##halsim##Callback( \
|
||||
@@ -26,15 +25,6 @@
|
||||
}, \
|
||||
this, true)
|
||||
|
||||
#define REGISTER_AOUT(halsim, jsonid, ctype, haltype) \
|
||||
HALSIM_RegisterAnalogOut##halsim##Callback( \
|
||||
m_channel, \
|
||||
[](const char* name, void* param, const struct HAL_Value* value) { \
|
||||
static_cast<HALSimWSProviderAnalogOut*>(param)->ProcessHalCallback( \
|
||||
{{jsonid, static_cast<ctype>(value->data.v_##haltype)}}); \
|
||||
}, \
|
||||
this, true)
|
||||
|
||||
namespace wpilibws {
|
||||
|
||||
void HALSimWSProviderAnalogIn::Initialize(WSRegisterFunc webRegisterFunc) {
|
||||
@@ -108,26 +98,4 @@ void HALSimWSProviderAnalogIn::OnNetValueChanged(const wpi::json& json) {
|
||||
}
|
||||
}
|
||||
|
||||
void HALSimWSProviderAnalogOut::Initialize(WSRegisterFunc webRegisterFunc) {
|
||||
CreateProviders<HALSimWSProviderAnalogOut>("AO", HAL_GetNumAnalogOutputs(),
|
||||
webRegisterFunc);
|
||||
}
|
||||
|
||||
HALSimWSProviderAnalogOut::~HALSimWSProviderAnalogOut() {
|
||||
CancelCallbacks();
|
||||
}
|
||||
|
||||
void HALSimWSProviderAnalogOut::RegisterCallbacks() {
|
||||
m_initCbKey = REGISTER_AOUT(Initialized, "<init", bool, boolean);
|
||||
m_voltageCbKey = REGISTER_AOUT(Voltage, "<voltage", double, double);
|
||||
}
|
||||
|
||||
void HALSimWSProviderAnalogOut::CancelCallbacks() {
|
||||
HALSIM_CancelAnalogOutInitializedCallback(m_channel, m_initCbKey);
|
||||
HALSIM_CancelAnalogOutVoltageCallback(m_channel, m_voltageCbKey);
|
||||
|
||||
m_initCbKey = 0;
|
||||
m_voltageCbKey = 0;
|
||||
}
|
||||
|
||||
} // namespace wpilibws
|
||||
|
||||
@@ -36,21 +36,4 @@ class HALSimWSProviderAnalogIn : public HALSimWSHalChanProvider {
|
||||
int32_t m_accumDeadbandCbKey = 0;
|
||||
};
|
||||
|
||||
class HALSimWSProviderAnalogOut : public HALSimWSHalChanProvider {
|
||||
public:
|
||||
static void Initialize(WSRegisterFunc webRegisterFunc);
|
||||
|
||||
using HALSimWSHalChanProvider::HALSimWSHalChanProvider;
|
||||
~HALSimWSProviderAnalogOut() override;
|
||||
|
||||
protected:
|
||||
void RegisterCallbacks() override;
|
||||
void CancelCallbacks() final;
|
||||
void DoCancelCallbacks();
|
||||
|
||||
private:
|
||||
int32_t m_initCbKey = 0;
|
||||
int32_t m_voltageCbKey = 0;
|
||||
};
|
||||
|
||||
} // namespace wpilibws
|
||||
|
||||
Reference in New Issue
Block a user