Skip to content

Commit 56dafe5

Browse files
authored
Merge pull request #216 from jgfoster/BusIO
Add test for #192: fatal error: 'Adafruit_SPIDevice.h' file not found
2 parents cfd3d21 + adb1762 commit 56dafe5

File tree

12 files changed

+101
-0
lines changed

12 files changed

+101
-0
lines changed

Diff for: .travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ script:
3333
- cd ..
3434
- bundle install
3535
- bundle exec arduino_ci.rb
36+
- cd ../BusIO
37+
- bundle install
38+
- bundle exec arduino_ci.rb

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1717
- Definitions for Arduino zero
1818
- Support for mock EEPROM (but only if board supports it)
1919
- Add stubs for `Client.h`, `IPAddress.h`, `Printable.h`, `Server.h`, and `Udp.h`
20+
- Sample project for `BusIO` to show problem finding header file
2021

2122
### Changed
2223
- Move repository from https://github.com/ianfixes/arduino_ci to https://github.com/Arduino-CI/arduino_ci

Diff for: SampleProjects/BusIO/.arduino-ci.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
unittest:
2+
platforms:
3+
- mega2560
4+
libraries:
5+
- "Adafruit BusIO"
6+
# - "Adafruit_BusIO" <= This works if you have the library pre-installed
7+
8+
compile:
9+
platforms:
10+
- mega2560
11+
libraries:
12+
- "Adafruit BusIO"

Diff for: SampleProjects/BusIO/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.bundle

Diff for: SampleProjects/BusIO/Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
source 'https://rubygems.org'
2+
gem 'arduino_ci', path: '../../'

Diff for: SampleProjects/BusIO/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# BusIO
2+
3+
This is an example of a library that depends on Adafruit BusIO.
4+
It is provided to help reproduce #192.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <Adafruit_SPIDevice.h>
2+
3+
#define SPIDEVICE_CS 10
4+
Adafruit_SPIDevice spi_dev = Adafruit_SPIDevice(SPIDEVICE_CS);
5+
6+
7+
void setup() {
8+
while (!Serial) { delay(10); }
9+
Serial.begin(115200);
10+
Serial.println("SPI device read and write test");
11+
12+
if (!spi_dev.begin()) {
13+
Serial.println("Could not initialize SPI device");
14+
while (1);
15+
}
16+
17+
uint8_t buffer[32];
18+
19+
// Try to read 32 bytes
20+
spi_dev.read(buffer, 32);
21+
Serial.print("Read: ");
22+
for (uint8_t i=0; i<32; i++) {
23+
Serial.print("0x"); Serial.print(buffer[i], HEX); Serial.print(", ");
24+
}
25+
Serial.println();
26+
27+
// read a register by writing first, then reading
28+
buffer[0] = 0x8F; // we'll reuse the same buffer
29+
spi_dev.write_then_read(buffer, 1, buffer, 2, false);
30+
Serial.print("Write then Read: ");
31+
for (uint8_t i=0; i<2; i++) {
32+
Serial.print("0x"); Serial.print(buffer[i], HEX); Serial.print(", ");
33+
}
34+
Serial.println();
35+
}
36+
37+
void loop() {
38+
39+
}

Diff for: SampleProjects/BusIO/library.properties

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name=BusIO
2+
version=0.1.0
3+
author=James Foster <[email protected]>
4+
maintainer=James Foster <[email protected]>
5+
sentence=Sample BusIO library to validate import of Adafruit BusIO
6+
paragraph=Sample BusIO library to validate import of Adafruit BusIO
7+
category=Other
8+
url=https://github.com/Arduino-CI/arduino_ci/SampleProjects/BusIO
9+
architectures=avr,esp8266
10+
includes=BusIO.h

Diff for: SampleProjects/BusIO/src/BusIO.h

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <Adafruit_SPIDevice.h>
2+
#include <Arduino.h>
3+
4+
class BusIO {
5+
public:
6+
BusIO() {}
7+
~BusIO() {}
8+
int answer() { return 42; }
9+
}

Diff for: SampleProjects/BusIO/test/test.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
bundle config --local path vendor/bundle
3+
bundle install
4+
bundle exec arduino_ci.rb --skip-examples-compilation
5+
*/
6+
7+
#include <Arduino.h>
8+
#include <ArduinoUnitTests.h>
9+
#include <BusIO.h>
10+
11+
unittest(loop) {
12+
// token test
13+
BusIO busIO;
14+
assertEqual(42, busIO.answer()));
15+
}
16+
17+
unittest_main()

Diff for: appveyor.yml

+3
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ test_script:
3131
- cd ..
3232
- bundle install
3333
- bundle exec arduino_ci.rb
34+
- cd ../BusIO
35+
- bundle install
36+
- bundle exec arduino_ci.rb

Diff for: exe/arduino_ci.rb

100644100755
File mode changed.

0 commit comments

Comments
 (0)