Module: Denko::SPI::BusCommon

Includes:
Behaviors::BusController, Behaviors::Reader
Included in:
BitBang, Bus
Defined in:
lib/denko/spi/bus_common.rb

Constant Summary

Constants included from Behaviors::Reader

Behaviors::Reader::READ_WAIT_TIME

Constants included from Behaviors::Lifecycle

Behaviors::Lifecycle::CALLBACK_METHODS

Instance Attribute Summary

Attributes included from Behaviors::State

#state

Attributes included from Behaviors::Component

#board, #params

Instance Method Summary collapse

Methods included from Behaviors::Reader

#_read, #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::Lifecycle

included

Methods included from Behaviors::BusController

#mutex

Methods included from Behaviors::Subcomponents

#add_hw_i2c, #add_hw_spi, #add_single_pin, #components, #hw_i2c_comps, #hw_spi_comps, #remove_hw_i2c, #remove_hw_spi, #remove_single_pin, #single_pin_components

Methods included from Behaviors::Component

#initialize, #micro_delay

Instance Method Details

#add_component(component) ⇒ Object

Add peripheral to self and the board. It gets callbacks directly from the board.



8
9
10
11
# File 'lib/denko/spi/bus_common.rb', line 8

def add_component(component)
  # Don't check for select pin uniqueness. Board handles that.
  components << component
end

#convert_pin(*args, **kwargs) ⇒ Object

Pass through to the real board for converting select/other pins.



19
20
21
# File 'lib/denko/spi/bus_common.rb', line 19

def convert_pin(*args, **kwargs)
  board.convert_pin(*args, **kwargs)
end

#remove_component(component) ⇒ Object

Remove peripheral from self and the board.



14
15
16
# File 'lib/denko/spi/bus_common.rb', line 14

def remove_component(component)
  components.delete(component)
end

#set_pin_mode(*args, **kwargs) ⇒ Object



23
24
25
# File 'lib/denko/spi/bus_common.rb', line 23

def set_pin_mode(*args, **kwargs)
  board.set_pin_mode(*args, **kwargs)
end

#stop(*args, **kwargs) ⇒ Object

If a component calls #stop, that’s just a call to Board#spi_stop giving its select pin.



28
29
30
# File 'lib/denko/spi/bus_common.rb', line 28

def stop(*args, **kwargs)
  board.spi_stop(*args, **kwargs)
end