public class DigitalInputDevice extends AbstractDigitalInputDevice
Modifier and Type | Field and Description |
---|---|
protected GpioDigitalInputDeviceInterface |
device |
activeHigh
gpio
Constructor and Description |
---|
DigitalInputDevice(GpioDeviceFactoryInterface deviceFactory,
int gpio,
GpioPullUpDown pud,
GpioEventTrigger trigger) |
DigitalInputDevice(int gpio) |
DigitalInputDevice(int gpio,
GpioPullUpDown pud,
GpioEventTrigger trigger) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
GpioPullUpDown |
getPullUpDown()
Get pull up / down configuration.
|
GpioEventTrigger |
getTrigger()
Get event trigger configuration.
|
boolean |
getValue()
Read the current underlying state of the input pin.
|
boolean |
isActive()
Read the current on/off state for this device taking into account the
pull up / down configuration.
|
protected void |
removeListener() |
protected void |
setListener() |
disableDeviceListener, enableDeviceListener, isActiveHigh, valueChanged, whenActivated, whenDeactivated
addListener, removeAllListeners, removeListener
getGpio
protected GpioDigitalInputDeviceInterface device
public DigitalInputDevice(int gpio) throws RuntimeIOException
gpio
- GPIO to which the device is connected.RuntimeIOException
- If an I/O error occurs.public DigitalInputDevice(int gpio, GpioPullUpDown pud, GpioEventTrigger trigger) throws RuntimeIOException
gpio
- GPIO to which the device is connected.pud
- Pull up/down configuration, values: NONE, PULL_UP, PULL_DOWN.trigger
- Event trigger configuration, values: NONE, RISING, FALLING,
BOTH.RuntimeIOException
- If an I/O error occurs.public DigitalInputDevice(GpioDeviceFactoryInterface deviceFactory, int gpio, GpioPullUpDown pud, GpioEventTrigger trigger) throws RuntimeIOException
deviceFactory
- Device factory to use to provision this digital input device.gpio
- GPIO to which the device is connected.pud
- Pull up/down configuration, values: NONE, PULL_UP, PULL_DOWN.trigger
- Event trigger configuration, values: NONE, RISING, FALLING,
BOTH.RuntimeIOException
- If an I/O error occurs.public void close()
public GpioPullUpDown getPullUpDown()
public GpioEventTrigger getTrigger()
public boolean getValue() throws RuntimeIOException
RuntimeIOException
- If an I/O error occurred.public boolean isActive() throws RuntimeIOException
isActive()
will return true
when when the value is
false
.RuntimeIOException
- If an I/O error occurred.protected void setListener()
setListener
in class AbstractDigitalInputDevice
protected void removeListener()
removeListener
in class AbstractDigitalInputDevice
Copyright © 2016–2018 mattjlewis. All rights reserved.