Skip to content

Add test for #192: fatal error: 'Adafruit_SPIDevice.h' file not found #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ script:
- cd ..
- bundle install
- bundle exec arduino_ci.rb
- cd ../BusIO
- bundle install
- bundle exec arduino_ci.rb
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Definitions for Arduino zero
- Support for mock EEPROM (but only if board supports it)
- Add stubs for `Client.h`, `IPAddress.h`, `Printable.h`, `Server.h`, and `Udp.h`
- Sample project for `BusIO` to show problem finding header file

### Changed
- Move repository from https://github.com/ianfixes/arduino_ci to https://github.com/Arduino-CI/arduino_ci
Expand Down
12 changes: 12 additions & 0 deletions SampleProjects/BusIO/.arduino-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
unittest:
platforms:
- mega2560
libraries:
- "Adafruit BusIO"
# - "Adafruit_BusIO" <= This works if you have the library pre-installed

compile:
platforms:
- mega2560
libraries:
- "Adafruit BusIO"
1 change: 1 addition & 0 deletions SampleProjects/BusIO/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.bundle
2 changes: 2 additions & 0 deletions SampleProjects/BusIO/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem 'arduino_ci', path: '../../'
4 changes: 4 additions & 0 deletions SampleProjects/BusIO/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# BusIO

This is an example of a library that depends on Adafruit BusIO.
It is provided to help reproduce #192.
39 changes: 39 additions & 0 deletions SampleProjects/BusIO/examples/spi_readwrite/spi_readwrite.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <Adafruit_SPIDevice.h>

#define SPIDEVICE_CS 10
Adafruit_SPIDevice spi_dev = Adafruit_SPIDevice(SPIDEVICE_CS);


void setup() {
while (!Serial) { delay(10); }
Serial.begin(115200);
Serial.println("SPI device read and write test");

if (!spi_dev.begin()) {
Serial.println("Could not initialize SPI device");
while (1);
}

uint8_t buffer[32];

// Try to read 32 bytes
spi_dev.read(buffer, 32);
Serial.print("Read: ");
for (uint8_t i=0; i<32; i++) {
Serial.print("0x"); Serial.print(buffer[i], HEX); Serial.print(", ");
}
Serial.println();

// read a register by writing first, then reading
buffer[0] = 0x8F; // we'll reuse the same buffer
spi_dev.write_then_read(buffer, 1, buffer, 2, false);
Serial.print("Write then Read: ");
for (uint8_t i=0; i<2; i++) {
Serial.print("0x"); Serial.print(buffer[i], HEX); Serial.print(", ");
}
Serial.println();
}

void loop() {

}
10 changes: 10 additions & 0 deletions SampleProjects/BusIO/library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name=BusIO
version=0.1.0
author=James Foster <[email protected]>
maintainer=James Foster <[email protected]>
sentence=Sample BusIO library to validate import of Adafruit BusIO
paragraph=Sample BusIO library to validate import of Adafruit BusIO
category=Other
url=https://github.com/Arduino-CI/arduino_ci/SampleProjects/BusIO
architectures=avr,esp8266
includes=BusIO.h
9 changes: 9 additions & 0 deletions SampleProjects/BusIO/src/BusIO.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <Adafruit_SPIDevice.h>
#include <Arduino.h>

class BusIO {
public:
BusIO() {}
~BusIO() {}
int answer() { return 42; }
}
17 changes: 17 additions & 0 deletions SampleProjects/BusIO/test/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
bundle config --local path vendor/bundle
bundle install
bundle exec arduino_ci.rb --skip-examples-compilation
*/

#include <Arduino.h>
#include <ArduinoUnitTests.h>
#include <BusIO.h>

unittest(loop) {
// token test
BusIO busIO;
assertEqual(42, busIO.answer()));
}

unittest_main()
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ test_script:
- cd ..
- bundle install
- bundle exec arduino_ci.rb
- cd ../BusIO
- bundle install
- bundle exec arduino_ci.rb
Empty file modified exe/arduino_ci.rb
100644 → 100755
Empty file.