subduino 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. data/VERSION +1 -1
  2. data/bin/subduino +18 -5
  3. data/duino/Makefile +2 -3
  4. data/duino/duino.pde +97 -66
  5. data/lib/subduino/ard_io.rb +33 -14
  6. data/lib/subduino/ard_ps.rb +47 -24
  7. data/lib/subduino/os.rb +49 -0
  8. data/lib/subduino/parse/bool.rb +1 -1
  9. data/lib/subduino/parse/energy.rb +18 -0
  10. data/lib/subduino/parse/flow.rb +13 -0
  11. data/lib/subduino/parse/lux.rb +1 -1
  12. data/lib/subduino/parse/presence.rb +9 -0
  13. data/lib/subduino/parse/pressure.rb +13 -0
  14. data/lib/subduino/parse/temp.rb +1 -1
  15. data/lib/subduino/parse.rb +3 -3
  16. data/lib/subduino/scaffold/Makefile +72 -73
  17. data/lib/subduino/scaffold/scaffold.pde +77 -0
  18. data/lib/subduino/store.rb +1 -1
  19. data/spec/subduino/parse_spec.rb +1 -1
  20. data/subduino.gemspec +8 -249
  21. metadata +8 -249
  22. data/webapp/Gemfile +0 -8
  23. data/webapp/Gemfile.lock +0 -14
  24. data/webapp/Rakefile +0 -49
  25. data/webapp/Readme.textile +0 -45
  26. data/webapp/VERSION +0 -1
  27. data/webapp/config.yml +0 -20
  28. data/webapp/lib/app.rb +0 -103
  29. data/webapp/lib/duino.rb +0 -206
  30. data/webapp/lib/environment.rb +0 -36
  31. data/webapp/lib/messenger.rb +0 -16
  32. data/webapp/public/app.css +0 -119
  33. data/webapp/public/app.js +0 -34
  34. data/webapp/public/custom.js +0 -187
  35. data/webapp/public/date_input.css +0 -149
  36. data/webapp/public/facebox.css +0 -83
  37. data/webapp/public/facebox.js +0 -319
  38. data/webapp/public/favicon.ico +0 -0
  39. data/webapp/public/faye.js +0 -1
  40. data/webapp/public/icons/alarm-clock-blue.png +0 -0
  41. data/webapp/public/icons/alarm-clock.png +0 -0
  42. data/webapp/public/icons/balloon-left.png +0 -0
  43. data/webapp/public/icons/bandaid.png +0 -0
  44. data/webapp/public/icons/bell-disable.png +0 -0
  45. data/webapp/public/icons/bell.png +0 -0
  46. data/webapp/public/icons/big_icon.png +0 -0
  47. data/webapp/public/icons/bomb.png +0 -0
  48. data/webapp/public/icons/bookmark.png +0 -0
  49. data/webapp/public/icons/box-label.png +0 -0
  50. data/webapp/public/icons/brightness-control-up.png +0 -0
  51. data/webapp/public/icons/brightness-control.png +0 -0
  52. data/webapp/public/icons/brightness-small.png +0 -0
  53. data/webapp/public/icons/broom.png +0 -0
  54. data/webapp/public/icons/bug.png +0 -0
  55. data/webapp/public/icons/calculator.png +0 -0
  56. data/webapp/public/icons/calendar-day.png +0 -0
  57. data/webapp/public/icons/camera.png +0 -0
  58. data/webapp/public/icons/cards-address.png +0 -0
  59. data/webapp/public/icons/chart.png +0 -0
  60. data/webapp/public/icons/clock-select.png +0 -0
  61. data/webapp/public/icons/color.png +0 -0
  62. data/webapp/public/icons/compass.png +0 -0
  63. data/webapp/public/icons/control-power-small.png +0 -0
  64. data/webapp/public/icons/control-power.png +0 -0
  65. data/webapp/public/icons/control-record-small.png +0 -0
  66. data/webapp/public/icons/cpus.png +0 -0
  67. data/webapp/public/icons/credit-card.png +0 -0
  68. data/webapp/public/icons/cross-small.png +0 -0
  69. data/webapp/public/icons/current.png +0 -0
  70. data/webapp/public/icons/dashboard.png +0 -0
  71. data/webapp/public/icons/database.png +0 -0
  72. data/webapp/public/icons/databases.png +0 -0
  73. data/webapp/public/icons/day.png +0 -0
  74. data/webapp/public/icons/door-big.png +0 -0
  75. data/webapp/public/icons/door-open-in.png +0 -0
  76. data/webapp/public/icons/door-open-out.png +0 -0
  77. data/webapp/public/icons/door-open.png +0 -0
  78. data/webapp/public/icons/door.png +0 -0
  79. data/webapp/public/icons/drive-globe.png +0 -0
  80. data/webapp/public/icons/equalizer.png +0 -0
  81. data/webapp/public/icons/exclamation-diamond.png +0 -0
  82. data/webapp/public/icons/exclamation.png +0 -0
  83. data/webapp/public/icons/eye-disable.png +0 -0
  84. data/webapp/public/icons/eye.png +0 -0
  85. data/webapp/public/icons/false.png +0 -0
  86. data/webapp/public/icons/favicon.png +0 -0
  87. data/webapp/public/icons/gear-small.png +0 -0
  88. data/webapp/public/icons/gear.png +0 -0
  89. data/webapp/public/icons/groups.png +0 -0
  90. data/webapp/public/icons/heart.png +0 -0
  91. data/webapp/public/icons/heart_empty.png +0 -0
  92. data/webapp/public/icons/info.png +0 -0
  93. data/webapp/public/icons/irrigation.png +0 -0
  94. data/webapp/public/icons/key.png +0 -0
  95. data/webapp/public/icons/lamp-big.png +0 -0
  96. data/webapp/public/icons/lightbulb.png +0 -0
  97. data/webapp/public/icons/lightbulb_off.png +0 -0
  98. data/webapp/public/icons/lightning-disable.png +0 -0
  99. data/webapp/public/icons/lightning-small.png +0 -0
  100. data/webapp/public/icons/lightning.png +0 -0
  101. data/webapp/public/icons/lock-unlock.png +0 -0
  102. data/webapp/public/icons/lock.png +0 -0
  103. data/webapp/public/icons/locked.png +0 -0
  104. data/webapp/public/icons/lux.png +0 -0
  105. data/webapp/public/icons/marker.png +0 -0
  106. data/webapp/public/icons/media-player-phone.png +0 -0
  107. data/webapp/public/icons/megaphone.png +0 -0
  108. data/webapp/public/icons/mem.png +0 -0
  109. data/webapp/public/icons/microphone.png +0 -0
  110. data/webapp/public/icons/monitor.png +0 -0
  111. data/webapp/public/icons/navigation.png +0 -0
  112. data/webapp/public/icons/night.png +0 -0
  113. data/webapp/public/icons/noise.png +0 -0
  114. data/webapp/public/icons/off.png +0 -0
  115. data/webapp/public/icons/on.png +0 -0
  116. data/webapp/public/icons/onoff.png +0 -0
  117. data/webapp/public/icons/pin.png +0 -0
  118. data/webapp/public/icons/plug--exclamation.png +0 -0
  119. data/webapp/public/icons/plug-disable.png +0 -0
  120. data/webapp/public/icons/plug.png +0 -0
  121. data/webapp/public/icons/rain.png +0 -0
  122. data/webapp/public/icons/refrigeration.png +0 -0
  123. data/webapp/public/icons/restart.png +0 -0
  124. data/webapp/public/icons/ruby.png +0 -0
  125. data/webapp/public/icons/server.png +0 -0
  126. data/webapp/public/icons/shield-disable.png +0 -0
  127. data/webapp/public/icons/shield.png +0 -0
  128. data/webapp/public/icons/socket--exclamation.png +0 -0
  129. data/webapp/public/icons/socket-disable.png +0 -0
  130. data/webapp/public/icons/socket.png +0 -0
  131. data/webapp/public/icons/start.png +0 -0
  132. data/webapp/public/icons/stop.png +0 -0
  133. data/webapp/public/icons/switch--exclamation.png +0 -0
  134. data/webapp/public/icons/switch-disable.png +0 -0
  135. data/webapp/public/icons/switch-small.png +0 -0
  136. data/webapp/public/icons/switch.png +0 -0
  137. data/webapp/public/icons/target.png +0 -0
  138. data/webapp/public/icons/television-off.png +0 -0
  139. data/webapp/public/icons/television.png +0 -0
  140. data/webapp/public/icons/temp.png +0 -0
  141. data/webapp/public/icons/terminal.png +0 -0
  142. data/webapp/public/icons/tick-small.png +0 -0
  143. data/webapp/public/icons/traffic-light-off.png +0 -0
  144. data/webapp/public/icons/traffic-light.png +0 -0
  145. data/webapp/public/icons/traffic.png +0 -0
  146. data/webapp/public/icons/true.png +0 -0
  147. data/webapp/public/icons/umbrella.png +0 -0
  148. data/webapp/public/icons/unlocked.png +0 -0
  149. data/webapp/public/icons/unmonitor.png +0 -0
  150. data/webapp/public/icons/unmonitored.png +0 -0
  151. data/webapp/public/icons/users.png +0 -0
  152. data/webapp/public/icons/vcard.png +0 -0
  153. data/webapp/public/icons/wall.png +0 -0
  154. data/webapp/public/icons/wall_brick.png +0 -0
  155. data/webapp/public/icons/wall_disable.png +0 -0
  156. data/webapp/public/icons/wand-disable.png +0 -0
  157. data/webapp/public/icons/wand.png +0 -0
  158. data/webapp/public/icons/warn.png +0 -0
  159. data/webapp/public/icons/weather_clouds.png +0 -0
  160. data/webapp/public/icons/weather_cloudy.png +0 -0
  161. data/webapp/public/icons/weather_lightning.png +0 -0
  162. data/webapp/public/icons/weather_rain.png +0 -0
  163. data/webapp/public/icons/weather_snow.png +0 -0
  164. data/webapp/public/icons/weather_sun.png +0 -0
  165. data/webapp/public/icons/wrench-screwdriver.png +0 -0
  166. data/webapp/public/icons/wrench.png +0 -0
  167. data/webapp/public/images/ajax-loader.gif +0 -0
  168. data/webapp/public/images/b.png +0 -0
  169. data/webapp/public/images/bendl.gif +0 -0
  170. data/webapp/public/images/bendr.gif +0 -0
  171. data/webapp/public/images/bendsb.gif +0 -0
  172. data/webapp/public/images/bg.jpg +0 -0
  173. data/webapp/public/images/bhead.gif +0 -0
  174. data/webapp/public/images/bheadl.gif +0 -0
  175. data/webapp/public/images/bheadr.gif +0 -0
  176. data/webapp/public/images/bl.png +0 -0
  177. data/webapp/public/images/bnd.gif +0 -0
  178. data/webapp/public/images/br.png +0 -0
  179. data/webapp/public/images/bread.gif +0 -0
  180. data/webapp/public/images/btnb.gif +0 -0
  181. data/webapp/public/images/btnb_.gif +0 -0
  182. data/webapp/public/images/btnm.gif +0 -0
  183. data/webapp/public/images/btnm_.gif +0 -0
  184. data/webapp/public/images/btns.gif +0 -0
  185. data/webapp/public/images/btns_.gif +0 -0
  186. data/webapp/public/images/cal.jpg +0 -0
  187. data/webapp/public/images/close.png +0 -0
  188. data/webapp/public/images/closelabel.gif +0 -0
  189. data/webapp/public/images/error.gif +0 -0
  190. data/webapp/public/images/ft.gif +0 -0
  191. data/webapp/public/images/hdr.gif +0 -0
  192. data/webapp/public/images/hdrl.gif +0 -0
  193. data/webapp/public/images/hdrr.gif +0 -0
  194. data/webapp/public/images/hld.jpg +0 -0
  195. data/webapp/public/images/imgb.gif +0 -0
  196. data/webapp/public/images/imgo.gif +0 -0
  197. data/webapp/public/images/imgt.gif +0 -0
  198. data/webapp/public/images/info.gif +0 -0
  199. data/webapp/public/images/jquery.wysiwyg.gif +0 -0
  200. data/webapp/public/images/li.gif +0 -0
  201. data/webapp/public/images/mbg.png +0 -0
  202. data/webapp/public/images/nsp.gif +0 -0
  203. data/webapp/public/images/phs.gif +0 -0
  204. data/webapp/public/images/sdd.jpg +0 -0
  205. data/webapp/public/images/sdd_.jpg +0 -0
  206. data/webapp/public/images/sidebar.gif +0 -0
  207. data/webapp/public/images/sorta.gif +0 -0
  208. data/webapp/public/images/sortd.gif +0 -0
  209. data/webapp/public/images/srch.gif +0 -0
  210. data/webapp/public/images/srch_.gif +0 -0
  211. data/webapp/public/images/success.gif +0 -0
  212. data/webapp/public/images/thumb1.jpg +0 -0
  213. data/webapp/public/images/thumb2.jpg +0 -0
  214. data/webapp/public/images/thumb3.jpg +0 -0
  215. data/webapp/public/images/tiny.gif +0 -0
  216. data/webapp/public/images/tiny_.gif +0 -0
  217. data/webapp/public/images/tl.png +0 -0
  218. data/webapp/public/images/tr.png +0 -0
  219. data/webapp/public/images/upload.gif +0 -0
  220. data/webapp/public/images/warning.gif +0 -0
  221. data/webapp/public/iui/backButton.png +0 -0
  222. data/webapp/public/iui/blueButton.png +0 -0
  223. data/webapp/public/iui/cancel.png +0 -0
  224. data/webapp/public/iui/grayButton.png +0 -0
  225. data/webapp/public/iui/greenButton.png +0 -0
  226. data/webapp/public/iui/iui-logo-touch-icon.png +0 -0
  227. data/webapp/public/iui/iui.css +0 -396
  228. data/webapp/public/iui/iui.js +0 -511
  229. data/webapp/public/iui/iuix.css +0 -1
  230. data/webapp/public/iui/iuix.js +0 -1
  231. data/webapp/public/iui/listArrow.png +0 -0
  232. data/webapp/public/iui/listArrowSel.png +0 -0
  233. data/webapp/public/iui/listGroup.png +0 -0
  234. data/webapp/public/iui/loading.gif +0 -0
  235. data/webapp/public/iui/pinstripes.png +0 -0
  236. data/webapp/public/iui/redButton.png +0 -0
  237. data/webapp/public/iui/selection.png +0 -0
  238. data/webapp/public/iui/thumb.png +0 -0
  239. data/webapp/public/iui/toggle.png +0 -0
  240. data/webapp/public/iui/toggleOn.png +0 -0
  241. data/webapp/public/iui/toolButton.png +0 -0
  242. data/webapp/public/iui/toolbar.png +0 -0
  243. data/webapp/public/iui/whiteButton.png +0 -0
  244. data/webapp/public/iui/yellowButton.png +0 -0
  245. data/webapp/public/jquery.img.preload.js +0 -152
  246. data/webapp/public/jquery.js +0 -154
  247. data/webapp/public/jquery.sparkline.js +0 -85
  248. data/webapp/public/jquery.tablesorter.min.js +0 -2
  249. data/webapp/public/jquery.visualize.js +0 -452
  250. data/webapp/public/jquery.wysiwyg.css +0 -56
  251. data/webapp/public/layout.css +0 -33
  252. data/webapp/public/right.js +0 -9
  253. data/webapp/public/rt.js +0 -7
  254. data/webapp/public/sparkline.js +0 -85
  255. data/webapp/public/style.css +0 -881
  256. data/webapp/public/visualize.css +0 -32
  257. data/webapp/spec/duino_spec.rb +0 -8
  258. data/webapp/spec/spec_helper.rb +0 -10
  259. data/webapp/views/command.haml +0 -4
  260. data/webapp/views/icon.haml +0 -6
  261. data/webapp/views/index.haml +0 -367
  262. data/webapp/views/layout.haml +0 -88
  263. data/webapp/views/mobile.haml +0 -21
  264. data/webapp/views/switch.haml +0 -56
  265. data/webapp/views/template.haml +0 -676
  266. data/webapp/views/top.haml +0 -4
  267. data/webapp/views/watch.haml +0 -26
