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 is GpioPullUpDown.NONE
and an external pull up/down resistor is used.-
Constructor Summary
-
Method Summary
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
setGpioDeviceFactoryInterface(GpioDeviceFactoryInterface deviceFactory)
DigitalInputDevice.Builder
setPullUpDown(GpioPullUpDown pud)
DigitalInputDevice.Builder
setTrigger(GpioEventTrigger trigger)
-
Constructor Details
-
Builder
public Builder(int gpio) -
Builder
-
-
Method Details
-
builder
Create a new DigitalInputDevice builder instance- Parameters:
gpio
- The GPIO to be used for the new DigitalInputDevice- Returns:
- A new DigitalInputDevice 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
public DigitalInputDevice.Builder setGpioDeviceFactoryInterface(GpioDeviceFactoryInterface deviceFactory) -
build
-