madrona-rad 0.4.0 → 0.4.1

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.
@@ -48,14 +48,6 @@ static void BlinkM_beginWithPowerPins(byte pwrpin, byte gndpin)
48
48
  Wire.begin();
49
49
  }
50
50
 
51
- // Call this first when BlinkM is plugged directly into Arduino
52
- // The BlinkMs PWR (power) pins should line up with pins 2 and 3 of the connector,
53
- // while the I2C (communications) pins should line up with pins 4 and 5.
54
-
55
- static void BlinkM_beginWithPower()
56
- {
57
- BlinkM_beginWithPowerPins( PC3, PC2 );
58
- }
59
51
 
60
52
  // sends a generic command
61
53
 
@@ -0,0 +1,47 @@
1
+ -framework for translation to C (wrapper for RubyToAnsiC)
2
+ -framework for translation testing (want to test that each Rad method translates to the expected C)
3
+
4
+ -have to replace symbol & str definitions with "char name[]" ?
5
+
6
+ -maybe can't build rad.c dynamically? can use as helpers in writing it statically rad.rb and RubyToAnsiC as helpers in writing it. . .
7
+ -maybe there's a way to give RubyToC prototypes for the arduino library methods (or maybe include them directly) so that it will be able to figure out the signatures for my methods (otherwise it breaks because, for example, it can't figure out what read returns).
8
+ -speaking of which: all rad methods need to have a statically typed return value or else they won't be translatable to C. For example, as it stands #read may return a bool (if it calls digitalRead) or an int (if it calls analogRead). This may force me to take away much of the syntactic sugar
9
+
10
+ -how to handle setting up named pins:
11
+
12
+ declare the name with an underscore:
13
+ int _led = 1;
14
+ and define an accessor for it:
15
+ int led(){
16
+ _led;
17
+ }
18
+ Then, calling the method will get you the int.
19
+
20
+ -drop read and write custom methods (at least for now)? save time, save a whole step. Make it trivial to implement the whole library. . .
21
+
22
+ ======================================================================================================
23
+ -the Arduino DSL is pretty good. Don't try to reinvent it for the board's api, add value on top of it!
24
+ ======================================================================================================
25
+
26
+ -add constants HIGH, LOW, etc.
27
+
28
+ -design directory structure
29
+ -->where do we put the sketch files
30
+ -->where do the .c files get compiled to?
31
+
32
+ -design rad lib directory structure
33
+ /sketch
34
+ my_sketch.rb
35
+ /build
36
+ my_sketch.c
37
+ rad.c
38
+ /rad
39
+ /lib
40
+ /specs
41
+ Rakefile
42
+
43
+
44
+ -helper methods like blink
45
+
46
+ -proof of concept of build process
47
+
@@ -0,0 +1,201 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{madrona-rad}
8
+ s.version = "0.4.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["JD Barnhart", "Greg Borenstein"]
12
+ s.date = %q{2009-10-28}
13
+ s.default_executable = %q{madrona-rad}
14
+ s.description = %q{Ruby Arduino Development: a framework for programming the Arduino physcial computing platform using Ruby}
15
+ s.email = %q{jd@jdbarnhart.com}
16
+ s.executables = ["madrona-rad"]
17
+ s.extra_rdoc_files = [
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".gitignore",
22
+ "History.txt",
23
+ "License.txt",
24
+ "Manifest.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "lib/examples/add_hysteresis.rb",
29
+ "lib/examples/basic_blink.rb",
30
+ "lib/examples/blink_m_address_assignment.rb",
31
+ "lib/examples/blink_m_hello.rb",
32
+ "lib/examples/blink_m_multi.rb",
33
+ "lib/examples/blink_with_serial.rb",
34
+ "lib/examples/configure_pa_lcd_boot.rb",
35
+ "lib/examples/debounce_methods.rb",
36
+ "lib/examples/external_variable_fu.rb",
37
+ "lib/examples/external_variables.rb",
38
+ "lib/examples/first_sound.rb",
39
+ "lib/examples/frequency_generator.rb",
40
+ "lib/examples/hello_array.rb",
41
+ "lib/examples/hello_array2.rb",
42
+ "lib/examples/hello_array_eeprom.rb",
43
+ "lib/examples/hello_clock.rb",
44
+ "lib/examples/hello_eeprom.rb",
45
+ "lib/examples/hello_eeprom_lcdpa.rb",
46
+ "lib/examples/hello_format_print.rb",
47
+ "lib/examples/hello_lcd_charset.rb",
48
+ "lib/examples/hello_maxbotix.rb",
49
+ "lib/examples/hello_pa_lcd.rb",
50
+ "lib/examples/hello_servos.rb",
51
+ "lib/examples/hello_spectra_sound.rb",
52
+ "lib/examples/hello_world.rb",
53
+ "lib/examples/hello_xbee.rb",
54
+ "lib/examples/hysteresis_duel.rb",
55
+ "lib/examples/i2c_with_clock_chip.rb",
56
+ "lib/examples/midi_beat_box.rb",
57
+ "lib/examples/midi_scales.rb",
58
+ "lib/examples/motor_knob.rb",
59
+ "lib/examples/servo_buttons.rb",
60
+ "lib/examples/servo_calibrate_continuous.rb",
61
+ "lib/examples/servo_throttle.rb",
62
+ "lib/examples/software_serial.rb",
63
+ "lib/examples/sparkfun_lcd.rb",
64
+ "lib/examples/spectra_soft_pot.rb",
65
+ "lib/examples/times_method.rb",
66
+ "lib/examples/toggle.rb",
67
+ "lib/examples/twitter.rb",
68
+ "lib/examples/two_wire.rb",
69
+ "lib/libraries/AFSoftSerial/AFSoftSerial.cpp",
70
+ "lib/libraries/AFSoftSerial/AFSoftSerial.h",
71
+ "lib/libraries/AFSoftSerial/keywords.txt",
72
+ "lib/libraries/AF_XPort/AF_XPort.cpp",
73
+ "lib/libraries/AF_XPort/AF_XPort.h",
74
+ "lib/libraries/DS1307/DS1307.cpp",
75
+ "lib/libraries/DS1307/DS1307.h",
76
+ "lib/libraries/DS1307/keywords.txt",
77
+ "lib/libraries/FrequencyTimer2/FrequencyTimer2.cpp",
78
+ "lib/libraries/FrequencyTimer2/FrequencyTimer2.h",
79
+ "lib/libraries/FrequencyTimer2/keywords.txt",
80
+ "lib/libraries/I2CEEPROM/I2CEEPROM.cpp",
81
+ "lib/libraries/I2CEEPROM/I2CEEPROM.h",
82
+ "lib/libraries/I2CEEPROM/keywords.txt",
83
+ "lib/libraries/LoopTimer/LoopTimer.cpp",
84
+ "lib/libraries/LoopTimer/LoopTimer.h",
85
+ "lib/libraries/LoopTimer/keywords.txt",
86
+ "lib/libraries/OneWire/OneWire.cpp",
87
+ "lib/libraries/OneWire/OneWire.h",
88
+ "lib/libraries/OneWire/keywords.txt",
89
+ "lib/libraries/OneWire/readme.txt",
90
+ "lib/libraries/SWSerLCDpa/SWSerLCDpa.cpp",
91
+ "lib/libraries/SWSerLCDpa/SWSerLCDpa.h",
92
+ "lib/libraries/SWSerLCDsf/SWSerLCDsf.cpp",
93
+ "lib/libraries/SWSerLCDsf/SWSerLCDsf.h",
94
+ "lib/libraries/Servo/Servo.cpp",
95
+ "lib/libraries/Servo/Servo.h",
96
+ "lib/libraries/Stepper/Stepper.cpp",
97
+ "lib/libraries/Stepper/Stepper.h",
98
+ "lib/libraries/Stepper/keywords.txt",
99
+ "lib/libraries/Wire/Wire.cpp",
100
+ "lib/libraries/Wire/Wire.h",
101
+ "lib/libraries/Wire/keywords.txt",
102
+ "lib/libraries/Wire/twi.h",
103
+ "lib/libraries/Wire/utility/twi.c",
104
+ "lib/libraries/Wire/utility/twi.h",
105
+ "lib/plugins/basics.rb",
106
+ "lib/plugins/bitwise_ops.rb",
107
+ "lib/plugins/blink.rb",
108
+ "lib/plugins/blink_m.rb",
109
+ "lib/plugins/debounce.rb",
110
+ "lib/plugins/debug_output_to_lcd.rb",
111
+ "lib/plugins/hysteresis.rb",
112
+ "lib/plugins/input_output_state.rb",
113
+ "lib/plugins/lcd_padding.rb",
114
+ "lib/plugins/mem_test.rb",
115
+ "lib/plugins/midi.rb",
116
+ "lib/plugins/parallax_ping.rb",
117
+ "lib/plugins/servo_pulse.rb",
118
+ "lib/plugins/servo_setup.rb",
119
+ "lib/plugins/smoother.rb",
120
+ "lib/plugins/spark_fun_serial_lcd.rb",
121
+ "lib/plugins/spectra_symbol.rb",
122
+ "lib/plugins/twitter_connect.rb",
123
+ "lib/rad.rb",
124
+ "lib/rad/README.rdoc",
125
+ "lib/rad/antiquated_todo.txt",
126
+ "lib/rad/arduino_plugin.rb",
127
+ "lib/rad/arduino_sketch.rb",
128
+ "lib/rad/darwin_installer.rb",
129
+ "lib/rad/generators/makefile/makefile.erb",
130
+ "lib/rad/generators/makefile/makefile.rb",
131
+ "lib/rad/hardware_library.rb",
132
+ "lib/rad/init.rb",
133
+ "lib/rad/linux_installer.rb",
134
+ "lib/rad/progressbar.rb",
135
+ "lib/rad/rad_processor.rb",
136
+ "lib/rad/rad_rewriter.rb",
137
+ "lib/rad/rad_type_checker.rb",
138
+ "lib/rad/sim/arduino_sketch.rb",
139
+ "lib/rad/sketch_compiler.rb",
140
+ "lib/rad/tasks/build_and_make.rake",
141
+ "lib/rad/tasks/rad.rb",
142
+ "lib/rad/todo.txt",
143
+ "lib/rad/variable_processing.rb",
144
+ "lib/rad/version.rb",
145
+ "madrona-rad.gemspec",
146
+ "project_dev.rake",
147
+ "setup.rb",
148
+ "spec/examples/hello_world.rb",
149
+ "spec/examples/serial_motor.rb",
150
+ "spec/models/arduino_sketch_spec.rb",
151
+ "spec/models/sketch_compiler_spec.rb",
152
+ "spec/models/spec_helper.rb",
153
+ "spec/sim/hello_world_spec.rb",
154
+ "spec/spec.opts",
155
+ "test/fixture.rb",
156
+ "test/hello_world_test/Makefile",
157
+ "test/hello_world_test/hello_world.cpp",
158
+ "test/test_array_processing.rb",
159
+ "test/test_plugin_loading.rb",
160
+ "test/test_translation_post_processing.rb",
161
+ "test/test_variable_processing.rb"
162
+ ]
163
+ s.homepage = %q{http://github.com/madrona/madrona-rad}
164
+ s.rdoc_options = ["--charset=UTF-8"]
165
+ s.require_paths = ["lib"]
166
+ s.rubygems_version = %q{1.3.5}
167
+ s.summary = %q{RAD: Ruby Arduino Development - 0.4.1 -- 1.9 Ready!}
168
+ s.test_files = [
169
+ "spec/examples/hello_world.rb",
170
+ "spec/examples/serial_motor.rb",
171
+ "spec/models/arduino_sketch_spec.rb",
172
+ "spec/models/sketch_compiler_spec.rb",
173
+ "spec/models/spec_helper.rb",
174
+ "spec/sim/hello_world_spec.rb",
175
+ "test/fixture.rb",
176
+ "test/test_array_processing.rb",
177
+ "test/test_plugin_loading.rb",
178
+ "test/test_translation_post_processing.rb",
179
+ "test/test_variable_processing.rb"
180
+ ]
181
+
182
+ if s.respond_to? :specification_version then
183
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
184
+ s.specification_version = 3
185
+
186
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
187
+ s.add_runtime_dependency(%q<ruby2c>, [">= 1.0.0.7"])
188
+ s.add_runtime_dependency(%q<sexp_processor>, [">= 3.0.2"])
189
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
190
+ else
191
+ s.add_dependency(%q<ruby2c>, [">= 1.0.0.7"])
192
+ s.add_dependency(%q<sexp_processor>, [">= 3.0.2"])
193
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
194
+ end
195
+ else
196
+ s.add_dependency(%q<ruby2c>, [">= 1.0.0.7"])
197
+ s.add_dependency(%q<sexp_processor>, [">= 3.0.2"])
198
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
199
+ end
200
+ end
201
+
data/project_dev.rake ADDED
@@ -0,0 +1,36 @@
1
+ def run_tests(sketch, type)
2
+ sh %{rake make:#{type} sketch=#{RAD_ROOT}/lib/examples/#{sketch}}
3
+ end
4
+
5
+ namespace :test do
6
+
7
+ desc "run the framework unit tests"
8
+ task :units do
9
+ FileList['test/test_*.rb'].each do |test|
10
+ sh %{ ruby #{RAD_ROOT}/#{test} }
11
+ end
12
+ end
13
+
14
+
15
+ desc "iterate through all the sketches in the example directory"
16
+ task :upload => :gather do
17
+ @examples.each {|e| run_tests(e, "upload")}
18
+ end
19
+
20
+ desc "compile all examples to test the framework"
21
+ task :compile => :gather do
22
+ @examples.each {|e| run_tests(e, "compile")}
23
+ end
24
+ end
25
+
26
+ desc "gather all tests"
27
+ task :gather do # => "make:upload" do
28
+ @examples = []
29
+ @test_results = []
30
+ Dir.entries( File.expand_path("#{RAD_ROOT}/lib/examples") ).each do |f|
31
+ if (f =~ /\.rb$/)
32
+ @examples << f.split('.').first
33
+ end
34
+ end
35
+
36
+ end
data/test/fixture.rb ADDED
@@ -0,0 +1,51 @@
1
+ class TranslationTesting < ArduinoSketch
2
+
3
+ def one
4
+ delay 1
5
+ end
6
+
7
+ def two
8
+ delay 1
9
+ @foo = 1
10
+ end
11
+
12
+ def three
13
+ @foo = 1
14
+ bar = 2
15
+ baz = wha
16
+ end
17
+
18
+ def four
19
+ @foo = 1
20
+ bar = 2
21
+ wiggle = wha
22
+ end
23
+
24
+ def five
25
+ @foo = 1
26
+ f = KOOL
27
+ end
28
+
29
+ def six
30
+ a = ZAK
31
+
32
+ end
33
+
34
+ def seven(int)
35
+ # coerce int to long int
36
+ a = int * 2
37
+ end
38
+
39
+ def eight(str)
40
+ # coerce str to string
41
+ a = ZAK + str
42
+ end
43
+
44
+ def nine
45
+ @my_array.each do |a|
46
+ delay a
47
+ end
48
+ end
49
+
50
+
51
+ end
metadata CHANGED
@@ -1,70 +1,64 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madrona-rad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
- - Greg Borenstein
8
7
  - JD Barnhart
8
+ - Greg Borenstein
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2008-09-04 00:00:00 -07:00
14
- default_executable: rad
13
+ date: 2009-10-28 00:00:00 -07:00
14
+ default_executable: madrona-rad
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: mime-types
17
+ name: ruby2c
18
18
  type: :runtime
19
19
  version_requirement:
20
20
  version_requirements: !ruby/object:Gem::Requirement
21
21
  requirements:
22
- - - ">"
22
+ - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: 0.0.0
24
+ version: 1.0.0.7
25
25
  version:
26
26
  - !ruby/object:Gem::Dependency
27
- name: ruby2c
27
+ name: sexp_processor
28
28
  type: :runtime
29
29
  version_requirement:
30
30
  version_requirements: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 1.0.0.7
34
+ version: 3.0.2
35
35
  version:
36
36
  - !ruby/object:Gem::Dependency
37
- name: sexp_processor
38
- type: :runtime
37
+ name: thoughtbot-shoulda
38
+ type: :development
39
39
  version_requirement:
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - ~>
43
- - !ruby/object:Gem::Version
44
- version: "3.0"
45
42
  - - ">="
46
43
  - !ruby/object:Gem::Version
47
- version: 3.0.2
44
+ version: "0"
48
45
  version:
49
46
  description: "Ruby Arduino Development: a framework for programming the Arduino physcial computing platform using Ruby"
50
47
  email: jd@jdbarnhart.com
51
48
  executables:
52
- - rad
49
+ - madrona-rad
53
50
  extensions: []
54
51
 
55
52
  extra_rdoc_files:
56
- - History.txt
57
- - Manifest.txt
58
53
  - README.rdoc
59
54
  files:
55
+ - .gitignore
60
56
  - History.txt
61
57
  - License.txt
62
58
  - Manifest.txt
63
59
  - README.rdoc
64
60
  - Rakefile
65
- - test/hello_world_test/Makefile
66
- - test/hello_world_test/hello_world.cpp
67
- - bin/rad
61
+ - VERSION
68
62
  - lib/examples/add_hysteresis.rb
69
63
  - lib/examples/basic_blink.rb
70
64
  - lib/examples/blink_m_address_assignment.rb
@@ -162,16 +156,17 @@ files:
162
156
  - lib/plugins/twitter_connect.rb
163
157
  - lib/rad.rb
164
158
  - lib/rad/README.rdoc
159
+ - lib/rad/antiquated_todo.txt
165
160
  - lib/rad/arduino_plugin.rb
166
161
  - lib/rad/arduino_sketch.rb
162
+ - lib/rad/darwin_installer.rb
167
163
  - lib/rad/generators/makefile/makefile.erb
168
164
  - lib/rad/generators/makefile/makefile.rb
169
165
  - lib/rad/hardware_library.rb
170
166
  - lib/rad/init.rb
167
+ - lib/rad/linux_installer.rb
171
168
  - lib/rad/progressbar.rb
172
169
  - lib/rad/rad_processor.rb
173
- - lib/rad/linux_installer.rb
174
- - lib/rad/darwin_installer.rb
175
170
  - lib/rad/rad_rewriter.rb
176
171
  - lib/rad/rad_type_checker.rb
177
172
  - lib/rad/sim/arduino_sketch.rb
@@ -181,7 +176,8 @@ files:
181
176
  - lib/rad/todo.txt
182
177
  - lib/rad/variable_processing.rb
183
178
  - lib/rad/version.rb
184
- - scripts/txt2html
179
+ - madrona-rad.gemspec
180
+ - project_dev.rake
185
181
  - setup.rb
186
182
  - spec/examples/hello_world.rb
187
183
  - spec/examples/serial_motor.rb
@@ -190,26 +186,20 @@ files:
190
186
  - spec/models/spec_helper.rb
191
187
  - spec/sim/hello_world_spec.rb
192
188
  - spec/spec.opts
189
+ - test/fixture.rb
190
+ - test/hello_world_test/Makefile
191
+ - test/hello_world_test/hello_world.cpp
193
192
  - test/test_array_processing.rb
194
193
  - test/test_plugin_loading.rb
195
194
  - test/test_translation_post_processing.rb
196
195
  - test/test_variable_processing.rb
197
- - website/index.html
198
- - website/index.txt
199
- - website/javascripts/rounded_corners_lite.inc.js
200
- - website/stylesheets/screen.css
201
- - website/template.rhtml
202
- - website/examples/assembler_test.rb.html
203
- - website/examples/gps_reader.rb.html
204
- - website/examples/hello_world.rb.html
205
- - website/examples/serial_motor.rb.html
206
196
  has_rdoc: true
207
- homepage: http://github.com/atduskreg/rad
208
- licenses:
197
+ homepage: http://github.com/madrona/madrona-rad
198
+ licenses: []
199
+
209
200
  post_install_message:
210
201
  rdoc_options:
211
- - --main
212
- - README.rdoc
202
+ - --charset=UTF-8
213
203
  require_paths:
214
204
  - lib
215
205
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -226,10 +216,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
216
  version:
227
217
  requirements: []
228
218
 
229
- rubyforge_project: rad
219
+ rubyforge_project:
230
220
  rubygems_version: 1.3.5
231
221
  signing_key:
232
- specification_version: 2
233
- summary: "RAD: Ruby Arduino Development - 0.4.0 -- 1.9 Ready!"
234
- test_files: []
235
-
222
+ specification_version: 3
223
+ summary: "RAD: Ruby Arduino Development - 0.4.1 -- 1.9 Ready!"
224
+ test_files:
225
+ - spec/examples/hello_world.rb
226
+ - spec/examples/serial_motor.rb
227
+ - spec/models/arduino_sketch_spec.rb
228
+ - spec/models/sketch_compiler_spec.rb
229
+ - spec/models/spec_helper.rb
230
+ - spec/sim/hello_world_spec.rb
231
+ - test/fixture.rb
232
+ - test/test_array_processing.rb
233
+ - test/test_plugin_loading.rb
234
+ - test/test_translation_post_processing.rb
235
+ - test/test_variable_processing.rb