rufirmata 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,8 +7,8 @@ module Rufirmata
7
7
  :taken,:firmata_version,:firmware, :listening
8
8
 
9
9
  def initialize(serial_port, options={})
10
+ @options = options
10
11
  options[:serial_port] = serial_port
11
- @serial_port ||= Rufirmata.create_serial_port(options)
12
12
  @name = options[:name] || serial_port
13
13
  @board_type =
14
14
  case options[:board_type]
@@ -19,8 +19,13 @@ module Rufirmata
19
19
  @taken = { :analog => { }, :digital =>{ } }
20
20
  @listening = false
21
21
  initialize_layout
22
- #This is critical. Sending commands before the board is ready will lock it up.
23
- sleep 2
22
+ connect unless options[:defer_init]
23
+ end
24
+
25
+ def connect
26
+ @serial_port ||= Rufirmata.create_serial_port(@options)
27
+ #This is critical. Sending commands before the board is ready will lock it up.
28
+ sleep 2 unless @options[:skip_init_delay]
24
29
  end
25
30
 
26
31
  def to_s
@@ -1,3 +1,3 @@
1
1
  module Rufirmata
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/spec/board_spec.rb CHANGED
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe Rufirmata::Board do
4
4
  before(:each) do
5
5
  Rufirmata.stub(:create_serial_port) { FakeSerial.new }
6
- @board = Rufirmata::Board.new("/dev/ttyUSB0")
6
+ @board = Rufirmata::Board.new("/dev/ttyUSB0", :skip_init_delay=>true)
7
7
  end
8
8
 
9
9
  describe "handlers" do
data/spec/pin_spec.rb CHANGED
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe Rufirmata::Pin do
4
4
  before(:each) do
5
5
  Rufirmata.stub(:create_serial_port) { FakeSerial.new }
6
- @board = Rufirmata::Board.new("/dev/ttyUSB0")
6
+ @board = Rufirmata::Board.new("/dev/ttyUSB0", :skip_init_delay=>true)
7
7
  end
8
8
 
9
9
  describe "notifications" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufirmata
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nathan Stults
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-28 00:00:00 -08:00
18
+ date: 2010-12-01 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency