artoo-arduino 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,32 +24,100 @@ describe Artoo::Adaptors::Firmata do
24
24
  end
25
25
 
26
26
  describe "device info interface" do
27
- it "#firmware_name"
28
- it "#version"
29
- end
30
27
 
31
- describe "digital GPIO interface" do
32
- it "#digital_read"
33
- it "#digital_write"
34
- end
28
+ it "expects #firmware_name to return Firmata firmware name" do
29
+ @firmata.expects(:firmware_name).returns("StandardFirmata.ino")
30
+ @adaptor.stubs(:firmata).returns(@firmata)
31
+ @adaptor.firmware_name.must_equal "StandardFirmata.ino"
32
+ end
33
+
34
+ it "expects #version to return Firmata version" do
35
+ @firmata.expects(:version).returns("2.3")
36
+ @adaptor.stubs(:firmata).returns(@firmata)
37
+ @adaptor.version.must_equal "2.3"
38
+ end
35
39
 
36
- describe "analog GPIO interface" do
37
- it "#analog_read"
38
- it "#analog_write"
39
40
  end
40
41
 
41
- describe "PWM GPIO interface" do
42
- it "#pwm_write"
42
+ describe "digital/analog I/O" do
43
+ before do
44
+ @firmata.stubs(:set_pin_mode)
45
+ @firmata.stubs(:toggle_pin_reporting)
46
+ @firmata_event = mock('event')
47
+ @firmata_event.stubs(:data).returns([1])
48
+ @firmata.stubs(:async_events).returns([@firmata_event])
49
+ @adaptor.stubs(:firmata).returns(@firmata)
50
+ end
51
+
52
+ describe "digital GPIO interface" do
53
+ it "#digital_read" do
54
+ @firmata_event.stubs(:name).returns(:digital_read_1)
55
+ @firmata.expects(:read_and_process)
56
+ @adaptor.digital_read(1).must_equal 1
57
+ end
58
+
59
+ it "#digital_write" do
60
+ @firmata.expects(:digital_write).returns(true)
61
+ @adaptor.digital_write(13, 1).must_equal true
62
+ end
63
+ end
64
+
65
+ describe "analog GPIO interface" do
66
+ it "#analog_read" do
67
+ @firmata_event.stubs(:name).returns(:analog_read_1)
68
+ @firmata_event.stubs(:data).returns([128])
69
+ @firmata.expects(:read_and_process)
70
+ @adaptor.analog_read(1).must_equal 128
71
+ end
72
+ end
43
73
  end
44
74
 
45
- describe "servo GPIO interface" do
46
- it "#servo_write"
75
+ describe "Analog output" do
76
+ before do
77
+ @firmata.stubs(:set_pin_mode)
78
+ @firmata.expects(:analog_write).returns(true)
79
+ @adaptor.stubs(:firmata).returns(@firmata)
80
+ end
81
+
82
+ describe "PWM GPIO interface" do
83
+ it "#pwm_write" do
84
+ @adaptor.pwm_write(3, 128).must_equal true
85
+ end
86
+ end
87
+
88
+ describe "servo GPIO interface" do
89
+ it "#servo_write" do
90
+ @adaptor.servo_write(3, 128).must_equal true
91
+ end
92
+ end
47
93
  end
48
94
 
49
95
  describe "i2c interface" do
50
- it "#i2c_start"
51
- it "#i2c_end"
52
- it "#i2c_read"
53
- it "#i2c_write"
96
+ before do
97
+ @adaptor.stubs(:firmata).returns(@firmata)
98
+ end
99
+ it "#i2c_start" do
100
+ @firmata.expects(:i2c_config).returns(true)
101
+ @adaptor.i2c_start(0).must_equal(true)
102
+ end
103
+
104
+ it "#i2c_end" do
105
+
106
+ end
107
+
108
+ it "#i2c_read" do
109
+ @firmata.expects(:i2c_read_request)
110
+ @firmata.expects(:read_and_process)
111
+ @firmata_event = mock('event')
112
+ @firmata_event.stubs(:data).returns([{ data: 1 }])
113
+ @firmata_event.stubs(:name).returns(:i2c_reply)
114
+ @firmata.stubs(:async_events).returns([@firmata_event])
115
+ @adaptor.i2c_read(1).must_equal(1)
116
+ end
117
+
118
+ it "#i2c_write" do
119
+ @firmata.expects(:i2c_write_request).returns(true)
120
+ @adaptor.i2c_write([1, 8]).must_equal(true)
121
+ end
54
122
  end
