Class: Raudi::AVR::Port

Inherits:
Object
  • Object
show all
Includes:
StateList
Defined in:
lib/raudi/avr/port.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, config) ⇒ Port

Returns a new instance of Port.



13
14
15
16
17
18
# File 'lib/raudi/avr/port.rb', line 13

def initialize(name, config)
  self.name = name.upcase
  self.pins = config['pins'].map{|pin_number, types|  Pin.new(self, pin_number, types)}
  self.pc_number= config['pc_number']
  self.interrupts = []
end

Instance Attribute Details

#interruptsObject

Returns the value of attribute interrupts.



11
12
13
# File 'lib/raudi/avr/port.rb', line 11

def interrupts
  @interrupts
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/raudi/avr/port.rb', line 11

def name
  @name
end

#pc_numberObject

Returns the value of attribute pc_number.



11
12
13
# File 'lib/raudi/avr/port.rb', line 11

def pc_number
  @pc_number
end

#pins(pin_number = nil) ⇒ Object

Returns the value of attribute pins.



11
12
13
# File 'lib/raudi/avr/port.rb', line 11

def pins
  @pins
end

Instance Method Details

#add_interrupt(new_interrupt) ⇒ Object



20
21
22
# File 'lib/raudi/avr/port.rb', line 20

def add_interrupt(new_interrupt)
  self.interrupts << new_interrupt unless interrupts.include?(new_interrupt)
end