Class: Raudi::AVR::Port
- Inherits:
-
Object
- Object
- Raudi::AVR::Port
- Includes:
- StateList
- Defined in:
- lib/raudi/avr/port.rb
Instance Attribute Summary collapse
-
#interrupts ⇒ Object
Returns the value of attribute interrupts.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pc_number ⇒ Object
Returns the value of attribute pc_number.
-
#pins(pin_number = nil) ⇒ Object
Returns the value of attribute pins.
Instance Method Summary collapse
- #add_interrupt(new_interrupt) ⇒ Object
-
#initialize(name, config) ⇒ Port
constructor
A new instance of Port.
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
#interrupts ⇒ Object
Returns the value of attribute interrupts.
11 12 13 |
# File 'lib/raudi/avr/port.rb', line 11 def interrupts @interrupts end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/raudi/avr/port.rb', line 11 def name @name end |
#pc_number ⇒ Object
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 |