SpiBusDriver
public
interface
SpiBusDriver
implements
Closeable
com.google.android.things.userdriver.pio.SpiBusDriver |
SPI user driver. A SpiBusDriver defines an entire SPI bus with multiple possible devices attached to it. Individual SpiDevice objects can be opened and closed on the bus independently.
Summary
Public methods | |
---|---|
default
void
|
close()
Closes the bus. |
abstract
SpiDevice
|
createSpiDevice(String chipSelect)
Creates an SPI device on the bus. |
abstract
String[]
|
getChipSelectNames()
Returns the array of supported chip selects. |
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. |
createSpiDevice
SpiDevice createSpiDevice (String chipSelect)
Creates an SPI device on the bus. This will be called when ownership of a single SPI device is requested. The driver should create and return a new SpiDevice object. The driver manager will internally make sure that no other SPI device is opened at this chip select until the returned device is closed.
Parameters | |
---|---|
chipSelect |
String : the name of the chip select to open the device with. |
Returns | |
---|---|
SpiDevice |
A new SpiDevice connected to the given address. |
Throws | |
---|---|
IOException |
on I/O failure; the SPI slave device will remain unowned. |
getChipSelectNames
String[] getChipSelectNames ()
Returns the array of supported chip selects. Chip select names can be arbitrary strings. The resulting I/O names will be {bus_name}.{cs_name}.
Returns | |
---|---|
String[] |
An array of string names. |
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