@@ -1,25 +1,25 @@
1
1
  #
2
2
  #
3
3
  # !!SCAFFOLD!! Arduino command line tools Makefile
4
- #
4
+ #
5
5
  #
6
6
  # Copyright (C) 2010 Martin Oldfield <m@mjo.tc>, based on work that is
7
7
  # Copyright Nicholas Zambetti, David A. Mellis & Hernando Barragan
8
8
  #
9
9
  # See footer for copyright/changelog....
10
- #
10
+ #
11
11
 
12
12
  #
13
13
  # CONFIGURATION [EDIT ME]
14
14
  #
15
15
  TARGET = !!SCAFFOLD!!
16
16
  ARDUINO_DIR = /usr/share/arduino
17
- ARDUINO_LIBS = Messenger
17
+ #ARDUINO_LIBS = ExtraLib
18
18
 
19
19
  # Board
20
20
  MCU = atmega328p
21
21
  F_CPU = 16000000
22
- ARDUINO_PORT = /dev/ttyUSB*
22
+ ARDUINO_PORT = /dev/ttyUSB*
23
23
 
24
24
  # Linux
25
25
  AVR_TOOLS_PATH = /usr/bin
@@ -29,7 +29,6 @@ AVRDUDE_CONF = /usr/share/arduino/hardware/tools/avrdude.conf
29
29
  AVRDUDE_ARD_PROGRAMMER = stk500v1
