arduino_ci 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +203 -4
- data/cpp/arduino/Arduino.cpp +0 -21
- data/cpp/arduino/Arduino.h +0 -10
- data/cpp/arduino/ArduinoDefines.h +0 -1
- data/cpp/arduino/AvrMath.h +5 -6
- data/cpp/arduino/Godmode.cpp +26 -0
- data/cpp/arduino/Godmode.h +41 -19
- data/cpp/arduino/HardwareSerial.h +7 -3
- data/cpp/arduino/PinHistory.h +160 -0
- data/cpp/arduino/Print.h +4 -2
- data/cpp/arduino/SoftwareSerial.h +77 -0
- data/cpp/arduino/Stream.h +4 -1
- data/cpp/arduino/WString.h +15 -9
- data/cpp/arduino/{include → avr}/README.md +0 -0
- data/cpp/arduino/{include → avr}/common.h +0 -0
- data/cpp/arduino/{include → avr}/fuse.h +0 -0
- data/cpp/arduino/{include → avr}/io.h +0 -0
- data/cpp/arduino/{include → avr}/io1200.h +0 -0
- data/cpp/arduino/{include → avr}/io2313.h +0 -0
- data/cpp/arduino/{include → avr}/io2323.h +0 -0
- data/cpp/arduino/{include → avr}/io2333.h +0 -0
- data/cpp/arduino/{include → avr}/io2343.h +0 -0
- data/cpp/arduino/{include → avr}/io43u32x.h +0 -0
- data/cpp/arduino/{include → avr}/io43u35x.h +0 -0
- data/cpp/arduino/{include → avr}/io4414.h +0 -0
- data/cpp/arduino/{include → avr}/io4433.h +0 -0
- data/cpp/arduino/{include → avr}/io4434.h +0 -0
- data/cpp/arduino/{include → avr}/io76c711.h +0 -0
- data/cpp/arduino/{include → avr}/io8515.h +0 -0
- data/cpp/arduino/{include → avr}/io8534.h +0 -0
- data/cpp/arduino/{include → avr}/io8535.h +0 -0
- data/cpp/arduino/{include → avr}/io86r401.h +0 -0
- data/cpp/arduino/{include → avr}/io90pwm1.h +0 -0
- data/cpp/arduino/{include → avr}/io90pwm161.h +0 -0
- data/cpp/arduino/{include → avr}/io90pwm216.h +0 -0
- data/cpp/arduino/{include → avr}/io90pwm2b.h +0 -0
- data/cpp/arduino/{include → avr}/io90pwm316.h +0 -0
- data/cpp/arduino/{include → avr}/io90pwm3b.h +0 -0
- data/cpp/arduino/{include → avr}/io90pwm81.h +0 -0
- data/cpp/arduino/{include → avr}/io90pwmx.h +0 -0
- data/cpp/arduino/{include → avr}/io90scr100.h +0 -0
- data/cpp/arduino/{include → avr}/ioa5272.h +0 -0
- data/cpp/arduino/{include → avr}/ioa5505.h +0 -0
- data/cpp/arduino/{include → avr}/ioa5702m322.h +0 -0
- data/cpp/arduino/{include → avr}/ioa5782.h +0 -0
- data/cpp/arduino/{include → avr}/ioa5790.h +0 -0
- data/cpp/arduino/{include → avr}/ioa5790n.h +0 -0
- data/cpp/arduino/{include → avr}/ioa5791.h +0 -0
- data/cpp/arduino/{include → avr}/ioa5795.h +0 -0
- data/cpp/arduino/{include → avr}/ioa5831.h +0 -0
- data/cpp/arduino/{include → avr}/ioa6285.h +0 -0
- data/cpp/arduino/{include → avr}/ioa6286.h +0 -0
- data/cpp/arduino/{include → avr}/ioa6289.h +0 -0
- data/cpp/arduino/{include → avr}/ioa6612c.h +0 -0
- data/cpp/arduino/{include → avr}/ioa6613c.h +0 -0
- data/cpp/arduino/{include → avr}/ioa6614q.h +0 -0
- data/cpp/arduino/{include → avr}/ioa6616c.h +0 -0
- data/cpp/arduino/{include → avr}/ioa6617c.h +0 -0
- data/cpp/arduino/{include → avr}/ioa664251.h +0 -0
- data/cpp/arduino/{include → avr}/ioa8210.h +0 -0
- data/cpp/arduino/{include → avr}/ioa8510.h +0 -0
- data/cpp/arduino/{include → avr}/ioat94k.h +0 -0
- data/cpp/arduino/{include → avr}/iocan128.h +0 -0
- data/cpp/arduino/{include → avr}/iocan32.h +0 -0
- data/cpp/arduino/{include → avr}/iocan64.h +0 -0
- data/cpp/arduino/{include → avr}/iocanxx.h +0 -0
- data/cpp/arduino/{include → avr}/iom103.h +0 -0
- data/cpp/arduino/{include → avr}/iom128.h +0 -0
- data/cpp/arduino/{include → avr}/iom1280.h +0 -0
- data/cpp/arduino/{include → avr}/iom1281.h +0 -0
- data/cpp/arduino/{include → avr}/iom1284.h +0 -0
- data/cpp/arduino/{include → avr}/iom1284p.h +0 -0
- data/cpp/arduino/{include → avr}/iom1284rfr2.h +0 -0
- data/cpp/arduino/{include → avr}/iom128a.h +0 -0
- data/cpp/arduino/{include → avr}/iom128rfa1.h +0 -0
- data/cpp/arduino/{include → avr}/iom128rfr2.h +0 -0
- data/cpp/arduino/{include → avr}/iom16.h +0 -0
- data/cpp/arduino/{include → avr}/iom161.h +0 -0
- data/cpp/arduino/{include → avr}/iom162.h +0 -0
- data/cpp/arduino/{include → avr}/iom163.h +0 -0
- data/cpp/arduino/{include → avr}/iom164.h +0 -0
- data/cpp/arduino/{include → avr}/iom164a.h +0 -0
- data/cpp/arduino/{include → avr}/iom164p.h +0 -0
- data/cpp/arduino/{include → avr}/iom164pa.h +0 -0
- data/cpp/arduino/{include → avr}/iom165.h +0 -0
- data/cpp/arduino/{include → avr}/iom165a.h +0 -0
- data/cpp/arduino/{include → avr}/iom165p.h +0 -0
- data/cpp/arduino/{include → avr}/iom165pa.h +0 -0
- data/cpp/arduino/{include → avr}/iom168.h +0 -0
- data/cpp/arduino/{include → avr}/iom168a.h +0 -0
- data/cpp/arduino/{include → avr}/iom168p.h +0 -0
- data/cpp/arduino/{include → avr}/iom168pa.h +0 -0
- data/cpp/arduino/{include → avr}/iom168pb.h +0 -0
- data/cpp/arduino/{include → avr}/iom169.h +0 -0
- data/cpp/arduino/{include → avr}/iom169a.h +0 -0
- data/cpp/arduino/{include → avr}/iom169p.h +0 -0
- data/cpp/arduino/{include → avr}/iom169pa.h +0 -0
- data/cpp/arduino/{include → avr}/iom16a.h +0 -0
- data/cpp/arduino/{include → avr}/iom16hva.h +0 -0
- data/cpp/arduino/{include → avr}/iom16hva2.h +0 -0
- data/cpp/arduino/{include → avr}/iom16hvb.h +0 -0
- data/cpp/arduino/{include → avr}/iom16hvbrevb.h +0 -0
- data/cpp/arduino/{include → avr}/iom16m1.h +0 -0
- data/cpp/arduino/{include → avr}/iom16u2.h +0 -0
- data/cpp/arduino/{include → avr}/iom16u4.h +0 -0
- data/cpp/arduino/{include → avr}/iom2560.h +0 -0
- data/cpp/arduino/{include → avr}/iom2561.h +0 -0
- data/cpp/arduino/{include → avr}/iom2564rfr2.h +0 -0
- data/cpp/arduino/{include → avr}/iom256rfr2.h +0 -0
- data/cpp/arduino/{include → avr}/iom3000.h +0 -0
- data/cpp/arduino/{include → avr}/iom32.h +0 -0
- data/cpp/arduino/{include → avr}/iom323.h +0 -0
- data/cpp/arduino/{include → avr}/iom324a.h +0 -0
- data/cpp/arduino/{include → avr}/iom324p.h +0 -0
- data/cpp/arduino/{include → avr}/iom324pa.h +0 -0
- data/cpp/arduino/{include → avr}/iom325.h +0 -0
- data/cpp/arduino/{include → avr}/iom3250.h +0 -0
- data/cpp/arduino/{include → avr}/iom3250a.h +0 -0
- data/cpp/arduino/{include → avr}/iom3250p.h +0 -0
- data/cpp/arduino/{include → avr}/iom3250pa.h +0 -0
- data/cpp/arduino/{include → avr}/iom325a.h +0 -0
- data/cpp/arduino/{include → avr}/iom325p.h +0 -0
- data/cpp/arduino/{include → avr}/iom325pa.h +0 -0
- data/cpp/arduino/{include → avr}/iom328.h +0 -0
- data/cpp/arduino/{include → avr}/iom328p.h +0 -0
- data/cpp/arduino/{include → avr}/iom329.h +0 -0
- data/cpp/arduino/{include → avr}/iom3290.h +0 -0
- data/cpp/arduino/{include → avr}/iom3290a.h +0 -0
- data/cpp/arduino/{include → avr}/iom3290pa.h +0 -0
- data/cpp/arduino/{include → avr}/iom329a.h +0 -0
- data/cpp/arduino/{include → avr}/iom329p.h +0 -0
- data/cpp/arduino/{include → avr}/iom329pa.h +0 -0
- data/cpp/arduino/{include → avr}/iom32a.h +0 -0
- data/cpp/arduino/{include → avr}/iom32c1.h +0 -0
- data/cpp/arduino/{include → avr}/iom32hvb.h +0 -0
- data/cpp/arduino/{include → avr}/iom32hvbrevb.h +0 -0
- data/cpp/arduino/{include → avr}/iom32m1.h +0 -0
- data/cpp/arduino/{include → avr}/iom32u2.h +0 -0
- data/cpp/arduino/{include → avr}/iom32u4.h +0 -0
- data/cpp/arduino/{include → avr}/iom32u6.h +0 -0
- data/cpp/arduino/{include → avr}/iom406.h +0 -0
- data/cpp/arduino/{include → avr}/iom48.h +0 -0
- data/cpp/arduino/{include → avr}/iom48a.h +0 -0
- data/cpp/arduino/{include → avr}/iom48p.h +0 -0
- data/cpp/arduino/{include → avr}/iom48pa.h +0 -0
- data/cpp/arduino/{include → avr}/iom48pb.h +0 -0
- data/cpp/arduino/{include → avr}/iom64.h +0 -0
- data/cpp/arduino/{include → avr}/iom640.h +0 -0
- data/cpp/arduino/{include → avr}/iom644.h +0 -0
- data/cpp/arduino/{include → avr}/iom644a.h +0 -0
- data/cpp/arduino/{include → avr}/iom644p.h +0 -0
- data/cpp/arduino/{include → avr}/iom644pa.h +0 -0
- data/cpp/arduino/{include → avr}/iom644rfr2.h +0 -0
- data/cpp/arduino/{include → avr}/iom645.h +0 -0
- data/cpp/arduino/{include → avr}/iom6450.h +0 -0
- data/cpp/arduino/{include → avr}/iom6450a.h +0 -0
- data/cpp/arduino/{include → avr}/iom6450p.h +0 -0
- data/cpp/arduino/{include → avr}/iom645a.h +0 -0
- data/cpp/arduino/{include → avr}/iom645p.h +0 -0
- data/cpp/arduino/{include → avr}/iom649.h +0 -0
- data/cpp/arduino/{include → avr}/iom6490.h +0 -0
- data/cpp/arduino/{include → avr}/iom6490a.h +0 -0
- data/cpp/arduino/{include → avr}/iom6490p.h +0 -0
- data/cpp/arduino/{include → avr}/iom649a.h +0 -0
- data/cpp/arduino/{include → avr}/iom649p.h +0 -0
- data/cpp/arduino/{include → avr}/iom64a.h +0 -0
- data/cpp/arduino/{include → avr}/iom64c1.h +0 -0
- data/cpp/arduino/{include → avr}/iom64hve.h +0 -0
- data/cpp/arduino/{include → avr}/iom64hve2.h +0 -0
- data/cpp/arduino/{include → avr}/iom64m1.h +0 -0
- data/cpp/arduino/{include → avr}/iom64rfr2.h +0 -0
- data/cpp/arduino/{include → avr}/iom8.h +0 -0
- data/cpp/arduino/{include → avr}/iom8515.h +0 -0
- data/cpp/arduino/{include → avr}/iom8535.h +0 -0
- data/cpp/arduino/{include → avr}/iom88.h +0 -0
- data/cpp/arduino/{include → avr}/iom88a.h +0 -0
- data/cpp/arduino/{include → avr}/iom88p.h +0 -0
- data/cpp/arduino/{include → avr}/iom88pa.h +0 -0
- data/cpp/arduino/{include → avr}/iom88pb.h +0 -0
- data/cpp/arduino/{include → avr}/iom8a.h +0 -0
- data/cpp/arduino/{include → avr}/iom8hva.h +0 -0
- data/cpp/arduino/{include → avr}/iom8u2.h +0 -0
- data/cpp/arduino/{include → avr}/iomx8.h +0 -0
- data/cpp/arduino/{include → avr}/iomxx0_1.h +0 -0
- data/cpp/arduino/{include → avr}/iomxx4.h +0 -0
- data/cpp/arduino/{include → avr}/iomxxhva.h +0 -0
- data/cpp/arduino/{include → avr}/iotn10.h +0 -0
- data/cpp/arduino/{include → avr}/iotn11.h +0 -0
- data/cpp/arduino/{include → avr}/iotn12.h +0 -0
- data/cpp/arduino/{include → avr}/iotn13.h +0 -0
- data/cpp/arduino/{include → avr}/iotn13a.h +0 -0
- data/cpp/arduino/{include → avr}/iotn15.h +0 -0
- data/cpp/arduino/{include → avr}/iotn1634.h +0 -0
- data/cpp/arduino/{include → avr}/iotn167.h +0 -0
- data/cpp/arduino/{include → avr}/iotn20.h +0 -0
- data/cpp/arduino/{include → avr}/iotn22.h +0 -0
- data/cpp/arduino/{include → avr}/iotn2313.h +0 -0
- data/cpp/arduino/{include → avr}/iotn2313a.h +0 -0
- data/cpp/arduino/{include → avr}/iotn24.h +0 -0
- data/cpp/arduino/{include → avr}/iotn24a.h +0 -0
- data/cpp/arduino/{include → avr}/iotn25.h +0 -0
- data/cpp/arduino/{include → avr}/iotn26.h +0 -0
- data/cpp/arduino/{include → avr}/iotn261.h +0 -0
- data/cpp/arduino/{include → avr}/iotn261a.h +0 -0
- data/cpp/arduino/{include → avr}/iotn28.h +0 -0
- data/cpp/arduino/{include → avr}/iotn4.h +0 -0
- data/cpp/arduino/{include → avr}/iotn40.h +0 -0
- data/cpp/arduino/{include → avr}/iotn4313.h +0 -0
- data/cpp/arduino/{include → avr}/iotn43u.h +0 -0
- data/cpp/arduino/{include → avr}/iotn44.h +0 -0
- data/cpp/arduino/{include → avr}/iotn441.h +0 -0
- data/cpp/arduino/{include → avr}/iotn44a.h +0 -0
- data/cpp/arduino/{include → avr}/iotn45.h +0 -0
- data/cpp/arduino/{include → avr}/iotn461.h +0 -0
- data/cpp/arduino/{include → avr}/iotn461a.h +0 -0
- data/cpp/arduino/{include → avr}/iotn48.h +0 -0
- data/cpp/arduino/{include → avr}/iotn5.h +0 -0
- data/cpp/arduino/{include → avr}/iotn828.h +0 -0
- data/cpp/arduino/{include → avr}/iotn84.h +0 -0
- data/cpp/arduino/{include → avr}/iotn841.h +0 -0
- data/cpp/arduino/{include → avr}/iotn84a.h +0 -0
- data/cpp/arduino/{include → avr}/iotn85.h +0 -0
- data/cpp/arduino/{include → avr}/iotn861.h +0 -0
- data/cpp/arduino/{include → avr}/iotn861a.h +0 -0
- data/cpp/arduino/{include → avr}/iotn87.h +0 -0
- data/cpp/arduino/{include → avr}/iotn88.h +0 -0
- data/cpp/arduino/{include → avr}/iotn9.h +0 -0
- data/cpp/arduino/{include → avr}/iotnx4.h +0 -0
- data/cpp/arduino/{include → avr}/iotnx5.h +0 -0
- data/cpp/arduino/{include → avr}/iotnx61.h +0 -0
- data/cpp/arduino/{include → avr}/iousb1286.h +0 -0
- data/cpp/arduino/{include → avr}/iousb1287.h +0 -0
- data/cpp/arduino/{include → avr}/iousb162.h +0 -0
- data/cpp/arduino/{include → avr}/iousb646.h +0 -0
- data/cpp/arduino/{include → avr}/iousb647.h +0 -0
- data/cpp/arduino/{include → avr}/iousb82.h +0 -0
- data/cpp/arduino/{include → avr}/iousbxx2.h +0 -0
- data/cpp/arduino/{include → avr}/iousbxx6_7.h +0 -0
- data/cpp/arduino/{include → avr}/iox128a1.h +0 -0
- data/cpp/arduino/{include → avr}/iox128a1u.h +0 -0
- data/cpp/arduino/{include → avr}/iox128a3.h +0 -0
- data/cpp/arduino/{include → avr}/iox128a3u.h +0 -0
- data/cpp/arduino/{include → avr}/iox128a4u.h +0 -0
- data/cpp/arduino/{include → avr}/iox128b1.h +0 -0
- data/cpp/arduino/{include → avr}/iox128b3.h +0 -0
- data/cpp/arduino/{include → avr}/iox128c3.h +0 -0
- data/cpp/arduino/{include → avr}/iox128d3.h +0 -0
- data/cpp/arduino/{include → avr}/iox128d4.h +0 -0
- data/cpp/arduino/{include → avr}/iox16a4.h +0 -0
- data/cpp/arduino/{include → avr}/iox16a4u.h +0 -0
- data/cpp/arduino/{include → avr}/iox16c4.h +0 -0
- data/cpp/arduino/{include → avr}/iox16d4.h +0 -0
- data/cpp/arduino/{include → avr}/iox16e5.h +0 -0
- data/cpp/arduino/{include → avr}/iox192a3.h +0 -0
- data/cpp/arduino/{include → avr}/iox192a3u.h +0 -0
- data/cpp/arduino/{include → avr}/iox192c3.h +0 -0
- data/cpp/arduino/{include → avr}/iox192d3.h +0 -0
- data/cpp/arduino/{include → avr}/iox256a3.h +0 -0
- data/cpp/arduino/{include → avr}/iox256a3b.h +0 -0
- data/cpp/arduino/{include → avr}/iox256a3bu.h +0 -0
- data/cpp/arduino/{include → avr}/iox256a3u.h +0 -0
- data/cpp/arduino/{include → avr}/iox256c3.h +0 -0
- data/cpp/arduino/{include → avr}/iox256d3.h +0 -0
- data/cpp/arduino/{include → avr}/iox32a4.h +0 -0
- data/cpp/arduino/{include → avr}/iox32a4u.h +0 -0
- data/cpp/arduino/{include → avr}/iox32c3.h +0 -0
- data/cpp/arduino/{include → avr}/iox32c4.h +0 -0
- data/cpp/arduino/{include → avr}/iox32d3.h +0 -0
- data/cpp/arduino/{include → avr}/iox32d4.h +0 -0
- data/cpp/arduino/{include → avr}/iox32e5.h +0 -0
- data/cpp/arduino/{include → avr}/iox384c3.h +0 -0
- data/cpp/arduino/{include → avr}/iox384d3.h +0 -0
- data/cpp/arduino/{include → avr}/iox64a1.h +0 -0
- data/cpp/arduino/{include → avr}/iox64a1u.h +0 -0
- data/cpp/arduino/{include → avr}/iox64a3.h +0 -0
- data/cpp/arduino/{include → avr}/iox64a3u.h +0 -0
- data/cpp/arduino/{include → avr}/iox64a4u.h +0 -0
- data/cpp/arduino/{include → avr}/iox64b1.h +0 -0
- data/cpp/arduino/{include → avr}/iox64b3.h +0 -0
- data/cpp/arduino/{include → avr}/iox64c3.h +0 -0
- data/cpp/arduino/{include → avr}/iox64d3.h +0 -0
- data/cpp/arduino/{include → avr}/iox64d4.h +0 -0
- data/cpp/arduino/{include → avr}/iox8e5.h +0 -0
- data/cpp/arduino/{include → avr}/lock.h +0 -0
- data/cpp/arduino/avr/pgmspace.h +94 -0
- data/cpp/arduino/{include → avr}/portpins.h +0 -0
- data/cpp/arduino/{include → avr}/version.h +0 -0
- data/cpp/arduino/{include → avr}/xmega.h +0 -0
- data/cpp/arduino/binary.h +1 -0
- data/cpp/arduino/ci/DeviceUsingBytes.h +56 -0
- data/cpp/arduino/ci/ObservableDataStream.h +124 -0
- data/cpp/arduino/ci/Queue.h +73 -0
- data/cpp/arduino/ci/README.md +5 -0
- data/cpp/arduino/ci/Table.h +125 -0
- data/cpp/unittest/ArduinoUnitTests.h +16 -16
- data/cpp/unittest/Assertion.h +2 -2
- data/cpp/unittest/Compare.h +1 -1
- data/exe/arduino_ci_remote.rb +34 -21
- data/lib/arduino_ci/arduino_cmd.rb +1 -0
- data/lib/arduino_ci/arduino_installation.rb +13 -19
- data/lib/arduino_ci/ci_config.rb +42 -10
- data/lib/arduino_ci/cpp_library.rb +6 -1
- data/lib/arduino_ci/version.rb +1 -1
- data/misc/{default.yaml → default.yml} +0 -0
- metadata +285 -277
@@ -29,13 +29,13 @@
|
|
29
29
|
#define SERIAL_7O2 0x3C
|
30
30
|
#define SERIAL_8O2 0x3E
|
31
31
|
|
32
|
-
class HardwareSerial : public Stream
|
32
|
+
class HardwareSerial : public Stream, public ObservableDataStream
|
33
33
|
{
|
34
34
|
protected:
|
35
35
|
String* mGodmodeDataOut;
|
36
36
|
|
37
37
|
public:
|
38
|
-
HardwareSerial(String* dataIn, String* dataOut, unsigned long* delay): Stream() {
|
38
|
+
HardwareSerial(String* dataIn, String* dataOut, unsigned long* delay): Stream(), ObservableDataStream() {
|
39
39
|
mGodmodeDataIn = dataIn;
|
40
40
|
mGodmodeDataOut = dataOut;
|
41
41
|
mGodmodeMicrosDelay = delay;
|
@@ -51,7 +51,11 @@ class HardwareSerial : public Stream
|
|
51
51
|
// virtual int read(void);
|
52
52
|
// virtual int availableForWrite(void);
|
53
53
|
// virtual void flush(void);
|
54
|
-
virtual size_t write(uint8_t aChar) {
|
54
|
+
virtual size_t write(uint8_t aChar) {
|
55
|
+
mGodmodeDataOut->append(String((char)aChar));
|
56
|
+
advertiseByte((unsigned char)aChar);
|
57
|
+
return 1;
|
58
|
+
}
|
55
59
|
|
56
60
|
inline size_t write(unsigned long n) { return write((uint8_t)n); }
|
57
61
|
inline size_t write(long n) { return write((uint8_t)n); }
|
@@ -0,0 +1,160 @@
|
|
1
|
+
#pragma once
|
2
|
+
#include "ci/Queue.h"
|
3
|
+
#include "ci/ObservableDataStream.h"
|
4
|
+
#include "WString.h"
|
5
|
+
|
6
|
+
// pins with history.
|
7
|
+
template <typename T>
|
8
|
+
class PinHistory : public ObservableDataStream {
|
9
|
+
private:
|
10
|
+
Queue<T> qIn;
|
11
|
+
Queue<T> qOut;
|
12
|
+
|
13
|
+
void clear() {
|
14
|
+
qOut.clear();
|
15
|
+
qIn.clear();
|
16
|
+
}
|
17
|
+
|
18
|
+
// enqueue ascii bits
|
19
|
+
void a2q(Queue<T> &q, String input, bool bigEndian, bool advertise) {
|
20
|
+
// 8 chars at a time, form up
|
21
|
+
for (int j = 0; j < input.length(); ++j) {
|
22
|
+
for (int i = 0; i < 8; ++i) {
|
23
|
+
int shift = bigEndian ? 7 - i : i;
|
24
|
+
unsigned char mask = (0x01 << shift);
|
25
|
+
q.push(mask & input[j]);
|
26
|
+
if (advertise) advertiseBit(q.back()); // not valid for all possible types but whatever
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
|
32
|
+
// convert a queue to a string as if it was serial bits
|
33
|
+
// start from offset, consider endianness
|
34
|
+
String q2a(const Queue<T> &q, unsigned int offset, bool bigEndian) const {
|
35
|
+
String ret = "";
|
36
|
+
|
37
|
+
Queue<T> q2(q);
|
38
|
+
|
39
|
+
while (offset) {
|
40
|
+
q2.pop();
|
41
|
+
--offset;
|
42
|
+
}
|
43
|
+
|
44
|
+
if (offset) return ret;
|
45
|
+
|
46
|
+
// 8 chars at a time, form up
|
47
|
+
while (q2.size() >= 8) {
|
48
|
+
unsigned char acc = 0x00;
|
49
|
+
for (int i = 0; i < 8; ++i) {
|
50
|
+
int shift = bigEndian ? 7 - i : i;
|
51
|
+
T val = q2.front();
|
52
|
+
unsigned char bit = val ? 0x1 : 0x0;
|
53
|
+
acc |= (bit << shift);
|
54
|
+
q2.pop();
|
55
|
+
}
|
56
|
+
ret.append(String((char)acc));
|
57
|
+
}
|
58
|
+
|
59
|
+
return ret;
|
60
|
+
}
|
61
|
+
|
62
|
+
public:
|
63
|
+
unsigned int asciiEncodingOffsetIn;
|
64
|
+
unsigned int asciiEncodingOffsetOut;
|
65
|
+
|
66
|
+
PinHistory() : ObservableDataStream() {
|
67
|
+
asciiEncodingOffsetIn = 0; // default is sensible
|
68
|
+
asciiEncodingOffsetOut = 1; // default is sensible
|
69
|
+
}
|
70
|
+
|
71
|
+
void reset(T val) {
|
72
|
+
clear();
|
73
|
+
qOut.push(val);
|
74
|
+
}
|
75
|
+
|
76
|
+
unsigned int historySize() const { return qOut.size(); }
|
77
|
+
|
78
|
+
unsigned int queueSize() const { return qIn.size(); }
|
79
|
+
|
80
|
+
// This returns the "value" of the pin in a raw sense
|
81
|
+
operator T() const {
|
82
|
+
if (!qIn.empty()) return qIn.front();
|
83
|
+
return qOut.back();
|
84
|
+
}
|
85
|
+
|
86
|
+
// this sets the value of the pin authoritatively
|
87
|
+
// so if there was a queue, dump it.
|
88
|
+
// the actual "set" operation doesn't happen until the next read
|
89
|
+
const T &operator=(const T& i) {
|
90
|
+
qIn.clear();
|
91
|
+
qOut.push(i);
|
92
|
+
advertiseBit(qOut.back()); // not valid for all possible types but whatever
|
93
|
+
return qOut.back();
|
94
|
+
}
|
95
|
+
|
96
|
+
// This returns the "value" of the pin according to the queued values
|
97
|
+
// if there is input, advance it to the output.
|
98
|
+
// then take the latest output.
|
99
|
+
T retrieve() {
|
100
|
+
if (!qIn.empty()) {
|
101
|
+
T hack_required_by_travis_ci = qIn.front();
|
102
|
+
qIn.pop();
|
103
|
+
qOut.push(hack_required_by_travis_ci);
|
104
|
+
}
|
105
|
+
return qOut.back();
|
106
|
+
}
|
107
|
+
|
108
|
+
// enqueue a set of elements
|
109
|
+
void fromArray(T const * const arr, unsigned int length) {
|
110
|
+
for (int i = 0; i < length; ++i) qIn.push(arr[i]);
|
111
|
+
}
|
112
|
+
|
113
|
+
// enqueue ascii bits for future use by the retrieve() function
|
114
|
+
void fromAscii(String input, bool bigEndian) { a2q(qIn, input, bigEndian, false); }
|
115
|
+
|
116
|
+
// send a stream of ascii bits immediately
|
117
|
+
void outgoingFromAscii(String input, bool bigEndian) { a2q(qOut, input, bigEndian, true); }
|
118
|
+
|
119
|
+
// convert the queue of incoming data to a string as if it was Serial comms
|
120
|
+
// start from offset, consider endianness
|
121
|
+
String incomingToAscii(unsigned int offset, bool bigEndian) const { return q2a(qIn, offset, bigEndian); }
|
122
|
+
|
123
|
+
// convert the queue of incoming data to a string as if it was Serial comms
|
124
|
+
// start from offset, consider endianness
|
125
|
+
String incomingToAscii(bool bigEndian) const { return incomingToAscii(asciiEncodingOffsetIn, bigEndian); }
|
126
|
+
|
127
|
+
// convert the pin history to a string as if it was Serial comms
|
128
|
+
// start from offset, consider endianness
|
129
|
+
String toAscii(unsigned int offset, bool bigEndian) const { return q2a(qOut, offset, bigEndian); }
|
130
|
+
|
131
|
+
// convert the pin history to a string as if it was Serial comms
|
132
|
+
// start from offset, consider endianness
|
133
|
+
String toAscii(bool bigEndian) const { return toAscii(asciiEncodingOffsetOut, bigEndian); }
|
134
|
+
|
135
|
+
// copy elements to an array, up to a given length
|
136
|
+
// return the number of elements moved
|
137
|
+
int toArray (T* arr, unsigned int length) const {
|
138
|
+
Queue<T> q2(qOut);
|
139
|
+
|
140
|
+
int ret = 0;
|
141
|
+
for (int i = 0; i < length && q2.size(); ++i) {
|
142
|
+
arr[i] = q2.front();
|
143
|
+
q2.pop();
|
144
|
+
++ret;
|
145
|
+
}
|
146
|
+
return ret;
|
147
|
+
}
|
148
|
+
|
149
|
+
// see if the array matches the elements in the queue
|
150
|
+
bool hasElements (T const * const arr, unsigned int length) const {
|
151
|
+
int i;
|
152
|
+
Queue<T> q2(qOut);
|
153
|
+
for (i = 0; i < length && q2.size(); ++i) {
|
154
|
+
if (q2.front() != arr[i]) return false;
|
155
|
+
q2.pop();
|
156
|
+
}
|
157
|
+
return i == length;
|
158
|
+
}
|
159
|
+
|
160
|
+
};
|
data/cpp/arduino/Print.h
CHANGED
@@ -31,8 +31,10 @@ class Print
|
|
31
31
|
|
32
32
|
virtual size_t write(uint8_t) = 0;
|
33
33
|
size_t write(const char *str) { return str == NULL ? 0 : write((const uint8_t *)str, String(str).length()); }
|
34
|
-
|
35
|
-
{
|
34
|
+
|
35
|
+
size_t write(const __FlashStringHelper *str) { return write((const char *)str); }
|
36
|
+
|
37
|
+
virtual size_t write(const uint8_t *buffer, size_t size) {
|
36
38
|
size_t n;
|
37
39
|
for (n = 0; size && write(*buffer++) && ++n; --size);
|
38
40
|
return n;
|
@@ -0,0 +1,77 @@
|
|
1
|
+
#pragma once
|
2
|
+
#include "Print.h"
|
3
|
+
#include "Stream.h"
|
4
|
+
#include "Godmode.h"
|
5
|
+
|
6
|
+
// definitions neeeded for Serial.begin's config arg
|
7
|
+
|
8
|
+
class SoftwareSerial : public Stream
|
9
|
+
{
|
10
|
+
private:
|
11
|
+
int mPinIn;
|
12
|
+
int mPinOut;
|
13
|
+
bool mInverse;
|
14
|
+
bool mIsListening;
|
15
|
+
GodmodeState* mState;
|
16
|
+
unsigned long mOffset; // bits to offset stream
|
17
|
+
bool bigEndian;
|
18
|
+
|
19
|
+
public:
|
20
|
+
SoftwareSerial(uint8_t receivePin, uint8_t transmitPin, bool inverse_logic = false) {
|
21
|
+
mPinIn = receivePin;
|
22
|
+
mPinOut = transmitPin;
|
23
|
+
mIsListening = false;
|
24
|
+
mOffset = 0; // godmode starts with 1 bit in the queue
|
25
|
+
mState = GODMODE();
|
26
|
+
bigEndian = false; // this is how serial works
|
27
|
+
}
|
28
|
+
|
29
|
+
~SoftwareSerial() {};
|
30
|
+
|
31
|
+
void setGodmodeOffset(unsigned long offset) {
|
32
|
+
mOffset = offset;
|
33
|
+
}
|
34
|
+
|
35
|
+
bool listen() { return mIsListening = true; }
|
36
|
+
bool isListening() { return mIsListening; }
|
37
|
+
bool stopListening() {
|
38
|
+
bool ret = mIsListening;
|
39
|
+
mIsListening = false;
|
40
|
+
return ret;
|
41
|
+
}
|
42
|
+
void begin(long speed) { listen(); }
|
43
|
+
void end() { stopListening(); }
|
44
|
+
bool overflow() { return false; }
|
45
|
+
|
46
|
+
int peek() {
|
47
|
+
if (!isListening()) return -1;
|
48
|
+
String input = mState->digitalPin[mPinIn].incomingToAscii(mOffset, bigEndian);
|
49
|
+
if (input.empty()) return -1;
|
50
|
+
return input[0];
|
51
|
+
}
|
52
|
+
|
53
|
+
virtual int read() {
|
54
|
+
if (!isListening()) return -1;
|
55
|
+
String input = mState->digitalPin[mPinIn].incomingToAscii(mOffset, bigEndian);
|
56
|
+
if (input.empty()) return -1;
|
57
|
+
int ret = input[0];
|
58
|
+
for (int i = 0; i < 8; ++i) digitalRead(mPinIn);
|
59
|
+
return ret;
|
60
|
+
}
|
61
|
+
|
62
|
+
//using Print::write;
|
63
|
+
|
64
|
+
virtual size_t write(uint8_t byte) {
|
65
|
+
mState->digitalPin[mPinOut].outgoingFromAscii(String((char)byte), bigEndian);
|
66
|
+
return 1;
|
67
|
+
}
|
68
|
+
|
69
|
+
virtual int available() { return mState->digitalPin[mPinIn].incomingToAscii(mOffset, bigEndian).length(); }
|
70
|
+
virtual void flush() {}
|
71
|
+
operator bool() { return true; }
|
72
|
+
|
73
|
+
static inline void handle_interrupt() {};
|
74
|
+
|
75
|
+
};
|
76
|
+
|
77
|
+
|
data/cpp/arduino/Stream.h
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
#include "WString.h"
|
4
4
|
#include "Print.h"
|
5
5
|
|
6
|
-
|
7
6
|
// This enumeration provides the lookahead options for parseInt(), parseFloat()
|
8
7
|
// The rules set out here are used until either the first valid character is found
|
9
8
|
// or a time out occurs due to lack of input.
|
@@ -45,7 +44,9 @@ class Stream : public Print
|
|
45
44
|
|
46
45
|
public:
|
47
46
|
virtual int available() { return mGodmodeDataIn->length(); }
|
47
|
+
|
48
48
|
virtual int peek() { return available() ? (int)((*mGodmodeDataIn)[0]) : -1; }
|
49
|
+
|
49
50
|
virtual int read() {
|
50
51
|
int ret = peek();
|
51
52
|
if (ret != -1) {
|
@@ -55,6 +56,8 @@ class Stream : public Print
|
|
55
56
|
return ret;
|
56
57
|
}
|
57
58
|
|
59
|
+
using Print::write;
|
60
|
+
|
58
61
|
virtual size_t write(uint8_t aChar) { mGodmodeDataIn->append(String((char)aChar)); return 1; }
|
59
62
|
|
60
63
|
|
data/cpp/arduino/WString.h
CHANGED
@@ -9,6 +9,9 @@
|
|
9
9
|
|
10
10
|
typedef std::string string;
|
11
11
|
|
12
|
+
//typedef const char __FlashStringHelper;
|
13
|
+
class __FlashStringHelper;
|
14
|
+
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
|
12
15
|
|
13
16
|
// Compatibility with string class
|
14
17
|
class String: public string
|
@@ -23,7 +26,7 @@ class String: public string
|
|
23
26
|
|
24
27
|
private:
|
25
28
|
static const char* digit(int val) {
|
26
|
-
const char* bank = "0123456789ABCDEF";
|
29
|
+
static const char* bank = "0123456789ABCDEF";
|
27
30
|
return bank + val;
|
28
31
|
}
|
29
32
|
|
@@ -51,10 +54,11 @@ class String: public string
|
|
51
54
|
|
52
55
|
public:
|
53
56
|
~String(void) {}
|
57
|
+
String(const __FlashStringHelper *str): string((const char *)str) {}
|
54
58
|
String(const char *cstr = ""): string(cstr) {}
|
55
|
-
String(const string &str): string(str
|
56
|
-
String(const String &str): string(str
|
57
|
-
explicit String(char c): string(
|
59
|
+
String(const string &str): string(str) {}
|
60
|
+
String(const String &str): string(str) {}
|
61
|
+
explicit String(char c): string(1, c) {}
|
58
62
|
|
59
63
|
explicit String(unsigned char val, unsigned char base=10): string(mytoa(val, base)) {}
|
60
64
|
explicit String(int val, unsigned char base=10): string(mytoas(val, base)) {}
|
@@ -66,14 +70,15 @@ public:
|
|
66
70
|
explicit String(double val, unsigned char decimalPlaces=2): string(dtoas(val, decimalPlaces)) {}
|
67
71
|
|
68
72
|
String & operator = (const String &rhs) { assign(rhs); return *this; }
|
69
|
-
String & operator = (const
|
70
|
-
|
71
|
-
|
73
|
+
String & operator = (const string &rhs) { assign(rhs); return *this; }
|
74
|
+
String & operator = (const char *cstr) { assign(cstr); return *this; }
|
75
|
+
String & operator = (const char c) { assign(1, c); return *this; }
|
72
76
|
|
77
|
+
unsigned char concat(const __FlashStringHelper *str) { append((const char *)str); return 1; }
|
73
78
|
unsigned char concat(const String &str) { append(str); return 1; }
|
74
79
|
unsigned char concat(const char *cstr) { append(cstr); return 1; }
|
75
|
-
unsigned char concat(char c) { append(
|
76
|
-
unsigned char concat(unsigned char c) { append(
|
80
|
+
unsigned char concat(char c) { append(1, c); return 1; }
|
81
|
+
unsigned char concat(unsigned char c) { append(1, c); return 1; }
|
77
82
|
unsigned char concat(int num) { append(String(num)); return 1; }
|
78
83
|
unsigned char concat(unsigned int num) { append(String(num)); return 1; }
|
79
84
|
unsigned char concat(long num) { append(String(num)); return 1; }
|
@@ -81,6 +86,7 @@ public:
|
|
81
86
|
unsigned char concat(float num) { append(String(num)); return 1; }
|
82
87
|
unsigned char concat(double num) { append(String(num)); return 1; }
|
83
88
|
|
89
|
+
String & operator += (const __FlashStringHelper *rhs) { concat(rhs); return *this; }
|
84
90
|
String & operator += (const String &rhs) { concat(rhs); return *this; }
|
85
91
|
String & operator += (const char *cstr) { concat(cstr); return *this; }
|
86
92
|
String & operator += (char c) { concat(c); return *this; }
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|