Class: Denko::UART::BitBang
- Inherits:
-
Object
- Object
- Denko::UART::BitBang
- Defined in:
- lib/denko/uart/bit_bang.rb
Constant Summary
Constants included from Behaviors::Lifecycle
Behaviors::Lifecycle::CALLBACK_METHODS
Instance Attribute Summary collapse
-
#baud ⇒ Object
readonly
Returns the value of attribute baud.
Attributes included from Behaviors::State
Attributes included from Behaviors::MultiPin
Attributes included from Behaviors::Component
Instance Method Summary collapse
- #hook_rx_callback ⇒ Object
- #initialize_pins(options = {}) ⇒ Object
- #start(baud) ⇒ Object
- #stop ⇒ Object
- #write(data) ⇒ Object
Methods included from Common
#flush, #gets, #initialize_buffer
Methods included from Behaviors::Lifecycle
Methods included from Behaviors::Callbacks
#add_callback, #callbacks, #pre_callback_filter, #remove_callback, #update
Methods included from Behaviors::State
Methods included from Behaviors::MultiPin
#convert_pins, #proxy_pin, #proxy_states, #require_pin, #require_pins
Methods included from Behaviors::Component
Instance Attribute Details
#baud ⇒ Object (readonly)
Returns the value of attribute baud.
15 16 17 |
# File 'lib/denko/uart/bit_bang.rb', line 15 def baud @baud end |
Instance Method Details
#hook_rx_callback ⇒ Object
41 42 43 |
# File 'lib/denko/uart/bit_bang.rb', line 41 def hook_rx_callback rx.add_callback { |data| self.update(data) } end |
#initialize_pins(options = {}) ⇒ Object
17 18 19 20 |
# File 'lib/denko/uart/bit_bang.rb', line 17 def initialize_pins(={}) require_pin(:tx) proxy_pin(:rx, UARTRxPin) end |
#start(baud) ⇒ Object
28 29 30 31 |
# File 'lib/denko/uart/bit_bang.rb', line 28 def start(baud) @baud = baud board.uart_bb_start(pins[:tx], pins[:rx], @baud) end |
#stop ⇒ Object
33 34 35 |
# File 'lib/denko/uart/bit_bang.rb', line 33 def stop() board.uart_bb_stop end |
#write(data) ⇒ Object
37 38 39 |
# File 'lib/denko/uart/bit_bang.rb', line 37 def write(data) board.uart_bb_write(data) end |