Class: Denko::I2C::BitBang
- Inherits:
-
Object
- Object
- Denko::I2C::BitBang
- Includes:
- Behaviors::Lifecycle, Behaviors::MultiPin, BusCommon
- Defined in:
- lib/denko/i2c/bit_bang.rb
Constant Summary
Constants included from Behaviors::Lifecycle
Behaviors::Lifecycle::CALLBACK_METHODS
Constants included from Behaviors::Reader
Behaviors::Reader::READ_WAIT_TIME
Instance Attribute Summary
Attributes included from Behaviors::State
Attributes included from Behaviors::Component
Attributes included from Behaviors::MultiPin
Instance Method Summary collapse
- #_read(address, register, num_bytes, frequency = nil, repeated_start = false) ⇒ Object
- #_search ⇒ Object
- #initialize_pins(options = {}) ⇒ Object
- #write(address, bytes, frequency = nil, repeated_start = false) ⇒ Object
Methods included from BusCommon
#bubble_callbacks, #found_devices, #search
Methods included from Behaviors::Lifecycle
Methods included from Behaviors::Reader
#read, #read_busy?, #read_nb, #read_raw, #read_using, #update
Methods included from Behaviors::Callbacks
#add_callback, #callbacks, #pre_callback_filter, #remove_callback, #update
Methods included from Behaviors::State
Methods included from Behaviors::BusControllerAddressed
Methods included from Behaviors::BusController
Methods included from Behaviors::Subcomponents
#add_component, #add_hw_i2c, #add_hw_spi, #add_single_pin, #components, #hw_i2c_comps, #hw_spi_comps, #remove_component, #remove_hw_i2c, #remove_hw_spi, #remove_single_pin, #single_pin_components
Methods included from Behaviors::Component
Methods included from Behaviors::MultiPin
#convert_pins, #proxy_pin, #proxy_states, #require_pin, #require_pins
Instance Method Details
#_read(address, register, num_bytes, frequency = nil, repeated_start = false) ⇒ Object
27 28 29 |
# File 'lib/denko/i2c/bit_bang.rb', line 27 def _read(address, register, num_bytes, frequency=nil, repeated_start=false) board.i2c_bb_read(pins[:scl], pins[:sda], address, register, num_bytes, repeated_start) end |
#_search ⇒ Object
19 20 21 |
# File 'lib/denko/i2c/bit_bang.rb', line 19 def _search board.i2c_bb_search(pins[:scl], pins[:sda]) end |
#initialize_pins(options = {}) ⇒ Object
8 9 10 11 |
# File 'lib/denko/i2c/bit_bang.rb', line 8 def initialize_pins(={}) proxy_pin :scl, DigitalIO::CBitBang proxy_pin :sda, DigitalIO::CBitBang end |
#write(address, bytes, frequency = nil, repeated_start = false) ⇒ Object
23 24 25 |
# File 'lib/denko/i2c/bit_bang.rb', line 23 def write(address, bytes, frequency=nil, repeated_start=false) board.i2c_bb_write(pins[:scl], pins[:sda], address, bytes, repeated_start) end |