Package com.diozero.devices
Class Button.Builder
java.lang.Object
com.diozero.devices.Button.Builder
- Enclosing class:
- Button
public static class Button.Builder extends Object
Button builder. Default values:
- pud:
GpioPullUpDown.NONE
- trigger:
GpioEventTrigger.BOTH
- activeHigh: set to false if pud ==
GpioPullUpDown.PULL_UP
, otherwise true (assumes normally open wiring configuration) - deviceFactory:
DeviceFactoryHelper.getNativeDeviceFactory()
PinInfo
instance must be specified. Using a
PinInfo instance allows input devices to be identified by either physical pin
number or GPIO chip and line offset.
The optional activeHigh parameter default value assumes a normally open
wiring configuration, however, this can be overridden for normally closed
configurations as well as scenarios where pud is GpioPullUpDown.NONE
and an external pull up/down resistor is used.-
Method Summary
Modifier and Type Method Description Button
build()
static Button.Builder
builder(int gpio)
Create a new Button builder instancestatic Button.Builder
builder(PinInfo pinInfo)
Create a new DigitalInputDevice builder instanceButton.Builder
setActiveHigh(boolean activeHigh)
Button.Builder
setGpioDeviceFactoryInterface(GpioDeviceFactoryInterface deviceFactory)
Button.Builder
setPullUpDown(GpioPullUpDown pud)
Button.Builder
setTrigger(GpioEventTrigger trigger)
-
Method Details
-
builder
Create a new Button builder instance- Parameters:
gpio
- The GPIO to be used for the new DigitalInputDevice- Returns:
- A new Button builder instance
-
builder
Create a new DigitalInputDevice builder instance- Parameters:
pinInfo
- The pin to be used for the new DigitalInputDevice- Returns:
- A new DigitalInputDevice builder instance
-
setPullUpDown
-
setTrigger
-
setActiveHigh
-
setGpioDeviceFactoryInterface
-
build
-