public final class GPIOPortConfig extends java.lang.Object implements DeviceConfig<GPIOPort>
GPIOPortConfig class encapsulates the hardware addressing information, and static and
dynamic configuration parameters of a GPIO port.
Some hardware addressing parameter, and static and dynamic configuration parameters may be set to
DeviceConfig.DEFAULT. Whether such default settings are supported is platform- as well as device
driver-dependent.
An instance of GPIOPortConfig can be passed to the
DeviceManager.open(DeviceConfig) or
DeviceManager.open(Class, DeviceConfig) method to open the designated GPIO port
with the specified configuration. A InvalidDeviceConfigException is thrown when
attempting to open a device with an invalid or unsupported configuration.
Note that the interrupt trigger of a GPIO port is defined by the interrupt trigger(s) configured
for its pins (see GPIOPinConfig.getTrigger).DeviceConfig.HardwareAddressing| Modifier and Type | Field and Description |
|---|---|
static int |
DIR_BOTH_INIT_INPUT
Bidirectional port direction with initial input direction.
|
static int |
DIR_BOTH_INIT_OUTPUT
Bidirectional port direction with initial output direction.
|
static int |
DIR_INPUT_ONLY
Input port direction.
|
static int |
DIR_OUTPUT_ONLY
Output port direction.
|
DEFAULT| Constructor and Description |
|---|
GPIOPortConfig(int direction,
int initValue,
GPIOPinConfig[] pins)
Creates a new
GPIOPortConfig with the specified hardware addressing information and
configuration parameters. |
| Modifier and Type | Method and Description |
|---|---|
int |
getDirection()
Gets the configured port direction.
|
int |
getInitValue()
Gets the configured default/initial value of the port, if configured for output.
|
GPIOPinConfig[] |
getPinConfigs()
Gets the configured configurations of the pins composing the port (in the exact same order
they compose the port).
|
GPIOPin[] |
getPins()
Gets the pins composing the port (in the exact same order they compose the port).
|
public static final int DIR_BOTH_INIT_INPUT
public static final int DIR_BOTH_INIT_OUTPUT
public static final int DIR_INPUT_ONLY
public static final int DIR_OUTPUT_ONLY
public GPIOPortConfig(int direction,
int initValue,
GPIOPinConfig[] pins)
GPIOPortConfig with the specified hardware addressing information and
configuration parameters.
Note that if the access modes (exclusive or shared) supported by the designated
GPIOPins are incompatible with those required by the underlying GPIOPort
device or device driver, attempting to open
the GPIOPort device using this configuration may result in a
InvalidDeviceConfigException to be thrown.direction - the allowed and initial direction of the port, one of: DIR_INPUT_ONLY,
DIR_OUTPUT_ONLY, DIR_BOTH_INIT_INPUT,
DIR_BOTH_INIT_OUTPUT.initValue - the initial value of the port when initially set for output.pins - the pin configurations in the exact same order they compose the port.java.lang.IllegalArgumentException - if any of the following is true:
direction is not one of the defined values;pins.length is 0;java.lang.NullPointerException - if pins is null.public int getDirection()
DIR_INPUT_ONLY, DIR_OUTPUT_ONLY,
DIR_BOTH_INIT_INPUT, DIR_BOTH_INIT_OUTPUT.public int getInitValue()
public GPIOPinConfig[] getPinConfigs()
public GPIOPin[] getPins()
IOException being thrown by port operations.null
if this GPIOPortConfig instance is not associated to an actual GPIOPort instance -
that is the GPIOPortConfig instance was not retrieved from a call to
getDescriptor().getConfiguration() on the GPIOPort instance.Copyright © 2012, 2014, Oracle and/or its affiliates. All rights reserved.
Legal Notices