Class: RubimCode::UserInput

Inherits:
UserIO show all
Defined in:
lib/rubimc/io_ports.rb

Overview

end UserInput class

Instance Attribute Summary

Attributes inherited from UserIO

#name, #pin, #port, #type

Instance Method Summary collapse

Constructor Details

#initialize(name, port: nil, pin: nil, type: "normal") ⇒ UserInput

Returns a new instance of UserInput.



80
81
82
83
# File 'lib/rubimc/io_ports.rb', line 80

def initialize(name, port: nil, pin: nil, type: "normal")
  super
  RubimCode.pout(RubimCode.rubim_cbit("DDR#{port}", "#{pin}") + " /* #{self.name} configure as output */ ")
end

Instance Method Details

#hi?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/rubimc/io_ports.rb', line 86

def hi?
  "bit_is_set(PORT#{port}, #{pin})" + " /*#{self.name}.#{__method__}*/"
end

#low?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/rubimc/io_ports.rb', line 90

def low?
  "bit_is_clear(PORT#{port}, #{pin})" + " /*#{self.name}.#{__method__}*/"
end