public final class GPIOPortConfig extends java.lang.Object implements PeripheralConfig
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 PeripheralConfig.DEFAULT.
Whether such default settings are supported is platform- as well as peripheral driver-dependent.
An instance of GPIOPortConfig can be passed to the PeripheralManager.open(PeripheralConfig) or
PeripheralManager.open(Class, PeripheralConfig) method to open the designated GPIO port with the specified
configuration. A PeripheralConfigInvalidException is thrown when attempting to open a peripheral 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()).| 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[] |
getPins()
Gets the configured 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.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[] getPins()
Copyright (c) 1990, 2013, Oracle and/or its affiliates. All rights reserved.