Stay organized with collections
Save and categorize content based on your preferences.
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
Inherited methods |
From
interface
java.io.Closeable
abstract
void
|
close()
Closes this stream and releases any system resources associated
with it.
|
|
From
interface
java.lang.AutoCloseable
abstract
void
|
close()
Closes this resource, relinquishing any underlying resources.
|
|
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.
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# SpiBusDriver\n\nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \\| [\\[Expand All\\]](#) \n\nSpiBusDriver\n============\n\n\n`\npublic\n\n\ninterface\nSpiBusDriver\n`\n\n\n`\n\n\nimplements\n\n`[Closeable](/reference/java/io/Closeable)`\n\n\n`\n\n|-------------------------------------------------------|\n| com.google.android.things.userdriver.pio.SpiBusDriver |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nSPI user driver.\n\nA SpiBusDriver defines an entire SPI bus with multiple possible devices attached to it.\nIndividual SpiDevice objects can be opened and closed on the bus independently.\n\nSummary\n-------\n\n| ### Public methods ||\n|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` default void` | ` `[close](/reference/com/google/android/things/userdriver/pio/SpiBusDriver#close())`() ` Closes the bus. |\n| ` abstract `[SpiDevice](/reference/com/google/android/things/pio/SpiDevice) | ` `[createSpiDevice](/reference/com/google/android/things/userdriver/pio/SpiBusDriver#createSpiDevice(java.lang.String))`(`[String](/reference/java/lang/String)` chipSelect) ` Creates an SPI device on the bus. |\n| ` abstract `[String[]](/reference/java/lang/String) | ` `[getChipSelectNames](/reference/com/google/android/things/userdriver/pio/SpiBusDriver#getChipSelectNames())`() ` Returns the array of supported chip selects. |\n| ` default void` | ` `[open](/reference/com/google/android/things/userdriver/pio/SpiBusDriver#open())`() ` Opens the bus. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[java.io.Closeable](/reference/java/io/Closeable)` ` |------------------|--------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[close](/reference/java/io/Closeable#close())`() ` Closes this stream and releases any system resources associated with it. | ||\n| From interface ` `[java.lang.AutoCloseable](/reference/java/lang/AutoCloseable)` ` |------------------|---------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[close](/reference/java/lang/AutoCloseable#close())`() ` Closes this resource, relinquishing any underlying resources. | ||\n\nPublic methods\n--------------\n\n### close\n\n```\nvoid close ()\n```\n\nCloses the bus.\n\nThis will be called just after the last device is closed by its owner. Any resources\nthat need to be cleaned up can be done so here.\n\nThis method may throw IOException to indicate I/O failure, but the bus will still be\nconsidered closed and may attempt to be re-opened in the future.\n\n\u003cbr /\u003e\n\n| Throws ||\n|-----------------------------------------------|----------------------------------------------------------|\n| [IOException](/reference/java/io/IOException) | on I/O failure; the bus will still be considered closed. |\n\n### createSpiDevice\n\n```\nSpiDevice createSpiDevice (String chipSelect)\n```\n\nCreates an SPI device on the bus.\n\nThis will be called when ownership of a single SPI device is requested. The driver should\ncreate and return a new SpiDevice object.\n\nThe driver manager will internally make sure that no other SPI device is opened at this\nchip select until the returned device is closed.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------------|-----------------------------------------------------------------------|\n| `chipSelect` | `String`: the name of the chip select to open the device with. \u003cbr /\u003e |\n\n| Returns ||\n|-----------------------------------------------------------------|--------------------------------------------------------|\n| [SpiDevice](/reference/com/google/android/things/pio/SpiDevice) | A new SpiDevice connected to the given address. \u003cbr /\u003e |\n\n| Throws ||\n|-----------------------------------------------|-----------------------------------------------------------|\n| [IOException](/reference/java/io/IOException) | on I/O failure; the SPI slave device will remain unowned. |\n\n### getChipSelectNames\n\n```\nString[] getChipSelectNames ()\n```\n\nReturns the array of supported chip selects.\n\nChip select names can be arbitrary strings. The resulting I/O names will be\n{bus_name}.{cs_name}.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------------------------------------|----------------------------------|\n| [String[]](/reference/java/lang/String) | An array of string names. \u003cbr /\u003e |\n\n### open\n\n```\nvoid open ()\n```\n\nOpens the bus.\n\nThis will be called just before the first device is requested on this bus. The driver\nmay do any initialization needed to configure the bus for use here.\n\n\u003cbr /\u003e\n\n| Throws ||\n|-----------------------------------------------|---------------------------------------------|\n| [IOException](/reference/java/io/IOException) | on I/O failure; the bus will remain closed. |\n\n-\n\n Interfaces\n ----------\n\n - [GpioDriver](/reference/com/google/android/things/userdriver/pio/GpioDriver)\n - [I2cBusDriver](/reference/com/google/android/things/userdriver/pio/I2cBusDriver)\n - [PwmDriver](/reference/com/google/android/things/userdriver/pio/PwmDriver)\n - [SpiBusDriver](/reference/com/google/android/things/userdriver/pio/SpiBusDriver)\n - [UartDeviceDriver](/reference/com/google/android/things/userdriver/pio/UartDeviceDriver)\n-\n\n Classes\n -------\n\n - [PioDriverManager](/reference/com/google/android/things/userdriver/pio/PioDriverManager)"]]