Class: UChip::MCP2221::I2CProxy
- Inherits:
-
Object
- Object
- UChip::MCP2221::I2CProxy
- Defined in:
- lib/uchip/mcp2221.rb
Instance Method Summary collapse
- #cancel ⇒ Object
-
#initialize(address, handler) ⇒ I2CProxy
constructor
A new instance of I2CProxy.
- #read(size) ⇒ Object
- #write(buf) ⇒ Object
Constructor Details
#initialize(address, handler) ⇒ I2CProxy
Returns a new instance of I2CProxy.
244 245 246 247 248 |
# File 'lib/uchip/mcp2221.rb', line 244 def initialize address, handler @read_address = (address << 1) | 1 @write_address = address << 1 @handler = handler end |
Instance Method Details
#cancel ⇒ Object
250 |
# File 'lib/uchip/mcp2221.rb', line 250 def cancel; @handler.i2c_cancel; end |
#read(size) ⇒ Object
256 257 258 259 |
# File 'lib/uchip/mcp2221.rb', line 256 def read size @handler.i2c_read_start @read_address, 8 @handler.i2c_read end |
#write(buf) ⇒ Object
252 253 254 |
# File 'lib/uchip/mcp2221.rb', line 252 def write buf @handler.i2c_write @write_address, buf end |