public class DigitalInputOutputDevice extends GpioDevice implements DigitalInputDeviceInterface
Modifier and Type | Field and Description |
---|---|
protected GpioDigitalInputOutputDeviceInterface |
device |
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.
|
void |
setMode(DeviceMode mode)
Set the input / output mode
|
void |
setValue(boolean value)
Set the output value (if mode.
|
getGpio
protected GpioDigitalInputOutputDeviceInterface device
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
close
in interface DigitalInputDeviceInterface
close
in interface Closeable
close
in interface AutoCloseable
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
getValue
in interface DigitalInputDeviceInterface
RuntimeIOException
- If an I/O error occurred.public void setValue(boolean value) throws RuntimeIOException
value
- The new valueRuntimeIOException
- If an I/O error occursCopyright © 2016–2017 mattjlewis. All rights reserved.