Package com.diozero.api
Class DigitalInputDevice.Builder
- java.lang.Object
-
- com.diozero.api.DigitalInputDevice.Builder
-
- Enclosing class:
- DigitalInputDevice
public static class DigitalInputDevice.Builder extends Object
Digital input device 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 isGpioPullUpDown.NONE
and an external pull up/down resistor is used.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DigitalInputDevice
build()
static DigitalInputDevice.Builder
builder(int gpio)
Create a new DigitalInputDevice builder instancestatic DigitalInputDevice.Builder
builder(PinInfo pinInfo)
Create a new DigitalInputDevice builder instanceDigitalInputDevice.Builder
setActiveHigh(boolean activeHigh)
DigitalInputDevice.Builder
setDeviceFactory(GpioDeviceFactoryInterface deviceFactory)
DigitalInputDevice.Builder
setPullUpDown(GpioPullUpDown pud)
DigitalInputDevice.Builder
setTrigger(GpioEventTrigger trigger)
-
-
-
Constructor Detail
-
Builder
public Builder(int gpio)
-
Builder
public Builder(PinInfo pinInfo)
-
-
Method Detail
-
builder
public static DigitalInputDevice.Builder builder(int gpio)
Create a new DigitalInputDevice builder instance- Parameters:
gpio
- The GPIO to be used for the new DigitalInputDevice- Returns:
- A new DigitalInputDevice builder instance
-
builder
public static DigitalInputDevice.Builder builder(PinInfo pinInfo)
Create a new DigitalInputDevice builder instance- Parameters:
pinInfo
- The pin to be used for the new DigitalInputDevice- Returns:
- A new DigitalInputDevice builder instance
-
setPullUpDown
public DigitalInputDevice.Builder setPullUpDown(GpioPullUpDown pud)
-
setTrigger
public DigitalInputDevice.Builder setTrigger(GpioEventTrigger trigger)
-
setActiveHigh
public DigitalInputDevice.Builder setActiveHigh(boolean activeHigh)
-
setDeviceFactory
public DigitalInputDevice.Builder setDeviceFactory(GpioDeviceFactoryInterface deviceFactory)
-
build
public DigitalInputDevice build() throws RuntimeIOException, NoSuchDeviceException
-
-