Class: Scale

Inherits:
Base show all
Defined in:
lib/functions/scale.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#frame_optimized, #name

Instance Method Summary collapse

Methods inherited from Base

#add_arduino_code, #add_cycle_level_scope, #add_top_level_scope, #append_tsortable, #buildit, #depends_on, #initialize, #resolve_frame_optimized, #top_level_scope_arduino_code

Constructor Details

This class inherits a constructor from Base

Instance Attribute Details

#hi_inObject

Returns the value of attribute hi_in.



14
15
16
# File 'lib/functions/scale.rb', line 14

def hi_in
  @hi_in
end

#hi_outObject

Returns the value of attribute hi_out.



16
17
18
# File 'lib/functions/scale.rb', line 16

def hi_out
  @hi_out
end

#inputObject

Returns the value of attribute input.



12
13
14
# File 'lib/functions/scale.rb', line 12

def input
  @input
end

#lo_inObject

Returns the value of attribute lo_in.



13
14
15
# File 'lib/functions/scale.rb', line 13

def lo_in
  @lo_in
end

#lo_outObject

Returns the value of attribute lo_out.



15
16
17
# File 'lib/functions/scale.rb', line 15

def lo_out
  @lo_out
end

Instance Method Details

#arduino_codeObject



22
23
24
25
26
27
28
29
30
# File 'lib/functions/scale.rb', line 22

def arduino_code
  unless @frame_optimized 
    [
      "scale(#{@input.name}, #{@lo_in.name}, #{@hi_in.name}, #{@lo_out.name}, #{@hi_out.name}, #{@name});"
    ]
  else
    []
  end
end

#cycle_level_arduino_codeObject



32
33
34
35
36
37
38
39
40
# File 'lib/functions/scale.rb', line 32

def cycle_level_arduino_code
  if @frame_optimized
    [
      "scale(#{@input.name}, #{@lo_in.name}, #{@hi_in.name}, #{@lo_out.name}, #{@hi_out.name}, #{@name});"
    ]
  else
    []
  end
end

#param_keysObject



18
19
20
# File 'lib/functions/scale.rb', line 18

def param_keys
  [:input, :lo_in, :hi_in, :lo_out, :hi_out]
end

#top_level_scope_codeObject



42
43
44
45
46
# File 'lib/functions/scale.rb', line 42

def top_level_scope_code
  [
    "long #{@name}[3];"
  ]
end