I2cBusDriver
public
interface
I2cBusDriver
implements
Closeable
com.google.android.things.userdriver.pio.I2cBusDriver |
I2C user driver. An I2cBusDriver defines an entire I2C bus with multiple possible devices attached to it. Individual I2cDevice objects can be opened and closed on the bus independently.
Summary
Public methods | |
---|---|
default
void
|
close()
Closes the bus. |
abstract
I2cDevice
|
createI2cDevice(int address)
Creates an I2C device on the bus. |
default
void
|
open()
Opens the bus. |
Inherited methods | |
---|---|
From
interface
java.io.Closeable
| |
From
interface
java.lang.AutoCloseable
|
Public methods
close
void close ()
Closes the bus. This will be called just after the last device is closed by its owner. Any resources that need to be cleaned up can be done so here. This method may throw IOException to indicate I/O failure, but the bus will still be considered closed and may attempt to be re-opened in the future.
Throws | |
---|---|
IOException |
on I/O failure; the bus will still be considered closed. |
createI2cDevice
I2cDevice createI2cDevice (int address)
Creates an I2C device on the bus. This will be called when ownership of a single I2C device is requested. The driver should create and return a new I2cDevice object. The driver manager will internally make sure that no other I2C device is opened at this address until the returned device is closed.
Parameters | |
---|---|
address |
int : The I2C device address to open. |
Returns | |
---|---|
I2cDevice |
A new I2cDevice connected to the given address. |
Throws | |
---|---|
IOException |
on I/O failure; the I2C slave device will remain unowned. |
open
void open ()
Opens the bus. This will be called just before the first device is requested on this bus. The driver may do any initialization needed to configure the bus for use here.
Throws | |
---|---|
IOException |
on I/O failure; the bus will remain closed. |
Interfaces
Classes