public class DigitalInputOutputDevice extends AbstractDigitalInputDevice
activeHigh
gpio
Constructor and Description |
---|
DigitalInputOutputDevice(GpioDeviceFactoryInterface deviceFactory,
int gpio,
DeviceMode mode) |
DigitalInputOutputDevice(int gpio,
DeviceMode mode) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
DeviceMode |
getMode()
Get the input / output mode
|
boolean |
getValue()
Read the current underlying state of the input pin.
|
protected void |
removeListener() |
protected void |
setListener() |
void |
setMode(DeviceMode mode)
Set the input / output mode
|
void |
setValue(boolean value)
Set the output value (if mode.
|
disableDeviceListener, enableDeviceListener, isActiveHigh, valueChanged, whenActivated, whenDeactivated
addListener, removeAllListeners, removeListener
getGpio
public DigitalInputOutputDevice(int gpio, DeviceMode mode) throws RuntimeIOException
gpio
- GPIO to which the device is connected.mode
- Input or output Mode
RuntimeIOException
- If an I/O error occurs.public DigitalInputOutputDevice(GpioDeviceFactoryInterface deviceFactory, int gpio, DeviceMode mode) throws RuntimeIOException
deviceFactory
- Device factory to use to provision this digital input device.gpio
- GPIO to which the device is connected.mode
- Input or output Mode
RuntimeIOException
- If an I/O error occurs.public void close() throws RuntimeIOException
RuntimeIOException
public DeviceMode getMode()
public void setMode(DeviceMode mode)
mode
- new mode, valid values are DIGITAL_INPUT
and DIGITAL_OUTPUT
public boolean getValue() throws RuntimeIOException
RuntimeIOException
- If an I/O error occurred.public void setValue(boolean value) throws RuntimeIOException
value
- The new valueRuntimeIOException
- If an I/O error occursprotected void setListener()
setListener
in class AbstractDigitalInputDevice
protected void removeListener()
removeListener
in class AbstractDigitalInputDevice
Copyright © 2016–2018 mattjlewis. All rights reserved.