Skip to content

Commit f8a4f09

Browse files
author
Federico Fissore
committed
Examples: mass code format. See example_formatter.conf
1 parent 14c7da3 commit f8a4f09

File tree

6 files changed

+40
-54
lines changed

6 files changed

+40
-54
lines changed

examples/CardInfo/CardInfo.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ SdFile root;
3434
// Sparkfun SD shield: pin 8
3535
const int chipSelect = 4;
3636

37-
void setup()
38-
{
37+
void setup() {
3938
// Open serial communications and wait for port to open:
4039
Serial.begin(9600);
4140
while (!Serial) {

examples/Datalogger/Datalogger.ino

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525

2626
const int chipSelect = 4;
2727

28-
void setup()
29-
{
28+
void setup() {
3029
// Open serial communications and wait for port to open:
3130
Serial.begin(9600);
3231
while (!Serial) {
@@ -45,8 +44,7 @@ void setup()
4544
Serial.println("card initialized.");
4645
}
4746

48-
void loop()
49-
{
47+
void loop() {
5048
// make a string for assembling the data to log:
5149
String dataString = "";
5250

examples/DumpFile/DumpFile.ino

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525

2626
const int chipSelect = 4;
2727

28-
void setup()
29-
{
28+
void setup() {
3029
// Open serial communications and wait for port to open:
3130
Serial.begin(9600);
3231
while (!Serial) {
@@ -61,7 +60,6 @@ void setup()
6160
}
6261
}
6362

64-
void loop()
65-
{
63+
void loop() {
6664
}
6765

examples/Files/Files.ino

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
File myFile;
2424

25-
void setup()
26-
{
25+
void setup() {
2726
// Open serial communications and wait for port to open:
2827
Serial.begin(9600);
2928
while (!Serial) {
@@ -41,8 +40,7 @@ void setup()
4140

4241
if (SD.exists("example.txt")) {
4342
Serial.println("example.txt exists.");
44-
}
45-
else {
43+
} else {
4644
Serial.println("example.txt doesn't exist.");
4745
}
4846

@@ -54,8 +52,7 @@ void setup()
5452
// Check to see if the file exists:
5553
if (SD.exists("example.txt")) {
5654
Serial.println("example.txt exists.");
57-
}
58-
else {
55+
} else {
5956
Serial.println("example.txt doesn't exist.");
6057
}
6158

@@ -65,14 +62,12 @@ void setup()
6562

6663
if (SD.exists("example.txt")) {
6764
Serial.println("example.txt exists.");
68-
}
69-
else {
65+
} else {
7066
Serial.println("example.txt doesn't exist.");
7167
}
7268
}
7369

74-
void loop()
75-
{
70+
void loop() {
7671
// nothing happens after setup finishes.
7772
}
7873

examples/ReadWrite/ReadWrite.ino

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323

2424
File myFile;
2525

26-
void setup()
27-
{
26+
void setup() {
2827
// Open serial communications and wait for port to open:
2928
Serial.begin(9600);
3029
while (!Serial) {
@@ -73,8 +72,7 @@ void setup()
7372
}
7473
}
7574

76-
void loop()
77-
{
75+
void loop() {
7876
// nothing happens after setup
7977
}
8078

examples/listfiles/listfiles.ino

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
22
Listfiles
3-
4-
This example shows how print out the files in a
5-
directory on a SD card
6-
3+
4+
This example shows how print out the files in a
5+
directory on a SD card
6+
77
The circuit:
88
* SD card attached to SPI bus as follows:
99
** MOSI - pin 11
@@ -17,7 +17,7 @@
1717
by Tom Igoe
1818
modified 2 Feb 2014
1919
by Scott Fitzgerald
20-
20+
2121
This example code is in the public domain.
2222
2323
*/
@@ -26,8 +26,7 @@
2626

2727
File root;
2828

29-
void setup()
30-
{
29+
void setup() {
3130
// Open serial communications and wait for port to open:
3231
Serial.begin(9600);
3332
while (!Serial) {
@@ -49,33 +48,32 @@ void setup()
4948
Serial.println("done!");
5049
}
5150

52-
void loop()
53-
{
51+
void loop() {
5452
// nothing happens after setup finishes.
5553
}
5654

5755
void printDirectory(File dir, int numTabs) {
58-
while(true) {
59-
60-
File entry = dir.openNextFile();
61-
if (! entry) {
62-
// no more files
63-
break;
64-
}
65-
for (uint8_t i=0; i<numTabs; i++) {
66-
Serial.print('\t');
67-
}
68-
Serial.print(entry.name());
69-
if (entry.isDirectory()) {
70-
Serial.println("/");
71-
printDirectory(entry, numTabs+1);
72-
} else {
73-
// files have sizes, directories do not
74-
Serial.print("\t\t");
75-
Serial.println(entry.size(), DEC);
76-
}
77-
entry.close();
78-
}
56+
while (true) {
57+
58+
File entry = dir.openNextFile();
59+
if (! entry) {
60+
// no more files
61+
break;
62+
}
63+
for (uint8_t i = 0; i < numTabs; i++) {
64+
Serial.print('\t');
65+
}
66+
Serial.print(entry.name());
67+
if (entry.isDirectory()) {
68+
Serial.println("/");
69+
printDirectory(entry, numTabs + 1);
70+
} else {
71+
// files have sizes, directories do not
72+
Serial.print("\t\t");
73+
Serial.println(entry.size(), DEC);
74+
}
75+
entry.close();
76+
}
7977
}
8078

8179

0 commit comments

Comments
 (0)