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:
Peter Johnson
2020-12-28 12:58:06 -08:00
committed by GitHub
parent 0291a3ff56
commit 2aed432b4b
634 changed files with 10716 additions and 3938 deletions

View File

@@ -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);