Class: PiDriver::Device::MCP23017::HardwareAddress
- Inherits:
-
Object
- Object
- PiDriver::Device::MCP23017::HardwareAddress
- Defined in:
- lib/pi_driver/device/mcp23017/hardware_address.rb
Instance Attribute Summary collapse
-
#a0 ⇒ Object
readonly
Returns the value of attribute a0.
-
#a1 ⇒ Object
readonly
Returns the value of attribute a1.
-
#a2 ⇒ Object
readonly
Returns the value of attribute a2.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ HardwareAddress
constructor
A new instance of HardwareAddress.
Constructor Details
#initialize(options) ⇒ HardwareAddress
Returns a new instance of HardwareAddress.
7 8 9 10 11 12 13 14 15 |
# File 'lib/pi_driver/device/mcp23017/hardware_address.rb', line 7 def initialize() @argument_helper = Utils::ArgumentHelper.new prefix: 'MCP23017::HardwareAddress' @observer = .delete :observer @a0 = Utils::State::LOW @a1 = Utils::State::LOW @a2 = Utils::State::LOW end |
Instance Attribute Details
#a0 ⇒ Object (readonly)
Returns the value of attribute a0.
5 6 7 |
# File 'lib/pi_driver/device/mcp23017/hardware_address.rb', line 5 def a0 @a0 end |
#a1 ⇒ Object (readonly)
Returns the value of attribute a1.
5 6 7 |
# File 'lib/pi_driver/device/mcp23017/hardware_address.rb', line 5 def a1 @a1 end |
#a2 ⇒ Object (readonly)
Returns the value of attribute a2.
5 6 7 |
# File 'lib/pi_driver/device/mcp23017/hardware_address.rb', line 5 def a2 @a2 end |
Class Method Details
.address_writer(*addresses) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pi_driver/device/mcp23017/hardware_address.rb', line 17 def self.address_writer(*addresses) addresses.each do |address| setter_symbol = "#{address}=".to_sym getter_instance = "@#{address}" define_method setter_symbol do |value| @argument_helper.check(:hardware_address, value, Utils::State::VALID_STATES) instance_variable_set(getter_instance, value) @observer.update_opcodes instance_variable_get getter_instance end end end |