BBB 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/BBB.gemspec CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
+ spec.add_dependency "json"
20
21
  spec.add_development_dependency "bundler", "~> 1.3"
21
22
  spec.add_development_dependency "rake"
22
23
  spec.add_development_dependency "rspec"
@@ -15,7 +15,7 @@ end
15
15
  #
16
16
  class TemperatureExampleApp < BBB::Application
17
17
  # Run this on the BeagleBoneBlack
18
- board BBB::Board.new
18
+ board BBB::Board::Base.new
19
19
 
20
20
  # Connect the circuit to the board
21
21
  circuit Circuit.new
data/examples/led.rb CHANGED
@@ -15,7 +15,7 @@ end
15
15
  #
16
16
  class LedExampleApplication < BBB::Application
17
17
  # Run this on the BeableBoneBlack
18
- board BBB::Board.new
18
+ board BBB::Board::Base.new
19
19
 
20
20
  # Connect the led circuit
21
21
  circuit Circuit.new
@@ -49,6 +49,5 @@ module BBB
49
49
  raise NotImplementedError
50
50
  end
51
51
 
52
-
53
52
  end
54
53
  end
@@ -30,8 +30,8 @@ module BBB
30
30
  end
31
31
 
32
32
  def connect_io_pin(pin)
33
- gpio_pin = pin_converter.convert(pin)
34
- pin.pin_io = gpio_pin
33
+ converted_pin = pin_converter.convert(pin)
34
+ pin.pin_io = converted_pin
35
35
  setup_pin(pin)
36
36
  end
37
37
 
@@ -7,6 +7,7 @@ module BBB
7
7
 
8
8
  def initialize
9
9
  @pin = BBB::IO::AnalogPin.new
10
+ @pins = [@pin]
10
11
  end
11
12
 
12
13
  def read
@@ -12,7 +12,11 @@ module BBB
12
12
  #
13
13
  def convert(pin, opts={})
14
14
  base_class = pin.class.to_s.split("::").last
15
- klass = GPIO::const_get(base_class.to_sym)
15
+ if GPIO.const_defined?(base_class)
16
+ klass = GPIO::const_get(base_class.to_sym)
17
+ elsif ADC.const_defined?(base_class)
18
+ klass = ADC::const_get(base_class.to_sym)
19
+ end
16
20
  opts = {:mock=>mock}.merge(opts)
17
21
  return klass.new(pin.position, pin.mode, opts)
18
22
  end
data/lib/BBB/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module BBB
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -36,8 +36,12 @@ describe BBB::Application do
36
36
  end
37
37
 
38
38
  class TestConnectionApp < BBB::Application
39
- board BBB::Board::TestBoard.new
39
+ board BBB::Board::TestBoard.new
40
40
  circuit TestLedCircuit.new
41
+
42
+ def run
43
+ "yeah, this one!"
44
+ end
41
45
  end
42
46
 
43
47
  it "attaches virtual pins to board pins" do
@@ -50,4 +54,18 @@ describe BBB::Application do
50
54
  app.led.on!
51
55
  end
52
56
 
57
+ class FunctionsInApp < BBB::Application
58
+ board BBB::Board::TestBoard.new
59
+ circuit TestLedCircuit.new
60
+
61
+ def run
62
+ raise StopIteration
63
+ end
64
+ end
65
+
66
+ it "does run the re-implemented run method" do
67
+ app = FunctionsInApp.new
68
+ lambda{app.start}.should_not raise_error
69
+ end
70
+
53
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: BBB
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-15 00:00:00.000000000 Z
12
+ date: 2013-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: json
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
14
30
  - !ruby/object:Gem::Dependency
15
31
  name: bundler
16
32
  requirement: !ruby/object:Gem::Requirement
@@ -126,12 +142,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
142
  - - ! '>='
127
143
  - !ruby/object:Gem::Version
128
144
  version: '0'
145
+ segments:
146
+ - 0
147
+ hash: -2077311598260566956
129
148
  required_rubygems_version: !ruby/object:Gem::Requirement
130
149
  none: false
131
150
  requirements:
132
151
  - - ! '>='
133
152
  - !ruby/object:Gem::Version
134
153
  version: '0'
154
+ segments:
155
+ - 0
156
+ hash: -2077311598260566956
135
157
  requirements: []
136
158
  rubyforge_project:
137
159
  rubygems_version: 1.8.25
@@ -154,4 +176,3 @@ test_files:
154
176
  - spec/io/mock_pin_spec.rb
155
177
  - spec/io/pinnable_spec.rb
156
178
  - spec/spec_helper.rb
157
- has_rdoc: