PeripheralManagerService
public
class
PeripheralManagerService
extends Object
java.lang.Object | |
↳ | com.google.android.things.pio.PeripheralManagerService |
Lists and opens peripherals.
Summary
Public constructors | |
---|---|
PeripheralManagerService()
Create a PeripheralManagerService object. |
Public methods | |
---|---|
List<String>
|
getGpioList()
Get the list of GPIO pins available. |
List<String>
|
getI2cBusList()
Get the list of I2C buses available. |
List<String>
|
getI2sDeviceList()
Get the list of I2s devices available. |
List<String>
|
getPwmList()
Get the list of PWM pins available. |
List<String>
|
getSpiBusList()
Get the list of SPI buses available. |
List<String>
|
getUartDeviceList()
Get the list of UART devices available. |
Gpio
|
openGpio(String name)
Open a GPIO pin. |
I2cDevice
|
openI2cDevice(String name, int address)
Open an I2C device. |
I2sDevice
|
openI2sDevice(String name)
Open an I2s device. |
Pwm
|
openPwm(String name)
Open a PWM pin. |
SpiDevice
|
openSpiDevice(String name)
Open a SPI device. |
UartDevice
|
openUartDevice(String name)
Open an UART device. |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
Public constructors
PeripheralManagerService
</div>
PeripheralManagerService ()
Create a PeripheralManagerService object.
</div>
Public methods
getGpioList
</div>
List<String> getGpioList ()
Get the list of GPIO pins available.
Refer to your board's documentation for the name to physical pin mapping. Not all the GPIO pins in the list will be free. Some may already be in use. </p>
Returns | |
---|---|
List<String> |
</div>
getI2cBusList
</div>
List<String> getI2cBusList ()
Get the list of I2C buses available.
Returns | |
---|---|
List<String> |
</div>
getI2sDeviceList
</div>
List<String> getI2sDeviceList ()
Get the list of I2s devices available.
Returns | |
---|---|
List<String> |
</div>
getPwmList
</div>
List<String> getPwmList ()
Get the list of PWM pins available.
Refer to your board's documentation for the name to physical pin mapping. Not all the PWM pins in the list will be free. Some may already be in use. </p>
Returns | |
---|---|
List<String> |
</div>
getSpiBusList
</div>
List<String> getSpiBusList ()
Get the list of SPI buses available.
Not all the SPI buses in the list will be free. Some may already be in use. </p>
Returns | |
---|---|
List<String> |
</div>
getUartDeviceList
</div>
List<String> getUartDeviceList ()
Get the list of UART devices available.
Returns | |
---|---|
List<String> |
</div>
openGpio
</div>
Gpio openGpio (String name)
Open a GPIO pin.
A GPIO pin can only be opened once at any given time on the system. To close and release the
GPIO pin, you need to call close()
explicitly.</p>
Parameters | |
---|---|
name |
String :
Name of the GPIO pin as returned by getGpioList() . |
Returns | |
---|---|
Gpio |
The GPIO object. |
Throws | |
---|---|
IOException |
Failed to open the named GPIO. |
</div>
openI2cDevice
</div>
I2cDevice openI2cDevice (String name, int address)
Open an I2C device.
An I2C device can only be opened once at any given time on the system. To close and release
the I2C device, you need to call close()
explicitly.</p>
Parameters | |
---|---|
name |
String :
Name of the I2C bus as returned by getI2cBusList() . |
address |
int :
Address of the device as described on the device datasheet. |
Returns | |
---|---|
I2cDevice |
The I2cDevice object. |
Throws | |
---|---|
IOException |
Failed to open the named I2C device. |
</div>
openI2sDevice
</div>
I2sDevice openI2sDevice (String name)
Open an I2s device.
An I2s device can only be opened once at any given time on the system. To close and release
the I2s device, you need to call close()
explicitly.</p>
Parameters | |
---|---|
name |
String :
Name of the I2s bus as returned by getI2sDeviceList() . |
Returns | |
---|---|
I2sDevice |
The I2sDevice object. |
Throws | |
---|---|
IOException |
Failed to open the named I2s bus. |
</div>
openPwm
</div>
Pwm openPwm (String name)
Open a PWM pin.
A PWM pin can only be opened once at any given time on the system. To close and release the
PWM pin, you need to call close()
explicitly.</p>
Parameters | |
---|---|
name |
String :
Name of the PWM pin as returned by getPwmList() . |
Returns | |
---|---|
Pwm |
The PWM object. |
Throws | |
---|---|
IOException |
Failed to open the named PWM. |
</div>
openSpiDevice
</div>
SpiDevice openSpiDevice (String name)
Open a SPI device.
A SPI device can only be opened once at any given time on the system. To close and release
the SPI device, you need to call close()
explicitly.</p>
Parameters | |
---|---|
name |
String :
Name of the SPI device as returned by getSpiBusList() . |
Returns | |
---|---|
SpiDevice |
The SpiDevice object. |
Throws | |
---|---|
IOException |
Failed to open the named SPI device. |
</div>
openUartDevice
</div>
UartDevice openUartDevice (String name)
Open an UART device.
An UART device can only be opened once at any given time on the system. To close and release
the UART device, you need to call close()
explicitly.</p>
Parameters | |
---|---|
name |
String :
Name of the UART bus as returned by getUartDeviceList() . |
Returns | |
---|---|
UartDevice |
The UartDevice object. |
Throws | |
---|---|
IOException |
Failed to open the named UART. |
</div>
</div>