Skip to content

Commit 8c3eb73

Browse files
authored
Merge pull request #563 from adafruit/add-bme680
Add bme680
2 parents fb4beea + b84e2a8 commit 8c3eb73

File tree

10 files changed

+48
-40
lines changed

10 files changed

+48
-40
lines changed

libraries/Wire/Wire_nRF52.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ TwoWire::TwoWire(NRF_TWIM_Type * p_twim, NRF_TWIS_Type * p_twis, IRQn_Type IRQn,
4646
}
4747

4848
void TwoWire::begin(void) {
49-
//Master Mode
49+
//Main Mode
5050
master = true;
5151

5252
*pincfg_reg(_uc_pinSCL) = ((uint32_t)GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos)
@@ -72,7 +72,7 @@ void TwoWire::begin(void) {
7272
}
7373

7474
void TwoWire::begin(uint8_t address) {
75-
//Slave mode
75+
//Secondary mode
7676
master = false;
7777

7878
*pincfg_reg(_uc_pinSCL) = ((uint32_t)GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos)

libraries/Wire/examples/SFRRanger_reader/SFRRanger_reader.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
void setup()
1616
{
17-
Wire.begin(); // join i2c bus (address optional for master)
17+
Wire.begin(); // join i2c bus (address optional for main)
1818
Serial.begin(9600); // start serial communication at 9600bps
1919
while ( !Serial ) delay(10); // for nrf52840 with native usb
2020
}
@@ -42,7 +42,7 @@ void loop()
4242
Wire.endTransmission(); // stop transmitting
4343

4444
// step 4: request reading from sensor
45-
Wire.requestFrom(112, 2); // request 2 bytes from slave device #112
45+
Wire.requestFrom(112, 2); // request 2 bytes from secondary device #112
4646

4747
// step 5: receive reading from sensor
4848
if(2 <= Wire.available()) // if two bytes were received

libraries/Wire/examples/digital_potentiometer/digital_potentiometer.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
void setup()
1818
{
19-
Wire.begin(); // join i2c bus (address optional for master)
19+
Wire.begin(); // join i2c bus (address optional for main)
2020
}
2121

2222
byte val = 0;

libraries/Wire/examples/master_reader/master_reader.ino renamed to libraries/Wire/examples/main_reader/main_reader.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Wire Master Reader
1+
// Wire Main Reader
22
// by Nicholas Zambetti <http://www.zambetti.com>
33

44
// Demonstrates use of the Wire library
5-
// Reads data from an I2C/TWI slave device
6-
// Refer to the "Wire Slave Sender" example for use with this
5+
// Reads data from an I2C/TWI secondary device
6+
// Refer to the "Wire Secondary Sender" example for use with this
77

88
// Created 29 March 2006
99

@@ -14,16 +14,16 @@
1414

1515
void setup()
1616
{
17-
Wire.begin(); // join i2c bus (address optional for master)
17+
Wire.begin(); // join i2c bus (address optional for main)
1818
Serial.begin(9600); // start serial for output
1919
while ( !Serial ) delay(10); // for nrf52840 with native usb
2020
}
2121

2222
void loop()
2323
{
24-
Wire.requestFrom(2, 6); // request 6 bytes from slave device #2
24+
Wire.requestFrom(2, 6); // request 6 bytes from secondary device #2
2525

26-
while(Wire.available()) // slave may send less than requested
26+
while(Wire.available()) // secondary may send less than requested
2727
{
2828
char c = Wire.read(); // receive a byte as character
2929
Serial.print(c); // print the character

libraries/Wire/examples/master_scan/master_scan.ino renamed to libraries/Wire/examples/main_scan/main_scan.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ void setup()
77
{
88
Serial.begin(115200); // start serial for output
99
while ( !Serial ) delay(10); // for nrf52840 with native usb
10-
wi->begin(); // join i2c bus (address optional for master)
10+
wi->begin(); // join i2c bus (address optional for main)
1111
}
1212

1313
void loop()

libraries/Wire/examples/master_writer/master_writer.ino renamed to libraries/Wire/examples/main_writer/main_writer.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Wire Master Writer
1+
// Wire Main Writer
22
// by Nicholas Zambetti <http://www.zambetti.com>
33

44
// Demonstrates use of the Wire library
5-
// Writes data to an I2C/TWI slave device
6-
// Refer to the "Wire Slave Receiver" example for use with this
5+
// Writes data to an I2C/TWI secondary device
6+
// Refer to the "Wire Secondary Receiver" example for use with this
77

88
// Created 29 March 2006
99

@@ -14,7 +14,7 @@
1414

1515
void setup()
1616
{
17-
Wire.begin(); // join i2c bus (address optional for master)
17+
Wire.begin(); // join i2c bus (address optional for main)
1818
}
1919

2020
byte x = 0;

libraries/Wire/examples/slave_receiver/slave_receiver.ino renamed to libraries/Wire/examples/secondary_receiver/secondary_receiver.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Wire Slave Receiver
1+
// Wire Secondary Receiver
22
// by Nicholas Zambetti <http://www.zambetti.com>
33

44
// Demonstrates use of the Wire library
5-
// Receives data as an I2C/TWI slave device
6-
// Refer to the "Wire Master Writer" example for use with this
5+
// Receives data as an I2C/TWI secondary device
6+
// Refer to the "Wire Main Writer" example for use with this
77

88
// Created 29 March 2006
99

@@ -25,7 +25,7 @@ void loop()
2525
delay(100);
2626
}
2727

28-
// function that executes whenever data is received from master
28+
// function that executes whenever data is received from main
2929
// this function is registered as an event, see setup()
3030
void receiveEvent(int howMany)
3131
{

libraries/Wire/examples/slave_sender/slave_sender.ino renamed to libraries/Wire/examples/secondary_sender/secondary_sender.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Wire Slave Sender
1+
// Wire Secondary Sender
22
// by Nicholas Zambetti <http://www.zambetti.com>
33

44
// Demonstrates use of the Wire library
5-
// Sends data as an I2C/TWI slave device
6-
// Refer to the "Wire Master Reader" example for use with this
5+
// Sends data as an I2C/TWI secondary device
6+
// Refer to the "Wire Main Reader" example for use with this
77

88
// Created 29 March 2006
99

@@ -23,10 +23,10 @@ void loop()
2323
delay(100);
2424
}
2525

26-
// function that executes whenever data is requested by master
26+
// function that executes whenever data is requested by main
2727
// this function is registered as an event, see setup()
2828
void requestEvent()
2929
{
3030
Wire.write("hello "); // respond with message of 6 bytes
31-
// as expected by master
31+
// as expected by main
3232
}

platform.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ compiler.c.elf.extra_flags=
7474
compiler.cpp.extra_flags=
7575
compiler.S.extra_flags=
7676
compiler.ar.extra_flags=
77+
compiler.libraries.ldflags=
7778
compiler.elf2bin.extra_flags=
7879
compiler.elf2hex.extra_flags=
7980

@@ -94,7 +95,7 @@ recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU=
9495
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
9596

9697
## Combine gc-sections, archives, and objects
97-
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{build.core.path}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group -lm "{build.path}/{archive_file}" -Wl,--end-group
98+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{build.core.path}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} {compiler.libraries.ldflags} -Wl,--start-group -lm "{build.path}/{archive_file}" -Wl,--end-group
9899

99100
## Create output (bin file)
100101
#recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2bin.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"

tools/build_all.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@
22
import glob
33
import sys
44
import subprocess
5+
from subprocess import Popen, PIPE
56
import time
67

8+
SUCCEEDED = "\033[32msucceeded\033[0m"
9+
FAILED = "\033[31mfailed\033[0m"
10+
SKIPPED = "\033[33mskipped\033[0m"
11+
WARNING = "\033[31mwarnings\033[0m"
12+
713
all_warnings = False
814
exit_status = 0
915
success_count = 0
1016
fail_count = 0
1117
skip_count = 0
1218

13-
build_format = '| {:20} | {:35} | {:9} | {:6} |'
19+
build_format = '| {:20} | {:35} | {:18} | {:6} |'
1420
build_separator = '-' * 83
1521

1622
default_boards = [ 'cluenrf52840', 'cplaynrf52840', 'feather52832', 'feather52840', 'feather52840sense', 'itsybitsy52840' ]
17-
1823
build_boards = []
1924

2025
# build all variants if input not existed
@@ -23,6 +28,9 @@
2328
else:
2429
build_boards = default_boards
2530

31+
all_examples = list(glob.iglob('libraries/**/*.ino', recursive=True))
32+
all_examples.sort()
33+
2634
def errorOutputFilter(line):
2735
if len(line) == 0:
2836
return False
@@ -39,29 +47,29 @@ def build_examples(variant):
3947
print(build_separator)
4048
print('| {:^79} |'.format('Board ' + variant))
4149
print(build_separator)
42-
print(build_format.format('Library', 'Example', 'Result', 'Time'))
50+
print(build_format.format('Library', 'Example', '\033[39mResult\033[0m', 'Time'))
4351
print(build_separator)
4452

4553
fqbn = "adafruit:nrf52:{}:softdevice={},debug=l0".format(variant, 's140v6' if variant != 'feather52832' else 's132v6')
4654

47-
for sketch in glob.iglob('libraries/**/*.ino', recursive=True):
55+
for sketch in all_examples:
4856
start_time = time.monotonic()
4957

5058
# Skip if contains: ".board.test.skip" or ".all.test.skip"
5159
# Skip if not contains: ".board.test.only" for a specific board
5260
sketchdir = os.path.dirname(sketch)
5361
if os.path.exists(sketchdir + '/.all.test.skip') or os.path.exists(sketchdir + '/.' + variant + '.test.skip'):
54-
success = "\033[33mskipped\033[0m "
62+
success = SKIPPED
5563
elif glob.glob(sketchdir+"/.*.test.only") and not os.path.exists(sketchdir + '/.' + variant + '.test.only'):
56-
success = "\033[33mskipped\033[0m "
64+
success = SKIPPED
5765
else:
5866
# TODO - preferably, would have STDERR show up in **both** STDOUT and STDERR.
5967
# preferably, would use Python logging handler to get both distinct outputs and one merged output
6068
# for now, split STDERR when building with all warnings enabled, so can detect warning/error output.
6169
if all_warnings:
62-
build_result = subprocess.run("arduino-cli compile --warnings all --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
70+
build_result = subprocess.run("arduino-cli compile --warnings all --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=PIPE, stderr=PIPE)
6371
else:
64-
build_result = subprocess.run("arduino-cli compile --warnings default --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
72+
build_result = subprocess.run("arduino-cli compile --warnings default --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=PIPE, stderr=PIPE)
6573

6674
# get stderr into a form where len(warningLines) indicates a true warning was output to stderr
6775
warningLines = [];
@@ -71,21 +79,21 @@ def build_examples(variant):
7179

7280
if build_result.returncode != 0:
7381
exit_status = build_result.returncode
74-
success = "\033[31mfailed\033[0m "
82+
success = FAILED
7583
fail_count += 1
7684
elif len(warningLines) != 0:
7785
exit_status = -1
78-
success = "\033[31mwarnings\033[0m "
86+
success = WARNING
7987
fail_count += 1
8088
else:
81-
success = "\033[32msucceeded\033[0m"
89+
success = SUCCEEDED
8290
success_count += 1
8391

8492
build_duration = time.monotonic() - start_time
8593

8694
print(build_format.format(sketch.split(os.path.sep)[1], os.path.basename(sketch), success, '{:5.2f}s'.format(build_duration)))
8795

88-
if success != "\033[33mskipped\033[0m ":
96+
if success != SKIPPED:
8997
if build_result.returncode != 0:
9098
print(build_result.stdout.decode("utf-8"))
9199
if (build_result.stderr):
@@ -96,15 +104,14 @@ def build_examples(variant):
96104
else:
97105
skip_count += 1
98106

99-
100107
build_time = time.monotonic()
101108

102109
for board in build_boards:
103110
build_examples(board)
104111

105112
print(build_separator)
106113
build_time = time.monotonic() - build_time
107-
print("Build Summary: {} \033[32msucceeded\033[0m, {} \033[31mfailed\033[0m, {} \033[33mskipped\033[0m and took {:.2f}s".format(success_count, fail_count, skip_count, build_time))
114+
print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(success_count, SUCCEEDED, fail_count, FAILED, skip_count, SKIPPED, build_time))
108115
print(build_separator)
109116

110117
sys.exit(exit_status)

0 commit comments

Comments
 (0)