Move mockdata/HAL_Value.h to hal/Value.h

Also prefix the MakeBoolean et al functions with HAL_ to avoid namespace
pollution.
This commit is contained in:
Peter Johnson
2019-09-23 23:28:49 -07:00
parent 1b266717a8
commit e8d6f8a2c1
37 changed files with 185 additions and 179 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -19,16 +19,16 @@ class AccelerometerData {
HAL_SIMDATAVALUE_DEFINE_NAME(Z)
static inline HAL_Value MakeRangeValue(HAL_AccelerometerRange value) {
return MakeEnum(value);
return HAL_MakeEnum(value);
}
public:
SimDataValue<HAL_Bool, MakeBoolean, GetActiveName> active{false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetActiveName> active{false};
SimDataValue<HAL_AccelerometerRange, MakeRangeValue, GetRangeName> range{
static_cast<HAL_AccelerometerRange>(0)};
SimDataValue<double, MakeDouble, GetXName> x{0.0};
SimDataValue<double, MakeDouble, GetYName> y{0.0};
SimDataValue<double, MakeDouble, GetZName> z{0.0};
SimDataValue<double, HAL_MakeDouble, GetXName> x{0.0};
SimDataValue<double, HAL_MakeDouble, GetYName> y{0.0};
SimDataValue<double, HAL_MakeDouble, GetZName> z{0.0};
virtual void ResetData();
};

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -17,9 +17,10 @@ class AnalogGyroData {
HAL_SIMDATAVALUE_DEFINE_NAME(Initialized)
public:
SimDataValue<double, MakeDouble, GetAngleName> angle{0.0};
SimDataValue<double, MakeDouble, GetRateName> rate{0.0};
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedName> initialized{false};
SimDataValue<double, HAL_MakeDouble, GetAngleName> angle{0.0};
SimDataValue<double, HAL_MakeDouble, GetRateName> rate{0.0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
false};
virtual void ResetData();
};

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -23,16 +23,20 @@ class AnalogInData {
HAL_SIMDATAVALUE_DEFINE_NAME(AccumulatorDeadband)
public:
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedName> initialized{false};
SimDataValue<int32_t, MakeInt, GetAverageBitsName> averageBits{7};
SimDataValue<int32_t, MakeInt, GetOversampleBitsName> oversampleBits{0};
SimDataValue<double, MakeDouble, GetVoltageName> voltage{0.0};
SimDataValue<HAL_Bool, MakeBoolean, GetAccumulatorInitializedName>
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
false};
SimDataValue<int32_t, HAL_MakeInt, GetAverageBitsName> averageBits{7};
SimDataValue<int32_t, HAL_MakeInt, GetOversampleBitsName> oversampleBits{0};
SimDataValue<double, HAL_MakeDouble, GetVoltageName> voltage{0.0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetAccumulatorInitializedName>
accumulatorInitialized{false};
SimDataValue<int64_t, MakeLong, GetAccumulatorValueName> accumulatorValue{0};
SimDataValue<int64_t, MakeLong, GetAccumulatorCountName> accumulatorCount{0};
SimDataValue<int32_t, MakeInt, GetAccumulatorCenterName> accumulatorCenter{0};
SimDataValue<int32_t, MakeInt, GetAccumulatorDeadbandName>
SimDataValue<int64_t, HAL_MakeLong, GetAccumulatorValueName> accumulatorValue{
0};
SimDataValue<int64_t, HAL_MakeLong, GetAccumulatorCountName> accumulatorCount{
0};
SimDataValue<int32_t, HAL_MakeInt, GetAccumulatorCenterName>
accumulatorCenter{0};
SimDataValue<int32_t, HAL_MakeInt, GetAccumulatorDeadbandName>
accumulatorDeadband{0};
virtual void ResetData();

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -16,8 +16,8 @@ class AnalogOutData {
HAL_SIMDATAVALUE_DEFINE_NAME(Initialized)
public:
SimDataValue<double, MakeDouble, GetVoltageName> voltage{0.0};
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedName> initialized{0};
SimDataValue<double, HAL_MakeDouble, GetVoltageName> voltage{0.0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{0};
virtual void ResetData();
};

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -19,15 +19,15 @@ class AnalogTriggerData {
static LLVM_ATTRIBUTE_ALWAYS_INLINE HAL_Value
MakeTriggerModeValue(HALSIM_AnalogTriggerMode value) {
return MakeEnum(value);
return HAL_MakeEnum(value);
}
public:
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedName> initialized{0};
SimDataValue<double, MakeDouble, GetTriggerLowerBoundName> triggerLowerBound{
0};
SimDataValue<double, MakeDouble, GetTriggerUpperBoundName> triggerUpperBound{
0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{0};
SimDataValue<double, HAL_MakeDouble, GetTriggerLowerBoundName>
triggerLowerBound{0};
SimDataValue<double, HAL_MakeDouble, GetTriggerUpperBoundName>
triggerUpperBound{0};
SimDataValue<HALSIM_AnalogTriggerMode, MakeTriggerModeValue,
GetTriggerModeName>
triggerMode{static_cast<HALSIM_AnalogTriggerMode>(0)};

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -19,11 +19,12 @@ class DIOData {
HAL_SIMDATAVALUE_DEFINE_NAME(FilterIndex)
public:
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedName> initialized{false};
SimDataValue<HAL_Bool, MakeBoolean, GetValueName> value{true};
SimDataValue<double, MakeDouble, GetPulseLengthName> pulseLength{0.0};
SimDataValue<HAL_Bool, MakeBoolean, GetIsInputName> isInput{true};
SimDataValue<int32_t, MakeInt, GetFilterIndexName> filterIndex{-1};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetValueName> value{true};
SimDataValue<double, HAL_MakeDouble, GetPulseLengthName> pulseLength{0.0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetIsInputName> isInput{true};
SimDataValue<int32_t, HAL_MakeInt, GetFilterIndexName> filterIndex{-1};
virtual void ResetData();
};

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -17,9 +17,10 @@ class DigitalPWMData {
HAL_SIMDATAVALUE_DEFINE_NAME(Pin)
public:
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedName> initialized{false};
SimDataValue<double, MakeDouble, GetDutyCycleName> dutyCycle{0.0};
SimDataValue<int32_t, MakeInt, GetPinName> pin{0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
false};
SimDataValue<double, HAL_MakeDouble, GetDutyCycleName> dutyCycle{0.0};
SimDataValue<int32_t, HAL_MakeInt, GetPinName> pin{0};
virtual void ResetData();
};

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -29,7 +29,7 @@ class DriverStationData {
static LLVM_ATTRIBUTE_ALWAYS_INLINE HAL_Value
MakeAllianceStationIdValue(HAL_AllianceStationID value) {
return MakeEnum(value);
return HAL_MakeEnum(value);
}
public:
@@ -58,16 +58,17 @@ class DriverStationData {
void NotifyNewData();
SimDataValue<HAL_Bool, MakeBoolean, GetEnabledName> enabled{false};
SimDataValue<HAL_Bool, MakeBoolean, GetAutonomousName> autonomous{false};
SimDataValue<HAL_Bool, MakeBoolean, GetTestName> test{false};
SimDataValue<HAL_Bool, MakeBoolean, GetEStopName> eStop{false};
SimDataValue<HAL_Bool, MakeBoolean, GetFmsAttachedName> fmsAttached{false};
SimDataValue<HAL_Bool, MakeBoolean, GetDsAttachedName> dsAttached{true};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetEnabledName> enabled{false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetAutonomousName> autonomous{false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetTestName> test{false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetEStopName> eStop{false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetFmsAttachedName> fmsAttached{
false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetDsAttachedName> dsAttached{true};
SimDataValue<HAL_AllianceStationID, MakeAllianceStationIdValue,
GetAllianceStationIdName>
allianceStationId{static_cast<HAL_AllianceStationID>(0)};
SimDataValue<double, MakeDouble, GetMatchTimeName> matchTime{0.0};
SimDataValue<double, HAL_MakeDouble, GetMatchTimeName> matchTime{0.0};
private:
wpi::spinlock m_joystickDataMutex;

View File

@@ -27,17 +27,20 @@ class EncoderData {
public:
std::atomic<int16_t> digitalChannelA{0};
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedName> initialized{false};
SimDataValue<int32_t, MakeInt, GetCountName> count{0};
SimDataValue<double, MakeDouble, GetPeriodName> period{
(std::numeric_limits<double>::max)()};
SimDataValue<HAL_Bool, MakeBoolean, GetResetName> reset{false};
SimDataValue<double, MakeDouble, GetMaxPeriodName> maxPeriod{0};
SimDataValue<HAL_Bool, MakeBoolean, GetDirectionName> direction{false};
SimDataValue<HAL_Bool, MakeBoolean, GetReverseDirectionName> reverseDirection{
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
false};
SimDataValue<int32_t, MakeInt, GetSamplesToAverageName> samplesToAverage{0};
SimDataValue<double, MakeDouble, GetDistancePerPulseName> distancePerPulse{1};
SimDataValue<int32_t, HAL_MakeInt, GetCountName> count{0};
SimDataValue<double, HAL_MakeDouble, GetPeriodName> period{
(std::numeric_limits<double>::max)()};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetResetName> reset{false};
SimDataValue<double, HAL_MakeDouble, GetMaxPeriodName> maxPeriod{0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetDirectionName> direction{false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetReverseDirectionName>
reverseDirection{false};
SimDataValue<int32_t, HAL_MakeInt, GetSamplesToAverageName> samplesToAverage{
0};
SimDataValue<double, HAL_MakeDouble, GetDistancePerPulseName>
distancePerPulse{1};
virtual void ResetData();
};

View File

@@ -1,27 +0,0 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 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. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <memory>
#include <string>
#include "mockdata/HALValue.h"
#include "mockdata/wpi/StringRef.h"
namespace hal {
class Value;
void ConvertToC(const Value& in, HAL_Value* out);
std::shared_ptr<Value> ConvertFromC(const HAL_Value& value);
void ConvertToC(wpi::StringRef in, HALString* out);
inline wpi::StringRef ConvertFromC(const HALString& str) {
return wpi::StringRef(str.str, str.len);
}
} // namespace hal

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -22,7 +22,8 @@ class I2CData {
int32_t sendSize);
void Read(int32_t deviceAddress, uint8_t* buffer, int32_t count);
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedName> initialized{false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
false};
SimCallbackRegistry<HAL_BufferCallback, GetReadName> read;
SimCallbackRegistry<HAL_ConstBufferCallback, GetWriteName> write;

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -31,21 +31,22 @@ class PCMData {
}
public:
SimDataValue<HAL_Bool, MakeBoolean, GetSolenoidInitializedName,
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetSolenoidInitializedName,
GetSolenoidInitializedDefault>
solenoidInitialized[kNumSolenoidChannels];
SimDataValue<HAL_Bool, MakeBoolean, GetSolenoidOutputName,
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetSolenoidOutputName,
GetSolenoidOutputDefault>
solenoidOutput[kNumSolenoidChannels];
SimDataValue<HAL_Bool, MakeBoolean, GetCompressorInitializedName>
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetCompressorInitializedName>
compressorInitialized{false};
SimDataValue<HAL_Bool, MakeBoolean, GetCompressorOnName> compressorOn{false};
SimDataValue<HAL_Bool, MakeBoolean, GetClosedLoopEnabledName>
closedLoopEnabled{true};
SimDataValue<HAL_Bool, MakeBoolean, GetPressureSwitchName> pressureSwitch{
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetCompressorOnName> compressorOn{
false};
SimDataValue<double, MakeDouble, GetCompressorCurrentName> compressorCurrent{
0.0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetClosedLoopEnabledName>
closedLoopEnabled{true};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetPressureSwitchName> pressureSwitch{
false};
SimDataValue<double, HAL_MakeDouble, GetCompressorCurrentName>
compressorCurrent{0.0};
virtual void ResetData();
};

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -23,10 +23,11 @@ class PDPData {
}
public:
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedName> initialized{false};
SimDataValue<double, MakeDouble, GetTemperatureName> temperature{0.0};
SimDataValue<double, MakeDouble, GetVoltageName> voltage{12.0};
SimDataValue<double, MakeDouble, GetCurrentName, GetCurrentDefault>
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
false};
SimDataValue<double, HAL_MakeDouble, GetTemperatureName> temperature{0.0};
SimDataValue<double, HAL_MakeDouble, GetVoltageName> voltage{12.0};
SimDataValue<double, HAL_MakeDouble, GetCurrentName, GetCurrentDefault>
current[kNumPDPChannels];
virtual void ResetData();

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -20,12 +20,13 @@ class PWMData {
HAL_SIMDATAVALUE_DEFINE_NAME(ZeroLatch)
public:
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedName> initialized{false};
SimDataValue<int32_t, MakeInt, GetRawValueName> rawValue{0};
SimDataValue<double, MakeDouble, GetSpeedName> speed{0};
SimDataValue<double, MakeDouble, GetPositionName> position{0};
SimDataValue<int32_t, MakeInt, GetPeriodScaleName> periodScale{0};
SimDataValue<HAL_Bool, MakeBoolean, GetZeroLatchName> zeroLatch{false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
false};
SimDataValue<int32_t, HAL_MakeInt, GetRawValueName> rawValue{0};
SimDataValue<double, HAL_MakeDouble, GetSpeedName> speed{0};
SimDataValue<double, HAL_MakeDouble, GetPositionName> position{0};
SimDataValue<int32_t, HAL_MakeInt, GetPeriodScaleName> periodScale{0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetZeroLatchName> zeroLatch{false};
virtual void ResetData();
};

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -18,12 +18,12 @@ class RelayData {
HAL_SIMDATAVALUE_DEFINE_NAME(Reverse)
public:
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedForwardName>
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedForwardName>
initializedForward{false};
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedReverseName>
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedReverseName>
initializedReverse{false};
SimDataValue<HAL_Bool, MakeBoolean, GetForwardName> forward{false};
SimDataValue<HAL_Bool, MakeBoolean, GetReverseName> reverse{false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetForwardName> forward{false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetReverseName> reverse{false};
virtual void ResetData();
};

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -29,22 +29,26 @@ class RoboRioData {
HAL_SIMDATAVALUE_DEFINE_NAME(UserFaults3V3)
public:
SimDataValue<HAL_Bool, MakeBoolean, GetFPGAButtonName> fpgaButton{false};
SimDataValue<double, MakeDouble, GetVInVoltageName> vInVoltage{0.0};
SimDataValue<double, MakeDouble, GetVInCurrentName> vInCurrent{0.0};
SimDataValue<double, MakeDouble, GetUserVoltage6VName> userVoltage6V{6.0};
SimDataValue<double, MakeDouble, GetUserCurrent6VName> userCurrent6V{0.0};
SimDataValue<HAL_Bool, MakeBoolean, GetUserActive6VName> userActive6V{false};
SimDataValue<double, MakeDouble, GetUserVoltage5VName> userVoltage5V{5.0};
SimDataValue<double, MakeDouble, GetUserCurrent5VName> userCurrent5V{0.0};
SimDataValue<HAL_Bool, MakeBoolean, GetUserActive5VName> userActive5V{false};
SimDataValue<double, MakeDouble, GetUserVoltage3V3Name> userVoltage3V3{3.3};
SimDataValue<double, MakeDouble, GetUserCurrent3V3Name> userCurrent3V3{0.0};
SimDataValue<HAL_Bool, MakeBoolean, GetUserActive3V3Name> userActive3V3{
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetFPGAButtonName> fpgaButton{false};
SimDataValue<double, HAL_MakeDouble, GetVInVoltageName> vInVoltage{0.0};
SimDataValue<double, HAL_MakeDouble, GetVInCurrentName> vInCurrent{0.0};
SimDataValue<double, HAL_MakeDouble, GetUserVoltage6VName> userVoltage6V{6.0};
SimDataValue<double, HAL_MakeDouble, GetUserCurrent6VName> userCurrent6V{0.0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetUserActive6VName> userActive6V{
false};
SimDataValue<int32_t, MakeInt, GetUserFaults6VName> userFaults6V{0};
SimDataValue<int32_t, MakeInt, GetUserFaults5VName> userFaults5V{0};
SimDataValue<int32_t, MakeInt, GetUserFaults3V3Name> userFaults3V3{0};
SimDataValue<double, HAL_MakeDouble, GetUserVoltage5VName> userVoltage5V{5.0};
SimDataValue<double, HAL_MakeDouble, GetUserCurrent5VName> userCurrent5V{0.0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetUserActive5VName> userActive5V{
false};
SimDataValue<double, HAL_MakeDouble, GetUserVoltage3V3Name> userVoltage3V3{
3.3};
SimDataValue<double, HAL_MakeDouble, GetUserCurrent3V3Name> userCurrent3V3{
0.0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetUserActive3V3Name> userActive3V3{
false};
SimDataValue<int32_t, HAL_MakeInt, GetUserFaults6VName> userFaults6V{0};
SimDataValue<int32_t, HAL_MakeInt, GetUserFaults5VName> userFaults5V{0};
SimDataValue<int32_t, HAL_MakeInt, GetUserFaults3V3Name> userFaults3V3{0};
virtual void ResetData();
};

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -19,11 +19,11 @@ class SPIAccelerometerData {
HAL_SIMDATAVALUE_DEFINE_NAME(Z)
public:
SimDataValue<HAL_Bool, MakeBoolean, GetActiveName> active{false};
SimDataValue<int32_t, MakeInt, GetRangeName> range{0};
SimDataValue<double, MakeDouble, GetXName> x{0.0};
SimDataValue<double, MakeDouble, GetYName> y{0.0};
SimDataValue<double, MakeDouble, GetZName> z{0.0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetActiveName> active{false};
SimDataValue<int32_t, HAL_MakeInt, GetRangeName> range{0};
SimDataValue<double, HAL_MakeDouble, GetXName> x{0.0};
SimDataValue<double, HAL_MakeDouble, GetYName> y{0.0};
SimDataValue<double, HAL_MakeDouble, GetZName> z{0.0};
virtual void ResetData();
};

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 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. */
@@ -27,7 +27,8 @@ class SPIData {
int32_t ReadAutoReceivedData(uint32_t* buffer, int32_t numToRead,
double timeout, int32_t* status);
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedName> initialized{false};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
false};
SimCallbackRegistry<HAL_BufferCallback, GetReadName> read;
SimCallbackRegistry<HAL_ConstBufferCallback, GetWriteName> write;
SimCallbackRegistry<HAL_SpiReadAutoReceiveBufferCallback, GetAutoReceiveName>