30
30
  AVRDUDE_ARD_BAUDRATE = 57600
31
31
 
32
- # INC_DIRS = ./vendor/Messenger
33
32
  #
34
33
  # Hopefully these will be self-explanatory but in case they're not:
35
34
  #
@@ -44,8 +43,8 @@ AVRDUDE_ARD_BAUDRATE = 57600
44
43
  # when uploading
45
44
  #
46
45
  # ARDUINO WITH OTHER TOOLS
47
- #
48
- # If the tools aren't in the Arduino distribution, then you need to
46
+ #
47
+ # If the tools aren't in the Arduino distribution, then you need to
49
48
  # specify their location:
50
49
  #
51
50
  # AVR_TOOLS_PATH = /usr/bin
@@ -76,9 +75,9 @@ AVRDUDE_ARD_BAUDRATE = 57600
76
75
  # You need to specify some details of your ISP programmer and might
77
76
  # also need to specify the fuse values:
78
77
  #
79
- # ISP_PROG = -c stk500v2
78
+ # ISP_PROG = -c stk500v2
80
79
  # ISP_PORT = /dev/ttyACM0
81
- #
80
+ #
82
81
  # ISP_LOCK_FUSE_PRE = 0x3f
83
82
  # ISP_LOCK_FUSE_POST = 0xcf
