subduino 0.3.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
@@ -1,92 +0,0 @@
1
- h1. Subduino
2
-
3
- Arduino Tools on Ruby
4
-
5
- http://github.com/nofxx/subduino
6
-
7
-
8
- h2. Install
9
-
10
- gem install subduino
11
-
12
-
13
- h3. Requirements
14
-
15
- * "Arduino":http://arduino.cc
16
-
17
- PubSub (gems):
18
-
19
- * "serialport":http://github.com/hparra/ruby-serialport
20
- * "redis":http://github.com/ezmobius/redis-rb
21
-
22
- Compile/Upload to arduino (archlinux pkgs):
23
-
24
- * "arduino" or "arduino64"
25
- * "gcc-avr"
26
- * "avrdude"
27
-
28
- WebApp (gems):
29
-
30
- * sinatra
31
- * haml
32
-
33
-
34
- h2. Create a project
35
-
36
- <pre><code>
37
- subduino some/dir/bot
38
- ...creates folder and some sketch files...
39
-
40
- </pre></code>
41
-
42
- h3. bot.rb
43
-
44
- Simple example that monitors arduinos on the USB.
45
-
46
- h3. bot.pde
47
-
48
- Common arduino source, can be compiled/uploaded via the IDE or:
49
-
50
- h3. Makefile
51
-
52
- Nice makefile so you don't need the IDE ;)
53
- Use 'make' or 'make upload'.
54
-
55
- It's being tested (works) on archlinux with arduino 0019.
56
- It's just a matter of setting the first lines of the Makefile correct for your OS.
57
- Please let me know so I can detect the OS and write a correct makefile for other distros.
58
-
59
-
60
- h2. PubSub
61
-
62
- <pre><code>
63
-
64
- Subduino.start do |reading|
65
- puts "Received from arduino: #{reading}"
66
- # Mail.send("foo@bla.com") if reading && reading.digital?
67
- # Postgre.remember(:sensor => reading)
68
- end
69
-
70
- Subduino.write(TXT)
71
-
72
- </pre></code>
73
-
74
-
75
- h2. Webapp
76
-
77
- Need some heavy work...
78
-
79
-
80
- h2. Contributing
81
-
82
- Fork/work/push.
83
-
84
-
85
- h3. Author
86
-
87
- nofxx
88
-
89
-
90
- h3. License
91
-
92
- "WTFPL":http://sam.zoy.org/wtfpl/
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.3.1
@@ -1,2 +0,0 @@
1
- semantic.cache
2
- build-cli
@@ -1,403 +0,0 @@
1
- #
2
- #
3
- # duino Arduino command line tools Makefile
4
- #
5
- #
6
- # Copyright (C) 2010 Martin Oldfield <m@mjo.tc>, based on work that is
7
- # Copyright Nicholas Zambetti, David A. Mellis & Hernando Barragan
8
- #
9
- #
10
- # See footer for copyright/changelog....
11
- #
12
-
13
- #
14
- # CONFIGURATION
15
- #
16
- TARGET = duino
17
- ARDUINO_DIR = /usr/share/arduino
18
- # ARDUINO_LIBS = ExtraLib
19
-
20
- MCU = atmega328p
21
- F_CPU = 16000000
22
- ARDUINO_PORT = /dev/ttyUSB*
23
-
24
- # Linux
25
- AVR_TOOLS_PATH = /usr/bin
26
- AVRDUDE_CONF = /usr/share/arduino/hardware/tools/avrdude.conf
27
-
28
-
29
- # Hopefully these will be self-explanatory but in case they're not:
30
- #
31
- # ARDUINO_DIR - Where the Arduino software has been unpacked
32
- # TARGET - The basename used for the final files. Canonically
33
- # this would match the .pde file, but it's not needed
34
- # here: you could always set it to xx if you wanted!
35
- # ARDUINO_LIBS - A list of any libraries used by the sketch (we assume
36
- # these are in $(ARDUINO_DIR)/hardware/libraries
37
- # MCU,F_CPU - The target processor description
38
- # ARDUINO_PORT - The port where the Arduino can be found (only needed
39
- # when uploading
40
- #
41
- # ARDUINO WITH OTHER TOOLS
42
- #
43
- # If the tools aren't in the Arduino distribution, then you need to
44
- # specify their location:
45
- #
46
- # AVR_TOOLS_PATH = /usr/bin
47
- # AVRDUDE_CONF = /etc/avrdude/avrdude.conf
48
-
49
- # Once this file has been created the typical workflow is just
50
- #
51
- # $ make upload
52
- #
53
- # All of the object files are created in the build-cli subdirectory
54
- # All sources should be in the current directory and can include:
55
- # - at most one .pde file which will be treated as C++ after the standard
56
- # Arduino header and footer have been affixed.
57
- # - any number of .c, .cpp, .s and .h files
58
- #
59
- #
60
- # Besides make upload you can also
61
- # make - no upload
62
- # make clean - remove all our dependencies
63
- # make depends - update dependencies
64
- # make reset - reset the Arduino by tickling DTR on the serial port
65
- # make raw_upload - upload without first resetting
66
- #
67
- ########################################################################
68
- #
69
- # ARDUINO WITH ISP
70
- #
71
- # You need to specify some details of your ISP programmer and might
72
- # also need to specify the fuse values:
73
- #
74
- # ISP_PROG = -c stk500v2
75
- # ISP_PORT = /dev/ttyACM0
76
- #
77
- # ISP_LOCK_FUSE_PRE = 0x3f
78
- # ISP_LOCK_FUSE_POST = 0xcf
79
- # ISP_HIGH_FUSE = 0xdf
80
- # ISP_LOW_FUSE = 0xff
81
- # ISP_EXT_FUSE = 0x01
82
- #
83
- # I think the fuses here are fine for uploading to the ATmega168
84
- # without bootloader.
85
- #
86
- # To actually do this upload use the ispload target:
87
- #
88
- # make ispload
89
- #
90
- #
91
- ########################################################################
92
- # Some paths
93
- #
94
-
95
- ifneq (ARDUINO_DIR,)
96
-
97
- ifndef AVR_TOOLS_PATH
98
- AVR_TOOLS_PATH = $(ARDUINO_DIR)/hardware/tools/avr/bin
99
- endif
100
-
101
- ifndef ARDUINO_ETC_PATH
102
- ARDUINO_ETC_PATH = $(ARDUINO_DIR)/hardware/tools/avr/etc
103
- endif
104
-
105
- ifndef AVRDUDE_CONF
106
- AVRDUDE_CONF = $(ARDUINO_ETC_PATH)/avrdude.conf
107
- endif
108
-
109
- ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries
110
- ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
111
-
112
- endif
113
-
114
- # Everything gets built in here
115
- OBJDIR = build-cli
116
-
117
- ########################################################################
118
- # Local sources
119
- #
120
- LOCAL_C_SRCS = $(wildcard *.c)
121
- LOCAL_CPP_SRCS = $(wildcard *.cpp)
122
- LOCAL_CC_SRCS = $(wildcard *.cc)
123
- LOCAL_PDE_SRCS = $(wildcard *.pde)
124
- LOCAL_AS_SRCS = $(wildcard *.S)
125
- LOCAL_OBJ_FILES = $(LOCAL_C_SRCS:.c=.o) $(LOCAL_CPP_SRCS:.cpp=.o) \
126
- $(LOCAL_CC_SRCS:.cc=.o) $(LOCAL_PDE_SRCS:.pde=.o) \
127
- $(LOCAL_AS_SRCS:.S=.o)
128
- LOCAL_OBJS = $(patsubst %,$(OBJDIR)/%,$(LOCAL_OBJ_FILES))
129
-
130
- # Dependency files
131
- DEPS = $(LOCAL_OBJS:.o=.d)
132
-
133
- # core sources
134
- ifeq ($(strip $(NO_CORE)),)
135
- ifdef ARDUINO_CORE_PATH
136
- CORE_C_SRCS = $(wildcard $(ARDUINO_CORE_PATH)/*.c)
137
- CORE_CPP_SRCS = $(wildcard $(ARDUINO_CORE_PATH)/*.cpp)
138
- # EXTRA_CPP_SRCS = $(wildcard $(ARDUINO_LIB_PATH)/ExtraLib/*.cpp)
139
- CORE_OBJ_FILES = $(CORE_C_SRCS:.c=.o) $(CORE_CPP_SRCS:.cpp=.o) $(EXTRA_CPP_SRCS:.cpp=.o)
140
- CORE_OBJS = $(patsubst $(ARDUINO_CORE_PATH)/%, $(OBJDIR)/%,$(CORE_OBJ_FILES))
141
- endif
142
- endif
143
-
144
- # all the objects!
145
- OBJS = $(LOCAL_OBJS) $(CORE_OBJS)
146
-
147
- ########################################################################
148
- # Rules for making stuff
149
- #
150
-
151
- # The name of the main targets
152
- TARGET_HEX = $(OBJDIR)/$(TARGET).hex
153
- TARGET_ELF = $(OBJDIR)/$(TARGET).elf
154
- TARGETS = $(OBJDIR)/$(TARGET).*
155
-
156
- # A list of dependencies
157
- DEP_FILE = $(OBJDIR)/depends.mk
158
-
159
- # Names of executables
160
- CC = $(AVR_TOOLS_PATH)/avr-gcc
161
- CXX = $(AVR_TOOLS_PATH)/avr-g++
162
- OBJCOPY = $(AVR_TOOLS_PATH)/avr-objcopy
163
- OBJDUMP = $(AVR_TOOLS_PATH)/avr-objdump
164
- AR = $(AVR_TOOLS_PATH)/avr-ar
165
- SIZE = $(AVR_TOOLS_PATH)/avr-size
166
- NM = $(AVR_TOOLS_PATH)/avr-nm
167
- REMOVE = rm -f
168
- MV = mv -f
169
- CAT = cat
170
- ECHO = echo
171
-
172
- # General arguments
173
- SYS_LIBS = $(patsubst %,$(ARDUINO_LIB_PATH)/%,$(ARDUINO_LIBS))
174
- SYS_INCLUDES = $(patsubst %,-I%,$(SYS_LIBS))
175
- SYS_OBJS = $(wildcard $(patsubst %,%/*.o,$(SYS_LIBS)))
176
-
177
- CPPFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) \
178
- -I. -I$(ARDUINO_CORE_PATH) \
179
- $(SYS_INCLUDES) -g -Os -w -Wall \
180
- -ffunction-sections -fdata-sections
181
- CFLAGS = -std=gnu99
182
- CXXFLAGS = -fno-exceptions
183
- ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp
184
- LDFLAGS = -mmcu=$(MCU) -lm -Wl,--gc-sections -Os
185
-
186
- # Rules for making a CPP file from the main sketch (.cpe)
187
- PDEHEADER = \\\#include \"WProgram.h\"
188
-
189
- # Expand and pick the first port
190
- ARD_PORT = $(firstword $(wildcard $(ARDUINO_PORT)))
191
-
192
- # Implicit rules for building everything (needed to get everything in
193
- # the right directory)
194
- #
195
- # Rather than mess around with VPATH there are quasi-duplicate rules
196
- # here for building e.g. a system C++ file and a local C++
197
- # file. Besides making things simpler now, this would also make it
198
- # easy to change the build options in future
199
-
200
- # normal local sources
201
- # .o rules are for objects, .d for dependency tracking
202
- # there seems to be an awful lot of duplication here!!!
203
- $(OBJDIR)/%.o: %.c
204
- $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
205
-
206
- $(OBJDIR)/%.o: %.cc
207
- $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
208
-
209
- $(OBJDIR)/%.o: %.cpp
210
- $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
211
-
212
- $(OBJDIR)/%.o: %.S
213
- $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
214
-
215
- $(OBJDIR)/%.o: %.s
216
- $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
217
-
218
- $(OBJDIR)/%.d: %.c
219
- $(CC) -MM $(CPPFLAGS) $(CFLAGS) $< -MF $@ -MT $(@:.d=.o)
220
-
221
- $(OBJDIR)/%.d: %.cc
222
- $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
223
-
224
- $(OBJDIR)/%.d: %.cpp
225
- $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
226
-
227
- $(OBJDIR)/%.d: %.S
228
- $(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
229
-
230
- $(OBJDIR)/%.d: %.s
231
- $(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
232
-
233
- # the pde -> cpp -> o file
234
- $(OBJDIR)/%.cpp: %.pde
235
- $(ECHO) $(PDEHEADER) > $@
236
- $(CAT) $< >> $@
237
-
238
- $(OBJDIR)/%.o: $(OBJDIR)/%.cpp
239
- $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
240
-
241
- $(OBJDIR)/%.d: $(OBJDIR)/%.cpp
242
- $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
243
-
244
- # core files
245
- $(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.c
246
- $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
247
-
248
- $(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.cpp
249
- $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
250
-
251
- # various object conversions
252
- $(OBJDIR)/%.hex: $(OBJDIR)/%.elf
253
- $(OBJCOPY) -O ihex -R .eeprom $< $@
254
-
255
- $(OBJDIR)/%.eep: $(OBJDIR)/%.elf
256
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
257
- --change-section-lma .eeprom=0 -O ihex $< $@
258
-
259
- $(OBJDIR)/%.lss: $(OBJDIR)/%.elf
260
- $(OBJDUMP) -h -S $< > $@
261
-
262
- $(OBJDIR)/%.sym: $(OBJDIR)/%.elf
263
- $(NM) -n $< > $@
264
-
265
- ########################################################################
266
- #
267
- # Avrdude
268
- #
269
- ifndef AVRDUDE
270
- AVRDUDE = $(AVR_TOOLS_PATH)/avrdude
271
- endif
272
-
273
- AVRDUDE_COM_OPTS = -q -V -p $(MCU)
274
- ifdef AVRDUDE_CONF
275
- AVRDUDE_COM_OPTS += -C $(AVRDUDE_CONF)
276
- endif
277
-
278
- ifndef AVRDUDE_ARD_PROGRAMMER
279
- AVRDUDE_ARD_PROGRAMMER = stk500v1
280
- endif
281
-
282
- ifndef AVRDUDE_ARD_BAUDRATE
283
- AVRDUDE_ARD_BAUDRATE = 57600 # 19600
284
- endif
285
-
286
- AVRDUDE_ARD_OPTS = -c $(AVRDUDE_ARD_PROGRAMMER) -b $(AVRDUDE_ARD_BAUDRATE) -P $(ARD_PORT)
287
-
288
- ifndef ISP_LOCK_FUSE_PRE
289
- ISP_LOCK_FUSE_PRE = 0x3f
290
- endif
291
-
292
- ifndef ISP_LOCK_FUSE_POST
293
- ISP_LOCK_FUSE_POST = 0xcf
294
- endif
295
-
296
- ifndef ISP_HIGH_FUSE
297
- ISP_HIGH_FUSE = 0xdf
298
- endif
299
-
300
- ifndef ISP_LOW_FUSE
301
- ISP_LOW_FUSE = 0xff
302
- endif
303
-
304
- ifndef ISP_EXT_FUSE
305
- ISP_EXT_FUSE = 0x01
306
- endif
307
-
308
- ifndef ISP_PROG
309
- ISP_PROG = -c stk500v2
310
- endif
311
-
312
- AVRDUDE_ISP_OPTS = -P $(ISP_PORT) $(ISP_PROG)
313
-
314
-
315
- ########################################################################
316
- #
317
- # Explicit targets start here
318
- #
319
-
320
- all: $(OBJDIR) $(TARGET_HEX)
321
-
322
- $(OBJDIR):
323
- mkdir $(OBJDIR)
324
-
325
- $(TARGET_ELF): $(OBJS)
326
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(SYS_OBJS)
327
-
328
- $(DEP_FILE): $(OBJDIR) $(DEPS)
329
- cat $(DEPS) > $(DEP_FILE)
330
-
331
- upload: reset raw_upload
332
-
333
- raw_upload: $(TARGET_HEX)
334
- $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
335
- -U flash:w:$(TARGET_HEX):i
336
-
337
- # stty on MacOS likes -F, but on Debian it likes -f redirecting
338
- # stdin/out appears to work but generates a spurious error on MacOS at
339
- # least. Perhaps it would be better to just do it in perl ?
340
- reset:
341
- for STTYF in 'stty --file' 'stty -f' 'stty <' ; \
342
- do $$STTYF /dev/tty >/dev/null 2>/dev/null && break ; \
343
- done ;\
344
- $$STTYF $(ARD_PORT) hupcl ;\
345
- (sleep 0.1 || sleep 1) ;\
346
- $$STTYF $(ARD_PORT) -hupcl
347
-
348
- ispload: $(TARGET_HEX)
349
- $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e \
350
- -U lock:w:$(ISP_LOCK_FUSE_PRE):m \
351
- -U hfuse:w:$(ISP_HIGH_FUSE):m \
352
- -U lfuse:w:$(ISP_LOW_FUSE):m \
353
- -U efuse:w:$(ISP_EXT_FUSE):m
354
- $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -D \
355
- -U flash:w:$(TARGET_HEX):i
356
- $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) \
357
- -U lock:w:$(ISP_LOCK_FUSE_POST):m
358
-
359
- clean:
360
- $(REMOVE) $(OBJS) $(TARGETS) $(DEP_FILE) $(DEPS)
361
-
362
- depends: $(DEPS)
363
- cat $(DEPS) > $(DEP_FILE)
364
-
365
- .PHONY: all clean depends upload raw_upload reset
366
-
367
- include $(DEP_FILE)
368
-
369
- #
370
- # This makefile is from:
371
- # http://mjo.tc/atelier/2009/02/arduino-cli.html
372
- #
373
- # With some help:
374
- #
375
- # http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1265576847
376
- # http://johanneshoff.com/arduino-command-line/Makefile
377
- #
378
- # This file is free software; you can redistribute it and/or modify it
379
- # under the terms of the GNU Lesser General Public License as
380
- # published by the Free Software Foundation; either version 2.1 of the
381
- # License, or (at your option) any later version.
382
- #
383
- # Adapted from Arduino 0011 Makefile by M J Oldfield
384
- #
385
- # Original Arduino adaptation by mellis, eighthave, oli.keller
386
- #
387
- # Version 0.1 17.ii.2009 M J Oldfield
388
- #
389
- # 0.2 22.ii.2009 M J Oldfield
390
- # - fixes so that the Makefile actually works!
391
- # - support for uploading via ISP
392
- # - orthogonal choices of using the Arduino for
393
- # tools, libraries and uploading
394
- #
395
- # 0.3 21.v.2010 M J Oldfield
396
- # - added proper license statement
397
- # - added code from Philip Hands to reset
398
- # Arduino prior to upload
399
- #
400
- # 0.4 25.v.2010 M J Oldfield
401
- # - tweaked reset target on Philip Hands' advice
402
- #
403
- ########################################################################