mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Add braces to C++ single-line loops and conditionals (NFC) (#2973)
This makes code easier to read and more consistent between C++ and Java. Also update clang-format settings to always add a line break (even if no braces are used).
This commit is contained in:
@@ -20,8 +20,9 @@ AddressableLEDSim::AddressableLEDSim(const AddressableLED& addressableLED)
|
||||
|
||||
AddressableLEDSim AddressableLEDSim::CreateForChannel(int pwmChannel) {
|
||||
int index = HALSIM_FindAddressableLEDForChannel(pwmChannel);
|
||||
if (index < 0)
|
||||
if (index < 0) {
|
||||
throw std::out_of_range("no addressable LED found for PWM channel");
|
||||
}
|
||||
return AddressableLEDSim{index};
|
||||
}
|
||||
|
||||
|
||||
@@ -71,4 +71,6 @@ void AnalogGyroSim::SetInitialized(bool initialized) {
|
||||
HALSIM_SetAnalogGyroInitialized(m_index, initialized);
|
||||
}
|
||||
|
||||
void AnalogGyroSim::ResetData() { HALSIM_ResetAnalogGyroData(m_index); }
|
||||
void AnalogGyroSim::ResetData() {
|
||||
HALSIM_ResetAnalogGyroData(m_index);
|
||||
}
|
||||
|
||||
@@ -176,4 +176,6 @@ void AnalogInputSim::SetAccumulatorDeadband(int accumulatorDeadband) {
|
||||
HALSIM_SetAnalogInAccumulatorDeadband(m_index, accumulatorDeadband);
|
||||
}
|
||||
|
||||
void AnalogInputSim::ResetData() { HALSIM_ResetAnalogInData(m_index); }
|
||||
void AnalogInputSim::ResetData() {
|
||||
HALSIM_ResetAnalogInData(m_index);
|
||||
}
|
||||
|
||||
@@ -53,4 +53,6 @@ void AnalogOutputSim::SetInitialized(bool initialized) {
|
||||
HALSIM_SetAnalogOutInitialized(m_index, initialized);
|
||||
}
|
||||
|
||||
void AnalogOutputSim::ResetData() { HALSIM_ResetAnalogOutData(m_index); }
|
||||
void AnalogOutputSim::ResetData() {
|
||||
HALSIM_ResetAnalogOutData(m_index);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ AnalogTriggerSim::AnalogTriggerSim(const AnalogTrigger& analogTrigger)
|
||||
|
||||
AnalogTriggerSim AnalogTriggerSim::CreateForChannel(int channel) {
|
||||
int index = HALSIM_FindAnalogTriggerForChannel(channel);
|
||||
if (index < 0) throw std::out_of_range("no analog trigger found for channel");
|
||||
if (index < 0) {
|
||||
throw std::out_of_range("no analog trigger found for channel");
|
||||
}
|
||||
return AnalogTriggerSim{index};
|
||||
}
|
||||
|
||||
@@ -83,4 +85,6 @@ void AnalogTriggerSim::SetTriggerUpperBound(double triggerUpperBound) {
|
||||
HALSIM_SetAnalogTriggerTriggerUpperBound(m_index, triggerUpperBound);
|
||||
}
|
||||
|
||||
void AnalogTriggerSim::ResetData() { HALSIM_ResetAnalogTriggerData(m_index); }
|
||||
void AnalogTriggerSim::ResetData() {
|
||||
HALSIM_ResetAnalogTriggerData(m_index);
|
||||
}
|
||||
|
||||
@@ -74,4 +74,6 @@ CallbackStore::~CallbackStore() {
|
||||
}
|
||||
}
|
||||
|
||||
void CallbackStore::SetUid(int32_t uid) { this->uid = uid; }
|
||||
void CallbackStore::SetUid(int32_t uid) {
|
||||
this->uid = uid;
|
||||
}
|
||||
|
||||
@@ -47,9 +47,13 @@ std::unique_ptr<CallbackStore> DIOSim::RegisterValueCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool DIOSim::GetValue() const { return HALSIM_GetDIOValue(m_index); }
|
||||
bool DIOSim::GetValue() const {
|
||||
return HALSIM_GetDIOValue(m_index);
|
||||
}
|
||||
|
||||
void DIOSim::SetValue(bool value) { HALSIM_SetDIOValue(m_index, value); }
|
||||
void DIOSim::SetValue(bool value) {
|
||||
HALSIM_SetDIOValue(m_index, value);
|
||||
}
|
||||
|
||||
std::unique_ptr<CallbackStore> DIOSim::RegisterPulseLengthCallback(
|
||||
NotifyCallback callback, bool initialNotify) {
|
||||
@@ -77,7 +81,9 @@ std::unique_ptr<CallbackStore> DIOSim::RegisterIsInputCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool DIOSim::GetIsInput() const { return HALSIM_GetDIOIsInput(m_index); }
|
||||
bool DIOSim::GetIsInput() const {
|
||||
return HALSIM_GetDIOIsInput(m_index);
|
||||
}
|
||||
|
||||
void DIOSim::SetIsInput(bool isInput) {
|
||||
HALSIM_SetDIOIsInput(m_index, isInput);
|
||||
@@ -92,10 +98,14 @@ std::unique_ptr<CallbackStore> DIOSim::RegisterFilterIndexCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
int DIOSim::GetFilterIndex() const { return HALSIM_GetDIOFilterIndex(m_index); }
|
||||
int DIOSim::GetFilterIndex() const {
|
||||
return HALSIM_GetDIOFilterIndex(m_index);
|
||||
}
|
||||
|
||||
void DIOSim::SetFilterIndex(int filterIndex) {
|
||||
HALSIM_SetDIOFilterIndex(m_index, filterIndex);
|
||||
}
|
||||
|
||||
void DIOSim::ResetData() { HALSIM_ResetDIOData(m_index); }
|
||||
void DIOSim::ResetData() {
|
||||
HALSIM_ResetDIOData(m_index);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ DigitalPWMSim::DigitalPWMSim(const DigitalOutput& digitalOutput)
|
||||
|
||||
DigitalPWMSim DigitalPWMSim::CreateForChannel(int channel) {
|
||||
int index = HALSIM_FindDigitalPWMForChannel(channel);
|
||||
if (index < 0) throw std::out_of_range("no digital PWM found for channel");
|
||||
if (index < 0) {
|
||||
throw std::out_of_range("no digital PWM found for channel");
|
||||
}
|
||||
return DigitalPWMSim{index};
|
||||
}
|
||||
|
||||
@@ -71,8 +73,14 @@ std::unique_ptr<CallbackStore> DigitalPWMSim::RegisterPinCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
int DigitalPWMSim::GetPin() const { return HALSIM_GetDigitalPWMPin(m_index); }
|
||||
int DigitalPWMSim::GetPin() const {
|
||||
return HALSIM_GetDigitalPWMPin(m_index);
|
||||
}
|
||||
|
||||
void DigitalPWMSim::SetPin(int pin) { HALSIM_SetDigitalPWMPin(m_index, pin); }
|
||||
void DigitalPWMSim::SetPin(int pin) {
|
||||
HALSIM_SetDigitalPWMPin(m_index, pin);
|
||||
}
|
||||
|
||||
void DigitalPWMSim::ResetData() { HALSIM_ResetDigitalPWMData(m_index); }
|
||||
void DigitalPWMSim::ResetData() {
|
||||
HALSIM_ResetDigitalPWMData(m_index);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@ std::unique_ptr<CallbackStore> DriverStationSim::RegisterEnabledCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool DriverStationSim::GetEnabled() { return HALSIM_GetDriverStationEnabled(); }
|
||||
bool DriverStationSim::GetEnabled() {
|
||||
return HALSIM_GetDriverStationEnabled();
|
||||
}
|
||||
|
||||
void DriverStationSim::SetEnabled(bool enabled) {
|
||||
HALSIM_SetDriverStationEnabled(enabled);
|
||||
@@ -56,9 +58,13 @@ std::unique_ptr<CallbackStore> DriverStationSim::RegisterTestCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool DriverStationSim::GetTest() { return HALSIM_GetDriverStationTest(); }
|
||||
bool DriverStationSim::GetTest() {
|
||||
return HALSIM_GetDriverStationTest();
|
||||
}
|
||||
|
||||
void DriverStationSim::SetTest(bool test) { HALSIM_SetDriverStationTest(test); }
|
||||
void DriverStationSim::SetTest(bool test) {
|
||||
HALSIM_SetDriverStationTest(test);
|
||||
}
|
||||
|
||||
std::unique_ptr<CallbackStore> DriverStationSim::RegisterEStopCallback(
|
||||
NotifyCallback callback, bool initialNotify) {
|
||||
@@ -69,7 +75,9 @@ std::unique_ptr<CallbackStore> DriverStationSim::RegisterEStopCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool DriverStationSim::GetEStop() { return HALSIM_GetDriverStationEStop(); }
|
||||
bool DriverStationSim::GetEStop() {
|
||||
return HALSIM_GetDriverStationEStop();
|
||||
}
|
||||
|
||||
void DriverStationSim::SetEStop(bool eStop) {
|
||||
HALSIM_SetDriverStationEStop(eStop);
|
||||
@@ -249,4 +257,6 @@ void DriverStationSim::SetReplayNumber(int replayNumber) {
|
||||
HALSIM_SetReplayNumber(replayNumber);
|
||||
}
|
||||
|
||||
void DriverStationSim::ResetData() { HALSIM_ResetDriverStationData(); }
|
||||
void DriverStationSim::ResetData() {
|
||||
HALSIM_ResetDriverStationData();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ DutyCycleSim::DutyCycleSim(const DutyCycle& dutyCycle)
|
||||
|
||||
DutyCycleSim DutyCycleSim::CreateForChannel(int channel) {
|
||||
int index = HALSIM_FindDutyCycleForChannel(channel);
|
||||
if (index < 0) throw std::out_of_range("no duty cycle found for channel");
|
||||
if (index < 0) {
|
||||
throw std::out_of_range("no duty cycle found for channel");
|
||||
}
|
||||
return DutyCycleSim{index};
|
||||
}
|
||||
|
||||
@@ -79,4 +81,6 @@ void DutyCycleSim::SetOutput(double period) {
|
||||
HALSIM_SetDutyCycleOutput(m_index, period);
|
||||
}
|
||||
|
||||
void DutyCycleSim::ResetData() { HALSIM_ResetDutyCycleData(m_index); }
|
||||
void DutyCycleSim::ResetData() {
|
||||
HALSIM_ResetDutyCycleData(m_index);
|
||||
}
|
||||
|
||||
@@ -20,11 +20,15 @@ EncoderSim::EncoderSim(const Encoder& encoder)
|
||||
|
||||
EncoderSim EncoderSim::CreateForChannel(int channel) {
|
||||
int index = HALSIM_FindEncoderForChannel(channel);
|
||||
if (index < 0) throw std::out_of_range("no encoder found for channel");
|
||||
if (index < 0) {
|
||||
throw std::out_of_range("no encoder found for channel");
|
||||
}
|
||||
return EncoderSim{index};
|
||||
}
|
||||
|
||||
EncoderSim EncoderSim::CreateForIndex(int index) { return EncoderSim{index}; }
|
||||
EncoderSim EncoderSim::CreateForIndex(int index) {
|
||||
return EncoderSim{index};
|
||||
}
|
||||
|
||||
std::unique_ptr<CallbackStore> EncoderSim::RegisterInitializedCallback(
|
||||
NotifyCallback callback, bool initialNotify) {
|
||||
@@ -52,9 +56,13 @@ std::unique_ptr<CallbackStore> EncoderSim::RegisterCountCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
int EncoderSim::GetCount() const { return HALSIM_GetEncoderCount(m_index); }
|
||||
int EncoderSim::GetCount() const {
|
||||
return HALSIM_GetEncoderCount(m_index);
|
||||
}
|
||||
|
||||
void EncoderSim::SetCount(int count) { HALSIM_SetEncoderCount(m_index, count); }
|
||||
void EncoderSim::SetCount(int count) {
|
||||
HALSIM_SetEncoderCount(m_index, count);
|
||||
}
|
||||
|
||||
std::unique_ptr<CallbackStore> EncoderSim::RegisterPeriodCallback(
|
||||
NotifyCallback callback, bool initialNotify) {
|
||||
@@ -82,7 +90,9 @@ std::unique_ptr<CallbackStore> EncoderSim::RegisterResetCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool EncoderSim::GetReset() const { return HALSIM_GetEncoderReset(m_index); }
|
||||
bool EncoderSim::GetReset() const {
|
||||
return HALSIM_GetEncoderReset(m_index);
|
||||
}
|
||||
|
||||
void EncoderSim::SetReset(bool reset) {
|
||||
HALSIM_SetEncoderReset(m_index, reset);
|
||||
@@ -173,14 +183,22 @@ void EncoderSim::SetDistancePerPulse(double distancePerPulse) {
|
||||
HALSIM_SetEncoderDistancePerPulse(m_index, distancePerPulse);
|
||||
}
|
||||
|
||||
void EncoderSim::ResetData() { HALSIM_ResetEncoderData(m_index); }
|
||||
void EncoderSim::ResetData() {
|
||||
HALSIM_ResetEncoderData(m_index);
|
||||
}
|
||||
|
||||
void EncoderSim::SetDistance(double distance) {
|
||||
HALSIM_SetEncoderDistance(m_index, distance);
|
||||
}
|
||||
|
||||
double EncoderSim::GetDistance() { return HALSIM_GetEncoderDistance(m_index); }
|
||||
double EncoderSim::GetDistance() {
|
||||
return HALSIM_GetEncoderDistance(m_index);
|
||||
}
|
||||
|
||||
void EncoderSim::SetRate(double rate) { HALSIM_SetEncoderRate(m_index, rate); }
|
||||
void EncoderSim::SetRate(double rate) {
|
||||
HALSIM_SetEncoderRate(m_index, rate);
|
||||
}
|
||||
|
||||
double EncoderSim::GetRate() { return HALSIM_GetEncoderRate(m_index); }
|
||||
double EncoderSim::GetRate() {
|
||||
return HALSIM_GetEncoderRate(m_index);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ GenericHIDSim::GenericHIDSim(const GenericHID& joystick)
|
||||
|
||||
GenericHIDSim::GenericHIDSim(int port) : m_port{port} {}
|
||||
|
||||
void GenericHIDSim::NotifyNewData() { DriverStationSim::NotifyNewData(); }
|
||||
void GenericHIDSim::NotifyNewData() {
|
||||
DriverStationSim::NotifyNewData();
|
||||
}
|
||||
|
||||
void GenericHIDSim::SetRawButton(int button, bool value) {
|
||||
DriverStationSim::SetJoystickButton(m_port, button, value);
|
||||
@@ -29,7 +31,9 @@ void GenericHIDSim::SetPOV(int pov, int value) {
|
||||
DriverStationSim::SetJoystickPOV(m_port, pov, value);
|
||||
}
|
||||
|
||||
void GenericHIDSim::SetPOV(int value) { SetPOV(0, value); }
|
||||
void GenericHIDSim::SetPOV(int value) {
|
||||
SetPOV(0, value);
|
||||
}
|
||||
|
||||
void GenericHIDSim::SetAxisCount(int count) {
|
||||
DriverStationSim::SetJoystickAxisCount(m_port, count);
|
||||
|
||||
@@ -55,6 +55,10 @@ void JoystickSim::SetThrottle(double value) {
|
||||
value);
|
||||
}
|
||||
|
||||
void JoystickSim::SetTrigger(bool state) { SetRawButton(1, state); }
|
||||
void JoystickSim::SetTrigger(bool state) {
|
||||
SetRawButton(1, state);
|
||||
}
|
||||
|
||||
void JoystickSim::SetTop(bool state) { SetRawButton(2, state); }
|
||||
void JoystickSim::SetTop(bool state) {
|
||||
SetRawButton(2, state);
|
||||
}
|
||||
|
||||
@@ -152,4 +152,6 @@ void PCMSim::SetAllSolenoidOutputs(uint8_t outputs) {
|
||||
HALSIM_SetPCMAllSolenoids(m_index, outputs);
|
||||
}
|
||||
|
||||
void PCMSim::ResetData() { HALSIM_ResetPCMData(m_index); }
|
||||
void PCMSim::ResetData() {
|
||||
HALSIM_ResetPCMData(m_index);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,9 @@ std::unique_ptr<CallbackStore> PDPSim::RegisterVoltageCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
double PDPSim::GetVoltage() const { return HALSIM_GetPDPVoltage(m_index); }
|
||||
double PDPSim::GetVoltage() const {
|
||||
return HALSIM_GetPDPVoltage(m_index);
|
||||
}
|
||||
|
||||
void PDPSim::SetVoltage(double voltage) {
|
||||
HALSIM_SetPDPVoltage(m_index, voltage);
|
||||
@@ -92,4 +94,6 @@ void PDPSim::SetAllCurrents(const double* currents) {
|
||||
HALSIM_SetPDPAllCurrents(m_index, currents);
|
||||
}
|
||||
|
||||
void PDPSim::ResetData() { HALSIM_ResetPDPData(m_index); }
|
||||
void PDPSim::ResetData() {
|
||||
HALSIM_ResetPDPData(m_index);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,9 @@ std::unique_ptr<CallbackStore> PWMSim::RegisterRawValueCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
int PWMSim::GetRawValue() const { return HALSIM_GetPWMRawValue(m_index); }
|
||||
int PWMSim::GetRawValue() const {
|
||||
return HALSIM_GetPWMRawValue(m_index);
|
||||
}
|
||||
|
||||
void PWMSim::SetRawValue(int rawValue) {
|
||||
HALSIM_SetPWMRawValue(m_index, rawValue);
|
||||
@@ -59,9 +61,13 @@ std::unique_ptr<CallbackStore> PWMSim::RegisterSpeedCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
double PWMSim::GetSpeed() const { return HALSIM_GetPWMSpeed(m_index); }
|
||||
double PWMSim::GetSpeed() const {
|
||||
return HALSIM_GetPWMSpeed(m_index);
|
||||
}
|
||||
|
||||
void PWMSim::SetSpeed(double speed) { HALSIM_SetPWMSpeed(m_index, speed); }
|
||||
void PWMSim::SetSpeed(double speed) {
|
||||
HALSIM_SetPWMSpeed(m_index, speed);
|
||||
}
|
||||
|
||||
std::unique_ptr<CallbackStore> PWMSim::RegisterPositionCallback(
|
||||
NotifyCallback callback, bool initialNotify) {
|
||||
@@ -72,7 +78,9 @@ std::unique_ptr<CallbackStore> PWMSim::RegisterPositionCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
double PWMSim::GetPosition() const { return HALSIM_GetPWMPosition(m_index); }
|
||||
double PWMSim::GetPosition() const {
|
||||
return HALSIM_GetPWMPosition(m_index);
|
||||
}
|
||||
|
||||
void PWMSim::SetPosition(double position) {
|
||||
HALSIM_SetPWMPosition(m_index, position);
|
||||
@@ -87,7 +95,9 @@ std::unique_ptr<CallbackStore> PWMSim::RegisterPeriodScaleCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
int PWMSim::GetPeriodScale() const { return HALSIM_GetPWMPeriodScale(m_index); }
|
||||
int PWMSim::GetPeriodScale() const {
|
||||
return HALSIM_GetPWMPeriodScale(m_index);
|
||||
}
|
||||
|
||||
void PWMSim::SetPeriodScale(int periodScale) {
|
||||
HALSIM_SetPWMPeriodScale(m_index, periodScale);
|
||||
@@ -102,10 +112,14 @@ std::unique_ptr<CallbackStore> PWMSim::RegisterZeroLatchCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool PWMSim::GetZeroLatch() const { return HALSIM_GetPWMZeroLatch(m_index); }
|
||||
bool PWMSim::GetZeroLatch() const {
|
||||
return HALSIM_GetPWMZeroLatch(m_index);
|
||||
}
|
||||
|
||||
void PWMSim::SetZeroLatch(bool zeroLatch) {
|
||||
HALSIM_SetPWMZeroLatch(m_index, zeroLatch);
|
||||
}
|
||||
|
||||
void PWMSim::ResetData() { HALSIM_ResetPWMData(m_index); }
|
||||
void PWMSim::ResetData() {
|
||||
HALSIM_ResetPWMData(m_index);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,9 @@ std::unique_ptr<CallbackStore> RelaySim::RegisterForwardCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool RelaySim::GetForward() const { return HALSIM_GetRelayForward(m_index); }
|
||||
bool RelaySim::GetForward() const {
|
||||
return HALSIM_GetRelayForward(m_index);
|
||||
}
|
||||
|
||||
void RelaySim::SetForward(bool forward) {
|
||||
HALSIM_SetRelayForward(m_index, forward);
|
||||
@@ -76,10 +78,14 @@ std::unique_ptr<CallbackStore> RelaySim::RegisterReverseCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool RelaySim::GetReverse() const { return HALSIM_GetRelayReverse(m_index); }
|
||||
bool RelaySim::GetReverse() const {
|
||||
return HALSIM_GetRelayReverse(m_index);
|
||||
}
|
||||
|
||||
void RelaySim::SetReverse(bool reverse) {
|
||||
HALSIM_SetRelayReverse(m_index, reverse);
|
||||
}
|
||||
|
||||
void RelaySim::ResetData() { HALSIM_ResetRelayData(m_index); }
|
||||
void RelaySim::ResetData() {
|
||||
HALSIM_ResetRelayData(m_index);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@ std::unique_ptr<CallbackStore> RoboRioSim::RegisterFPGAButtonCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool RoboRioSim::GetFPGAButton() { return HALSIM_GetRoboRioFPGAButton(); }
|
||||
bool RoboRioSim::GetFPGAButton() {
|
||||
return HALSIM_GetRoboRioFPGAButton();
|
||||
}
|
||||
|
||||
void RoboRioSim::SetFPGAButton(bool fPGAButton) {
|
||||
HALSIM_SetRoboRioFPGAButton(fPGAButton);
|
||||
@@ -104,7 +106,9 @@ std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserActive6VCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool RoboRioSim::GetUserActive6V() { return HALSIM_GetRoboRioUserActive6V(); }
|
||||
bool RoboRioSim::GetUserActive6V() {
|
||||
return HALSIM_GetRoboRioUserActive6V();
|
||||
}
|
||||
|
||||
void RoboRioSim::SetUserActive6V(bool userActive6V) {
|
||||
HALSIM_SetRoboRioUserActive6V(userActive6V);
|
||||
@@ -153,7 +157,9 @@ std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserActive5VCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool RoboRioSim::GetUserActive5V() { return HALSIM_GetRoboRioUserActive5V(); }
|
||||
bool RoboRioSim::GetUserActive5V() {
|
||||
return HALSIM_GetRoboRioUserActive5V();
|
||||
}
|
||||
|
||||
void RoboRioSim::SetUserActive5V(bool userActive5V) {
|
||||
HALSIM_SetRoboRioUserActive5V(userActive5V);
|
||||
@@ -202,7 +208,9 @@ std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserActive3V3Callback(
|
||||
return store;
|
||||
}
|
||||
|
||||
bool RoboRioSim::GetUserActive3V3() { return HALSIM_GetRoboRioUserActive3V3(); }
|
||||
bool RoboRioSim::GetUserActive3V3() {
|
||||
return HALSIM_GetRoboRioUserActive3V3();
|
||||
}
|
||||
|
||||
void RoboRioSim::SetUserActive3V3(bool userActive3V3) {
|
||||
HALSIM_SetRoboRioUserActive3V3(userActive3V3);
|
||||
@@ -217,7 +225,9 @@ std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserFaults6VCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
int RoboRioSim::GetUserFaults6V() { return HALSIM_GetRoboRioUserFaults6V(); }
|
||||
int RoboRioSim::GetUserFaults6V() {
|
||||
return HALSIM_GetRoboRioUserFaults6V();
|
||||
}
|
||||
|
||||
void RoboRioSim::SetUserFaults6V(int userFaults6V) {
|
||||
HALSIM_SetRoboRioUserFaults6V(userFaults6V);
|
||||
@@ -232,7 +242,9 @@ std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserFaults5VCallback(
|
||||
return store;
|
||||
}
|
||||
|
||||
int RoboRioSim::GetUserFaults5V() { return HALSIM_GetRoboRioUserFaults5V(); }
|
||||
int RoboRioSim::GetUserFaults5V() {
|
||||
return HALSIM_GetRoboRioUserFaults5V();
|
||||
}
|
||||
|
||||
void RoboRioSim::SetUserFaults5V(int userFaults5V) {
|
||||
HALSIM_SetRoboRioUserFaults5V(userFaults5V);
|
||||
@@ -247,10 +259,14 @@ std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserFaults3V3Callback(
|
||||
return store;
|
||||
}
|
||||
|
||||
int RoboRioSim::GetUserFaults3V3() { return HALSIM_GetRoboRioUserFaults3V3(); }
|
||||
int RoboRioSim::GetUserFaults3V3() {
|
||||
return HALSIM_GetRoboRioUserFaults3V3();
|
||||
}
|
||||
|
||||
void RoboRioSim::SetUserFaults3V3(int userFaults3V3) {
|
||||
HALSIM_SetRoboRioUserFaults3V3(userFaults3V3);
|
||||
}
|
||||
|
||||
void ResetData() { HALSIM_ResetRoboRioData(); }
|
||||
void ResetData() {
|
||||
HALSIM_ResetRoboRioData();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
using namespace frc;
|
||||
using namespace frc::sim;
|
||||
|
||||
SPIAccelerometerSim::SPIAccelerometerSim(int index) { m_index = index; }
|
||||
SPIAccelerometerSim::SPIAccelerometerSim(int index) {
|
||||
m_index = index;
|
||||
}
|
||||
|
||||
std::unique_ptr<CallbackStore> SPIAccelerometerSim::RegisterActiveCallback(
|
||||
NotifyCallback callback, bool initialNotify) {
|
||||
|
||||
@@ -37,8 +37,12 @@ std::vector<std::string> SimDeviceSim::GetEnumOptions(hal::SimEnum val) {
|
||||
const char** options = HALSIM_GetSimValueEnumOptions(val, &numOptions);
|
||||
std::vector<std::string> rv;
|
||||
rv.reserve(numOptions);
|
||||
for (int32_t i = 0; i < numOptions; ++i) rv.emplace_back(options[i]);
|
||||
for (int32_t i = 0; i < numOptions; ++i) {
|
||||
rv.emplace_back(options[i]);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void SimDeviceSim::ResetData() { HALSIM_ResetSimDeviceData(); }
|
||||
void SimDeviceSim::ResetData() {
|
||||
HALSIM_ResetSimDeviceData();
|
||||
}
|
||||
|
||||
@@ -9,21 +9,37 @@
|
||||
namespace frc {
|
||||
namespace sim {
|
||||
|
||||
void SetRuntimeType(HAL_RuntimeType type) { HALSIM_SetRuntimeType(type); }
|
||||
void SetRuntimeType(HAL_RuntimeType type) {
|
||||
HALSIM_SetRuntimeType(type);
|
||||
}
|
||||
|
||||
void WaitForProgramStart() { HALSIM_WaitForProgramStart(); }
|
||||
void WaitForProgramStart() {
|
||||
HALSIM_WaitForProgramStart();
|
||||
}
|
||||
|
||||
void SetProgramStarted() { HALSIM_SetProgramStarted(); }
|
||||
void SetProgramStarted() {
|
||||
HALSIM_SetProgramStarted();
|
||||
}
|
||||
|
||||
bool GetProgramStarted() { return HALSIM_GetProgramStarted(); }
|
||||
bool GetProgramStarted() {
|
||||
return HALSIM_GetProgramStarted();
|
||||
}
|
||||
|
||||
void RestartTiming() { HALSIM_RestartTiming(); }
|
||||
void RestartTiming() {
|
||||
HALSIM_RestartTiming();
|
||||
}
|
||||
|
||||
void PauseTiming() { HALSIM_PauseTiming(); }
|
||||
void PauseTiming() {
|
||||
HALSIM_PauseTiming();
|
||||
}
|
||||
|
||||
void ResumeTiming() { HALSIM_ResumeTiming(); }
|
||||
void ResumeTiming() {
|
||||
HALSIM_ResumeTiming();
|
||||
}
|
||||
|
||||
bool IsTimingPaused() { return HALSIM_IsTimingPaused(); }
|
||||
bool IsTimingPaused() {
|
||||
return HALSIM_IsTimingPaused();
|
||||
}
|
||||
|
||||
void StepTiming(units::second_t delta) {
|
||||
HALSIM_StepTiming(static_cast<uint64_t>(delta.to<double>() * 1e6));
|
||||
|
||||
Reference in New Issue
Block a user