Module: Raudi::Source::Interrupt
- Included in:
- Controller
- Defined in:
- lib/raudi/source/interrupt.rb
Instance Method Summary collapse
- #allow_interrupt ⇒ Object
- #generate_interrupts ⇒ Object
- #interrupt_block(*names, &block) ⇒ Object
- #vector_name(*args) ⇒ Object
Instance Method Details
#allow_interrupt ⇒ Object
7 8 9 |
# File 'lib/raudi/source/interrupt.rb', line 7 def allow_interrupt code_line("sei()") if controller.interrupt end |
#generate_interrupts ⇒ Object
21 22 23 24 |
# File 'lib/raudi/source/interrupt.rb', line 21 def generate_interrupts return unless controller.interrupt processings.each(&:generate_interrupts) end |
#interrupt_block(*names, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/raudi/source/interrupt.rb', line 11 def interrupt_block(*names, &block) interrupt_header = "ISR(#{vector_name(*names)})" new_block = lambda do insert_action(*names) block.call if block_given? end code_block(interrupt_header, &new_block) new_line end |
#vector_name(*args) ⇒ Object
26 27 28 29 |
# File 'lib/raudi/source/interrupt.rb', line 26 def vector_name(*args) vector_name = args.map(&:upcase).join('_') vector_name << "_vect" end |