Class: Elemac::Outputs
- Inherits:
-
Object
- Object
- Elemac::Outputs
- Defined in:
- lib/elemac/outputs.rb
Instance Method Summary collapse
- #dimm_outputs ⇒ Object
-
#initialize(device:) ⇒ Outputs
constructor
A new instance of Outputs.
- #out_a ⇒ Object
- #out_b ⇒ Object
- #out_c ⇒ Object
- #out_d ⇒ Object
- #out_e ⇒ Object
- #out_f ⇒ Object
- #out_g ⇒ Object
- #outputs_available ⇒ Object
- #power_outputs ⇒ Object
- #ttl_outputs ⇒ Object
Constructor Details
#initialize(device:) ⇒ Outputs
Returns a new instance of Outputs.
7 8 9 10 11 12 13 14 |
# File 'lib/elemac/outputs.rb', line 7 def initialize(device:) @device = device # TODO: check loaded sensors @out_a = @out_b = @out_c = @out_d = @out_e = true @out_f = true @out_g = true # more unavailable now end |
Instance Method Details
#dimm_outputs ⇒ Object
58 59 60 |
# File 'lib/elemac/outputs.rb', line 58 def dimm_outputs [out_f] # and more... end |
#out_a ⇒ Object
16 17 18 19 |
# File 'lib/elemac/outputs.rb', line 16 def out_a throw 'Output A unavailable' unless @out_a PowerOutput.new(device: @device, index: 0) end |
#out_b ⇒ Object
20 21 22 23 |
# File 'lib/elemac/outputs.rb', line 20 def out_b throw 'Output B unavailable' unless @out_b PowerOutput.new(device: @device, index: 1) end |
#out_c ⇒ Object
24 25 26 27 |
# File 'lib/elemac/outputs.rb', line 24 def out_c throw 'Output C unavailable' unless @out_c PowerOutput.new(device: @device, index: 2) end |
#out_d ⇒ Object
28 29 30 31 |
# File 'lib/elemac/outputs.rb', line 28 def out_d throw 'Output D unavailable' unless @out_d PowerOutput.new(device: @device, index: 3) end |
#out_e ⇒ Object
32 33 34 35 |
# File 'lib/elemac/outputs.rb', line 32 def out_e throw 'Output E unavailable' unless @out_e PowerOutput.new(device: @device, index: 4) end |
#out_f ⇒ Object
36 37 38 39 |
# File 'lib/elemac/outputs.rb', line 36 def out_f throw 'Output F unavailable' unless @out_f PwmOutput.new(device: @device, index: 5, dim_index: 0) end |
#out_g ⇒ Object
40 41 42 43 |
# File 'lib/elemac/outputs.rb', line 40 def out_g throw 'Output G unavailable' unless @out_g TtlOutput.new(device: @device, index: 6) end |
#outputs_available ⇒ Object
45 46 47 |
# File 'lib/elemac/outputs.rb', line 45 def outputs_available ['a','b','c','d','e','f','g'] # and more... end |
#power_outputs ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/elemac/outputs.rb', line 49 def power_outputs outputs = [] outputs << out_a if @out_a outputs << out_b if @out_b outputs << out_c if @out_c outputs << out_d if @out_d outputs << out_e if @out_e end |
#ttl_outputs ⇒ Object
62 63 64 |
# File 'lib/elemac/outputs.rb', line 62 def ttl_outputs [out_g] # and more... end |