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.
Files changed (306) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +203 -4
  3. data/cpp/arduino/Arduino.cpp +0 -21
  4. data/cpp/arduino/Arduino.h +0 -10
  5. data/cpp/arduino/ArduinoDefines.h +0 -1
  6. data/cpp/arduino/AvrMath.h +5 -6
  7. data/cpp/arduino/Godmode.cpp +26 -0
  8. data/cpp/arduino/Godmode.h +41 -19
  9. data/cpp/arduino/HardwareSerial.h +7 -3
  10. data/cpp/arduino/PinHistory.h +160 -0
  11. data/cpp/arduino/Print.h +4 -2
  12. data/cpp/arduino/SoftwareSerial.h +77 -0
  13. data/cpp/arduino/Stream.h +4 -1
  14. data/cpp/arduino/WString.h +15 -9
  15. data/cpp/arduino/{include → avr}/README.md +0 -0
  16. data/cpp/arduino/{include → avr}/common.h +0 -0
  17. data/cpp/arduino/{include → avr}/fuse.h +0 -0
  18. data/cpp/arduino/{include → avr}/io.h +0 -0
  19. data/cpp/arduino/{include → avr}/io1200.h +0 -0
  20. data/cpp/arduino/{include → avr}/io2313.h +0 -0
  21. data/cpp/arduino/{include → avr}/io2323.h +0 -0
  22. data/cpp/arduino/{include → avr}/io2333.h +0 -0
  23. data/cpp/arduino/{include → avr}/io2343.h +0 -0
  24. data/cpp/arduino/{include → avr}/io43u32x.h +0 -0
  25. data/cpp/arduino/{include → avr}/io43u35x.h +0 -0
  26. data/cpp/arduino/{include → avr}/io4414.h +0 -0
  27. data/cpp/arduino/{include → avr}/io4433.h +0 -0
  28. data/cpp/arduino/{include → avr}/io4434.h +0 -0
  29. data/cpp/arduino/{include → avr}/io76c711.h +0 -0
  30. data/cpp/arduino/{include → avr}/io8515.h +0 -0
  31. data/cpp/arduino/{include → avr}/io8534.h +0 -0
  32. data/cpp/arduino/{include → avr}/io8535.h +0 -0
  33. data/cpp/arduino/{include → avr}/io86r401.h +0 -0
  34. data/cpp/arduino/{include → avr}/io90pwm1.h +0 -0
  35. data/cpp/arduino/{include → avr}/io90pwm161.h +0 -0
  36. data/cpp/arduino/{include → avr}/io90pwm216.h +0 -0
  37. data/cpp/arduino/{include → avr}/io90pwm2b.h +0 -0
  38. data/cpp/arduino/{include → avr}/io90pwm316.h +0 -0
  39. data/cpp/arduino/{include → avr}/io90pwm3b.h +0 -0
  40. data/cpp/arduino/{include → avr}/io90pwm81.h +0 -0
  41. data/cpp/arduino/{include → avr}/io90pwmx.h +0 -0
  42. data/cpp/arduino/{include → avr}/io90scr100.h +0 -0
  43. data/cpp/arduino/{include → avr}/ioa5272.h +0 -0
  44. data/cpp/arduino/{include → avr}/ioa5505.h +0 -0
  45. data/cpp/arduino/{include → avr}/ioa5702m322.h +0 -0
  46. data/cpp/arduino/{include → avr}/ioa5782.h +0 -0
  47. data/cpp/arduino/{include → avr}/ioa5790.h +0 -0
  48. data/cpp/arduino/{include → avr}/ioa5790n.h +0 -0
  49. data/cpp/arduino/{include → avr}/ioa5791.h +0 -0
  50. data/cpp/arduino/{include → avr}/ioa5795.h +0 -0
  51. data/cpp/arduino/{include → avr}/ioa5831.h +0 -0
  52. data/cpp/arduino/{include → avr}/ioa6285.h +0 -0
  53. data/cpp/arduino/{include → avr}/ioa6286.h +0 -0
  54. data/cpp/arduino/{include → avr}/ioa6289.h +0 -0
  55. data/cpp/arduino/{include → avr}/ioa6612c.h +0 -0
  56. data/cpp/arduino/{include → avr}/ioa6613c.h +0 -0
  57. data/cpp/arduino/{include → avr}/ioa6614q.h +0 -0
  58. data/cpp/arduino/{include → avr}/ioa6616c.h +0 -0
  59. data/cpp/arduino/{include → avr}/ioa6617c.h +0 -0
  60. data/cpp/arduino/{include → avr}/ioa664251.h +0 -0
  61. data/cpp/arduino/{include → avr}/ioa8210.h +0 -0
  62. data/cpp/arduino/{include → avr}/ioa8510.h +0 -0
  63. data/cpp/arduino/{include → avr}/ioat94k.h +0 -0
  64. data/cpp/arduino/{include → avr}/iocan128.h +0 -0
  65. data/cpp/arduino/{include → avr}/iocan32.h +0 -0
  66. data/cpp/arduino/{include → avr}/iocan64.h +0 -0
  67. data/cpp/arduino/{include → avr}/iocanxx.h +0 -0
  68. data/cpp/arduino/{include → avr}/iom103.h +0 -0
  69. data/cpp/arduino/{include → avr}/iom128.h +0 -0
  70. data/cpp/arduino/{include → avr}/iom1280.h +0 -0
  71. data/cpp/arduino/{include → avr}/iom1281.h +0 -0
  72. data/cpp/arduino/{include → avr}/iom1284.h +0 -0
  73. data/cpp/arduino/{include → avr}/iom1284p.h +0 -0
  74. data/cpp/arduino/{include → avr}/iom1284rfr2.h +0 -0
  75. data/cpp/arduino/{include → avr}/iom128a.h +0 -0
  76. data/cpp/arduino/{include → avr}/iom128rfa1.h +0 -0
  77. data/cpp/arduino/{include → avr}/iom128rfr2.h +0 -0
  78. data/cpp/arduino/{include → avr}/iom16.h +0 -0
  79. data/cpp/arduino/{include → avr}/iom161.h +0 -0
  80. data/cpp/arduino/{include → avr}/iom162.h +0 -0
  81. data/cpp/arduino/{include → avr}/iom163.h +0 -0
  82. data/cpp/arduino/{include → avr}/iom164.h +0 -0
  83. data/cpp/arduino/{include → avr}/iom164a.h +0 -0
  84. data/cpp/arduino/{include → avr}/iom164p.h +0 -0
  85. data/cpp/arduino/{include → avr}/iom164pa.h +0 -0
  86. data/cpp/arduino/{include → avr}/iom165.h +0 -0
  87. data/cpp/arduino/{include → avr}/iom165a.h +0 -0
  88. data/cpp/arduino/{include → avr}/iom165p.h +0 -0
  89. data/cpp/arduino/{include → avr}/iom165pa.h +0 -0
  90. data/cpp/arduino/{include → avr}/iom168.h +0 -0
  91. data/cpp/arduino/{include → avr}/iom168a.h +0 -0
  92. data/cpp/arduino/{include → avr}/iom168p.h +0 -0
  93. data/cpp/arduino/{include → avr}/iom168pa.h +0 -0
  94. data/cpp/arduino/{include → avr}/iom168pb.h +0 -0
  95. data/cpp/arduino/{include → avr}/iom169.h +0 -0
  96. data/cpp/arduino/{include → avr}/iom169a.h +0 -0
  97. data/cpp/arduino/{include → avr}/iom169p.h +0 -0
  98. data/cpp/arduino/{include → avr}/iom169pa.h +0 -0
  99. data/cpp/arduino/{include → avr}/iom16a.h +0 -0
  100. data/cpp/arduino/{include → avr}/iom16hva.h +0 -0
  101. data/cpp/arduino/{include → avr}/iom16hva2.h +0 -0
  102. data/cpp/arduino/{include → avr}/iom16hvb.h +0 -0
  103. data/cpp/arduino/{include → avr}/iom16hvbrevb.h +0 -0
  104. data/cpp/arduino/{include → avr}/iom16m1.h +0 -0
  105. data/cpp/arduino/{include → avr}/iom16u2.h +0 -0
  106. data/cpp/arduino/{include → avr}/iom16u4.h +0 -0
  107. data/cpp/arduino/{include → avr}/iom2560.h +0 -0
  108. data/cpp/arduino/{include → avr}/iom2561.h +0 -0
  109. data/cpp/arduino/{include → avr}/iom2564rfr2.h +0 -0
  110. data/cpp/arduino/{include → avr}/iom256rfr2.h +0 -0
  111. data/cpp/arduino/{include → avr}/iom3000.h +0 -0
  112. data/cpp/arduino/{include → avr}/iom32.h +0 -0
  113. data/cpp/arduino/{include → avr}/iom323.h +0 -0
  114. data/cpp/arduino/{include → avr}/iom324a.h +0 -0
  115. data/cpp/arduino/{include → avr}/iom324p.h +0 -0
  116. data/cpp/arduino/{include → avr}/iom324pa.h +0 -0
  117. data/cpp/arduino/{include → avr}/iom325.h +0 -0
  118. data/cpp/arduino/{include → avr}/iom3250.h +0 -0
  119. data/cpp/arduino/{include → avr}/iom3250a.h +0 -0
  120. data/cpp/arduino/{include → avr}/iom3250p.h +0 -0
  121. data/cpp/arduino/{include → avr}/iom3250pa.h +0 -0
  122. data/cpp/arduino/{include → avr}/iom325a.h +0 -0
  123. data/cpp/arduino/{include → avr}/iom325p.h +0 -0
  124. data/cpp/arduino/{include → avr}/iom325pa.h +0 -0
  125. data/cpp/arduino/{include → avr}/iom328.h +0 -0
  126. data/cpp/arduino/{include → avr}/iom328p.h +0 -0
  127. data/cpp/arduino/{include → avr}/iom329.h +0 -0
  128. data/cpp/arduino/{include → avr}/iom3290.h +0 -0
  129. data/cpp/arduino/{include → avr}/iom3290a.h +0 -0
  130. data/cpp/arduino/{include → avr}/iom3290pa.h +0 -0
  131. data/cpp/arduino/{include → avr}/iom329a.h +0 -0
  132. data/cpp/arduino/{include → avr}/iom329p.h +0 -0
  133. data/cpp/arduino/{include → avr}/iom329pa.h +0 -0
  134. data/cpp/arduino/{include → avr}/iom32a.h +0 -0
  135. data/cpp/arduino/{include → avr}/iom32c1.h +0 -0
  136. data/cpp/arduino/{include → avr}/iom32hvb.h +0 -0
  137. data/cpp/arduino/{include → avr}/iom32hvbrevb.h +0 -0
  138. data/cpp/arduino/{include → avr}/iom32m1.h +0 -0
  139. data/cpp/arduino/{include → avr}/iom32u2.h +0 -0
  140. data/cpp/arduino/{include → avr}/iom32u4.h +0 -0
  141. data/cpp/arduino/{include → avr}/iom32u6.h +0 -0
  142. data/cpp/arduino/{include → avr}/iom406.h +0 -0
  143. data/cpp/arduino/{include → avr}/iom48.h +0 -0
  144. data/cpp/arduino/{include → avr}/iom48a.h +0 -0
  145. data/cpp/arduino/{include → avr}/iom48p.h +0 -0
  146. data/cpp/arduino/{include → avr}/iom48pa.h +0 -0
  147. data/cpp/arduino/{include → avr}/iom48pb.h +0 -0
  148. data/cpp/arduino/{include → avr}/iom64.h +0 -0
  149. data/cpp/arduino/{include → avr}/iom640.h +0 -0
  150. data/cpp/arduino/{include → avr}/iom644.h +0 -0
  151. data/cpp/arduino/{include → avr}/iom644a.h +0 -0
  152. data/cpp/arduino/{include → avr}/iom644p.h +0 -0
  153. data/cpp/arduino/{include → avr}/iom644pa.h +0 -0
  154. data/cpp/arduino/{include → avr}/iom644rfr2.h +0 -0
  155. data/cpp/arduino/{include → avr}/iom645.h +0 -0
  156. data/cpp/arduino/{include → avr}/iom6450.h +0 -0
  157. data/cpp/arduino/{include → avr}/iom6450a.h +0 -0
  158. data/cpp/arduino/{include → avr}/iom6450p.h +0 -0
  159. data/cpp/arduino/{include → avr}/iom645a.h +0 -0
  160. data/cpp/arduino/{include → avr}/iom645p.h +0 -0
  161. data/cpp/arduino/{include → avr}/iom649.h +0 -0
  162. data/cpp/arduino/{include → avr}/iom6490.h +0 -0
  163. data/cpp/arduino/{include → avr}/iom6490a.h +0 -0
  164. data/cpp/arduino/{include → avr}/iom6490p.h +0 -0
  165. data/cpp/arduino/{include → avr}/iom649a.h +0 -0
  166. data/cpp/arduino/{include → avr}/iom649p.h +0 -0
  167. data/cpp/arduino/{include → avr}/iom64a.h +0 -0
  168. data/cpp/arduino/{include → avr}/iom64c1.h +0 -0
  169. data/cpp/arduino/{include → avr}/iom64hve.h +0 -0
  170. data/cpp/arduino/{include → avr}/iom64hve2.h +0 -0
  171. data/cpp/arduino/{include → avr}/iom64m1.h +0 -0
  172. data/cpp/arduino/{include → avr}/iom64rfr2.h +0 -0
  173. data/cpp/arduino/{include → avr}/iom8.h +0 -0
  174. data/cpp/arduino/{include → avr}/iom8515.h +0 -0
  175. data/cpp/arduino/{include → avr}/iom8535.h +0 -0
  176. data/cpp/arduino/{include → avr}/iom88.h +0 -0
  177. data/cpp/arduino/{include → avr}/iom88a.h +0 -0
  178. data/cpp/arduino/{include → avr}/iom88p.h +0 -0
  179. data/cpp/arduino/{include → avr}/iom88pa.h +0 -0
  180. data/cpp/arduino/{include → avr}/iom88pb.h +0 -0
  181. data/cpp/arduino/{include → avr}/iom8a.h +0 -0
  182. data/cpp/arduino/{include → avr}/iom8hva.h +0 -0
  183. data/cpp/arduino/{include → avr}/iom8u2.h +0 -0
  184. data/cpp/arduino/{include → avr}/iomx8.h +0 -0
  185. data/cpp/arduino/{include → avr}/iomxx0_1.h +0 -0
  186. data/cpp/arduino/{include → avr}/iomxx4.h +0 -0
  187. data/cpp/arduino/{include → avr}/iomxxhva.h +0 -0
  188. data/cpp/arduino/{include → avr}/iotn10.h +0 -0
  189. data/cpp/arduino/{include → avr}/iotn11.h +0 -0
  190. data/cpp/arduino/{include → avr}/iotn12.h +0 -0
  191. data/cpp/arduino/{include → avr}/iotn13.h +0 -0
  192. data/cpp/arduino/{include → avr}/iotn13a.h +0 -0
  193. data/cpp/arduino/{include → avr}/iotn15.h +0 -0
  194. data/cpp/arduino/{include → avr}/iotn1634.h +0 -0
  195. data/cpp/arduino/{include → avr}/iotn167.h +0 -0
  196. data/cpp/arduino/{include → avr}/iotn20.h +0 -0
  197. data/cpp/arduino/{include → avr}/iotn22.h +0 -0
  198. data/cpp/arduino/{include → avr}/iotn2313.h +0 -0
  199. data/cpp/arduino/{include → avr}/iotn2313a.h +0 -0
  200. data/cpp/arduino/{include → avr}/iotn24.h +0 -0
  201. data/cpp/arduino/{include → avr}/iotn24a.h +0 -0
  202. data/cpp/arduino/{include → avr}/iotn25.h +0 -0
  203. data/cpp/arduino/{include → avr}/iotn26.h +0 -0
  204. data/cpp/arduino/{include → avr}/iotn261.h +0 -0
  205. data/cpp/arduino/{include → avr}/iotn261a.h +0 -0
  206. data/cpp/arduino/{include → avr}/iotn28.h +0 -0
  207. data/cpp/arduino/{include → avr}/iotn4.h +0 -0
  208. data/cpp/arduino/{include → avr}/iotn40.h +0 -0
  209. data/cpp/arduino/{include → avr}/iotn4313.h +0 -0
  210. data/cpp/arduino/{include → avr}/iotn43u.h +0 -0
  211. data/cpp/arduino/{include → avr}/iotn44.h +0 -0
  212. data/cpp/arduino/{include → avr}/iotn441.h +0 -0
  213. data/cpp/arduino/{include → avr}/iotn44a.h +0 -0
  214. data/cpp/arduino/{include → avr}/iotn45.h +0 -0
  215. data/cpp/arduino/{include → avr}/iotn461.h +0 -0
  216. data/cpp/arduino/{include → avr}/iotn461a.h +0 -0
  217. data/cpp/arduino/{include → avr}/iotn48.h +0 -0
  218. data/cpp/arduino/{include → avr}/iotn5.h +0 -0
  219. data/cpp/arduino/{include → avr}/iotn828.h +0 -0
  220. data/cpp/arduino/{include → avr}/iotn84.h +0 -0
  221. data/cpp/arduino/{include → avr}/iotn841.h +0 -0
  222. data/cpp/arduino/{include → avr}/iotn84a.h +0 -0
  223. data/cpp/arduino/{include → avr}/iotn85.h +0 -0
  224. data/cpp/arduino/{include → avr}/iotn861.h +0 -0
  225. data/cpp/arduino/{include → avr}/iotn861a.h +0 -0
  226. data/cpp/arduino/{include → avr}/iotn87.h +0 -0
  227. data/cpp/arduino/{include → avr}/iotn88.h +0 -0
  228. data/cpp/arduino/{include → avr}/iotn9.h +0 -0
  229. data/cpp/arduino/{include → avr}/iotnx4.h +0 -0
  230. data/cpp/arduino/{include → avr}/iotnx5.h +0 -0
  231. data/cpp/arduino/{include → avr}/iotnx61.h +0 -0
  232. data/cpp/arduino/{include → avr}/iousb1286.h +0 -0
  233. data/cpp/arduino/{include → avr}/iousb1287.h +0 -0
  234. data/cpp/arduino/{include → avr}/iousb162.h +0 -0
  235. data/cpp/arduino/{include → avr}/iousb646.h +0 -0
  236. data/cpp/arduino/{include → avr}/iousb647.h +0 -0
  237. data/cpp/arduino/{include → avr}/iousb82.h +0 -0
  238. data/cpp/arduino/{include → avr}/iousbxx2.h +0 -0
  239. data/cpp/arduino/{include → avr}/iousbxx6_7.h +0 -0
  240. data/cpp/arduino/{include → avr}/iox128a1.h +0 -0
  241. data/cpp/arduino/{include → avr}/iox128a1u.h +0 -0
  242. data/cpp/arduino/{include → avr}/iox128a3.h +0 -0
  243. data/cpp/arduino/{include → avr}/iox128a3u.h +0 -0
  244. data/cpp/arduino/{include → avr}/iox128a4u.h +0 -0
  245. data/cpp/arduino/{include → avr}/iox128b1.h +0 -0
  246. data/cpp/arduino/{include → avr}/iox128b3.h +0 -0
  247. data/cpp/arduino/{include → avr}/iox128c3.h +0 -0
  248. data/cpp/arduino/{include → avr}/iox128d3.h +0 -0
  249. data/cpp/arduino/{include → avr}/iox128d4.h +0 -0
  250. data/cpp/arduino/{include → avr}/iox16a4.h +0 -0
  251. data/cpp/arduino/{include → avr}/iox16a4u.h +0 -0
  252. data/cpp/arduino/{include → avr}/iox16c4.h +0 -0
  253. data/cpp/arduino/{include → avr}/iox16d4.h +0 -0
  254. data/cpp/arduino/{include → avr}/iox16e5.h +0 -0
  255. data/cpp/arduino/{include → avr}/iox192a3.h +0 -0
  256. data/cpp/arduino/{include → avr}/iox192a3u.h +0 -0
  257. data/cpp/arduino/{include → avr}/iox192c3.h +0 -0
  258. data/cpp/arduino/{include → avr}/iox192d3.h +0 -0
  259. data/cpp/arduino/{include → avr}/iox256a3.h +0 -0
  260. data/cpp/arduino/{include → avr}/iox256a3b.h +0 -0
  261. data/cpp/arduino/{include → avr}/iox256a3bu.h +0 -0
  262. data/cpp/arduino/{include → avr}/iox256a3u.h +0 -0
  263. data/cpp/arduino/{include → avr}/iox256c3.h +0 -0
  264. data/cpp/arduino/{include → avr}/iox256d3.h +0 -0
  265. data/cpp/arduino/{include → avr}/iox32a4.h +0 -0
  266. data/cpp/arduino/{include → avr}/iox32a4u.h +0 -0
  267. data/cpp/arduino/{include → avr}/iox32c3.h +0 -0
  268. data/cpp/arduino/{include → avr}/iox32c4.h +0 -0
  269. data/cpp/arduino/{include → avr}/iox32d3.h +0 -0
  270. data/cpp/arduino/{include → avr}/iox32d4.h +0 -0
  271. data/cpp/arduino/{include → avr}/iox32e5.h +0 -0
  272. data/cpp/arduino/{include → avr}/iox384c3.h +0 -0
  273. data/cpp/arduino/{include → avr}/iox384d3.h +0 -0
  274. data/cpp/arduino/{include → avr}/iox64a1.h +0 -0
  275. data/cpp/arduino/{include → avr}/iox64a1u.h +0 -0
  276. data/cpp/arduino/{include → avr}/iox64a3.h +0 -0
  277. data/cpp/arduino/{include → avr}/iox64a3u.h +0 -0
  278. data/cpp/arduino/{include → avr}/iox64a4u.h +0 -0
  279. data/cpp/arduino/{include → avr}/iox64b1.h +0 -0
  280. data/cpp/arduino/{include → avr}/iox64b3.h +0 -0
  281. data/cpp/arduino/{include → avr}/iox64c3.h +0 -0
  282. data/cpp/arduino/{include → avr}/iox64d3.h +0 -0
  283. data/cpp/arduino/{include → avr}/iox64d4.h +0 -0
  284. data/cpp/arduino/{include → avr}/iox8e5.h +0 -0
  285. data/cpp/arduino/{include → avr}/lock.h +0 -0
  286. data/cpp/arduino/avr/pgmspace.h +94 -0
  287. data/cpp/arduino/{include → avr}/portpins.h +0 -0
  288. data/cpp/arduino/{include → avr}/version.h +0 -0
  289. data/cpp/arduino/{include → avr}/xmega.h +0 -0
  290. data/cpp/arduino/binary.h +1 -0
  291. data/cpp/arduino/ci/DeviceUsingBytes.h +56 -0
  292. data/cpp/arduino/ci/ObservableDataStream.h +124 -0
  293. data/cpp/arduino/ci/Queue.h +73 -0
  294. data/cpp/arduino/ci/README.md +5 -0
  295. data/cpp/arduino/ci/Table.h +125 -0
  296. data/cpp/unittest/ArduinoUnitTests.h +16 -16
  297. data/cpp/unittest/Assertion.h +2 -2
  298. data/cpp/unittest/Compare.h +1 -1
  299. data/exe/arduino_ci_remote.rb +34 -21
  300. data/lib/arduino_ci/arduino_cmd.rb +1 -0
  301. data/lib/arduino_ci/arduino_installation.rb +13 -19
  302. data/lib/arduino_ci/ci_config.rb +42 -10
  303. data/lib/arduino_ci/cpp_library.rb +6 -1
  304. data/lib/arduino_ci/version.rb +1 -1
  305. data/misc/{default.yaml → default.yml} +0 -0
  306. 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) { mGodmodeDataOut->append(String((char)aChar)); return 1; }
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
- virtual size_t write(const uint8_t *buffer, size_t size)
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
 
@@ -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.c_str()) {}
56
- String(const String &str): string(str.c_str()) {}
57
- explicit String(char c): string(&c, 1) {}
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 char *cstr) { assign(cstr); return *this; }
70
-
71
- unsigned char reserve(unsigned int size) { return true; } // calling reserve(size) segfaults, no idea why
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((const char*)&c, 1); return 1; }
76
- unsigned char concat(unsigned char c) { append((const char*)&c, 1); return 1; }
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