summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-12-20 20:31:04 +0100
committerHampusM <hampus@hampusmat.com>2021-12-20 20:31:04 +0100
commit2bcbead3d8e189493efc5066c61755f4ad138223 (patch)
tree86c01dbd08cf7a7a285d46f296383a5eec496b85
parent806b3c424133adb75385f37042d65e393a8855e3 (diff)
style: add clang format
-rw-r--r--.clang-format1
-rw-r--r--src/gyro.cpp9
2 files changed, 7 insertions, 3 deletions
diff --git a/.clang-format b/.clang-format
index 9d7c3a7..5facbda 100644
--- a/.clang-format
+++ b/.clang-format
@@ -3,6 +3,7 @@ UseTab: Always
IndentWidth: 4
TabWidth: 4
AllowShortBlocksOnASingleLine: Empty
+BreakBeforeBraces: Allman
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
ColumnLimit: 0
diff --git a/src/gyro.cpp b/src/gyro.cpp
index bdd68e9..78498bc 100644
--- a/src/gyro.cpp
+++ b/src/gyro.cpp
@@ -3,7 +3,8 @@
GY521 sensor(0x68);
-void setup() {
+void setup()
+{
Serial.begin(9600);
// Wait for Serial because the Arduino Leonardo is weird
@@ -12,7 +13,8 @@ void setup() {
Wire.begin();
delay(100);
- while (!sensor.wakeup()) {
+ while (!sensor.wakeup())
+ {
Serial.print(millis());
Serial.println("Error: Could not connect to the GY521 sensor. Retrying after 2000 milliseconds...");
delay(2000);
@@ -30,7 +32,8 @@ void setup() {
sensor.gye = -1.495;
}
-void loop() {
+void loop()
+{
sensor.read();
float pitch = sensor.getPitch();
float roll = sensor.getRoll();