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:
@@ -123,7 +123,8 @@ static void writeRegister(Register reg, uint8_t data) {
|
||||
// Execute and wait until it's done (up to a millisecond)
|
||||
initialTime = HAL_GetFPGATime(&status);
|
||||
while (accel->readSTAT(&status) & 1) {
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000) break;
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000)
|
||||
break;
|
||||
}
|
||||
|
||||
// Send a stop transmit/receive message with the data
|
||||
@@ -134,7 +135,8 @@ static void writeRegister(Register reg, uint8_t data) {
|
||||
// Execute and wait until it's done (up to a millisecond)
|
||||
initialTime = HAL_GetFPGATime(&status);
|
||||
while (accel->readSTAT(&status) & 1) {
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000) break;
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +153,8 @@ static uint8_t readRegister(Register reg) {
|
||||
// Execute and wait until it's done (up to a millisecond)
|
||||
initialTime = HAL_GetFPGATime(&status);
|
||||
while (accel->readSTAT(&status) & 1) {
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000) break;
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000)
|
||||
break;
|
||||
}
|
||||
|
||||
// Receive a message with the data and stop
|
||||
@@ -162,7 +165,8 @@ static uint8_t readRegister(Register reg) {
|
||||
// Execute and wait until it's done (up to a millisecond)
|
||||
initialTime = HAL_GetFPGATime(&status);
|
||||
while (accel->readSTAT(&status) & 1) {
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000) break;
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000)
|
||||
break;
|
||||
}
|
||||
|
||||
return accel->readDATI(&status);
|
||||
|
||||
Reference in New Issue
Block a user