Skip to content

Commit a2d06c0

Browse files
author
Federico Fissore
committed
Run new astyle formatter against all the examples
(Filtered from arduino/Arduino@b4c68b3)
1 parent 049e28d commit a2d06c0

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

examples/BarometricPressureSensor/BarometricPressureSensor.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/*
22
SCP1000 Barometric Pressure Sensor Display
3-
3+
44
Shows the output of a Barometric Pressure Sensor on a
55
Uses the SPI library. For details on the sensor, see:
66
http://www.sparkfun.com/commerce/product_info.php?products_id=8161
77
http://www.vti.fi/en/support/obsolete_products/pressure_sensors/
8-
8+
99
This sketch adapted from Nathan Seidle's SCP1000 example for PIC:
1010
http://www.sparkfun.com/datasheets/Sensors/SCP1000-Testing.zip
11-
11+
1212
Circuit:
1313
SCP1000 sensor attached to pins 6, 7, 10 - 13:
1414
DRDY: pin 6
1515
CSB: pin 7
1616
MOSI: pin 11
1717
MISO: pin 12
1818
SCK: pin 13
19-
19+
2020
created 31 July 2010
2121
modified 14 August 2010
2222
by Tom Igoe
@@ -77,7 +77,7 @@ void loop() {
7777
//Read the pressure data lower 16 bits:
7878
unsigned int pressure_data_low = readRegister(0x20, 2);
7979
//combine the two parts into one 19-bit number:
80-
long pressure = ((pressure_data_high << 16) | pressure_data_low)/4;
80+
long pressure = ((pressure_data_high << 16) | pressure_data_low) / 4;
8181

8282
// display the temperature:
8383
Serial.println("\tPressure [Pa]=" + String(pressure));

examples/BarometricPressureSensor/BarometricPressureSensor/BarometricPressureSensor.ino

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/*
22
SCP1000 Barometric Pressure Sensor Display
3-
3+
44
Shows the output of a Barometric Pressure Sensor on a
55
Uses the SPI library. For details on the sensor, see:
66
http://www.sparkfun.com/commerce/product_info.php?products_id=8161
77
http://www.vti.fi/en/support/obsolete_products/pressure_sensors/
8-
8+
99
This sketch adapted from Nathan Seidle's SCP1000 example for PIC:
1010
http://www.sparkfun.com/datasheets/Sensors/SCP1000-Testing.zip
11-
11+
1212
Circuit:
1313
SCP1000 sensor attached to pins 6, 7, 10 - 13:
1414
DRDY: pin 6
1515
CSB: pin 7
1616
MOSI: pin 11
1717
MISO: pin 12
1818
SCK: pin 13
19-
19+
2020
created 31 July 2010
2121
modified 14 August 2010
2222
by Tom Igoe
@@ -33,7 +33,7 @@ cont byte READ = 0b00000000; // SCP1000's read command
3333
const byte WRITE = 0b00000010; // SCP1000's write command
3434
// pins used for the connection with the sensor
3535
// the other you need are controlled by the SPI library):
36-
const int dataReadyPin = 6;
36+
const int dataReadyPin = 6;
3737
const int chipSelectPin = 7;
3838

3939
void setup() {
@@ -70,13 +70,13 @@ void loop() {
7070

7171

7272
//Read the pressure data highest 3 bits:
73-
byte pressure_data_high = readRegister(0x1F, 1);
73+
byte pressure_data_high = readRegister(0x1F, 1);
7474
pressure_data_high &= 0b00000111; //you only needs bits 2 to 0
7575

7676
//Read the pressure data lower 16 bits:
77-
unsigned int pressure_data_low = readRegister(0x20, 2);
77+
unsigned int pressure_data_low = readRegister(0x20, 2);
7878
//combine the two parts into one 19-bit number:
79-
long pressure = ((pressure_data_high << 16) | pressure_data_low)/4;
79+
long pressure = ((pressure_data_high << 16) | pressure_data_low) / 4;
8080

8181
// display the temperature:
8282
Serial.println("\tPressure [Pa]=" + String(pressure));
@@ -86,7 +86,7 @@ void loop() {
8686
//Read from or write to register from the SCP1000:
8787
unsigned int readRegister(byte thisRegister, int bytesToRead ) {
8888
byte inByte = 0; // incoming byte from the SPI
89-
unsigned int result = 0; // result to return
89+
unsigned int result = 0; // result to return
9090

9191
// SCP1000 expects the register name in the upper 6 bits
9292
// of the byte. So shift the bits left by two bits:
@@ -95,25 +95,25 @@ unsigned int readRegister(byte thisRegister, int bytesToRead ) {
9595
dataToSend = thisRegister & READ;
9696

9797
// take the chip select low to select the device:
98-
digitalWrite(chipSelectPin, LOW);
98+
digitalWrite(chipSelectPin, LOW);
9999
// send the device the register you want to read:
100-
SPI.transfer(dataToSend);
100+
SPI.transfer(dataToSend);
101101
// send a value of 0 to read the first byte returned:
102-
result = SPI.transfer(0x00);
102+
result = SPI.transfer(0x00);
103103
// decrement the number of bytes left to read:
104104
bytesToRead--;
105105
// if you still have another byte to read:
106106
if (bytesToRead > 0) {
107-
// shift the first byte left, then get the second byte:
107+
// shift the first byte left, then get the second byte:
108108
result = result << 8;
109-
inByte = SPI.transfer(0x00);
109+
inByte = SPI.transfer(0x00);
110110
// combine the byte you just got with the previous one:
111111
result = result | inByte;
112112
// decrement the number of bytes left to read:
113113
bytesToRead--;
114114
}
115115
// take the chip select high to de-select:
116-
digitalWrite(chipSelectPin, HIGH);
116+
digitalWrite(chipSelectPin, HIGH);
117117
// return the result:
118118
return(result);
119119
}
@@ -130,13 +130,13 @@ void writeRegister(byte thisRegister, byte thisValue) {
130130
dataToSend = thisRegister | WRITE;
131131

132132
// take the chip select low to select the device:
133-
digitalWrite(chipSelectPin, LOW);
133+
digitalWrite(chipSelectPin, LOW);
134134

135135
SPI.transfer(dataToSend); //Send register location
136136
SPI.transfer(thisValue); //Send value to record into register
137137

138138
// take the chip select high to de-select:
139-
digitalWrite(chipSelectPin, HIGH);
139+
digitalWrite(chipSelectPin, HIGH);
140140
}
141141

142142

examples/DigitalPotControl/DigitalPotControl.ino

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
/*
22
Digital Pot Control
3-
3+
44
This example controls an Analog Devices AD5206 digital potentiometer.
55
The AD5206 has 6 potentiometer channels. Each channel's pins are labeled
66
A - connect this to voltage
77
W - this is the pot's wiper, which changes when you set it
88
B - connect this to ground.
9-
10-
The AD5206 is SPI-compatible,and to command it, you send two bytes,
9+
10+
The AD5206 is SPI-compatible,and to command it, you send two bytes,
1111
one with the channel number (0 - 5) and one with the resistance value for the
12-
channel (0 - 255).
13-
12+
channel (0 - 255).
13+
1414
The circuit:
1515
* All A pins of AD5206 connected to +5V
1616
* All B pins of AD5206 connected to ground
1717
* An LED and a 220-ohm resisor in series connected from each W pin to ground
1818
* CS - to digital pin 10 (SS pin)
1919
* SDI - to digital pin 11 (MOSI pin)
2020
* CLK - to digital pin 13 (SCK pin)
21-
22-
created 10 Aug 2010
21+
22+
created 10 Aug 2010
2323
by Tom Igoe
24-
24+
2525
Thanks to Heather Dewey-Hagborg for the original tutorial, 2005
26-
26+
2727
*/
2828

2929

@@ -38,12 +38,12 @@ void setup() {
3838
// set the slaveSelectPin as an output:
3939
pinMode (slaveSelectPin, OUTPUT);
4040
// initialize SPI:
41-
SPI.begin();
41+
SPI.begin();
4242
}
4343

4444
void loop() {
4545
// go through the six channels of the digital pot:
46-
for (int channel = 0; channel < 6; channel++) {
46+
for (int channel = 0; channel < 6; channel++) {
4747
// change the resistance on this channel from min to max:
4848
for (int level = 0; level < 255; level++) {
4949
digitalPotWrite(channel, level);
@@ -62,10 +62,10 @@ void loop() {
6262

6363
void digitalPotWrite(int address, int value) {
6464
// take the SS pin low to select the chip:
65-
digitalWrite(slaveSelectPin,LOW);
65+
digitalWrite(slaveSelectPin, LOW);
6666
// send in the address and value via SPI:
6767
SPI.transfer(address);
6868
SPI.transfer(value);
6969
// take the SS pin high to de-select the chip:
70-
digitalWrite(slaveSelectPin,HIGH);
70+
digitalWrite(slaveSelectPin, HIGH);
7171
}

0 commit comments

Comments
 (0)