Class: RubyI2C::Device::Base
- Inherits:
-
Object
- Object
- RubyI2C::Device::Base
- Defined in:
- lib/ruby_i2c/device/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#address ⇒ Object
readonly
Returns the value of attribute address.
Instance Method Summary collapse
- #command(*args) ⇒ Object
-
#initialize(adapter: RubyI2C::Adapter::UnixDevice.new, address: nil) ⇒ Base
constructor
A new instance of Base.
- #read(*args) ⇒ Object
- #write(*args) ⇒ Object
Constructor Details
#initialize(adapter: RubyI2C::Adapter::UnixDevice.new, address: nil) ⇒ Base
Returns a new instance of Base.
7 8 9 10 |
# File 'lib/ruby_i2c/device/base.rb', line 7 def initialize(adapter: RubyI2C::Adapter::UnixDevice.new, address: nil) @adapter = adapter @address = address end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
5 6 7 |
# File 'lib/ruby_i2c/device/base.rb', line 5 def adapter @adapter end |
#address ⇒ Object (readonly)
Returns the value of attribute address.
5 6 7 |
# File 'lib/ruby_i2c/device/base.rb', line 5 def address @address end |
Instance Method Details
#command(*args) ⇒ Object
13 14 15 |
# File 'lib/ruby_i2c/device/base.rb', line 13 def command(*args) adapter.command address, *args end |
#read(*args) ⇒ Object
18 19 20 |
# File 'lib/ruby_i2c/device/base.rb', line 18 def read(*args) adapter.read address, *args end |
#write(*args) ⇒ Object
23 24 25 |
# File 'lib/ruby_i2c/device/base.rb', line 23 def write(*args) adapter.write address, *args end |