Skip to content

Commit 0ef9a4d

Browse files
committed
Fix compilation errors in busIO code
1 parent fe4c689 commit 0ef9a4d

20 files changed

+216
-570
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2727
- Mocks of built-in macros made more accurate
2828
- NUM_SERIAL_PORTS can now be set explicitly
2929
- Improve SPI header strategy
30+
- Arduino backend is now `arduino-cli` version `0.13.0`
3031

3132
### Fixed
3233
- Don't define `ostream& operator<<(nullptr_t)` if already defined by Apple
@@ -39,6 +40,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3940
- Deprecated `arduino_ci_remote.rb` in favor of `arduino_ci.rb`
4041

4142
### Removed
43+
- `ARDUINO_CI_SKIP_SPLASH_SCREEN_RSPEC_TESTS` no longer affects any tests because there are no longer splash screens since switching to `arduino-cli`
4244

4345
### Security
4446

CONTRIBUTING.md

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ See `SampleProjects/TestSomething/test/*.cpp` for the existing tests (run by rsp
3131

3232
To speed up testing by targeting only the files you're working on, you can set several environment variables that `bundle exec rspec` will respond to:
3333

34-
* `ARDUINO_CI_SKIP_SPLASH_SCREEN_RSPEC_TESTS`: if set, this will avoid any rspec test that calls the arduino executable (and as such, causes the splash screen to pop up).
3534
* `ARDUINO_CI_SKIP_RUBY_RSPEC_TESTS`: if set, this will skip all tests against ruby code (useful if you are not changing Ruby code).
3635
* `ARDUINO_CI_SKIP_CPP_RSPEC_TESTS`: if set, this will skip all tests against the `TestSomething` sample project (useful if you are not changing C++ code).
3736
* `ARDUINO_CI_SELECT_CPP_TESTS=<glob>`: if set, this will skip all C++ unit tests whose filenames don't match the provided glob (executed in the tests directory)

SampleProjects/BusIO/src/BusIO.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ class BusIO {
66
BusIO() {}
77
~BusIO() {}
88
int answer() { return 42; }
9-
}
9+
};

SampleProjects/BusIO/test/test.cpp renamed to SampleProjects/BusIO/test/busio.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ bundle exec arduino_ci.rb --skip-examples-compilation
88
#include <ArduinoUnitTests.h>
99
#include <BusIO.h>
1010

11-
unittest(loop) {
11+
unittest(busio_answer) {
1212
// token test
1313
BusIO busIO;
14-
assertEqual(42, busIO.answer()));
14+
assertEqual(42, busIO.answer());
1515
}
1616

1717
unittest_main()

cpp/arduino/Wire.h

+12-3
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class TwoWire : public ObservableDataStream {
116116
// https://www.arduino.cc/en/Reference/WireRequestFrom
117117
// Used by the master to request bytes from a slave device. The bytes may then
118118
// be retrieved with the available() and read() functions.
119-
uint8_t requestFrom(uint8_t address, size_t quantity, bool stop) {
119+
uint8_t requestFrom(uint8_t address, uint8_t quantity, uint32_t _iaddress, uint8_t _isize, uint8_t stop) {
120120
assert(_didBegin);
121121
assert(address > 0 && address < SLAVE_COUNT);
122122
assert(quantity <= BUFFER_LENGTH);
@@ -131,11 +131,20 @@ class TwoWire : public ObservableDataStream {
131131
return 0;
132132
}
133133
}
134+
135+
uint8_t requestFrom(uint8_t address, uint8_t quantity, uint8_t stop) {
136+
return requestFrom((uint8_t)address, (uint8_t)quantity, (uint32_t)0, (uint8_t)0, (uint8_t)stop);
137+
}
138+
139+
uint8_t requestFrom(uint8_t address, uint8_t quantity) {
140+
return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)true);
141+
}
142+
134143
uint8_t requestFrom(int address, int quantity) {
135-
return requestFrom((uint8_t)address, (size_t)quantity, true);
144+
return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)true);
136145
}
137146
uint8_t requestFrom(int address, int quantity, int stop) {
138-
return requestFrom((uint8_t)address, (size_t)quantity, (bool)stop);
147+
return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)stop);
139148
}
140149

141150
// https://www.arduino.cc/en/Reference/WireWrite

exe/arduino_ci.rb

100644100755
+3-12
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,6 @@ def perform_compilation_tests(config)
262262
return
263263
end
264264

265-
# index the existing libraries
266-
attempt("Indexing libraries") { @arduino_cmd.index_libraries } unless @arduino_cmd.libraries_indexed
267-
268265
# initialize library under test
269266
installed_library_path = attempt("Installing library under test") do
270267
@arduino_cmd.install_local_library(Pathname.new("."))
@@ -345,7 +342,6 @@ def perform_compilation_tests(config)
345342

346343
install_arduino_library_dependencies(aux_libraries)
347344

348-
last_board = nil
349345
if config.platforms_to_build.empty?
350346
inform("Skipping builds") { "no platforms were requested" }
351347
return
@@ -356,8 +352,6 @@ def perform_compilation_tests(config)
356352
return
357353
end
358354

359-
attempt("Setting compiler warning level") { @arduino_cmd.set_pref("compiler.warning_level", "all") }
360-
361355
# switching boards takes time, so iterate board first
362356
# _then_ whichever examples match it
363357
examples_by_platform = library_examples.each_with_object({}) do |example_path, acc|
@@ -370,13 +364,10 @@ def perform_compilation_tests(config)
370364

371365
examples_by_platform.each do |platform, example_paths|
372366
board = example_platform_info[platform][:board]
373-
assure("Switching to board for #{platform} (#{board})") { @arduino_cmd.use_board(board) } unless last_board == board
374-
last_board = board
375-
376367
example_paths.each do |example_path|
377368
example_name = File.basename(example_path)
378-
attempt("Verifying #{example_name}") do
379-
ret = @arduino_cmd.verify_sketch(example_path)
369+
attempt("Compiling #{example_name} for #{board}") do
370+
ret = @arduino_cmd.compile_sketch(example_path, board)
380371
unless ret
381372
puts
382373
puts "Last command: #{@arduino_cmd.last_msg}"
@@ -393,7 +384,7 @@ def perform_compilation_tests(config)
393384
config = ArduinoCI::CIConfig.default.from_project_library
394385

395386
@arduino_cmd = ArduinoCI::ArduinoInstallation.autolocate!
396-
inform("Located Arduino binary") { @arduino_cmd.binary_path.to_s }
387+
inform("Located arduino-cli binary") { @arduino_cmd.binary_path.to_s }
397388

398389
perform_unit_tests(config)
399390
perform_compilation_tests(config)

0 commit comments

Comments
 (0)