Class: Denko::I2C::BitBang

Inherits:
Object
  • Object
show all
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

#state

Attributes included from Behaviors::Component

#board, #params

Attributes included from Behaviors::MultiPin

#pin, #pins, #proxies

Instance Method Summary collapse

Methods included from BusCommon

#bubble_callbacks, #found_devices, #search

Methods included from Behaviors::Lifecycle

included

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

#update_state

Methods included from Behaviors::BusControllerAddressed

#add_component

Methods included from Behaviors::BusController

#mutex

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

#initialize, #micro_delay

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

#_searchObject



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(options={})
  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