public class InPort extends Object
InPort
class supports the access and configuration of a port of output pins of the general purpose IO driver (GPIO).
The usage of all GPIO ports is restricted to the same interface where the GPIO driver was opened.
The parallel access of the GPIO driver by Java and another interface (i.e. AT commnad interface) is not supported.
When the module starts up, all GPIO pins are set to high-impedance state after initializing.
Therefore, it is recommended to connect pull-up or pull-down resistors to all GPIO pins you want to use as output.
This is necessary to keep these pins from floating or driving any external devices before all settings are done by the output port
constructor and after release the output port again.Constructor and Description |
---|
InPort(Vector<String> pins)
Creates a new instance of a GPIO port of input pins.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(InPortListener listener)
Registers listeners to receive value changes at an input port.
|
void |
clearListener()
Removes all listener objects which have been previously added to this input port.
|
Vector<String> |
getPins()
Gets the given pin configuration of an instance of a GPIO port of output
pins.
|
int |
getValue()
Gets the current value of an instance of a GPIO port of input pins.
|
void |
release()
Releases an instance of a GPIO port of input pins.
|
void |
removeListener(InPortListener listener)
Removes a listener object which has been previously added from the internal list table of listener objects.
|
void |
startPolling()
Starts polling of a GPIO port of input pins.
|
void |
stopPolling()
Stops polling of a GPIO port of input pins.
|
public InPort(Vector<String> pins) throws IOException
pins
- pin configuration of port. First pin in vector is the LSB.IOException
- on failure.public void release() throws IOException
IOException
- on failure.public void startPolling() throws IOException
IOException
- on failure.public void stopPolling() throws IOException
IOException
- on failure.public int getValue() throws IOException
IOException
- on failure.public Vector<String> getPins()
public void addListener(InPortListener listener)
listener
- The InPortListener object to be registered.public void removeListener(InPortListener listener)
listener
- The InPortListener object to be removed from the list.public void clearListener()