84
83
  # ISP_HIGH_FUSE = 0xdf
@@ -87,7 +86,7 @@ AVRDUDE_ARD_BAUDRATE = 57600
87
86
  #
88
87
  # I think the fuses here are fine for uploading to the ATmega168
89
88
  # without bootloader.
90
- #
89
+ #
91
90
  # To actually do this upload use the ispload target:
92
91
  #
93
92
  # make ispload
@@ -117,7 +116,7 @@ ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
117
116
  endif
118
117
 
119
118
  # Everything gets built in here
120
- OBJDIR = build-cli
119
+ OBJDIR = build-cli
121
120
 
122
121
  ########################################################################
123
122
  # Local sources
@@ -128,8 +127,8 @@ LOCAL_CC_SRCS = $(wildcard *.cc)
128
127
  LOCAL_PDE_SRCS = $(wildcard *.pde)
129
128
  LOCAL_AS_SRCS = $(wildcard *.S)
130
129
  LOCAL_OBJ_FILES = $(LOCAL_C_SRCS:.c=.o) $(LOCAL_CPP_SRCS:.cpp=.o) \
131
- $(LOCAL_CC_SRCS:.cc=.o) $(LOCAL_PDE_SRCS:.pde=.o) \
132
- $(LOCAL_AS_SRCS:.S=.o)
130
+ $(LOCAL_CC_SRCS:.cc=.o) $(LOCAL_PDE_SRCS:.pde=.o) \
131
+ $(LOCAL_AS_SRCS:.S=.o)
133
132
  LOCAL_OBJS = $(patsubst %,$(OBJDIR)/%,$(LOCAL_OBJ_FILES))
