class Elemac::Outputs

Public Class Methods

new(device:) click to toggle source
# 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

Public Instance Methods

dimm_outputs() click to toggle source
# File lib/elemac/outputs.rb, line 58
def dimm_outputs
        [out_f] # and more...
end
out_a() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/elemac/outputs.rb, line 45
def outputs_available
        ['a','b','c','d','e','f','g'] # and more...
end
power_outputs() click to toggle source
# 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() click to toggle source
# File lib/elemac/outputs.rb, line 62
def ttl_outputs
        [out_g] # and more...
end