minilab 2.0.0-x86-mingw32 → 2.0.1-x86-mingw32

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/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  Gemfile.lock
2
2
  minilab*.gem
3
+ .yardoc
@@ -0,0 +1 @@
1
+ lib/**/*.rb --no-private -r README.rdoc - CHANGES LICENSE
data/CHANGES CHANGED
@@ -1,11 +1,15 @@
1
+ == 2.0.1
2
+ * converted a significant amount of documentation to yardoc format
3
+ * some of Minilab's instance methods now return [true] instead of [whatever]
4
+
1
5
  == 2.0.0
2
6
  * minilab now requires Ruby 1.9 to run and is built for the RubyInstaller package.
3
7
  minilab's public interface has not changed.
4
8
  * Now using the latest and greatest bundler techniques for gem development.
5
9
  * Two libraries minilab used for testing (hardmock and systir) do not run on Ruby 1.9. Therefore, minilab now uses:
6
- ** RSpec as a test harness
7
- ** steak as an acceptance test harness
8
- ** rr for mocking in unit tests
10
+ * RSpec as a test harness
11
+ * steak as an acceptance test harness
12
+ * rr for mocking in unit tests
9
13
 
10
14
  == 1.1.1
11
15
  * Lots of little things changed as part of the Rubyforge -> Gemcutter/GitHub/rdoc.info migration
@@ -62,8 +62,8 @@ See the end of this document for an outline of how a miniLAB and DB37 connector
62
62
  * Reading analog values only supports single-ended mode. As you can probably guess, I didn't need differential mode, so I didn't add support for it.
63
63
 
64
64
  == Contact information
