Class: Raudi::AVR::Timer
- Inherits:
-
Object
- Object
- Raudi::AVR::Timer
- Defined in:
- lib/raudi/avr/timer.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#counter ⇒ Object
Returns the value of attribute counter.
-
#interrupt ⇒ Object
Returns the value of attribute interrupt.
-
#length ⇒ Object
Returns the value of attribute length.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#mode_params ⇒ Object
Returns the value of attribute mode_params.
-
#name ⇒ Object
Returns the value of attribute name.
-
#prescale ⇒ Object
Returns the value of attribute prescale.
Instance Method Summary collapse
-
#initialize(name, params) ⇒ Timer
constructor
A new instance of Timer.
- #max_number ⇒ Object
- #number ⇒ Object
- #range ⇒ Object
Constructor Details
#initialize(name, params) ⇒ Timer
Returns a new instance of Timer.
19 20 21 22 23 |
# File 'lib/raudi/avr/timer.rb', line 19 def initialize(name, params) self.name = name self.length = params['length'] self.normal! end |
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active.
7 8 9 |
# File 'lib/raudi/avr/timer.rb', line 7 def active @active end |
#counter ⇒ Object
Returns the value of attribute counter.
7 8 9 |
# File 'lib/raudi/avr/timer.rb', line 7 def counter @counter end |
#interrupt ⇒ Object
Returns the value of attribute interrupt.
7 8 9 |
# File 'lib/raudi/avr/timer.rb', line 7 def interrupt @interrupt end |
#length ⇒ Object
Returns the value of attribute length.
7 8 9 |
# File 'lib/raudi/avr/timer.rb', line 7 def length @length end |
#mode ⇒ Object
Returns the value of attribute mode.
7 8 9 |
# File 'lib/raudi/avr/timer.rb', line 7 def mode @mode end |
#mode_params ⇒ Object
Returns the value of attribute mode_params.
7 8 9 |
# File 'lib/raudi/avr/timer.rb', line 7 def mode_params @mode_params end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/raudi/avr/timer.rb', line 7 def name @name end |
#prescale ⇒ Object
Returns the value of attribute prescale.
7 8 9 |
# File 'lib/raudi/avr/timer.rb', line 7 def prescale @prescale end |
Instance Method Details
#max_number ⇒ Object
33 34 35 |
# File 'lib/raudi/avr/timer.rb', line 33 def max_number 2**length end |
#number ⇒ Object
25 26 27 |
# File 'lib/raudi/avr/timer.rb', line 25 def number name[/\d+/].to_i end |
#range ⇒ Object
29 30 31 |
# File 'lib/raudi/avr/timer.rb', line 29 def range 0...max_number end |