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
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
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
@@ -0,0 +1,94 @@
1
+ #pragma once
2
+
3
+
4
+ /*
5
+ def d(var_raw)
6
+ var = var_raw.split("_")[0]
7
+ out = "#define #{var}_P(...) #{var}(__VA_ARGS__)\n"
8
+ IO.popen('pbcopy', 'w') { |f| f << out }
9
+ out
10
+ end
11
+
12
+ text = File.open("arduino-1.8.5/hardware/tools/avr/avr/include/avr/pgmspace.h").read
13
+ externs = text.split("\n").select {|l| l.start_with? "extern"}
14
+ out = externs.map {|l| l.split("(")[0].split(" ")[-1].gsub("*", "") }.uniq
15
+ out.each { |l| puts d(l) }
16
+ */
17
+
18
+ #include <avr/io.h>
19
+
20
+ #define PROGMEM
21
+
22
+ #ifndef PGM_P
23
+ #define PGM_P const char *
24
+ #endif
25
+
26
+ #ifndef PGM_VOID_P
27
+ #define PGM_VOID_P const void *
28
+ #endif
29
+
30
+ // everything's a no-op
31
+ #define PSTR(s) ((const char *)(s))
32
+ #define pgm_read_byte_near(x) (x)
33
+ #define pgm_read_word_near(x) (x)
34
+ #define pgm_read_dword_near(x) (x)
35
+ #define pgm_read_float_near(x) (x)
36
+ #define pgm_read_ptr_near(x) (x)
37
+
38
+ #define pgm_read_byte_far(x) (x)
39
+ #define pgm_read_word_far(x) (x)
40
+ #define pgm_read_dword_far(x) (x)
41
+ #define pgm_read_float_far(x) (x)
42
+ #define pgm_read_ptr_far(x) (x)
43
+
44
+
45
+ #define pgm_read_byte(x) (x)
46
+ #define pgm_read_word(x) (x)
47
+ #define pgm_read_dword(x) (x)
48
+ #define pgm_read_float(x) (x)
49
+ #define pgm_read_ptr(x) (x)
50
+ #define pgm_get_far_address(x) (x)
51
+
52
+ #define memchr_P(...) memchr(__VA_ARGS__)
53
+ #define memcmp_P(...) memcmp(__VA_ARGS__)
54
+ #define memccpy_P(...) memccpy(__VA_ARGS__)
55
+ #define memcpy_P(...) memcpy(__VA_ARGS__)
56
+ #define memmem_P(...) memmem(__VA_ARGS__)
57
+ #define memrchr_P(...) memrchr(__VA_ARGS__)
58
+ #define strcat_P(...) strcat(__VA_ARGS__)
59
+ #define strchr_P(...) strchr(__VA_ARGS__)
60
+ #define strchrnul_P(...) strchrnul(__VA_ARGS__)
61
+ #define strcmp_P(...) strcmp(__VA_ARGS__)
62
+ #define strcpy_P(...) strcpy(__VA_ARGS__)
63
+ #define strcasecmp_P(...) strcasecmp(__VA_ARGS__)
64
+ #define strcasestr_P(...) strcasestr(__VA_ARGS__)
65
+ #define strcspn_P(...) strcspn(__VA_ARGS__)
66
+ #define strlcat_P(...) strlcat(__VA_ARGS__)
67
+ #define strlcpy_P(...) strlcpy(__VA_ARGS__)
68
+ #define strnlen_P(...) strnlen(__VA_ARGS__)
69
+ #define strncmp_P(...) strncmp(__VA_ARGS__)
70
+ #define strncasecmp_P(...) strncasecmp(__VA_ARGS__)
71
+ #define strncat_P(...) strncat(__VA_ARGS__)
72
+ #define strncpy_P(...) strncpy(__VA_ARGS__)
73
+ #define strpbrk_P(...) strpbrk(__VA_ARGS__)
74
+ #define strrchr_P(...) strrchr(__VA_ARGS__)
75
+ #define strsep_P(...) strsep(__VA_ARGS__)
76
+ #define strspn_P(...) strspn(__VA_ARGS__)
77
+ #define strstr_P(...) strstr(__VA_ARGS__)
78
+ #define strtok_P(...) strtok(__VA_ARGS__)
79
+ #define strtok_P(...) strtok(__VA_ARGS__)
80
+ #define strlen_P(...) strlen(__VA_ARGS__)
81
+ #define strnlen_P(...) strnlen(__VA_ARGS__)
82
+ #define memcpy_P(...) memcpy(__VA_ARGS__)
83
+ #define strcpy_P(...) strcpy(__VA_ARGS__)
84
+ #define strncpy_P(...) strncpy(__VA_ARGS__)
85
+ #define strcat_P(...) strcat(__VA_ARGS__)
86
+ #define strlcat_P(...) strlcat(__VA_ARGS__)
87
+ #define strncat_P(...) strncat(__VA_ARGS__)
88
+ #define strcmp_P(...) strcmp(__VA_ARGS__)
89
+ #define strncmp_P(...) strncmp(__VA_ARGS__)
90
+ #define strcasecmp_P(...) strcasecmp(__VA_ARGS__)
91
+ #define strncasecmp_P(...) strncasecmp(__VA_ARGS__)
92
+ #define strstr_P(...) strstr(__VA_ARGS__)
93
+ #define strlcpy_P(...) strlcpy(__VA_ARGS__)
94
+ #define memcmp_P(...) memcmp(__VA_ARGS__)
File without changes
File without changes
File without changes
data/cpp/arduino/binary.h CHANGED
@@ -1,3 +1,4 @@
1
+ #pragma once
1
2
  /* ruby
2
3
  (1..8).each do |b|
3
4
  (0..(2**b - 1)).each do |v|
@@ -0,0 +1,56 @@
1
+ #pragma once
2
+
3
+ #include "ObservableDataStream.h"
4
+ #include "Table.h"
5
+ #include <WString.h>
6
+ #include <Godmode.h>
7
+
8
+
9
+ // Define a rudimentary serial device that responds to byte sequences
10
+ //
11
+ // The class monitors whatever stream it is observing, and builds up
12
+ // a buffer of the incoming data. If/when that data matches one of
13
+ // the stored responses, the buffer is cleared and the response to
14
+ // the matched requests is sent to the handler `onMatchInput`
15
+ //
16
+ // WARNING: if input is consumed and no matches are found, you are
17
+ // in a bad state where you can never match anything again. @TODO
18
+ //
19
+ // The extender of this abstract class should provide the following:
20
+ // 1. A set of responses using one of the provided convenience functions:
21
+ // * `addResponse`: request and response are taken verbatim
22
+ // * `addResponseLine`: request and response are appended a \n
23
+ // * `addResponseCRLF`: request and response are appended a \r\n
24
+ // 2. An action `onMatchInput` -- what to do with a response when triggered
25
+ class DeviceUsingBytes : public DataStreamObserver {
26
+ public:
27
+ String mMessage;
28
+ Table<String, String> mResponses;
29
+ GodmodeState* state;
30
+
31
+
32
+ DeviceUsingBytes() : DataStreamObserver(true, false) {
33
+ mMessage = "";
34
+ state = GODMODE();
35
+ }
36
+
37
+ virtual ~DeviceUsingBytes() {}
38
+
39
+ bool addResponse(String hear, String say) { return mResponses.add(hear, say); }
40
+ bool addResponseLine(String hear, String say) { return mResponses.add(hear + "\n", say + "\n"); }
41
+ bool addResponseCRLF(String hear, String say) { return mResponses.add(hear + "\r\n", say + "\r\n"); }
42
+
43
+ // what to do when there is a match
44
+ virtual void onMatchInput(String output) = 0;
45
+
46
+ virtual String observerName() const { return "DeviceUsingBytes"; }
47
+
48
+ virtual void onByte(unsigned char c) {
49
+ mMessage.concat(c);
50
+ if (mResponses.has(mMessage)) {
51
+ onMatchInput(mResponses.get(mMessage));
52
+ mMessage = "";
53
+ }
54
+ }
55
+ };
56
+
@@ -0,0 +1,124 @@
1
+ #pragma once
2
+
3
+ #include "Table.h"
4
+ #include <WString.h>
5
+
6
+
7
+ // This pair of classes defines an Observer pattern for bits and bytes.
8
+ // This would allow us to create "devices" that respond in "real" time
9
+ // to Arduino outputs, in the form of altering the Arduino inputs
10
+ //
11
+ // e.g. replying to a serial output with serial input
12
+ class ObservableDataStream;
13
+
14
+ // datastream observers handle deliveries of bits and bytes.
15
+ // optionally, they can turn bit events into byte events with a given endianness
16
+ class DataStreamObserver {
17
+ private:
18
+ unsigned int mBitPosition; // for building the byte (mask helper)
19
+ unsigned char mBuildingByte; // for storing incoming bits
20
+ bool mAutoBitPack; // whether to report the packed bits
21
+ bool mBigEndian; // bit order for byte
22
+
23
+ protected:
24
+ // functions that are up to the implementer to provide.
25
+ virtual void onBit(bool aBit) {}
26
+ virtual void onByte(unsigned char aByte) {}
27
+ virtual String observerName() const = 0;
28
+
29
+ public:
30
+ DataStreamObserver(bool autoBitPack, bool bigEndian)
31
+ {
32
+ mBitPosition = 0;
33
+ mBuildingByte = 0x00;
34
+ mAutoBitPack = autoBitPack;
35
+ mBigEndian = bigEndian;
36
+ }
37
+
38
+ virtual ~DataStreamObserver() {}
39
+
40
+ // entry point for byte-related handler
41
+ void handleByte(unsigned char aByte) {
42
+ onByte(aByte);
43
+ }
44
+
45
+ // entry poitn for bit-related handler
46
+ void handleBit(bool aBit) {
47
+ onBit(aBit);
48
+
49
+ if (!mAutoBitPack) return;
50
+
51
+ // build the next value
52
+ int shift = mBigEndian ? 7 - mBitPosition : mBitPosition;
53
+ unsigned char val = aBit ? 0x1 : 0x0;
54
+ mBuildingByte |= (val << shift);
55
+
56
+ // if we roll over after incrementing, the byte is ready to ship
57
+ mBitPosition = (mBitPosition + 1) % 8;
58
+ if (mBitPosition == 0) {
59
+ handleByte(mBuildingByte);
60
+ mBuildingByte = 0x00;
61
+ };
62
+ }
63
+
64
+ // inlined after ObservableDataStream definition to fake out the compiler
65
+ bool attach(ObservableDataStream* source);
66
+ bool detach(ObservableDataStream* source);
67
+ };
68
+
69
+ // Inheritable interface for things that produce data, like pins or serial ports
70
+ // this class allows others to subscribe for updates on these values and trigger actions
71
+ // e.g. if you "turn on" a motor with one pin and expect to see a change in an analog pin
72
+ class ObservableDataStream
73
+ {
74
+ private:
75
+ Table<String, DataStreamObserver*> mObservers;
76
+ bool mAdvertisingBit;
77
+ unsigned char mAdvertisingByte;
78
+
79
+ protected:
80
+ // to allow both member and non-member functions to be called, we need to trick the compiler
81
+ // into getting the (this) of a static function. So the default is a work function signature
82
+ // that takes a second optional argument. in this case, we use the argument.
83
+
84
+ static void workAdvertiseBit(ObservableDataStream* that, String _, DataStreamObserver* val) {
85
+ val->handleBit(that->mAdvertisingBit);
86
+ }
87
+
88
+ static void workAdvertiseByte(ObservableDataStream* that, String _, DataStreamObserver* val) {
89
+ val->handleByte(that->mAdvertisingByte);
90
+ }
91
+
92
+ // advertise functions allow the data stream to publish to observers
93
+
94
+ // update all observers with a byte value
95
+ void advertiseByte(unsigned char aByte) {
96
+ // save the value to a class variable. then use the static method with this instance
97
+ mAdvertisingByte = aByte;
98
+ mObservers.iterate(workAdvertiseByte, this);
99
+ }
100
+
101
+ // update all observers with a byte value
102
+ // build up a byte
103
+ // if requested, advertise the byte
104
+ void advertiseBit(bool aBit) {
105
+ // do the named thing first, of course
106
+ mAdvertisingBit = aBit;
107
+ mObservers.iterate(workAdvertiseBit, this);
108
+ }
109
+
110
+ public:
111
+ ObservableDataStream() : mObservers() {
112
+ mAdvertisingBit = false; // we'll re-init on demand though
113
+ mAdvertisingByte = 0x07; // we'll re-init on demand though
114
+ }
115
+
116
+ virtual ~ObservableDataStream() {}
117
+
118
+ bool addObserver(String name, DataStreamObserver* obs) { return mObservers.add(name, obs); }
119
+ bool removeObserver(String name) { return mObservers.remove(name); }
120
+ };
121
+
122
+ inline bool DataStreamObserver::attach(ObservableDataStream* source) { return source->addObserver(observerName(), this); }
123
+
124
+ inline bool DataStreamObserver::detach(ObservableDataStream* source) { return source->removeObserver(observerName()); }
@@ -0,0 +1,73 @@
1
+ #pragma once
2
+
3
+ template <typename T>
4
+ class Queue {
5
+ private:
6
+ struct Node {
7
+ T data;
8
+ Node* next;
9
+ };
10
+
11
+ Node* mFront;
12
+ Node* mBack;
13
+ unsigned long mSize;
14
+ T mNil;
15
+
16
+ void init() {
17
+ mFront = mBack = NULL;
18
+ mSize = 0;
19
+ }
20
+
21
+ public:
22
+ Queue(): mNil() { init(); }
23
+
24
+ Queue(const Queue<T>& q) {
25
+ init();
26
+ for (Node* n = q.mFront; n; n = n->next) push(n->data);
27
+ }
28
+
29
+ inline unsigned long size() const { return mSize; }
30
+
31
+ inline bool empty() const { return 0 == mSize; }
32
+
33
+ const T& front() const { return empty() ? mNil : mFront->data; }
34
+
35
+ const T& back() const { return empty() ? mNil : mBack->data; }
36
+
37
+ bool push(const T& v)
38
+ {
39
+ Node *n = new Node;
40
+ if (n == NULL) return false;
41
+
42
+ n->data = v;
43
+ n->next = NULL;
44
+
45
+ if (mFront == NULL)
46
+ {
47
+ mFront = mBack = n;
48
+ } else {
49
+ mBack->next = n;
50
+ mBack = n;
51
+ }
52
+
53
+ ++mSize;
54
+ return true;
55
+ }
56
+
57
+ void pop() {
58
+ if (empty()) return;
59
+ if (mFront == mBack) {
60
+ mFront = mBack = NULL;
61
+ } else {
62
+ Node* n = mFront;
63
+ mFront = mFront->next;
64
+ delete n;
65
+ }
66
+
67
+ --mSize;
68
+ }
69
+
70
+ void clear() { while (!empty()) pop(); }
71
+
72
+ ~Queue() { clear(); }
73
+ };