134
133
 
135
134
  # Dependency files
@@ -140,8 +139,8 @@ ifeq ($(strip $(NO_CORE)),)
140
139
  ifdef ARDUINO_CORE_PATH
141
140
  CORE_C_SRCS = $(wildcard $(ARDUINO_CORE_PATH)/*.c)
142
141
  CORE_CPP_SRCS = $(wildcard $(ARDUINO_CORE_PATH)/*.cpp)
143
- EXTRA_CPP_SRCS = $(wildcard $(ARDUINO_LIB_PATH)/Messenger/*.cpp)
144
- CORE_OBJ_FILES = $(CORE_C_SRCS:.c=.o) $(CORE_CPP_SRCS:.cpp=.o) $(EXTRA_CPP_SRCS:.cpp=.o)
142
+ # EXTRA_CPP_SRCS = $(wildcard $(ARDUINO_LIB_PATH)/ExtraLib/*.cpp)
143
+ CORE_OBJ_FILES = $(CORE_C_SRCS:.c=.o) $(CORE_CPP_SRCS:.cpp=.o) $(EXTRA_CPP_SRCS:.cpp=.o)
145
144
  CORE_OBJS = $(patsubst $(ARDUINO_CORE_PATH)/%, $(OBJDIR)/%,$(CORE_OBJ_FILES))
146
145
  endif
147
146
  endif
@@ -180,9 +179,9 @@ SYS_INCLUDES = $(patsubst %,-I%,$(SYS_LIBS))
180
179
  SYS_OBJS = $(wildcard $(patsubst %,%/*.o,$(SYS_LIBS)))
181
180
 
182
181
  CPPFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) \
183
- -I. -I$(ARDUINO_CORE_PATH) \
184
- $(SYS_INCLUDES) -g -Os -w -Wall \
185
- -ffunction-sections -fdata-sections
182
+ -I. -I$(ARDUINO_CORE_PATH) \
183
+ $(SYS_INCLUDES) -g -Os -w -Wall \
184
+ -ffunction-sections -fdata-sections
186
185
  CFLAGS = -std=gnu99
187
186
  CXXFLAGS = -fno-exceptions
188
187
  ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp
@@ -206,66 +205,66 @@ ARD_PORT = $(firstword $(wildcard $(ARDUINO_PORT)))
206
205
  # .o rules are for objects, .d for dependency tracking
207
206
  # there seems to be an awful lot of duplication here!!!
208
207
  $(OBJDIR)/%.o: %.c
209
- $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
208
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
210
209
 
211
210
  $(OBJDIR)/%.o: %.cc
212
- $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
211
+ $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
213
212
 
214
213
  $(OBJDIR)/%.o: %.cpp
215
- $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
214
+ $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
216
215
 
217
216
  $(OBJDIR)/%.o: %.S
218
- $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
217
+ $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
219
218
 
220
219
  $(OBJDIR)/%.o: %.s
221
- $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
220
+ $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
222
221
 
223
222
  $(OBJDIR)/%.d: %.c
224
- $(CC) -MM $(CPPFLAGS) $(CFLAGS) $< -MF $@ -MT $(@:.d=.o)
223
+ $(CC) -MM $(CPPFLAGS) $(CFLAGS) $< -MF $@ -MT $(@:.d=.o)
225
224
 
226
225
  $(OBJDIR)/%.d: %.cc
227
- $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
226
+ $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
228
227
 
229
228
  $(OBJDIR)/%.d: %.cpp
230
- $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
229
+ $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
231
230
 
232
231
  $(OBJDIR)/%.d: %.S
233
- $(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
232
+ $(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
234
233
 
235
234
  $(OBJDIR)/%.d: %.s
236
- $(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
235
+ $(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
237
236
 
238
237
  # the pde -> cpp -> o file
239
238
  $(OBJDIR)/%.cpp: %.pde
240
- $(ECHO) $(PDEHEADER) > $@
241
- $(CAT) $< >> $@
239
+ $(ECHO) $(PDEHEADER) > $@
240
+ $(CAT) $< >> $@
242
241
 
243
242
  $(OBJDIR)/%.o: $(OBJDIR)/%.cpp
244
- $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
243
+ $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
245
244
 
246
245
  $(OBJDIR)/%.d: $(OBJDIR)/%.cpp
247
- $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
246
+ $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
248
247
 
249
248
  # core files
250
249
  $(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.c
251
- $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
250
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
252
251
 
253
252
  $(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.cpp
254
- $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
253
+ $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
255
254
 
256
255
  # various object conversions
257
256
  $(OBJDIR)/%.hex: $(OBJDIR)/%.elf
258
- $(OBJCOPY) -O ihex -R .eeprom $< $@
257
+ $(OBJCOPY) -O ihex -R .eeprom $< $@
259
258
 
260
259
  $(OBJDIR)/%.eep: $(OBJDIR)/%.elf
261
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
262
- --change-section-lma .eeprom=0 -O ihex $< $@
260
+ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
261
+ --change-section-lma .eeprom=0 -O ihex $< $@
263
262
 
264
263
  $(OBJDIR)/%.lss: $(OBJDIR)/%.elf
265
- $(OBJDUMP) -h -S $< > $@
264
+ $(OBJDUMP) -h -S $< > $@
266
265
 
267
266
  $(OBJDIR)/%.sym: $(OBJDIR)/%.elf
268
- $(NM) -n $< > $@
267
+ $(NM) -n $< > $@
269
268
 
270
269
  ########################################################################
271
270
  #
@@ -311,7 +310,7 @@ ISP_EXT_FUSE = 0x01
311
310
  endif
312
311
 
313
312
  ifndef ISP_PROG
314
- ISP_PROG = -c stk500v2
313
+ ISP_PROG = -c stk500v2
315
314
  endif
316
315
 
317
316
  AVRDUDE_ISP_OPTS = -P $(ISP_PORT) $(ISP_PROG)
@@ -322,52 +321,52 @@ AVRDUDE_ISP_OPTS = -P $(ISP_PORT) $(ISP_PROG)
322
321
  # Explicit targets start here
323
322
  #
324
323
 
325
- all: $(OBJDIR) $(TARGET_HEX)
324
+ all: $(OBJDIR) $(TARGET_HEX)
326
325
 
327
326
  $(OBJDIR):
328
- mkdir $(OBJDIR)
327
+ mkdir $(OBJDIR)
329
328
 
330
- $(TARGET_ELF): $(OBJS)
331
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(SYS_OBJS)
329
+ $(TARGET_ELF): $(OBJS)
330
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(SYS_OBJS)
332
331
 
333
- $(DEP_FILE): $(OBJDIR) $(DEPS)
334
- cat $(DEPS) > $(DEP_FILE)
332
+ $(DEP_FILE): $(OBJDIR) $(DEPS)
333
+ cat $(DEPS) > $(DEP_FILE)
335
334
 
336
- upload: reset raw_upload
335
+ upload: reset raw_upload
337
336
 
338
- raw_upload: $(TARGET_HEX)
339
- $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
340
- -U flash:w:$(TARGET_HEX):i
337
+ raw_upload: $(TARGET_HEX)
338
+ $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
339
+ -U flash:w:$(TARGET_HEX):i
341
340
 
342
341
  # stty on MacOS likes -F, but on Debian it likes -f redirecting
343
342
  # stdin/out appears to work but generates a spurious error on MacOS at
344
343
  # least. Perhaps it would be better to just do it in perl ?
345
- reset:
346
- for STTYF in 'stty --file' 'stty -f' 'stty <' ; \
347
- do $$STTYF /dev/tty >/dev/null 2>/dev/null && break ; \
348
- done ;\
349
- $$STTYF $(ARD_PORT) hupcl ;\
350
- (sleep 0.1 || sleep 1) ;\
351
- $$STTYF $(ARD_PORT) -hupcl
352
-
353
- ispload: $(TARGET_HEX)
354
- $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e \
355
- -U lock:w:$(ISP_LOCK_FUSE_PRE):m \
356
- -U hfuse:w:$(ISP_HIGH_FUSE):m \
357
- -U lfuse:w:$(ISP_LOW_FUSE):m \
358
- -U efuse:w:$(ISP_EXT_FUSE):m
359
- $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -D \
360
- -U flash:w:$(TARGET_HEX):i
361
- $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) \
362
- -U lock:w:$(ISP_LOCK_FUSE_POST):m
344
+ reset:
345
+ for STTYF in 'stty --file' 'stty -f' 'stty <' ; \
346
+ do $$STTYF /dev/tty >/dev/null 2>/dev/null && break ; \
347
+ done ;\
348
+ $$STTYF $(ARD_PORT) hupcl ;\
349
+ (sleep 0.1 || sleep 1) ;\
350
+ $$STTYF $(ARD_PORT) -hupcl
351
+
352
+ ispload: $(TARGET_HEX)
353
+ $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e \
354
+ -U lock:w:$(ISP_LOCK_FUSE_PRE):m \
355
+ -U hfuse:w:$(ISP_HIGH_FUSE):m \
356
+ -U lfuse:w:$(ISP_LOW_FUSE):m \
357
+ -U efuse:w:$(ISP_EXT_FUSE):m
358
+ $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -D \
359
+ -U flash:w:$(TARGET_HEX):i
360
+ $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) \
361
+ -U lock:w:$(ISP_LOCK_FUSE_POST):m
363
362
 
364
363
  clean:
365
- $(REMOVE) $(OBJS) $(TARGETS) $(DEP_FILE) $(DEPS)
364
+ $(REMOVE) $(OBJS) $(TARGETS) $(DEP_FILE) $(DEPS)
366
365
 
367
- depends: $(DEPS)
368
- cat $(DEPS) > $(DEP_FILE)
366
+ depends: $(DEPS)
367
+ cat $(DEPS) > $(DEP_FILE)
369
368
 
370
- .PHONY: all clean depends upload raw_upload reset
369
+ .PHONY: all clean depends upload raw_upload reset
371
370
 
372
371
  include $(DEP_FILE)
373
372
 
@@ -375,7 +374,7 @@ include $(DEP_FILE)
375
374
  #
376
375
  # This makefile is from:
377
376
  # http://mjo.tc/atelier/2009/02/arduino-cli.html
378
- #
377
+ #
379
378
  # With some help:
380
379
  #
381
380
  # http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1265576847
@@ -8,10 +8,87 @@
8
8
 
9
9
  #include <Messenger.h>
10
10
 
11
+ #define sec 1000
12
+ #define min 60000
13
+ #define hour 3600000
14
+ #define day 86400000
15
+
16
+ // Output
17
+ const int rxPin = 0;
18
+ const int txPin = 1;
19
+ const int d2 = 2;
20
+ const int d3 = 3;
21
+ const int d4 = 4;
22
+ const int d5 = 5;
23
+ const int d6 = 6;
24
+ const int d7 = 7;
25
+ const int d8 = 8;
26
+ const int d9 = 9;
27
+ //const int d10 = 10;
28
+ //const int d11 = 11;
29
+ //const int d12 = 12;
30
+ const int infoPin = 13;
31
+
32
+ // Input
33
+ const int i0 = A0;
34
+ const int i1 = A1;
35
+ const int i2 = A2;
36
+ const int i3 = A3;
37
+ const int i4 = A4;
38
+ const int i5 = A5;
39
+ // Digital
40
+ const int d10 = 10;
41
+ const int d11 = 11;
42
+ const int d12 = 12;
43
+
44
+ Messenger message = Messenger();
45
+
46
+ // Create the callback function
47
+
48
+ unsigned long mintomilli(unsigned long m) {
49
+ return(m * 60000);
50
+ }
51
+
52
+ void messageReady() {
53
+ int pin = 2;
54
+ int val = 0;
55
+ // Loop through all the available elements of the message
56
+ while ( message.available() && pin <= infoPin ) {
57
+ val = message.readInt();
58
+ // Set the pin as determined by the message
59
+ analogWrite(pin, val);
60
+ pin = pin + 1;
61
+ }
62
+
63
+ }
64
+
11
65
  void setup() {
66
+ // Atmega defaults INPUT
67
+ pinMode(infoPin, OUTPUT);
12
68
 
69
+ Serial.begin(115200);
70
+ message.attach(messageReady);
13
71
  }
14
72
 
15
73
  void loop() {
16
74
 
75
+ time_now = millis();
76
+
77
+ // Sync over wire
78
+ if ( abs(time_now - last_sync) >= sync) {
79
+ last_sync = time_now;
80
+ sprintf(buffer, "i0:%d,i1:%d,i2:%d,i3:%d,i4:%d,i5:%d,d11:%d,d12:%d",
81
+ analogRead(i0),
82
+ analogRead(i1),
83
+ analogRead(i2),
84
+ analogRead(i3),
85
+ analogRead(i4),
86
+ analogRead(i5),
87
+ digitalRead(d11),
88
+ digitalRead(d12));
89
+ Serial.println(buffer);
90
+ }
91
+
92
+ while ( Serial.available() ) message.process(Serial.read());
93
+
17
94
  }
@@ -23,7 +23,7 @@ module Subduino
23
23
 
24
24
  def write(k, v, stamp = false)
25
25
  return unless redis #.connected?
26
- stamp ? redis.rpush("#{k}_log", "#{timestamp}:#{v}") : redis.set(k, v)
26
+ stamp ? redis.rpush("log:inputs:#{k}", "#{timestamp}:#{v}") : redis.set("now:inputs:"+k, v)
27
27
  end
28
28
 
29
29
 
@@ -4,7 +4,7 @@ describe Parse do
4
4
  include Parse
5
5
 
6
6
  it "should parse digital" do
7
- d = DigParser.new(8)
7
+ d = Digital.new(8)
8
8
  d.should be_digital
9
9
  end
10
10