10 files changed
+48
-40
No files matched your search
@@ -46,7 +46,7 @@ TwoWire::TwoWire(NRF_TWIM_Type * p_twim, NRF_TWIS_Type * p_twis, IRQn_Type IRQn,
|
||||
}
|
||||
|
||||
void TwoWire::begin(void) {
|
||||
//Master Mode
|
||||
//Main Mode
|
||||
master = true;
|
||||
|
||||
*pincfg_reg(_uc_pinSCL) = ((uint32_t)GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos)
|
||||
@@ -72,7 +72,7 @@ void TwoWire::begin(void) {
|
||||
}
|
||||
|
||||
void TwoWire::begin(uint8_t address) {
|
||||
//Slave mode
|
||||
//Secondary mode
|
||||
master = false;
|
||||
|
||||
*pincfg_reg(_uc_pinSCL) = ((uint32_t)GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
void setup()
|
||||
{
|
||||
Wire.begin(); // join i2c bus (address optional for master)
|
||||
Wire.begin(); // join i2c bus (address optional for main)
|
||||
Serial.begin(9600); // start serial communication at 9600bps
|
||||
while ( !Serial ) delay(10); // for nrf52840 with native usb
|
||||
}
|
||||
@@ -42,7 +42,7 @@ void loop()
|
||||
Wire.endTransmission(); // stop transmitting
|
||||
|
||||
// step 4: request reading from sensor
|
||||
Wire.requestFrom(112, 2); // request 2 bytes from slave device #112
|
||||
Wire.requestFrom(112, 2); // request 2 bytes from secondary device #112
|
||||
|
||||
// step 5: receive reading from sensor
|
||||
if(2 <= Wire.available()) // if two bytes were received
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
void setup()
|
||||
{
|
||||
Wire.begin(); // join i2c bus (address optional for master)
|
||||
Wire.begin(); // join i2c bus (address optional for main)
|
||||
}
|
||||
|
||||
byte val = 0;
|
||||
|
||||
+6
-6
@@ -1,9 +1,9 @@
|
||||
// Wire Master Reader
|
||||
// Wire Main Reader
|
||||
// by Nicholas Zambetti <http://www.zambetti.com>
|
||||
|
||||
// Demonstrates use of the Wire library
|
||||
// Reads data from an I2C/TWI slave device
|
||||
// Refer to the "Wire Slave Sender" example for use with this
|
||||
// Reads data from an I2C/TWI secondary device
|
||||
// Refer to the "Wire Secondary Sender" example for use with this
|
||||
|
||||
// Created 29 March 2006
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
|
||||
void setup()
|
||||
{
|
||||
Wire.begin(); // join i2c bus (address optional for master)
|
||||
Wire.begin(); // join i2c bus (address optional for main)
|
||||
Serial.begin(9600); // start serial for output
|
||||
while ( !Serial ) delay(10); // for nrf52840 with native usb
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Wire.requestFrom(2, 6); // request 6 bytes from slave device #2
|
||||
Wire.requestFrom(2, 6); // request 6 bytes from secondary device #2
|
||||
|
||||
while(Wire.available()) // slave may send less than requested
|
||||
while(Wire.available()) // secondary may send less than requested
|
||||
{
|
||||
char c = Wire.read(); // receive a byte as character
|
||||
Serial.print(c); // print the character
|
||||
+1
-1
@@ -7,7 +7,7 @@ void setup()
|
||||
{
|
||||
Serial.begin(115200); // start serial for output
|
||||
while ( !Serial ) delay(10); // for nrf52840 with native usb
|
||||
wi->begin(); // join i2c bus (address optional for master)
|
||||
wi->begin(); // join i2c bus (address optional for main)
|
||||
}
|
||||
|
||||
void loop()
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
// Wire Master Writer
|
||||
// Wire Main Writer
|
||||
// by Nicholas Zambetti <http://www.zambetti.com>
|
||||
|
||||
// Demonstrates use of the Wire library
|
||||
// Writes data to an I2C/TWI slave device
|
||||
// Refer to the "Wire Slave Receiver" example for use with this
|
||||
// Writes data to an I2C/TWI secondary device
|
||||
// Refer to the "Wire Secondary Receiver" example for use with this
|
||||
|
||||
// Created 29 March 2006
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
void setup()
|
||||
{
|
||||
Wire.begin(); // join i2c bus (address optional for master)
|
||||
Wire.begin(); // join i2c bus (address optional for main)
|
||||
}
|
||||
|
||||
byte x = 0;
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
// Wire Slave Receiver
|
||||
// Wire Secondary Receiver
|
||||
// by Nicholas Zambetti <http://www.zambetti.com>
|
||||
|
||||
// Demonstrates use of the Wire library
|
||||
// Receives data as an I2C/TWI slave device
|
||||
// Refer to the "Wire Master Writer" example for use with this
|
||||
// Receives data as an I2C/TWI secondary device
|
||||
// Refer to the "Wire Main Writer" example for use with this
|
||||
|
||||
// Created 29 March 2006
|
||||
|
||||
@@ -25,7 +25,7 @@ void loop()
|
||||
delay(100);
|
||||
}
|
||||
|
||||
// function that executes whenever data is received from master
|
||||
// function that executes whenever data is received from main
|
||||
// this function is registered as an event, see setup()
|
||||
void receiveEvent(int howMany)
|
||||
{
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
// Wire Slave Sender
|
||||
// Wire Secondary Sender
|
||||
// by Nicholas Zambetti <http://www.zambetti.com>
|
||||
|
||||
// Demonstrates use of the Wire library
|
||||
// Sends data as an I2C/TWI slave device
|
||||
// Refer to the "Wire Master Reader" example for use with this
|
||||
// Sends data as an I2C/TWI secondary device
|
||||
// Refer to the "Wire Main Reader" example for use with this
|
||||
|
||||
// Created 29 March 2006
|
||||
|
||||
@@ -23,10 +23,10 @@ void loop()
|
||||
delay(100);
|
||||
}
|
||||
|
||||
// function that executes whenever data is requested by master
|
||||
// function that executes whenever data is requested by main
|
||||
// this function is registered as an event, see setup()
|
||||
void requestEvent()
|
||||
{
|
||||
Wire.write("hello "); // respond with message of 6 bytes
|
||||
// as expected by master
|
||||
// as expected by main
|
||||
}
|
||||
+2
-1
@@ -74,6 +74,7 @@ compiler.c.elf.extra_flags=
|
||||
compiler.cpp.extra_flags=
|
||||
compiler.S.extra_flags=
|
||||
compiler.ar.extra_flags=
|
||||
compiler.libraries.ldflags=
|
||||
compiler.elf2bin.extra_flags=
|
||||
compiler.elf2hex.extra_flags=
|
||||
|
||||
@@ -94,7 +95,7 @@ recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU=
|
||||
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
|
||||
|
||||
## Combine gc-sections, archives, and objects
|
||||
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
|
||||
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
|
||||
|
||||
## Create output (bin file)
|
||||
#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"
|
||||
|
||||
+21
-14
@@ -2,19 +2,24 @@ import os
|
||||
import glob
|
||||
import sys
|
||||
import subprocess
|
||||
from subprocess import Popen, PIPE
|
||||
import time
|
||||
|
||||
SUCCEEDED = "\033[32msucceeded\033[0m"
|
||||
FAILED = "\033[31mfailed\033[0m"
|
||||
SKIPPED = "\033[33mskipped\033[0m"
|
||||
WARNING = "\033[31mwarnings\033[0m"
|
||||
|
||||
all_warnings = False
|
||||
exit_status = 0
|
||||
success_count = 0
|
||||
fail_count = 0
|
||||
skip_count = 0
|
||||
|
||||
build_format = '| {:20} | {:35} | {:9} | {:6} |'
|
||||
build_format = '| {:20} | {:35} | {:18} | {:6} |'
|
||||
build_separator = '-' * 83
|
||||
|
||||
default_boards = [ 'cluenrf52840', 'cplaynrf52840', 'feather52832', 'feather52840', 'feather52840sense', 'itsybitsy52840' ]
|
||||
|
||||
build_boards = []
|
||||
|
||||
# build all variants if input not existed
|
||||
@@ -23,6 +28,9 @@ if len(sys.argv) > 1:
|
||||
else:
|
||||
build_boards = default_boards
|
||||
|
||||
all_examples = list(glob.iglob('libraries/**/*.ino', recursive=True))
|
||||
all_examples.sort()
|
||||
|
||||
def errorOutputFilter(line):
|
||||
if len(line) == 0:
|
||||
return False
|
||||
@@ -39,29 +47,29 @@ def build_examples(variant):
|
||||
print(build_separator)
|
||||
print('| {:^79} |'.format('Board ' + variant))
|
||||
print(build_separator)
|
||||
print(build_format.format('Library', 'Example', 'Result', 'Time'))
|
||||
print(build_format.format('Library', 'Example', '\033[39mResult\033[0m', 'Time'))
|
||||
print(build_separator)
|
||||
|
||||
fqbn = "adafruit:nrf52:{}:softdevice={},debug=l0".format(variant, 's140v6' if variant != 'feather52832' else 's132v6')
|
||||
|
||||
for sketch in glob.iglob('libraries/**/*.ino', recursive=True):
|
||||
for sketch in all_examples:
|
||||
start_time = time.monotonic()
|
||||
|
||||
# Skip if contains: ".board.test.skip" or ".all.test.skip"
|
||||
# Skip if not contains: ".board.test.only" for a specific board
|
||||
sketchdir = os.path.dirname(sketch)
|
||||
if os.path.exists(sketchdir + '/.all.test.skip') or os.path.exists(sketchdir + '/.' + variant + '.test.skip'):
|
||||
success = "\033[33mskipped\033[0m "
|
||||
success = SKIPPED
|
||||
elif glob.glob(sketchdir+"/.*.test.only") and not os.path.exists(sketchdir + '/.' + variant + '.test.only'):
|
||||
success = "\033[33mskipped\033[0m "
|
||||
success = SKIPPED
|
||||
else:
|
||||
# TODO - preferably, would have STDERR show up in **both** STDOUT and STDERR.
|
||||
# preferably, would use Python logging handler to get both distinct outputs and one merged output
|
||||
# for now, split STDERR when building with all warnings enabled, so can detect warning/error output.
|
||||
if all_warnings:
|
||||
build_result = subprocess.run("arduino-cli compile --warnings all --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
build_result = subprocess.run("arduino-cli compile --warnings all --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=PIPE, stderr=PIPE)
|
||||
else:
|
||||
build_result = subprocess.run("arduino-cli compile --warnings default --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
build_result = subprocess.run("arduino-cli compile --warnings default --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=PIPE, stderr=PIPE)
|
||||
|
||||
# get stderr into a form where len(warningLines) indicates a true warning was output to stderr
|
||||
warningLines = [];
|
||||
@@ -71,21 +79,21 @@ def build_examples(variant):
|
||||
|
||||
if build_result.returncode != 0:
|
||||
exit_status = build_result.returncode
|
||||
success = "\033[31mfailed\033[0m "
|
||||
success = FAILED
|
||||
fail_count += 1
|
||||
elif len(warningLines) != 0:
|
||||
exit_status = -1
|
||||
success = "\033[31mwarnings\033[0m "
|
||||
success = WARNING
|
||||
fail_count += 1
|
||||
else:
|
||||
success = "\033[32msucceeded\033[0m"
|
||||
success = SUCCEEDED
|
||||
success_count += 1
|
||||
|
||||
build_duration = time.monotonic() - start_time
|
||||
|
||||
print(build_format.format(sketch.split(os.path.sep)[1], os.path.basename(sketch), success, '{:5.2f}s'.format(build_duration)))
|
||||
|
||||
if success != "\033[33mskipped\033[0m ":
|
||||
if success != SKIPPED:
|
||||
if build_result.returncode != 0:
|
||||
print(build_result.stdout.decode("utf-8"))
|
||||
if (build_result.stderr):
|
||||
@@ -96,7 +104,6 @@ def build_examples(variant):
|
||||
else:
|
||||
skip_count += 1
|
||||
|
||||
|
||||
build_time = time.monotonic()
|
||||
|
||||
for board in build_boards:
|
||||
@@ -104,7 +111,7 @@ for board in build_boards:
|
||||
|
||||
print(build_separator)
|
||||
build_time = time.monotonic() - build_time
|
||||
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))
|
||||
print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(success_count, SUCCEEDED, fail_count, FAILED, skip_count, SKIPPED, build_time))
|
||||
print(build_separator)
|
||||
|
||||
sys.exit(exit_status)
|
||||
Reference in new issue
Block a user