arduino_ci 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +48 -336
- data/cpp/arduino/Arduino.h +4 -68
- data/cpp/arduino/Godmode.cpp +14 -0
- data/cpp/arduino/Godmode.h +32 -12
- data/cpp/arduino/SPI.h +150 -0
- data/cpp/arduino/ci/Table.h +8 -0
- data/exe/arduino_ci_remote.rb +88 -33
- data/exe/arduino_ci_remote.rb.orig +216 -0
- data/exe/ensure_arduino_installation.rb +5 -0
- data/lib/arduino_ci/arduino_cmd.rb +40 -32
- data/lib/arduino_ci/arduino_cmd_linux.rb +2 -20
- data/lib/arduino_ci/arduino_cmd_linux_builder.rb +0 -18
- data/lib/arduino_ci/arduino_cmd_osx.rb +0 -17
- data/lib/arduino_ci/arduino_cmd_windows.rb +0 -17
- data/lib/arduino_ci/arduino_downloader.rb +4 -0
- data/lib/arduino_ci/arduino_downloader_linux.rb +2 -0
- data/lib/arduino_ci/arduino_downloader_windows.rb +2 -0
- data/lib/arduino_ci/arduino_installation.rb +6 -3
- data/lib/arduino_ci/ci_config.rb +13 -3
- data/lib/arduino_ci/cpp_library.rb +129 -52
- data/lib/arduino_ci/host.rb +10 -4
- data/lib/arduino_ci/version.rb +1 -1
- metadata +11 -11
- data/lib/arduino_ci/arduino_downloader.rb.orig +0 -219
- data/lib/arduino_ci/arduino_downloader_linux.rb.orig +0 -79
- data/lib/arduino_ci/arduino_downloader_osx.rb.orig +0 -88
- data/lib/arduino_ci/arduino_installation.rb.orig +0 -116
- data/lib/arduino_ci/display_manager.rb +0 -192
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 158ec153267d358e71149cc9814043f1d1d8c07a1be5f8e261f794d3159e4bad
|
4
|
+
data.tar.gz: e03b6a69dc0e486d9147e7bdc48c4bf4b595c66caad48ed8c03350814dcffd1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c216c4195a1166c99a252e666f30e8e73cf6018ccb61fba693fef08da319710c180d88cf57c5207a3b1a03e168ee208c202e056cdfaec2765d6f8455ecc33e0
|
7
|
+
data.tar.gz: 41c4a7a2f88a49c28ed1315316e37495e057e934f85b2c67002d90583dbecaa7b637371a69e49d1edc57ccdcb0fbf90623202fef6658e6648a38849ae35e2b68
|
data/README.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
|
2
|
-
# ArduinoCI Ruby gem (`arduino_ci`) [![Gem Version](https://badge.fury.io/rb/arduino_ci.svg)](https://rubygems.org/gems/arduino_ci) [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/arduino_ci/0.1.
|
2
|
+
# ArduinoCI Ruby gem (`arduino_ci`) [![Gem Version](https://badge.fury.io/rb/arduino_ci.svg)](https://rubygems.org/gems/arduino_ci) [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/arduino_ci/0.1.11)
|
3
3
|
|
4
|
+
You want your Arduino library to be automatically built and tested every time someone contributes code to your project on GitHub, but the Arduino IDE lacks the ability to run unit tests. [Arduino CI](https://github.com/ianfixes/arduino_ci) provides that ability.
|
4
5
|
|
5
|
-
|
6
|
+
You want to run tests on your Arduino library without hardware present, but the IDE doesn't support that. Arduino CI proivdes that ability.
|
6
7
|
|
7
|
-
|
8
|
+
You want to precisely replicate certain software states in your library, but you don't have sub-millisecond reflexes for physically faking the inputs, outputs, and serial port. Arduino CI fakes 100% of the physical input and output of an Arduino board, including the clock.
|
8
9
|
|
9
|
-
|
10
|
+
`arduino_ci` is a cross-platform build/test system, consisting of a Ruby gem and a series of C++ mocks. It enables tests to be run both locally and as part of a CI service like Travis or Appveyor. Any OS that can run the Arduino IDE can run `arduino_ci`.
|
10
11
|
|
11
12
|
Platform | CI Status
|
12
13
|
---------|:---------
|
@@ -17,6 +18,15 @@ Windows | [![Windows Build status](https://ci.appveyor.com/api/projects/status/
|
|
17
18
|
|
18
19
|
## Installation In Your GitHub Project And Using Travis CI
|
19
20
|
|
21
|
+
The following prerequisites must be fulfilled:
|
22
|
+
|
23
|
+
* A compiler; [g++](https://gcc.gnu.org/) is preferred. On OSX, this is provided by the built-in `clang`.
|
24
|
+
* A GitHub (or other repository-hosting) project for your library
|
25
|
+
* A CI system like Travis or Appveor that is linked to your project
|
26
|
+
|
27
|
+
|
28
|
+
### Changes to Your Repo
|
29
|
+
|
20
30
|
Add a file called `Gemfile` (no extension) to your Arduino project:
|
21
31
|
|
22
32
|
```ruby
|
@@ -24,7 +34,14 @@ source 'https://rubygems.org'
|
|
24
34
|
gem 'arduino_ci'
|
25
35
|
```
|
26
36
|
|
27
|
-
|
37
|
+
> **Note:** `arduino_ci_remote.rb` expects to be run from the root directory of your Arduino project library.
|
38
|
+
|
39
|
+
|
40
|
+
#### Travis CI
|
41
|
+
|
42
|
+
You'll need to go to https://travis-ci.org/profile/ and enable testing for your Arduino project. Once that happens, you should be all set. The script will test all example projects of the library and all unit tests.
|
43
|
+
|
44
|
+
Next, you need this in `.travis.yml` in your repo
|
28
45
|
|
29
46
|
```yaml
|
30
47
|
sudo: false
|
@@ -34,348 +51,32 @@ script:
|
|
34
51
|
- bundle exec arduino_ci_remote.rb
|
35
52
|
```
|
36
53
|
|
37
|
-
|
38
|
-
|
39
|
-
> **Note:** `arduino_ci_remote.rb` expects to be run from the root directory of your Arduino project library.
|
40
|
-
|
41
|
-
### Unit tests in `test/`
|
42
|
-
|
43
|
-
All `.cpp` files in the `test/` directory of your Arduino library are assumed to contain unit tests. Each and every one will be compiled and executed on its own.
|
44
|
-
|
45
|
-
The most basic unit test file is as follows:
|
46
|
-
|
47
|
-
```C++
|
48
|
-
#include <ArduinoUnitTests.h>
|
49
|
-
#include "../do-something.h"
|
50
|
-
|
51
|
-
unittest(your_test_name)
|
52
|
-
{
|
53
|
-
assertEqual(4, doSomething());
|
54
|
-
}
|
55
|
-
|
56
|
-
unittest_main()
|
57
|
-
```
|
58
|
-
|
59
|
-
This test defines one `unittest` (a macro provided by `ArduionUnitTests.h`), called `your_test_name`, which makes some assertions on the target library. The `unittest_main()` is a macro for the `int main()` boilerplate required for unit testing.
|
54
|
+
#### Appveyor CI
|
60
55
|
|
56
|
+
You'll need to go to https://ci.appveyor.com/projects and add your project.
|
61
57
|
|
62
|
-
|
63
|
-
|
64
|
-
Complete control of the Arduino environment is available in your unit tests through a construct called `GODMODE()`.
|
65
|
-
|
66
|
-
```C++
|
67
|
-
unittest(example_godmode_stuff)
|
68
|
-
{
|
69
|
-
GodmodeState* state = GODMODE(); // get access to the state
|
70
|
-
state->reset(); // does a full reset of the state.
|
71
|
-
state->resetClock(); // - you can reset just the clock (to zero)
|
72
|
-
state->resetPins(); // - or just the pins
|
73
|
-
state->micros = 1; // manually set the clock such that micros() returns 1
|
74
|
-
state->digitalPin[4]; // tells you the commanded state of digital pin 4
|
75
|
-
state->digitalPin[4] = HIGH; // digitalRead(4) will now return HIGH
|
76
|
-
state->analogPin[3]; // tells you the commanded state of analog pin 3
|
77
|
-
state->analogPin[3] = 99; // analogRead(3) will now return 99
|
78
|
-
}
|
79
|
-
```
|
80
|
-
|
81
|
-
#### Pin Histories
|
82
|
-
|
83
|
-
Of course, it's possible that your code might flip the bit more than once in a function. For that scenario, you may want to examine the history of a pin's commanded outputs:
|
84
|
-
|
85
|
-
```C++
|
86
|
-
unittest(pin_history)
|
87
|
-
{
|
88
|
-
GodmodeState* state = GODMODE();
|
89
|
-
int myPin = 3;
|
90
|
-
state->reset(); // pin will start LOW
|
91
|
-
digitalWrite(myPin, HIGH);
|
92
|
-
digitalWrite(myPin, LOW);
|
93
|
-
digitalWrite(myPin, LOW);
|
94
|
-
digitalWrite(myPin, HIGH);
|
95
|
-
digitalWrite(myPin, HIGH);
|
96
|
-
|
97
|
-
// pin history is queued in case we want to analyze it later.
|
98
|
-
// we expect 6 values in that queue.
|
99
|
-
assertEqual(6, state->digitalPin[1].size());
|
100
|
-
bool expected[6] = {LOW, HIGH, LOW, LOW, HIGH, HIGH};
|
101
|
-
bool actual[6];
|
102
|
-
|
103
|
-
// convert history queue into an array so we can verify it
|
104
|
-
int numMoved = state->digitalPin[myPin].toArray(actual, 6);
|
105
|
-
assertEqual(6, numMoved);
|
106
|
-
|
107
|
-
// verify each element
|
108
|
-
for (int i = 0; i < 6; ++i) {
|
109
|
-
assertEqual(expected[i], actual[i]);
|
110
|
-
}
|
111
|
-
}
|
112
|
-
```
|
113
|
-
|
114
|
-
|
115
|
-
#### Pin Futures
|
116
|
-
|
117
|
-
Reading the pin more than once per function is also a possibility. In that case, we want to queue up a few values for the `digitalRead` or `analogRead` to find.
|
118
|
-
|
119
|
-
```C++
|
120
|
-
unittest(pin_read_history)
|
121
|
-
{
|
122
|
-
GodmodeState* state = GODMODE();
|
123
|
-
state->reset();
|
124
|
-
|
125
|
-
int future[6] = {33, 22, 55, 11, 44, 66};
|
126
|
-
state->analogPin[1].fromArray(future, 6);
|
127
|
-
for (int i = 0; i < 6; ++i)
|
128
|
-
{
|
129
|
-
assertEqual(future[i], analogRead(1));
|
130
|
-
}
|
131
|
-
|
132
|
-
// for digital pins, we have the added possibility of specifying
|
133
|
-
// a stream of input bytes encoded as ASCII
|
134
|
-
bool bigEndian = true;
|
135
|
-
state->digitalPin[1].fromAscii("Yo", bigEndian);
|
136
|
-
|
137
|
-
// digitial history as serial data, big-endian
|
138
|
-
bool expectedBits[16] = {
|
139
|
-
0, 1, 0, 1, 1, 0, 0, 1, // Y
|
140
|
-
0, 1, 1, 0, 1, 1, 1, 1 // o
|
141
|
-
};
|
142
|
-
|
143
|
-
for (int i = 0; i < 16; ++i) {
|
144
|
-
assertEqual(expectedBits[i], digitalRead(1));
|
145
|
-
}
|
146
|
-
}
|
147
|
-
```
|
148
|
-
|
149
|
-
#### Serial Data
|
150
|
-
|
151
|
-
Basic input and output verification of serial port data can be done as follows:
|
152
|
-
|
153
|
-
```c++
|
154
|
-
unittest(reading_writing_serial)
|
155
|
-
{
|
156
|
-
GodmodeState* state = GODMODE();
|
157
|
-
state->serialPort[0].dataIn = ""; // the queue of data waiting to be read
|
158
|
-
state->serialPort[0].dataOut = ""; // the history of data written
|
159
|
-
|
160
|
-
// When there is no data, nothing happens
|
161
|
-
assertEqual(-1, Serial.peek());
|
162
|
-
assertEqual("", state->serialPort[0].dataIn);
|
163
|
-
assertEqual("", state->serialPort[0].dataOut);
|
164
|
-
|
165
|
-
// if we put data on the input and peek at it, we see the value and it's not consumed
|
166
|
-
state->serialPort[0].dataIn = "a";
|
167
|
-
assertEqual('a', Serial.peek());
|
168
|
-
assertEqual("a", state->serialPort[0].dataIn);
|
169
|
-
assertEqual("", state->serialPort[0].dataOut);
|
170
|
-
|
171
|
-
// if we read the input, we see the value and it's consumed
|
172
|
-
assertEqual('a', Serial.read());
|
173
|
-
assertEqual("", state->serialPort[0].dataIn);
|
174
|
-
assertEqual("", state->serialPort[0].dataOut);
|
175
|
-
|
176
|
-
// when we write data, it shows up in the history -- the output buffer
|
177
|
-
Serial.write('b');
|
178
|
-
assertEqual("", state->serialPort[0].dataIn);
|
179
|
-
assertEqual("b", state->serialPort[0].dataOut);
|
180
|
-
|
181
|
-
// when we print more data, note that the history
|
182
|
-
// still contains the first thing we wrote
|
183
|
-
Serial.print("cdefg");
|
184
|
-
assertEqual("", state->serialPort[0].dataIn);
|
185
|
-
assertEqual("bcdefg", state->serialPort[0].dataOut);
|
186
|
-
}
|
187
|
-
```
|
188
|
-
|
189
|
-
A more complicated example: working with serial port IO. Let's say I have the following function:
|
190
|
-
|
191
|
-
```C++
|
192
|
-
void smartLightswitchSerialHandler(int pin) {
|
193
|
-
if (Serial.available() > 0) {
|
194
|
-
int incomingByte = Serial.read();
|
195
|
-
int val = incomingByte == '0' ? LOW : HIGH;
|
196
|
-
Serial.print("Ack ");
|
197
|
-
digitalWrite(pin, val);
|
198
|
-
Serial.print(String(pin));
|
199
|
-
Serial.print(" ");
|
200
|
-
Serial.print((char)incomingByte);
|
201
|
-
}
|
202
|
-
}
|
203
|
-
```
|
204
|
-
|
205
|
-
This function has 3 side effects: it drains the serial port's receive buffer, affects a pin, and puts data in the serial port's send buffer. Or, if the receive buffer is empty, it does nothing at all.
|
206
|
-
|
207
|
-
```C++
|
208
|
-
unittest(does_nothing_if_no_data)
|
209
|
-
{
|
210
|
-
// configure initial state
|
211
|
-
GodmodeState* state = GODMODE();
|
212
|
-
int myPin = 3;
|
213
|
-
state->serialPort[0].dataIn = "";
|
214
|
-
state->serialPort[0].dataOut = "";
|
215
|
-
state->digitalPin[myPin] = LOW;
|
216
|
-
|
217
|
-
// execute action
|
218
|
-
smartLightswitchSerialHandler(myPin);
|
219
|
-
|
220
|
-
// assess final state
|
221
|
-
assertEqual(LOW, state->digitalPin[myPin]);
|
222
|
-
assertEqual("", state->serialPort[0].dataIn);
|
223
|
-
assertEqual("", state->serialPort[0].dataOut);
|
224
|
-
}
|
225
|
-
|
226
|
-
unittest(two_flips)
|
227
|
-
{
|
228
|
-
GodmodeState* state = GODMODE();
|
229
|
-
int myPin = 3;
|
230
|
-
state->serialPort[0].dataIn = "10junk";
|
231
|
-
state->serialPort[0].dataOut = "";
|
232
|
-
state->digitalPin[myPin] = LOW;
|
233
|
-
smartLightswitchSerialHandler(myPin);
|
234
|
-
assertEqual(HIGH, state->digitalPin[myPin]);
|
235
|
-
assertEqual("0junk", state->serialPort[0].dataIn);
|
236
|
-
assertEqual("Ack 3 1", state->serialPort[0].dataOut);
|
237
|
-
|
238
|
-
state->serialPort[0].dataOut = "";
|
239
|
-
smartLightswitchSerialHandler(myPin);
|
240
|
-
assertEqual(LOW, state->digitalPin[myPin]);
|
241
|
-
assertEqual("junk", state->serialPort[0].dataIn);
|
242
|
-
assertEqual("Ack 3 0", state->serialPort[0].dataOut);
|
243
|
-
}
|
244
|
-
```
|
245
|
-
|
246
|
-
#### Pin History as ASCII
|
247
|
-
|
248
|
-
|
249
|
-
For additional complexity, there are some cases where you want to use a pin as a serial port. There are history functions for that too.
|
250
|
-
|
251
|
-
```C++
|
252
|
-
int myPin = 3;
|
253
|
-
|
254
|
-
// digitial history as serial data, big-endian
|
255
|
-
bool bigEndian = true;
|
256
|
-
bool binaryAscii[24] = {
|
257
|
-
0, 1, 0, 1, 1, 0, 0, 1, // Y
|
258
|
-
0, 1, 1, 0, 0, 1, 0, 1, // e
|
259
|
-
0, 1, 1, 1, 0, 0, 1, 1 // s
|
260
|
-
};
|
261
|
-
|
262
|
-
// "send" these bits
|
263
|
-
for (int i = 0; i < 24; digitalWrite(myPin, binaryAscii[i++]));
|
264
|
-
|
265
|
-
// The first bit in the history is the initial value, which we will ignore
|
266
|
-
int offset = 1;
|
267
|
-
|
268
|
-
// We should be able to parse the bits as ascii
|
269
|
-
assertEqual("Yes", state->digitalPin[myPin].toAscii(offset, bigEndian));
|
270
|
-
```
|
271
|
-
|
272
|
-
Instead of queueing bits as ASCII for future use with `toAscii`, you can send those bits directly (and immediately) to the output using `outgoingFromAscii`. Likewise, you can reinterpret/examine (as ASCII) the bits you have previously queued up by calling `incomingToAscii` on the PinHistory object.
|
273
|
-
|
274
|
-
|
275
|
-
#### Interactivity of "Devices" with Observers
|
276
|
-
|
277
|
-
Even pin history and input/output buffers aren't capable of testing interactive code. For example, queueing the canned responses from a serial device before the requests are even sent to it is not a sane test environment; the library under test will see the entire future waiting for it on the input pin instead of a buffer that fills and empties over time. This calls for something more complicated.
|
278
|
-
|
279
|
-
In this example, we create a simple class to emulate a Hayes modem. (For more information, dig into the `DataStreamObserver` code on which `DeviceUsingBytes` is based.
|
280
|
-
|
281
|
-
```c++
|
282
|
-
class FakeHayesModem : public DeviceUsingBytes {
|
283
|
-
public:
|
284
|
-
String mLast;
|
285
|
-
|
286
|
-
FakeHayesModem() : DeviceUsingBytes() {
|
287
|
-
mLast = "";
|
288
|
-
addResponseLine("AT", "OK");
|
289
|
-
addResponseLine("ATV1", "NO CARRIER");
|
290
|
-
}
|
291
|
-
virtual ~FakeHayesModem() {}
|
292
|
-
virtual void onMatchInput(String output) { mLast = output; }
|
293
|
-
};
|
294
|
-
|
295
|
-
unittest(modem_hardware)
|
296
|
-
{
|
297
|
-
GodmodeState* state = GODMODE();
|
298
|
-
state->reset();
|
299
|
-
FakeHayesModem m;
|
300
|
-
m.attach(&Serial);
|
301
|
-
|
302
|
-
Serial.write("AT\n");
|
303
|
-
assertEqual("AT\n", state->serialPort[0].dataOut);
|
304
|
-
assertEqual("OK\n", m.mLast);
|
305
|
-
}
|
306
|
-
```
|
307
|
-
|
308
|
-
Note that instead of setting `mLast = output` in the `onMatchInput()` function for test purposes, we could just as easily queue some bytes to state->serialPort[0].dataIn for the library under test to find on its next `peek()` or `read()`. Or we could execute some action on a digital or analog input pin; the possibilities are fairly endless in this regard, although you will have to define them yourself -- from scratch -- extending the `DataStreamObserver` class to emulate your physical device.
|
309
|
-
|
310
|
-
|
311
|
-
## Overriding default build behavior
|
312
|
-
|
313
|
-
You can add `.arduino-ci.yml` files to the project directory (which will then apply to both `test/` and `examples/`), as well as to the `test/` directory and each example directory in `examples/`. All defined fields can be overridden.
|
314
|
-
|
315
|
-
You may define new platforms, or edit existing platform definitions:
|
58
|
+
Next, you'll need this in `appveyor.yml` in your repo.
|
316
59
|
|
317
60
|
```yaml
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
gcc:
|
323
|
-
features:
|
324
|
-
- omit-frame-pointer # becomes -fomit-frame-pointer flag
|
325
|
-
defines:
|
326
|
-
- HAVE_THING # becomes -DHAVE_THING flag
|
327
|
-
warnings:
|
328
|
-
- no-implicit # becomes -Wno-implicit flag
|
329
|
-
flags:
|
330
|
-
- -foobar # becomes -foobar flag
|
331
|
-
|
332
|
-
zero: ~ # undefines the `zero` board completely
|
333
|
-
|
334
|
-
esp8266: # redefines the existing esp8266
|
335
|
-
board: esp8266:esp8266:booo
|
336
|
-
package: esp8266:esp8266
|
337
|
-
gcc:
|
338
|
-
features:
|
339
|
-
defines:
|
340
|
-
warnings:
|
341
|
-
flags:
|
61
|
+
build: off
|
62
|
+
test_script:
|
63
|
+
- bundle install
|
64
|
+
- bundle exec arduino_ci_remote.rb
|
342
65
|
```
|
343
66
|
|
67
|
+
## Quick Start
|
344
68
|
|
345
|
-
|
346
|
-
|
347
|
-
```yaml
|
348
|
-
compile:
|
349
|
-
libraries:
|
350
|
-
- "Adafruit FONA Library"
|
351
|
-
platforms:
|
352
|
-
- esp8266
|
353
|
-
```
|
354
|
-
|
69
|
+
This software is in beta. But [SampleProjects/DoSomething](SampleProjects/DoSomething) has a decent writeup and is a good bare-bones example of all the features.
|
355
70
|
|
356
|
-
|
71
|
+
## Reference
|
357
72
|
|
358
|
-
|
359
|
-
unittest:
|
360
|
-
compilers:
|
361
|
-
- g++ # default
|
362
|
-
- g++-4.9
|
363
|
-
- g++-7
|
364
|
-
testfiles:
|
365
|
-
select:
|
366
|
-
- "*-*.*"
|
367
|
-
reject:
|
368
|
-
- "sam-squamsh.*"
|
369
|
-
libraries:
|
370
|
-
- "abc123"
|
371
|
-
- "def456"
|
372
|
-
platforms:
|
373
|
-
- bogo
|
374
|
-
```
|
73
|
+
For more information on the usage of `arduino_ci`, see [REFERENCE.md](REFERENCE.md). It contains information such as:
|
375
74
|
|
376
|
-
|
75
|
+
* Where to put unit test files
|
76
|
+
* How to structure unit test files
|
77
|
+
* How to control the global (physical) state of the Arduino board
|
78
|
+
* How to modify the Arduino platforms, compilers, test plans, etc
|
377
79
|
|
378
|
-
This software is in alpha. But [SampleProjects/DoSomething](SampleProjects/DoSomething) has a decent writeup and is a good bare-bones example of all the features.
|
379
80
|
|
380
81
|
## Known Problems
|
381
82
|
|
@@ -384,6 +85,16 @@ This software is in alpha. But [SampleProjects/DoSomething](SampleProjects/DoSo
|
|
384
85
|
* https://github.com/ianfixes/arduino_ci/issues
|
385
86
|
|
386
87
|
|
88
|
+
## Comparison to Other Arduino Testing Tools
|
89
|
+
|
90
|
+
|
91
|
+
| Project | CI | Builds Examples | Unittest | Arduino Mocks | Windows | OSX | Linux | License |
|
92
|
+
|---------|----|-----------------|----------|---------------|---------|-----|-------|---------|
|
93
|
+
|[ArduinoCI](https://github.com/ianfixes/arduino_ci)| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |Free (Apache-2.0)|
|
94
|
+
|[ArduinoUnit](https://github.com/mmurdoch/arduinounit)|❌ |❌ |Hardware-based|❌ | ✅ | ✅ | ✅ |Free (MIT)| |
|
95
|
+
|[Adafruit `travis-ci-arduino`](https://github.com/adafruit/travis-ci-arduino) | ✅ | ✅ | ❌| ❌ | ❌ | ❌ | ✅ |Free (MIT)|
|
96
|
+
|[PlatformIO](https://platformio.org)| ✅ | ✅ | Paid only | ❌ | ✅ | ✅ | ✅ |Proprietary (EULA)|
|
97
|
+
|
387
98
|
## Author
|
388
99
|
|
389
100
|
This gem was written by Ian Katz (ianfixes@gmail.com) in 2018. It's released under the Apache 2.0 license.
|
@@ -394,3 +105,4 @@ This gem was written by Ian Katz (ianfixes@gmail.com) in 2018. It's released un
|
|
394
105
|
* [Contributing](CONTRIBUTING.md)
|
395
106
|
* [Adafruit/travis-ci-arduino](https://github.com/adafruit/travis-ci-arduino) which inspired this project
|
396
107
|
* [mmurdoch/arduinounit](https://github.com/mmurdoch/arduinounit) from which the unit test macros were adopted
|
108
|
+
|
data/cpp/arduino/Arduino.h
CHANGED
@@ -14,6 +14,7 @@ Where possible, variable names from the Arduino library are used to avoid confli
|
|
14
14
|
#include "Print.h"
|
15
15
|
#include "Stream.h"
|
16
16
|
#include "HardwareSerial.h"
|
17
|
+
#include "SPI.h"
|
17
18
|
|
18
19
|
typedef bool boolean;
|
19
20
|
typedef uint8_t byte;
|
@@ -43,9 +44,6 @@ typedef uint8_t byte;
|
|
43
44
|
#define yield() _NOP()
|
44
45
|
#define interrupts() _NOP()
|
45
46
|
#define noInterrupts() _NOP()
|
46
|
-
#define attachInterrupt(...) _NOP()
|
47
|
-
#define detachInterrupt(...) _NOP()
|
48
|
-
|
49
47
|
|
50
48
|
// TODO: correctly establish this per-board!
|
51
49
|
#define F_CPU 1000000UL
|
@@ -59,14 +57,6 @@ typedef unsigned int word;
|
|
59
57
|
|
60
58
|
|
61
59
|
|
62
|
-
/*
|
63
|
-
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
|
64
|
-
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
|
65
|
-
|
66
|
-
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
|
67
|
-
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
|
68
|
-
|
69
|
-
*/
|
70
60
|
|
71
61
|
// Get the bit location within the hardware port of the given virtual pin.
|
72
62
|
// This comes from the pins_*.c file for the active board configuration.
|
@@ -74,43 +64,6 @@ uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
|
|
74
64
|
#define analogInPinToBit(P) (P)
|
75
65
|
#define digitalPinToInterrupt(P) (P)
|
76
66
|
|
77
|
-
/*
|
78
|
-
// On the ATmega1280, the addresses of some of the port registers are
|
79
|
-
// greater than 255, so we can't store them in uint8_t's.
|
80
|
-
extern const uint16_t PROGMEM port_to_mode_PGM[];
|
81
|
-
extern const uint16_t PROGMEM port_to_input_PGM[];
|
82
|
-
extern const uint16_t PROGMEM port_to_output_PGM[];
|
83
|
-
|
84
|
-
extern const uint8_t PROGMEM digital_pin_to_port_PGM[];
|
85
|
-
// extern const uint8_t PROGMEM digital_pin_to_bit_PGM[];
|
86
|
-
extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[];
|
87
|
-
extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
|
88
|
-
|
89
|
-
// Get the bit location within the hardware port of the given virtual pin.
|
90
|
-
// This comes from the pins_*.c file for the active board configuration.
|
91
|
-
//
|
92
|
-
// These perform slightly better as macros compared to inline functions
|
93
|
-
//
|
94
|
-
#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) )
|
95
|
-
#define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) )
|
96
|
-
#define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) )
|
97
|
-
#define analogInPinToBit(P) (P)
|
98
|
-
#define portOutputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_output_PGM + (P))) )
|
99
|
-
#define portInputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_input_PGM + (P))) )
|
100
|
-
#define portModeRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_mode_PGM + (P))) )
|
101
|
-
|
102
|
-
*/
|
103
|
-
|
104
|
-
|
105
|
-
/* TODO
|
106
|
-
|
107
|
-
// USB
|
108
|
-
#include "USBAPI.h"
|
109
|
-
Keyboard
|
110
|
-
Mouse
|
111
|
-
|
112
|
-
*/
|
113
|
-
|
114
67
|
// uint16_t makeWord(uint16_t w);
|
115
68
|
// uint16_t makeWord(byte h, byte l);
|
116
69
|
inline unsigned int makeWord(unsigned int w) { return w; }
|
@@ -118,23 +71,6 @@ inline unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8)
|
|
118
71
|
|
119
72
|
#define word(...) makeWord(__VA_ARGS__)
|
120
73
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
// audio is taken care of in GODMODE
|
125
|
-
|
126
|
-
|
127
|
-
// BIG TODO ON THIS ONE
|
128
|
-
// $ find . | grep pins_
|
129
|
-
// ./arduino-1.8.5/hardware/arduino/avr/variants/circuitplay32u4/pins_arduino.h
|
130
|
-
// ./arduino-1.8.5/hardware/arduino/avr/variants/eightanaloginputs/pins_arduino.h
|
131
|
-
// ./arduino-1.8.5/hardware/arduino/avr/variants/ethernet/pins_arduino.h
|
132
|
-
// ./arduino-1.8.5/hardware/arduino/avr/variants/gemma/pins_arduino.h
|
133
|
-
// ./arduino-1.8.5/hardware/arduino/avr/variants/leonardo/pins_arduino.h
|
134
|
-
// ./arduino-1.8.5/hardware/arduino/avr/variants/mega/pins_arduino.h
|
135
|
-
// ./arduino-1.8.5/hardware/arduino/avr/variants/micro/pins_arduino.h
|
136
|
-
// ./arduino-1.8.5/hardware/arduino/avr/variants/robot_control/pins_arduino.h
|
137
|
-
// ./arduino-1.8.5/hardware/arduino/avr/variants/robot_motor/pins_arduino.h
|
138
|
-
// ./arduino-1.8.5/hardware/arduino/avr/variants/standard/pins_arduino.h
|
139
|
-
// ./arduino-1.8.5/hardware/arduino/avr/variants/yun/pins_arduino.h
|
140
|
-
// #include "pins_arduino.h"
|
74
|
+
|
75
|
+
|
76
|
+
|