Class: Denko::DigitalIO::Output
Instance Attribute Summary
#interrupts_enabled, #thread
#callback_mutex
#mode, #pin
#board
Instance Method Summary
collapse
#enable_interrupts, included, #stop, #stop_thread, #threaded, #threaded_loop
#add_callback, #callbacks, #initialize, #remove_callback, #update
#initialize, #state
#initialize, #micro_delay
Instance Method Details
#after_initialize(options = {}) ⇒ Object
9
10
11
12
|
# File 'lib/denko/digital_io/output.rb', line 9
def after_initialize(options={})
super(options)
board.digital_read(pin)
end
|
#digital_write(value) ⇒ Object
Also known as:
write
18
19
20
21
|
# File 'lib/denko/digital_io/output.rb', line 18
def digital_write(value)
@board.digital_write(@pin, value)
self.state = value
end
|
#high ⇒ Object
Also known as:
on
29
30
31
|
# File 'lib/denko/digital_io/output.rb', line 29
def high
digital_write(board.high)
end
|
#high? ⇒ Boolean
Also known as:
on?
40
|
# File 'lib/denko/digital_io/output.rb', line 40
def high?; state == board.high end
|
#low ⇒ Object
Also known as:
off
25
26
27
|
# File 'lib/denko/digital_io/output.rb', line 25
def low
digital_write(board.low)
end
|
#low? ⇒ Boolean
Also known as:
off?
41
|
# File 'lib/denko/digital_io/output.rb', line 41
def low?; state == board.low end
|
#pre_callback_filter(board_state) ⇒ Object
14
15
16
|
# File 'lib/denko/digital_io/output.rb', line 14
def pre_callback_filter(board_state)
board_state.to_i
end
|
#toggle ⇒ Object
33
34
35
|
# File 'lib/denko/digital_io/output.rb', line 33
def toggle
state == board.low ? high : low
end
|