Skip to content

Most visited

Recently visited

navigation

PioDriverManager

PioDriverManager

public class PioDriverManager
extends Object

java.lang.Object
   ↳ com.google.android.things.pio.PioDriverManager


Manager for PIO userspace drivers. Registered drivers are individually synchronized to guarantee that no calls will be made before open() or after close(), and no calls will be made concurrently on the same driver. Driver registration and unregistration is also thread-safe and may be done while a driver is in use. If a driver is unregistered while in use, subsequent calls will raise an exception.

Summary

Public constructors

PioDriverManager()

Public methods

void registerGpioDriver(String name, GpioDriver driver)

Registers a new GPIO driver with the PIO manager.

void registerI2cBusDriver(String name, I2cBusDriver driver)

Registers a new I2C driver with the PIO manager.

void registerPwmDriver(String name, PwmDriver driver)

Registers a new PWM driver with the PIO manager.

void registerSpiBusDriver(String busName, SpiBusDriver driver)

Registers a new SPI driver with the PIO manager.

void registerUartDeviceDriver(String name, UartDeviceDriver driver)

Registers a new UART driver with the PIO manager.

void unregisterGpioDriver(String name)

Unregisters an existing GPIO driver from the PIO manager.

void unregisterI2cBusDriver(String name)

Unregisters an existing I2C driver from the PIO manager.

void unregisterPwmDriver(String name)

Unregisters an existing PWM driver from the PIO manager.

void unregisterSpiBusDriver(String busName)

Unregisters an existing SPI driver from the PIO manager.

void unregisterUartDeviceDriver(String name)

Unregisters an existing UART driver from the PIO manager.

Inherited methods

From class java.lang.Object

Public constructors

PioDriverManager

PioDriverManager ()

Throws
IllegalStateException Failed to connect to the PIO service.

Public methods

registerGpioDriver

void registerGpioDriver (String name, 
                GpioDriver driver)

Registers a new GPIO driver with the PIO manager.

Parameters
name String: GPIO name.
driver GpioDriver: GPIO driver.
Throws
IOException failed to register the driver.

registerI2cBusDriver

void registerI2cBusDriver (String name, 
                I2cBusDriver driver)

Registers a new I2C driver with the PIO manager.

Parameters
name String: I2C bus name.
driver I2cBusDriver: I2cBusDriver driver.
Throws
IOException failed to register the driver.

registerPwmDriver

void registerPwmDriver (String name, 
                PwmDriver driver)

Registers a new PWM driver with the PIO manager.

Parameters
name String: PWM name.
driver PwmDriver: PWM driver.
Throws
IOException failed to register the driver.

registerSpiBusDriver

void registerSpiBusDriver (String busName, 
                SpiBusDriver driver)

Registers a new SPI driver with the PIO manager. The SPI bus name may match an existing SPI bus in order to add more chip selects, but a single PioDriverManager cannot register multiple drivers with the same bus name.

Parameters
busName String: SPI bus name.
driver SpiBusDriver: SpiBusDriver driver.
Throws
IOException failed to register the driver.

registerUartDeviceDriver

void registerUartDeviceDriver (String name, 
                UartDeviceDriver driver)

Registers a new UART driver with the PIO manager.

Parameters
name String: UART name.
driver UartDeviceDriver: UART driver.
Throws
IOException failed to register the driver.

unregisterGpioDriver

void unregisterGpioDriver (String name)

Unregisters an existing GPIO driver from the PIO manager. If the named driver is open it will be closed and any subsequent usage by the owner will throw IOException. If the named driver doesn't exist this method has no effect.

Parameters
name String: GPIO name.
Throws
IOException error while closing the driver; driver will still be unregistered.

unregisterI2cBusDriver

void unregisterI2cBusDriver (String name)

Unregisters an existing I2C driver from the PIO manager. If the named driver is open it will be closed and any subsequent usage by the owner will throw IOException. If the named driver doesn't exist this method has no effect.

Parameters
name String: I2C bus name.
Throws
IOException error while closing the driver; driver will still be unregistered.

unregisterPwmDriver

void unregisterPwmDriver (String name)

Unregisters an existing PWM driver from the PIO manager. If the named driver is open it will be closed and any subsequent usage by the owner will throw IOException. If the named driver doesn't exist this method has no effect.

Parameters
name String: PWM name.
Throws
IOException error while closing the driver; driver will still be unregistered.

unregisterSpiBusDriver

void unregisterSpiBusDriver (String busName)

Unregisters an existing SPI driver from the PIO manager. If any devices on the named driver are open they will be closed and any subsequent usage by the owner will throw IOException. If the named driver doesn't exist this method has no effect.

Parameters
busName String: SPI bus name.
Throws
IOException error while closing the driver; driver will still be unregistered.

unregisterUartDeviceDriver

void unregisterUartDeviceDriver (String name)

Unregisters an existing UART driver from the PIO manager. If the named driver is open it will be closed and any subsequent usage by the owner will throw IOException. If the named driver doesn't exist this method has no effect.

Parameters
name String: UART name.
Throws
IOException error while closing the driver; driver will still be unregistered.
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)