Module: Denko::Behaviors::BusPeripheralAddressed

Includes:
BusPeripheral
Included in:
I2C::Peripheral, OneWire::Peripheral
Defined in:
lib/denko/behaviors/bus_peripheral_addressed.rb

Instance Attribute Summary

Attributes included from BusPeripheral

#address

Attributes included from Component

#board

Instance Method Summary collapse

Methods included from BusPeripheral

#atomically

Methods included from Component

#initialize, #micro_delay

Methods included from State

#initialize, #state

Instance Method Details

#before_initialize(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
# File 'lib/denko/behaviors/bus_peripheral_addressed.rb', line 6

def before_initialize(options={})
  # Allow @address override in options, even if peripheral sets a default.
  @address = options[:address] if options[:address]

  raise ArgumentError, "missing address for #{self}. Try Bus#search first" unless @address
  super(options)
end