mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
[hal] Implement stub mockdata on RoboRIO (#2575)
This makes it much more user-friendly to use simulation classes without needing to ifdef for C++ to avoid linker errors or be very careful about construction to avoid runtime errors in Java.
This commit is contained in:
28
hal/src/main/native/athena/mockdata/AccelerometerData.cpp
Normal file
28
hal/src/main/native/athena/mockdata/AccelerometerData.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/AccelerometerData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetAccelerometerData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, Accelerometer##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Active, false)
|
||||
DEFINE_CAPI(HAL_AccelerometerRange, Range, HAL_AccelerometerRange_k2G)
|
||||
DEFINE_CAPI(double, X, 0)
|
||||
DEFINE_CAPI(double, Y, 0)
|
||||
DEFINE_CAPI(double, Z, 0)
|
||||
|
||||
void HALSIM_RegisterAccelerometerAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
45
hal/src/main/native/athena/mockdata/AddressableLEDData.cpp
Normal file
45
hal/src/main/native/athena/mockdata/AddressableLEDData.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/AddressableLEDData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
int32_t HALSIM_FindAddressableLEDForChannel(int32_t channel) { return 0; }
|
||||
|
||||
void HALSIM_ResetAddressableLEDData(int32_t index) {}
|
||||
|
||||
int32_t HALSIM_GetAddressableLEDData(int32_t index,
|
||||
struct HAL_AddressableLEDData* data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_SetAddressableLEDData(int32_t index,
|
||||
const struct HAL_AddressableLEDData* data,
|
||||
int32_t length) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, AddressableLED##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
DEFINE_CAPI(int32_t, OutputPort, 0)
|
||||
DEFINE_CAPI(int32_t, Length, 0)
|
||||
DEFINE_CAPI(HAL_Bool, Running, false)
|
||||
|
||||
#undef DEFINE_CAPI
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMCALLBACKREGISTRY_STUB_CAPI(TYPE, HALSIM, AddressableLED##CAPINAME)
|
||||
|
||||
DEFINE_CAPI(HAL_ConstBufferCallback, Data, data)
|
||||
|
||||
void HALSIM_RegisterAddressableLEDAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
26
hal/src/main/native/athena/mockdata/AnalogGyroData.cpp
Normal file
26
hal/src/main/native/athena/mockdata/AnalogGyroData.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/AnalogGyroData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetAnalogGyroData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, AnalogGyro##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(double, Angle, 0)
|
||||
DEFINE_CAPI(double, Rate, 0)
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
|
||||
void HALSIM_RegisterAnalogGyroAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
33
hal/src/main/native/athena/mockdata/AnalogInData.cpp
Normal file
33
hal/src/main/native/athena/mockdata/AnalogInData.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/AnalogInData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetAnalogInData(int32_t index) {}
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetAnalogInSimDevice(int32_t index) { return 0; }
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, AnalogIn##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
DEFINE_CAPI(int32_t, AverageBits, 0)
|
||||
DEFINE_CAPI(int32_t, OversampleBits, 0)
|
||||
DEFINE_CAPI(double, Voltage, 0)
|
||||
DEFINE_CAPI(HAL_Bool, AccumulatorInitialized, false)
|
||||
DEFINE_CAPI(int64_t, AccumulatorValue, 0)
|
||||
DEFINE_CAPI(int64_t, AccumulatorCount, 0)
|
||||
DEFINE_CAPI(int32_t, AccumulatorCenter, 0)
|
||||
DEFINE_CAPI(int32_t, AccumulatorDeadband, 0)
|
||||
|
||||
void HALSIM_RegisterAnalogInAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
25
hal/src/main/native/athena/mockdata/AnalogOutData.cpp
Normal file
25
hal/src/main/native/athena/mockdata/AnalogOutData.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/AnalogOutData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetAnalogOutData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, AnalogOut##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(double, Voltage, 0)
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
|
||||
void HALSIM_RegisterAnalogOutAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify) {
|
||||
}
|
||||
} // extern "C"
|
||||
31
hal/src/main/native/athena/mockdata/AnalogTriggerData.cpp
Normal file
31
hal/src/main/native/athena/mockdata/AnalogTriggerData.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/AnalogTriggerData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
int32_t HALSIM_FindAnalogTriggerForChannel(int32_t channel) { return 0; }
|
||||
|
||||
void HALSIM_ResetAnalogTriggerData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, AnalogTrigger##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
DEFINE_CAPI(double, TriggerLowerBound, 0)
|
||||
DEFINE_CAPI(double, TriggerUpperBound, 0)
|
||||
DEFINE_CAPI(HALSIM_AnalogTriggerMode, TriggerMode,
|
||||
HALSIM_AnalogTriggerUnassigned)
|
||||
|
||||
void HALSIM_RegisterAnalogTriggerAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
25
hal/src/main/native/athena/mockdata/CanDataInternal.cpp
Normal file
25
hal/src/main/native/athena/mockdata/CanDataInternal.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/CanData.h"
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
void HALSIM_ResetCanData(void) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME) \
|
||||
HAL_SIMCALLBACKREGISTRY_STUB_CAPI_NOINDEX(TYPE, HALSIM, Can##CAPINAME)
|
||||
|
||||
DEFINE_CAPI(HAL_CAN_SendMessageCallback, SendMessage)
|
||||
DEFINE_CAPI(HAL_CAN_ReceiveMessageCallback, ReceiveMessage)
|
||||
DEFINE_CAPI(HAL_CAN_OpenStreamSessionCallback, OpenStream)
|
||||
DEFINE_CAPI(HAL_CAN_CloseStreamSessionCallback, CloseStream)
|
||||
DEFINE_CAPI(HAL_CAN_ReadStreamSessionCallback, ReadStream)
|
||||
DEFINE_CAPI(HAL_CAN_GetCANStatusCallback, GetCANStatus)
|
||||
|
||||
} // extern "C"
|
||||
28
hal/src/main/native/athena/mockdata/DIOData.cpp
Normal file
28
hal/src/main/native/athena/mockdata/DIOData.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/DIOData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetDIOData(int32_t index) {}
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetDIOSimDevice(int32_t index) { return 0; }
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, DIO##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
DEFINE_CAPI(HAL_Bool, Value, false)
|
||||
DEFINE_CAPI(double, PulseLength, 0)
|
||||
DEFINE_CAPI(HAL_Bool, IsInput, false)
|
||||
DEFINE_CAPI(int32_t, FilterIndex, 0)
|
||||
|
||||
void HALSIM_RegisterDIOAllCallbacks(int32_t index, HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
28
hal/src/main/native/athena/mockdata/DigitalPWMData.cpp
Normal file
28
hal/src/main/native/athena/mockdata/DigitalPWMData.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/DigitalPWMData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
int32_t HALSIM_FindDigitalPWMForChannel(int32_t channel) { return 0; }
|
||||
|
||||
void HALSIM_ResetDigitalPWMData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, DigitalPWM##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
DEFINE_CAPI(double, DutyCycle, 0)
|
||||
DEFINE_CAPI(int32_t, Pin, 0)
|
||||
|
||||
void HALSIM_RegisterDigitalPWMAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
51
hal/src/main/native/athena/mockdata/DriverStationData.cpp
Normal file
51
hal/src/main/native/athena/mockdata/DriverStationData.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/DriverStationData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetDriverStationData(void) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI_NOINDEX(TYPE, HALSIM, DriverStation##CAPINAME, \
|
||||
RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Enabled, false)
|
||||
DEFINE_CAPI(HAL_Bool, Autonomous, false)
|
||||
DEFINE_CAPI(HAL_Bool, Test, false)
|
||||
DEFINE_CAPI(HAL_Bool, EStop, false)
|
||||
DEFINE_CAPI(HAL_Bool, FmsAttached, false)
|
||||
DEFINE_CAPI(HAL_Bool, DsAttached, false)
|
||||
DEFINE_CAPI(HAL_AllianceStationID, AllianceStationId,
|
||||
HAL_AllianceStationID_kRed1)
|
||||
DEFINE_CAPI(double, MatchTime, 0)
|
||||
|
||||
void HALSIM_SetJoystickAxes(int32_t joystickNum, const HAL_JoystickAxes* axes) {
|
||||
}
|
||||
|
||||
void HALSIM_SetJoystickPOVs(int32_t joystickNum, const HAL_JoystickPOVs* povs) {
|
||||
}
|
||||
|
||||
void HALSIM_SetJoystickButtons(int32_t joystickNum,
|
||||
const HAL_JoystickButtons* buttons) {}
|
||||
|
||||
void HALSIM_SetJoystickDescriptor(int32_t joystickNum,
|
||||
const HAL_JoystickDescriptor* descriptor) {}
|
||||
|
||||
void HALSIM_GetJoystickOutputs(int32_t joystickNum, int64_t* outputs,
|
||||
int32_t* leftRumble, int32_t* rightRumble) {}
|
||||
|
||||
void HALSIM_SetMatchInfo(const HAL_MatchInfo* info) {}
|
||||
|
||||
void HALSIM_NotifyDriverStationNewData(void) {}
|
||||
|
||||
void HALSIM_RegisterDriverStationAllCallbacks(HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
33
hal/src/main/native/athena/mockdata/DutyCycleData.cpp
Normal file
33
hal/src/main/native/athena/mockdata/DutyCycleData.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/DutyCycleData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
int32_t HALSIM_FindDutyCycleForChannel(int32_t channel) { return 0; }
|
||||
|
||||
void HALSIM_ResetDutyCycleData(int32_t index) {}
|
||||
|
||||
int32_t HALSIM_GetDutyCycleDigitalChannel(int32_t index) { return 0; }
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetDutyCycleSimDevice(int32_t index) { return 0; }
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, DutyCycle##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
DEFINE_CAPI(int32_t, Frequency, 0)
|
||||
DEFINE_CAPI(double, Output, 0)
|
||||
|
||||
void HALSIM_RegisterDutyCycleAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify) {
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
47
hal/src/main/native/athena/mockdata/EncoderData.cpp
Normal file
47
hal/src/main/native/athena/mockdata/EncoderData.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/EncoderData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
int32_t HALSIM_FindEncoderForChannel(int32_t channel) { return 0; }
|
||||
|
||||
void HALSIM_ResetEncoderData(int32_t index) {}
|
||||
|
||||
int32_t HALSIM_GetEncoderDigitalChannelA(int32_t index) { return 0; }
|
||||
|
||||
int32_t HALSIM_GetEncoderDigitalChannelB(int32_t index) { return 0; }
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetEncoderSimDevice(int32_t index) { return 0; }
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, Encoder##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
DEFINE_CAPI(int32_t, Count, 0)
|
||||
DEFINE_CAPI(double, Period, 0)
|
||||
DEFINE_CAPI(HAL_Bool, Reset, false)
|
||||
DEFINE_CAPI(double, MaxPeriod, 0)
|
||||
DEFINE_CAPI(HAL_Bool, Direction, false)
|
||||
DEFINE_CAPI(HAL_Bool, ReverseDirection, false)
|
||||
DEFINE_CAPI(int32_t, SamplesToAverage, 0)
|
||||
DEFINE_CAPI(double, DistancePerPulse, 0)
|
||||
|
||||
void HALSIM_SetEncoderDistance(int32_t index, double distance) {}
|
||||
|
||||
double HALSIM_GetEncoderDistance(int32_t index) { return 0; }
|
||||
|
||||
void HALSIM_SetEncoderRate(int32_t index, double rate) {}
|
||||
|
||||
double HALSIM_GetEncoderRate(int32_t index) { return 0; }
|
||||
|
||||
void HALSIM_RegisterEncoderAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
27
hal/src/main/native/athena/mockdata/I2CData.cpp
Normal file
27
hal/src/main/native/athena/mockdata/I2CData.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/I2CData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetI2CData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, I2C##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
|
||||
#undef DEFINE_CAPI
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME) \
|
||||
HAL_SIMCALLBACKREGISTRY_STUB_CAPI(TYPE, HALSIM, I2C##CAPINAME)
|
||||
|
||||
DEFINE_CAPI(HAL_BufferCallback, Read)
|
||||
DEFINE_CAPI(HAL_ConstBufferCallback, Write)
|
||||
|
||||
} // extern "C"
|
||||
34
hal/src/main/native/athena/mockdata/MockHooks.cpp
Normal file
34
hal/src/main/native/athena/mockdata/MockHooks.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/MockHooks.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
void HALSIM_SetRuntimeType(HAL_RuntimeType type) {}
|
||||
|
||||
void HALSIM_WaitForProgramStart(void) {}
|
||||
|
||||
void HALSIM_SetProgramStarted(void) {}
|
||||
|
||||
HAL_Bool HALSIM_GetProgramStarted(void) { return false; }
|
||||
|
||||
void HALSIM_RestartTiming(void) {}
|
||||
|
||||
void HALSIM_PauseTiming(void) {}
|
||||
|
||||
void HALSIM_ResumeTiming(void) {}
|
||||
|
||||
HAL_Bool HALSIM_IsTimingPaused(void) { return false; }
|
||||
|
||||
void HALSIM_StepTiming(uint64_t delta) {}
|
||||
|
||||
void HALSIM_SetSendError(HALSIM_SendErrorHandler handler) {}
|
||||
|
||||
void HALSIM_SetSendConsoleLine(HALSIM_SendConsoleLineHandler handler) {}
|
||||
|
||||
} // extern "C"
|
||||
20
hal/src/main/native/athena/mockdata/NotifierData.cpp
Normal file
20
hal/src/main/native/athena/mockdata/NotifierData.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2016-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/NotifierData.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
uint64_t HALSIM_GetNextNotifierTimeout(void) { return 0; }
|
||||
|
||||
int32_t HALSIM_GetNumNotifiers(void) { return 0; }
|
||||
|
||||
int32_t HALSIM_GetNotifierInfo(struct HALSIM_NotifierInfo* arr, int32_t size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
40
hal/src/main/native/athena/mockdata/PCMData.cpp
Normal file
40
hal/src/main/native/athena/mockdata/PCMData.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/PCMData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetPCMData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, PCM##CAPINAME, RETURN)
|
||||
|
||||
HAL_SIMDATAVALUE_STUB_CAPI_CHANNEL(HAL_Bool, HALSIM, PCMSolenoidInitialized,
|
||||
false)
|
||||
HAL_SIMDATAVALUE_STUB_CAPI_CHANNEL(HAL_Bool, HALSIM, PCMSolenoidOutput, false)
|
||||
DEFINE_CAPI(HAL_Bool, CompressorInitialized, false)
|
||||
DEFINE_CAPI(HAL_Bool, CompressorOn, false)
|
||||
DEFINE_CAPI(HAL_Bool, ClosedLoopEnabled, false)
|
||||
DEFINE_CAPI(HAL_Bool, PressureSwitch, false)
|
||||
DEFINE_CAPI(double, CompressorCurrent, 0)
|
||||
|
||||
void HALSIM_GetPCMAllSolenoids(int32_t index, uint8_t* values) { *values = 0; }
|
||||
|
||||
void HALSIM_SetPCMAllSolenoids(int32_t index, uint8_t values) {}
|
||||
|
||||
void HALSIM_RegisterPCMAllNonSolenoidCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
|
||||
void HALSIM_RegisterPCMAllSolenoidCallbacks(int32_t index, int32_t channel,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
34
hal/src/main/native/athena/mockdata/PDPData.cpp
Normal file
34
hal/src/main/native/athena/mockdata/PDPData.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/PDPData.h"
|
||||
|
||||
#include "../PortsInternal.h"
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetPDPData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, PDP##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
DEFINE_CAPI(double, Temperature, 0)
|
||||
DEFINE_CAPI(double, Voltage, 0)
|
||||
HAL_SIMDATAVALUE_STUB_CAPI_CHANNEL(double, HALSIM, PDPCurrent, 0)
|
||||
|
||||
void HALSIM_GetPDPAllCurrents(int32_t index, double* currents) {
|
||||
for (int i = 0; i < hal::kNumPDPChannels; i++) currents[i] = 0;
|
||||
}
|
||||
|
||||
void HALSIM_SetPDPAllCurrents(int32_t index, const double* currents) {}
|
||||
|
||||
void HALSIM_RegisterPDPAllNonCurrentCallbacks(int32_t index, int32_t channel,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
27
hal/src/main/native/athena/mockdata/PWMData.cpp
Normal file
27
hal/src/main/native/athena/mockdata/PWMData.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/PWMData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetPWMData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, PWM##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
DEFINE_CAPI(int32_t, RawValue, 0)
|
||||
DEFINE_CAPI(double, Speed, 0)
|
||||
DEFINE_CAPI(double, Position, 0)
|
||||
DEFINE_CAPI(int32_t, PeriodScale, 0)
|
||||
DEFINE_CAPI(HAL_Bool, ZeroLatch, false)
|
||||
|
||||
void HALSIM_RegisterPWMAllCallbacks(int32_t index, HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
26
hal/src/main/native/athena/mockdata/RelayData.cpp
Normal file
26
hal/src/main/native/athena/mockdata/RelayData.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/RelayData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetRelayData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, Relay##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, InitializedForward, false)
|
||||
DEFINE_CAPI(HAL_Bool, InitializedReverse, false)
|
||||
DEFINE_CAPI(HAL_Bool, Forward, false)
|
||||
DEFINE_CAPI(HAL_Bool, Reverse, false)
|
||||
|
||||
void HALSIM_RegisterRelayAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback, void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
36
hal/src/main/native/athena/mockdata/RoboRioData.cpp
Normal file
36
hal/src/main/native/athena/mockdata/RoboRioData.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/RoboRioData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetRoboRioData(void) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI_NOINDEX(TYPE, HALSIM, RoboRio##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, FPGAButton, false)
|
||||
DEFINE_CAPI(double, VInVoltage, 0)
|
||||
DEFINE_CAPI(double, VInCurrent, 0)
|
||||
DEFINE_CAPI(double, UserVoltage6V, 0)
|
||||
DEFINE_CAPI(double, UserCurrent6V, 0)
|
||||
DEFINE_CAPI(HAL_Bool, UserActive6V, false)
|
||||
DEFINE_CAPI(double, UserVoltage5V, 0)
|
||||
DEFINE_CAPI(double, UserCurrent5V, 0)
|
||||
DEFINE_CAPI(HAL_Bool, UserActive5V, false)
|
||||
DEFINE_CAPI(double, UserVoltage3V3, 0)
|
||||
DEFINE_CAPI(double, UserCurrent3V3, 0)
|
||||
DEFINE_CAPI(HAL_Bool, UserActive3V3, false)
|
||||
DEFINE_CAPI(int32_t, UserFaults6V, 0)
|
||||
DEFINE_CAPI(int32_t, UserFaults5V, 0)
|
||||
DEFINE_CAPI(int32_t, UserFaults3V3, 0)
|
||||
|
||||
void HALSIM_RegisterRoboRioAllCallbacks(HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
28
hal/src/main/native/athena/mockdata/SPIAccelerometerData.cpp
Normal file
28
hal/src/main/native/athena/mockdata/SPIAccelerometerData.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/SPIAccelerometerData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetSPIAccelerometerData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, SPIAccelerometer##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Active, false)
|
||||
DEFINE_CAPI(int32_t, Range, 0)
|
||||
DEFINE_CAPI(double, X, 0)
|
||||
DEFINE_CAPI(double, Y, 0)
|
||||
DEFINE_CAPI(double, Z, 0)
|
||||
|
||||
void HALSIM_RegisterSPIAccelerometerAllCallbcaks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
} // extern "C"
|
||||
28
hal/src/main/native/athena/mockdata/SPIData.cpp
Normal file
28
hal/src/main/native/athena/mockdata/SPIData.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/SPIData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
void HALSIM_ResetSPIData(int32_t index) {}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, SPI##CAPINAME, RETURN)
|
||||
|
||||
DEFINE_CAPI(HAL_Bool, Initialized, false)
|
||||
|
||||
#undef DEFINE_CAPI
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME) \
|
||||
HAL_SIMCALLBACKREGISTRY_STUB_CAPI(TYPE, HALSIM, SPI##CAPINAME)
|
||||
|
||||
DEFINE_CAPI(HAL_BufferCallback, Read)
|
||||
DEFINE_CAPI(HAL_ConstBufferCallback, Write)
|
||||
DEFINE_CAPI(HAL_SpiReadAutoReceiveBufferCallback, ReadAutoReceivedData)
|
||||
|
||||
} // extern "C"
|
||||
78
hal/src/main/native/athena/mockdata/SimDeviceData.cpp
Normal file
78
hal/src/main/native/athena/mockdata/SimDeviceData.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "hal/simulation/SimDeviceData.h"
|
||||
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
void HALSIM_SetSimDeviceEnabled(const char* prefix, HAL_Bool enabled) {}
|
||||
|
||||
HAL_Bool HALSIM_IsSimDeviceEnabled(const char* name) { return false; }
|
||||
|
||||
int32_t HALSIM_RegisterSimDeviceCreatedCallback(
|
||||
const char* prefix, void* param, HALSIM_SimDeviceCallback callback,
|
||||
HAL_Bool initialNotify) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_CancelSimDeviceCreatedCallback(int32_t uid) {}
|
||||
|
||||
int32_t HALSIM_RegisterSimDeviceFreedCallback(
|
||||
const char* prefix, void* param, HALSIM_SimDeviceCallback callback) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_CancelSimDeviceFreedCallback(int32_t uid) {}
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetSimDeviceHandle(const char* name) { return 0; }
|
||||
|
||||
const char* HALSIM_GetSimDeviceName(HAL_SimDeviceHandle handle) { return ""; }
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetSimValueDeviceHandle(HAL_SimValueHandle handle) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_EnumerateSimDevices(const char* prefix, void* param,
|
||||
HALSIM_SimDeviceCallback callback) {}
|
||||
|
||||
int32_t HALSIM_RegisterSimValueCreatedCallback(HAL_SimDeviceHandle device,
|
||||
void* param,
|
||||
HALSIM_SimValueCallback callback,
|
||||
HAL_Bool initialNotify) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_CancelSimValueCreatedCallback(int32_t uid) {}
|
||||
|
||||
int32_t HALSIM_RegisterSimValueChangedCallback(HAL_SimValueHandle handle,
|
||||
void* param,
|
||||
HALSIM_SimValueCallback callback,
|
||||
HAL_Bool initialNotify) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_CancelSimValueChangedCallback(int32_t uid) {}
|
||||
|
||||
HAL_SimValueHandle HALSIM_GetSimValueHandle(HAL_SimDeviceHandle device,
|
||||
const char* name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_EnumerateSimValues(HAL_SimDeviceHandle device, void* param,
|
||||
HALSIM_SimValueCallback callback) {}
|
||||
|
||||
const char** HALSIM_GetSimValueEnumOptions(HAL_SimValueHandle handle,
|
||||
int32_t* numOptions) {
|
||||
*numOptions = 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void HALSIM_ResetSimDeviceData(void) {}
|
||||
|
||||
} // extern "C"
|
||||
@@ -152,4 +152,42 @@ class SimCallbackRegistry : public impl::SimCallbackRegistryBase {
|
||||
DATA->LOWERNAME.Cancel(uid); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a stub standard C API for SimCallbackRegistry.
|
||||
*
|
||||
* Functions defined:
|
||||
* - int32 NS_RegisterCAPINAMECallback(
|
||||
* int32_t index, TYPE callback, void* param)
|
||||
* - void NS_CancelCAPINAMECallback(int32_t index, int32_t uid)
|
||||
*
|
||||
* @param TYPE the underlying callback type (e.g. HAL_BufferCallback)
|
||||
* @param NS the "namespace" (e.g. HALSIM)
|
||||
* @param CAPINAME the C API name (usually first letter capitalized)
|
||||
*/
|
||||
#define HAL_SIMCALLBACKREGISTRY_STUB_CAPI(TYPE, NS, CAPINAME) \
|
||||
int32_t NS##_Register##CAPINAME##Callback(int32_t index, TYPE callback, \
|
||||
void* param) { \
|
||||
return 0; \
|
||||
} \
|
||||
\
|
||||
void NS##_Cancel##CAPINAME##Callback(int32_t index, int32_t uid) {}
|
||||
|
||||
/**
|
||||
* Define a stub standard C API for SimCallbackRegistry (no index variant).
|
||||
*
|
||||
* Functions defined:
|
||||
* - int32 NS_RegisterCAPINAMECallback(TYPE callback, void* param)
|
||||
* - void NS_CancelCAPINAMECallback(int32_t uid)
|
||||
*
|
||||
* @param TYPE the underlying callback type (e.g. HAL_BufferCallback)
|
||||
* @param NS the "namespace" (e.g. HALSIM)
|
||||
* @param CAPINAME the C API name (usually first letter capitalized)
|
||||
*/
|
||||
#define HAL_SIMCALLBACKREGISTRY_STUB_CAPI_NOINDEX(TYPE, NS, CAPINAME) \
|
||||
int32_t NS##_Register##CAPINAME##Callback(TYPE callback, void* param) { \
|
||||
return 0; \
|
||||
} \
|
||||
\
|
||||
void NS##_Cancel##CAPINAME##Callback(int32_t uid) {}
|
||||
|
||||
} // namespace hal
|
||||
|
||||
@@ -224,4 +224,90 @@ class SimDataValue final : public impl::SimDataValueBase<T, MakeValue> {
|
||||
\
|
||||
void NS##_Set##CAPINAME(TYPE LOWERNAME) { DATA->LOWERNAME = LOWERNAME; }
|
||||
|
||||
/**
|
||||
* Define a stub standard C API for simulation data.
|
||||
*
|
||||
* Functions defined:
|
||||
* - int32 NS_RegisterCAPINAMECallback(
|
||||
* int32_t index, HAL_NotifyCallback callback, void* param,
|
||||
* HAL_Bool initialNotify)
|
||||
* - void NS_CancelCAPINAMECallback(int32_t index, int32_t uid)
|
||||
* - TYPE NS_GetCAPINAME(int32_t index)
|
||||
* - void NS_SetCAPINAME(int32_t index, TYPE value)
|
||||
*
|
||||
* @param TYPE the underlying value type (e.g. double)
|
||||
* @param NS the "namespace" (e.g. HALSIM)
|
||||
* @param CAPINAME the C API name (usually first letter capitalized)
|
||||
* @param RETURN what to return from the Get function
|
||||
*/
|
||||
#define HAL_SIMDATAVALUE_STUB_CAPI(TYPE, NS, CAPINAME, RETURN) \
|
||||
int32_t NS##_Register##CAPINAME##Callback( \
|
||||
int32_t index, HAL_NotifyCallback callback, void* param, \
|
||||
HAL_Bool initialNotify) { \
|
||||
return 0; \
|
||||
} \
|
||||
\
|
||||
void NS##_Cancel##CAPINAME##Callback(int32_t index, int32_t uid) {} \
|
||||
\
|
||||
TYPE NS##_Get##CAPINAME(int32_t index) { return RETURN; } \
|
||||
\
|
||||
void NS##_Set##CAPINAME(int32_t index, TYPE) {}
|
||||
|
||||
/**
|
||||
* Define a stub standard C API for simulation data (channel variant).
|
||||
*
|
||||
* Functions defined:
|
||||
* - int32 NS_RegisterCAPINAMECallback(
|
||||
* int32_t index, int32_t channel, HAL_NotifyCallback callback,
|
||||
* void* param, HAL_Bool initialNotify)
|
||||
* - void NS_CancelCAPINAMECallback(int32_t index, int32_t channel, int32_t uid)
|
||||
* - TYPE NS_GetCAPINAME(int32_t index, int32_t channel)
|
||||
* - void NS_SetCAPINAME(int32_t index, int32_t channel, TYPE value)
|
||||
*
|
||||
* @param TYPE the underlying value type (e.g. double)
|
||||
* @param NS the "namespace" (e.g. HALSIM)
|
||||
* @param CAPINAME the C API name (usually first letter capitalized)
|
||||
* @param RETURN what to return from the Get function
|
||||
*/
|
||||
#define HAL_SIMDATAVALUE_STUB_CAPI_CHANNEL(TYPE, NS, CAPINAME, RETURN) \
|
||||
int32_t NS##_Register##CAPINAME##Callback( \
|
||||
int32_t index, int32_t channel, HAL_NotifyCallback callback, \
|
||||
void* param, HAL_Bool initialNotify) { \
|
||||
return 0; \
|
||||
} \
|
||||
\
|
||||
void NS##_Cancel##CAPINAME##Callback(int32_t index, int32_t channel, \
|
||||
int32_t uid) {} \
|
||||
\
|
||||
TYPE NS##_Get##CAPINAME(int32_t index, int32_t channel) { return RETURN; } \
|
||||
\
|
||||
void NS##_Set##CAPINAME(int32_t index, int32_t channel, TYPE) {}
|
||||
|
||||
/**
|
||||
* Define a stub standard C API for simulation data (no index variant).
|
||||
*
|
||||
* Functions defined:
|
||||
* - int32 NS_RegisterCAPINAMECallback(
|
||||
* HAL_NotifyCallback callback, void* param, HAL_Bool initialNotify)
|
||||
* - void NS_CancelCAPINAMECallback(int32_t uid)
|
||||
* - TYPE NS_GetCAPINAME(void)
|
||||
* - void NS_SetCAPINAME(TYPE value)
|
||||
*
|
||||
* @param TYPE the underlying value type (e.g. double)
|
||||
* @param NS the "namespace" (e.g. HALSIM)
|
||||
* @param CAPINAME the C API name (usually first letter capitalized)
|
||||
* @param RETURN what to return from the Get function
|
||||
*/
|
||||
#define HAL_SIMDATAVALUE_STUB_CAPI_NOINDEX(TYPE, NS, CAPINAME, RETURN) \
|
||||
int32_t NS##_Register##CAPINAME##Callback( \
|
||||
HAL_NotifyCallback callback, void* param, HAL_Bool initialNotify) { \
|
||||
return 0; \
|
||||
} \
|
||||
\
|
||||
void NS##_Cancel##CAPINAME##Callback(int32_t uid) {} \
|
||||
\
|
||||
TYPE NS##_Get##CAPINAME(void) { return RETURN; } \
|
||||
\
|
||||
void NS##_Set##CAPINAME(TYPE) {}
|
||||
|
||||
} // namespace hal
|
||||
|
||||
Reference in New Issue
Block a user