Class: RubimCode::UserIO

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

Overview

class << self

Direct Known Subclasses

UserInput, UserOutput

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of UserIO.



47
48
49
50
51
52
53
54
55
56
# File 'lib/rubimc/io_ports.rb', line 47

def initialize(name, port: nil, pin: nil, type: "normal")
  # ToDo: check type of params:
  # name, port - only symbol
  # pin - only UserVariable with type 'fixed' (feature: pin can receive also instance vars: @pin_num)
  # type - only 'normal' (feature: realize 'tri-state' type)
  @name = name.to_s
  @port = port.to_s
  @pin = pin.name.to_s
  @type = type.to_s
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



45
46
47
# File 'lib/rubimc/io_ports.rb', line 45

def name
  @name
end

#pinObject

Returns the value of attribute pin.



45
46
47
# File 'lib/rubimc/io_ports.rb', line 45

def pin
  @pin
end

#portObject

Returns the value of attribute port.



45
46
47
# File 'lib/rubimc/io_ports.rb', line 45

def port
  @port
end

#typeObject

Returns the value of attribute type.



45
46
47
# File 'lib/rubimc/io_ports.rb', line 45

def type
  @type
end