mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02: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:
@@ -8,7 +8,9 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
int32_t HALSIM_FindAddressableLEDForChannel(int32_t channel) { return 0; }
|
||||
int32_t HALSIM_FindAddressableLEDForChannel(int32_t channel) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_ResetAddressableLEDData(int32_t index) {}
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
extern "C" {
|
||||
void HALSIM_ResetAnalogInData(int32_t index) {}
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetAnalogInSimDevice(int32_t index) { return 0; }
|
||||
HAL_SimDeviceHandle HALSIM_GetAnalogInSimDevice(int32_t index) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, AnalogIn##CAPINAME, RETURN)
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
int32_t HALSIM_FindAnalogTriggerForChannel(int32_t channel) { return 0; }
|
||||
int32_t HALSIM_FindAnalogTriggerForChannel(int32_t channel) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_ResetAnalogTriggerData(int32_t index) {}
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
extern "C" {
|
||||
void HALSIM_ResetDIOData(int32_t index) {}
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetDIOSimDevice(int32_t index) { return 0; }
|
||||
HAL_SimDeviceHandle HALSIM_GetDIOSimDevice(int32_t index) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define DEFINE_CAPI(TYPE, CAPINAME, RETURN) \
|
||||
HAL_SIMDATAVALUE_STUB_CAPI(TYPE, HALSIM, DIO##CAPINAME, RETURN)
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
int32_t HALSIM_FindDigitalPWMForChannel(int32_t channel) { return 0; }
|
||||
int32_t HALSIM_FindDigitalPWMForChannel(int32_t channel) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_ResetDigitalPWMData(int32_t index) {}
|
||||
|
||||
|
||||
@@ -7,13 +7,19 @@
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
int32_t HALSIM_FindDutyCycleForChannel(int32_t channel) { return 0; }
|
||||
int32_t HALSIM_FindDutyCycleForChannel(int32_t channel) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_ResetDutyCycleData(int32_t index) {}
|
||||
|
||||
int32_t HALSIM_GetDutyCycleDigitalChannel(int32_t index) { return 0; }
|
||||
int32_t HALSIM_GetDutyCycleDigitalChannel(int32_t index) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetDutyCycleSimDevice(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)
|
||||
|
||||
@@ -7,15 +7,23 @@
|
||||
#include "hal/simulation/SimDataValue.h"
|
||||
|
||||
extern "C" {
|
||||
int32_t HALSIM_FindEncoderForChannel(int32_t channel) { return 0; }
|
||||
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_GetEncoderDigitalChannelA(int32_t index) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HALSIM_GetEncoderDigitalChannelB(int32_t index) { return 0; }
|
||||
int32_t HALSIM_GetEncoderDigitalChannelB(int32_t index) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetEncoderSimDevice(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)
|
||||
@@ -32,11 +40,15 @@ DEFINE_CAPI(double, DistancePerPulse, 0)
|
||||
|
||||
void HALSIM_SetEncoderDistance(int32_t index, double distance) {}
|
||||
|
||||
double HALSIM_GetEncoderDistance(int32_t index) { return 0; }
|
||||
double HALSIM_GetEncoderDistance(int32_t index) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_SetEncoderRate(int32_t index, double rate) {}
|
||||
|
||||
double HALSIM_GetEncoderRate(int32_t index) { return 0; }
|
||||
double HALSIM_GetEncoderRate(int32_t index) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HALSIM_RegisterEncoderAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
|
||||
@@ -12,7 +12,9 @@ void HALSIM_WaitForProgramStart(void) {}
|
||||
|
||||
void HALSIM_SetProgramStarted(void) {}
|
||||
|
||||
HAL_Bool HALSIM_GetProgramStarted(void) { return false; }
|
||||
HAL_Bool HALSIM_GetProgramStarted(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void HALSIM_RestartTiming(void) {}
|
||||
|
||||
@@ -20,7 +22,9 @@ void HALSIM_PauseTiming(void) {}
|
||||
|
||||
void HALSIM_ResumeTiming(void) {}
|
||||
|
||||
HAL_Bool HALSIM_IsTimingPaused(void) { return false; }
|
||||
HAL_Bool HALSIM_IsTimingPaused(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void HALSIM_StepTiming(uint64_t delta) {}
|
||||
|
||||
|
||||
@@ -6,9 +6,13 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
uint64_t HALSIM_GetNextNotifierTimeout(void) { return 0; }
|
||||
uint64_t HALSIM_GetNextNotifierTimeout(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HALSIM_GetNumNotifiers(void) { return 0; }
|
||||
int32_t HALSIM_GetNumNotifiers(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HALSIM_GetNotifierInfo(struct HALSIM_NotifierInfo* arr, int32_t size) {
|
||||
return 0;
|
||||
|
||||
@@ -21,7 +21,9 @@ 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_GetPCMAllSolenoids(int32_t index, uint8_t* values) {
|
||||
*values = 0;
|
||||
}
|
||||
|
||||
void HALSIM_SetPCMAllSolenoids(int32_t index, uint8_t values) {}
|
||||
|
||||
|
||||
@@ -19,7 +19,9 @@ 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;
|
||||
for (int i = 0; i < hal::kNumPDPChannels; i++) {
|
||||
currents[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void HALSIM_SetPDPAllCurrents(int32_t index, const double* currents) {}
|
||||
|
||||
@@ -10,7 +10,9 @@ extern "C" {
|
||||
|
||||
void HALSIM_SetSimDeviceEnabled(const char* prefix, HAL_Bool enabled) {}
|
||||
|
||||
HAL_Bool HALSIM_IsSimDeviceEnabled(const char* name) { return false; }
|
||||
HAL_Bool HALSIM_IsSimDeviceEnabled(const char* name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t HALSIM_RegisterSimDeviceCreatedCallback(
|
||||
const char* prefix, void* param, HALSIM_SimDeviceCallback callback,
|
||||
@@ -28,9 +30,13 @@ int32_t HALSIM_RegisterSimDeviceFreedCallback(const char* prefix, void* param,
|
||||
|
||||
void HALSIM_CancelSimDeviceFreedCallback(int32_t uid) {}
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetSimDeviceHandle(const char* name) { return 0; }
|
||||
HAL_SimDeviceHandle HALSIM_GetSimDeviceHandle(const char* name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* HALSIM_GetSimDeviceName(HAL_SimDeviceHandle handle) { return ""; }
|
||||
const char* HALSIM_GetSimDeviceName(HAL_SimDeviceHandle handle) {
|
||||
return "";
|
||||
}
|
||||
|
||||
HAL_SimDeviceHandle HALSIM_GetSimValueDeviceHandle(HAL_SimValueHandle handle) {
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user