55
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artoo-arduino
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ron Evans
@@ -11,116 +11,117 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-10-18 00:00:00.000000000 Z
14
+ date: 2014-02-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: artoo
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - '>='
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.4.0
22
+ version: 1.6.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 1.4.0
29
+ version: 1.6.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: artoo-gpio
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - '>='
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
36
  version: '0'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - '>='
41
+ - - ">="
42
42
  - !ruby/object:Gem::Version
43
43
  version: '0'
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: artoo-i2c
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - '>='
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - '>='
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: hybridgroup-firmata
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - ~>
62
+ - - ">="
63
63
  - !ruby/object:Gem::Version
64
64
  version: 0.4.5
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ~>
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: 0.4.5
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: minitest
74
74
  requirement: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - ~>
76
+ - - "~>"
77
77
  - !ruby/object:Gem::Version
78
78
  version: '5.0'
79
79
  type: :development
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - ~>
83
+ - - "~>"
84
84
  - !ruby/object:Gem::Version
85
85
  version: '5.0'
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: minitest-happy
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - '>='
90
+ - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  type: :development
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - '>='
97
+ - - ">="
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  - !ruby/object:Gem::Dependency
101
101
  name: mocha
102
102
  requirement: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - ~>
104
+ - - "~>"
105
105
  - !ruby/object:Gem::Version
106
106
  version: 0.14.0
107
107
  type: :development
108
108
  prerelease: false
109
109
  version_requirements: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - ~>
111
+ - - "~>"
112
112
  - !ruby/object:Gem::Version
113
113
  version: 0.14.0
114
114
  description: Artoo adaptor and driver for Arduino
115
115
  email:
116
116
  - artoo@hybridgroup.com
117
117
  executables: []
118
- extensions: []
118
+ extensions:
119
+ - ext/Rakefile
119
120
  extra_rdoc_files: []
120
121
  files:
121
- - .gitignore
122
- - .rvmrc.example
123
- - .travis.yml
122
+ - ".gitignore"
123
+ - ".rvmrc.example"
124
+ - ".travis.yml"
124
125
  - Gemfile
125
126
  - Gemfile.lock
126
127
  - LICENSE
@@ -143,9 +144,12 @@ files:
143
144
  - examples/motor_speed_with_analog_input.rb
144
145
  - examples/servo.rb
145
146
  - examples/wiichuck.rb
147
+ - ext/Rakefile
146
148
  - lib/artoo-arduino.rb
147
149
  - lib/artoo-arduino/version.rb
148
150
  - lib/artoo/adaptors/firmata.rb
151
+ - lib/artoo/commands/firmata.rb
152
+ - lib/artoo/commands/hex/StandardFirmata.cpp.hex
149
153
  - test/adaptors/firmata_test.rb
150
154
  - test/test_helper.rb
151
155
  homepage: https://github.com/hybridgroup/artoo-arduino
@@ -158,17 +162,17 @@ require_paths:
158
162
  - lib
159
163
  required_ruby_version: !ruby/object:Gem::Requirement
160
164
  requirements:
161
- - - '>='
165
+ - - ">="
162
166
  - !ruby/object:Gem::Version
163
167
  version: '0'
164
168
  required_rubygems_version: !ruby/object:Gem::Requirement
165
169
  requirements:
166
- - - '>='
170
+ - - ">="
167
171
  - !ruby/object:Gem::Version
168
172
  version: '0'
169
173
  requirements: []
170
174
  rubyforge_project: artoo-arduino
171
- rubygems_version: 2.0.3
175
+ rubygems_version: 2.2.1
172
176
  signing_key:
173
177
  specification_version: 4
174
178
  summary: Artoo adaptor and driver for Arduino