Package com.diozero.devices.sandpit
Class DebouncedDigitalInputDevice
java.lang.Object
com.diozero.api.GpioDevice
com.diozero.api.GpioInputDevice<DigitalInputEvent>
com.diozero.api.AbstractDigitalInputDevice
com.diozero.api.DigitalInputDevice
com.diozero.api.WaitableDigitalInputDevice
com.diozero.devices.sandpit.DebouncedDigitalInputDevice
- All Implemented Interfaces:
DeviceInterface
,DigitalInputDeviceInterface
,DeviceEventConsumer<DigitalInputEvent>
,AutoCloseable
,Consumer<DigitalInputEvent>
public class DebouncedDigitalInputDevice extends WaitableDigitalInputDevice
Represents a generic input device with typical on/off behaviour.
This class extends 'WaitableInputDevice' with machinery to fire the active
and inactive events for devices that operate in a typical digital manner:
straight forward on / off states with (reasonably) clean transitions between
the two.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.diozero.api.DigitalInputDevice
DigitalInputDevice.Builder
-
Field Summary
Fields inherited from class com.diozero.api.DigitalInputDevice
device
Fields inherited from class com.diozero.api.AbstractDigitalInputDevice
activeHigh
Fields inherited from class com.diozero.api.GpioDevice
pinInfo
-
Constructor Summary
Constructors Constructor Description DebouncedDigitalInputDevice(int gpio)
DebouncedDigitalInputDevice(int gpio, GpioPullUpDown pud, float debounceTime)
DebouncedDigitalInputDevice(int gpio, GpioPullUpDown pud, float debounceTime, GpioEventTrigger trigger)
-
Method Summary
Modifier and Type Method Description void
setDebounceTime(float debounceTime)
Methods inherited from class com.diozero.api.WaitableDigitalInputDevice
accept, disableDeviceListener, waitForActive, waitForActive, waitForInactive, waitForInactive, waitForValue
Methods inherited from class com.diozero.api.DigitalInputDevice
builder, builder, close, getPullUpDown, getTrigger, getValue, isActive, removeListener, setListener
Methods inherited from class com.diozero.api.AbstractDigitalInputDevice
enableDeviceListener, isActiveHigh, whenActivated, whenDeactivated
Methods inherited from class com.diozero.api.GpioInputDevice
addListener, removeAllListeners, removeListener
Methods inherited from class com.diozero.api.GpioDevice
getGpio
-
Constructor Details
-
DebouncedDigitalInputDevice
- Throws:
RuntimeIOException
-
DebouncedDigitalInputDevice
public DebouncedDigitalInputDevice(int gpio, GpioPullUpDown pud, float debounceTime) throws RuntimeIOException- Parameters:
gpio
- GPIOpud
- Pull-up/down configuratoindebounceTime
- Specifies the length of time (in seconds) that the component will ignore changes in state after an initial change. This defaults to 0 which indicates that no bounce compensation will be performed.- Throws:
RuntimeIOException
- if an I/O error occurs
-
DebouncedDigitalInputDevice
public DebouncedDigitalInputDevice(int gpio, GpioPullUpDown pud, float debounceTime, GpioEventTrigger trigger) throws RuntimeIOException- Throws:
RuntimeIOException
-
-
Method Details
-
setDebounceTime
public void setDebounceTime(float debounceTime)
-