65
- * Matt Fletcher <fletcher@atomicobject.com>
66
- * Atomic Object <http://atomicobject.com>
65
+ * Matt Fletcher (mailto:fletcher@atomicobject.com)
66
+ * Atomic Object (http://atomicobject.com)
67
67
 
68
68
  == Appendix
69
69
  === DB37 pin to port mapping
@@ -73,7 +73,7 @@ Pin:: Port
73
73
  26-29:: :portcl
74
74
  22-25:: :portch
75
75
 
76
- === System test setup
76
+ === Acceptance test setup
77
77
 
78
78
  On top of the miniLAB:
79
79
  CH0 IN:: D/A OUT 1
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- require "rake/rdoctask"
2
1
  require "rspec/core/rake_task"
3
2
 
4
3
  desc "Run the unit specs"
@@ -16,10 +15,3 @@ namespace :spec do
16
15
  desc "all tests"
17
16
  task :all => %w[ spec:unit spec:acceptance ]
18
17
  end
19
-
20
- Rake::RDocTask.new do |rdoc|
21
- rdoc.rdoc_dir = "rdoc"
22
- rdoc.title = "minilab: Ruby library for the miniLAB 1008"
23
- rdoc.options = %w[ --main README.rdoc --title minilab ]
24
- rdoc.rdoc_files.include("lib/minilab.rb", "README.rdoc", "CHANGES", "LICENSE")
25
- end
@@ -1,5 +1,5 @@
1
1
  module Minilab
2
- class AnalogIo #:nodoc:
2
+ class AnalogIo #@private
3
3
  constructor :minilab_wrapper
4
4
 
5
5
  def read_analog(channel)
@@ -1,5 +1,5 @@
1
1
  module Minilab
2
- class ConnectionState
2
+ class ConnectionState #@private
3
3
  def initialize
4
4
  @connected = false
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Minilab
2
- class DigitalAuxportIo #:nodoc:
2
+ class DigitalAuxportIo #@private
3
3
  constructor :minilab_wrapper
4
4
  include MinilabConstants
5
5
 
@@ -1,5 +1,5 @@
1
1
  module Minilab
2
- class DigitalConfiguration #:nodoc:
2
+ class DigitalConfiguration #@private
3
3
  include MinilabConstants
4
4
  constructor :minilab_wrapper
5
5
 
@@ -1,5 +1,5 @@
1
1
  module Minilab
2
- class DigitalPortIo #:nodoc:
2
+ class DigitalPortIo #@private
3
3
  constructor :minilab_wrapper, :digital_configuration, :library_translator
4
4
 
5
5
  def configure_input_port(port)
@@ -1,5 +1,5 @@
1
1
  module Minilab
2
- class LibraryTranslator #:nodoc:
2
+ class LibraryTranslator #@private
3
3
  include MinilabConstants
4
4
 
5
5
  def get_port_for_pin(pin)
@@ -1,14 +1,17 @@
1
+ # @author Matt Fletcher (fletcher@atomicobject.com)
1
2
  module Minilab
2
- # Use this method to construct Minilab objects. The object will not yet
3
- # be connected to the device.
3
+ # Constructs Minilab objects.
4
+ # @return [Minilab] an unconnected Minilab object. Use {Minilab#connect}
5
+ # to connect it to the physical device.
4
6
  def self.build
5
7
  MinilabContext.new.build[:minilab]
6
8
  end
7
9
 
8
10
  # The main interface to the minilab library. Create one of these objects
9
- # using the +Minilab.build+ method. After you've created a minilab object,
10
- # use the +connect+ method to establish the connection to the device.
11
+ # using the {Minilab.build} method. After you've created a minilab object,
12
+ # use the {#connect} method to establish the connection to the device.
11
13
  # Minilab objects are not usable until they've been connected.
14
+ # @author Matt Fletcher (fletcher@atomicobject.com)
12
15
  class Minilab
13
16
  include MinilabConstants
14
17
  constructor :minilab_wrapper, :analog_io, :digital_auxport_io, :digital_port_io, :connection_state
@@ -17,18 +20,22 @@ module Minilab
17
20
  # * Error reporting from MCC's universal library is set to print
18
21
  # errors to standard out instead of popping up a Windows dialog.
19
22
  # * Each of the DB37 digital ports is setup for input.
23
+ # @return [true]
20
24
  def connect
21
25
  @minilab_wrapper.setup_error_handling(DONTPRINT, STOPALL)
22
26
  @minilab_wrapper.declare_revision(CURRENTREVNUM)
23
27
  @connection_state.connected = true
24
28
  DigitalConfiguration::PORTS.each { |port| configure_input_port(port) }
29
+ true
25
30
  end
26
31
 
27
- # Read from one of the eight analog channels (0 - 7) on top of the device.
32
+ # Read from one of the eight analog channels on top of the device.
28
33
  #
29
34
  # Single-ended mode is the only analog mode supported.
30
35
  #
31
- # An error is raised if an invalid channel number is given.
36
+ # @param [Fixnum] channel the analog channel (0 - 7)
37
+ # @return [Float] the voltage
38
+ # @raise [RuntimeError] the channel number is invalid
32
39
  def read_analog(channel)
33
40
  ensure_connected_to_device
34
41
  @analog_io.read_analog(channel)
@@ -39,8 +46,10 @@ module Minilab
39
46
  #
40
47
  # Single-ended mode is the only analog mode supported.
41
48
  #
42
- # An error is raised if an invalid channel number or an out-of-range
43
- # voltage is given.
49
+ # @param [Fixnum] channel the analog channel (0 or 1)
50
+ # @param [Float] volts the voltage (0.0 - 5.0)
51
+ # @raise [RuntimeError] the channel number is invalid
52
+ # @raise [RuntimeError] the voltage is out of range
44
53
  def write_analog(channel, volts)
45
54
  ensure_connected_to_device
46
55
  @analog_io.write_analog(channel, volts)
@@ -48,9 +57,10 @@ module Minilab
48
57
 
49
58
  # Configure one of the DB37 ports for input.
50
59
  #
51
- # Specify _port_ as a symbol. The available ports are <tt>:porta</tt>,
52
- # <tt>:portb</tt>, <tt>:portcl</tt>, and <tt>:portch</tt>. An error is
53
- # raised if an invalid port is given.
60
+ # @param [Symbol] port the port. Valid ports are
61
+ # :porta, :portb, :portcl, and :portch.
62
+ # @return [true]
63
+ # @raise [RuntimeError] the port is invalid
54
64
  def configure_input_port(port)
55
65
  ensure_connected_to_device
56
66
  @digital_port_io.configure_input_port(port)
@@ -58,44 +68,42 @@ module Minilab
58
68
 
59
69
  # Configure one of the DB37 ports for output.
60
70
  #
61
- # Specify _port_ as a symbol. The available ports are <tt>:porta</tt>,
62
- # <tt>:portb</tt>, <tt>:portcl</tt>, and <tt>:portch</tt>. An error is
63
- # raised if an invalid port is given.
71
+ # @param (see #configure_input_port)
72
+ # @return [true]
73
+ # @raise (see #configure_input_port)
64
74
  def configure_output_port(port)
65
75
  ensure_connected_to_device
66
76
  @digital_port_io.configure_output_port(port)
67
77
  end
68
78
 
69
- # Read a single bit from one of the digital pins.
79
+ # Read a single bit from one of the auxport pins (on the top of the
80
+ # device) or from a DB37 pin. Ensure the pin has been configured for
81
+ # input (see {#configure_input_port}) before using this method.
82
+ # auxport pins do not need to be configured.
70
83
  #
71
- # If you'd like to read from one of the pins on the top of the device (the
72
- # auxport pins), then specify the pin as a string with its label (e.g.
73
- # read_digital("DIO1")). Alternatively, if you'd like to read from one of
74
- # the DB37 pins, specify the pin as the number it's labeled with (e.g.
75
- # read_digital(13)).
76
- #
77
- # An error is raised if you specify a pin that doesn't exist or if you
78
- # try to read from a DB37 pin on a port that is not configured for input.
79
- # The digital pins on the top of the device do not need to be configured.
84
+ # @param [String, Fixnum] pin a String name of the auxport (e.g. "DIO1")
85
+ # or a Fixnum DB37 pin number (e.g. 13)
86
+ # @return [Fixnum] the bit value
87
+ # @raise [RuntimeError] the given pin doesn't exist
88
+ # @raise [RuntimeError] the DB37 pin has not been configured for input
80
89
  def read_digital(pin)
81
90
  ensure_connected_to_device
82
91
  perform_digital_op(pin, :read, pin)
83
92
  end
84
93
 
85
- # Write a single bit to one of the digital pins. _value_ must be an integer
86
- # 1 or 0.
87
- #
88
- # If you'd like to write to one of the pins on the top of the device (the
89
- # auxport pins), then specify the pin as a string with its label (e.g.
90
- # write_digital("DIO2", 0)). Alternatively, if you'd like to write to one
91
- # of the DB37 pins, specify the pin as the number it's labeled with (e.g.
92
- # write_digital(17, 1)).
94
+ # Write a single bit to one of the auxport pins (on the top of the
95
+ # device) or to a DB37 pin. Ensure the pin has been configured for
96
+ # output (see {#configure_output_port}) before using this method.
97
+ # auxport pins do not need to be configured.
93
98
  #
94
- # An error is raised if you specify a pin that doesn't exist or if you
95
- # try to write to a DB37 pin on a port that is not configured for output.
96
- # The digital pins on the top of the device do not need to be configured.
97
- #
98
- # Values above 1 are interpreted as 1; negative values raise an error.
99
+ # @param [String, Fixnum] pin a String name of the auxport (e.g. "DIO1")
100
+ # or a Fixnum DB37 pin number (e.g. 13)
101
+ # @param [Fixnum] value the value (0 or 1) to write. values above 1 are
102
+ # interpreted as 1.
103
+ # @return [true]
104
+ # @raise [RuntimeError] the given pin doesn't exist
105
+ # @raise [RuntimeError] the DB37 pin has not been configured for input
106
+ # @raise [RuntimeError] a negative value is given
99
107
  def write_digital(pin, value)
100
108
  ensure_connected_to_device
101
109
  perform_digital_op(pin, :write, pin, value)
@@ -103,10 +111,9 @@ module Minilab
103
111
 
104
112
  # Read a byte from one of the DB37 ports.
105
113
  #
106
- # Specify _port_ as a symbol. The available ports are <tt>:porta</tt>,
107
- # <tt>:portb</tt>, <tt>:portcl</tt>, and <tt>:portch</tt>.
108
- #
109
- # An error is raised if an invalid port is given.
114
+ # @param (see #configure_input_port)
115
+ # @return [Fixnum] the byte value
116
+ # @raise (see #configure_input_port)
110
117
  def read_digital_byte(port)
111
118
  ensure_connected_to_device
112
119
  @digital_port_io.read_port(port)
@@ -1,7 +1,8 @@
1
- # Lifted from cbw.h. Let's hope these don't change often.
2
- # Using revision number 5.90.
3
1
  module Minilab
4
- module MinilabConstants
2
+ module MinilabConstants #@private
3
+ # Lifted from cbw.h. Let's hope these don't change often.
4
+ # Using revision number 5.90.
5
+
5
6
  CURRENTREVNUM = 5.90
6
7
 
7
8
  BOARDNUM = 0
@@ -3,7 +3,7 @@ require "yaml"
3
3
  require "pathname"
4
4
 
5
5
  module Minilab
6
- class MinilabContext #:nodoc:
6
+ class MinilabContext #@private
7
7
  OBJECT_DEFINITION = Pathname.new(__FILE__).dirname + "objects.yml"
8
8
 
9
9
  def build
@@ -2,7 +2,7 @@ require "ffi"
2
2
  require "pathname"
3
3
 
4
4
  module Minilab
5
- class MinilabHardware
5
+ class MinilabHardware #@private
6
6
  include MinilabConstants
7
7
 
8
8
  def setup_error_handling(reporting, handling)
@@ -1,5 +1,5 @@
1
1
  module Minilab
2
- class MinilabWrapper #:nodoc:
2
+ class MinilabWrapper #@private
3
3
  constructor :minilab_hardware
4
4
 
5
5
  def method_missing(method, *argz)
@@ -1,3 +1,3 @@
1
1
  module Minilab
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
@@ -19,7 +19,7 @@ describe Minilab::Minilab do
19
19
  @digital_port_io.configure_input_port(port)
20
20
  end
21
21
 
22
- subject.connect
22
+ assert subject.connect
23
23
  end
24
24
 
25
25
  it "bomb out if trying to use a method but haven't connected yet" do
@@ -58,7 +58,7 @@ describe Minilab::Minilab do
58
58
  @connection_state.connected?.returns true
59
59
  @digital_auxport_io.write_digital('DIO3', 0).returns(true)
60
60
 
61
- subject.write_digital('DIO3', 0)
61
+ assert subject.write_digital('DIO3', 0)
62
62
  end
63
63
 
64
64
  it "use the digital port object when the pin is a numbered pin for read_digital" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 0
8
- - 0
9
- version: 2.0.0
8
+ - 1
9
+ version: 2.0.1
10
10
  platform: x86-mingw32
11
11
  authors:
12
12
  - Matt Fletcher
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-02 00:00:00 -05:00
17
+ date: 2011-01-04 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -99,8 +99,8 @@ extra_rdoc_files:
99
99
  - CHANGES
100
100
  - LICENSE
101
101
  files:
102
- - .document
103
102
  - .gitignore
103
+ - .yardopts
104
104
  - CHANGES
105
105
  - Gemfile
106
106
  - LICENSE
data/.document DELETED
@@ -1,2 +0,0 @@
1
- README.rdoc
2
- lib/minilab.rb