Class: Denko::I2C::Bus

Inherits:
Object
  • Object
show all
Includes:
Behaviors::Lifecycle, BusCommon
Defined in:
lib/denko/i2c/bus.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

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

Instance Method Details

#_read(address, register, num_bytes, frequency = 100000, repeated_start = false) ⇒ Object



19
20
21
# File 'lib/denko/i2c/bus.rb', line 19

def _read(address, register, num_bytes, frequency=100000, repeated_start=false)
  board.i2c_read(i2c_index, address, register, num_bytes, frequency, repeated_start)
end

#_searchObject



11
12
13
# File 'lib/denko/i2c/bus.rb', line 11

def _search
  board.i2c_search(i2c_index)
end

#i2c_indexObject



7
8
9
# File 'lib/denko/i2c/bus.rb', line 7

def i2c_index
  @i2c_index ||= params[:i2c_index] || params[:index] || 0
end

#write(address, bytes, frequency = 100000, repeated_start = false) ⇒ Object



15
16
17
# File 'lib/denko/i2c/bus.rb', line 15

def write(address, bytes, frequency=100000, repeated_start=false)
  board.i2c_write(i2c_index, address, bytes, frequency, repeated_start)
end