public static void main(String[] args) throws InterruptedException { System.out.println("works"); GpioController gpio = GpioFactory.getInstance(); GpioPinDigitalOutput pin1 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01, "MyLed", PinState.HIGH); pin1.setShutdownOptions(true, PinState.LOW); Thread.sleep(5000); System.out.println("pin low"); pin1.low(); Thread.sleep(5000); System.out.println("pin toggle"); pin1.toggle(); Thread.sleep(5000); System.out.println("pin pulse"); pin1.pulse(1000, true); Thread.sleep(2000); System.out.println("pin blink"); pin1.blink(500, 5000); Thread.sleep(2000); System.out.println("koniec"); gpio.shutdown(); }
public static void main(String args[]) throws InterruptedException { System.out.println("<--Pi4J--> GPIO Listen Example ... started."); // create gpio controller final GpioController gpio = GpioFactory.getInstance(); // provision gpio pin #02 as an input pin with its internal pull down resistor enabled final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN); // create and register gpio pin listener myButton.addListener( new GpioPinListenerDigital() { @Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console System.out.println( " --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + event.getState()); } }); System.out.println( " ... complete the GPIO #02 circuit and see the listener feedback here in the console."); // keep program running until user aborts (CTRL-C) for (; ; ) { Thread.sleep(500); } // stop all GPIO activity/threads by shutting down the GPIO controller // (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks) // gpio.shutdown(); <--- implement this method call if you wish to terminate the Pi4J GPIO // controller }
private void unprovision(Pin pin) { for (GpioPin e : gpioContoller.getProvisionedPins()) { if (e.getPin().equals(pin)) { gpioContoller.unprovisionPin(e); break; } } }
public static void main(String[] args) throws InterruptedException { System.out.println("<--Pi4J--> GPIO Trigger Example ... started."); // create gpio controller final GpioController gpio = GpioFactory.getInstance(); // provision gpio pin #02 as an input pin with its internal pull down resistor enabled final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN); System.out.println(" ... complete the GPIO #02 circuit and see the triggers take effect."); // setup gpio pins #04, #05, #06 as an output pins and make sure they are all LOW at startup GpioPinDigitalOutput myLed[] = { gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, "LED #1", PinState.LOW), gpio.provisionDigitalOutputPin(RaspiPin.GPIO_05, "LED #2", PinState.LOW), gpio.provisionDigitalOutputPin(RaspiPin.GPIO_06, "LED #3", PinState.LOW) }; // create a gpio control trigger on the input pin ; when the input goes HIGH, also set gpio pin // #04 to HIGH myButton.addTrigger(new GpioSetStateTrigger(PinState.HIGH, myLed[0], PinState.HIGH)); // create a gpio control trigger on the input pin ; when the input goes LOW, also set gpio pin // #04 to LOW myButton.addTrigger(new GpioSetStateTrigger(PinState.LOW, myLed[0], PinState.LOW)); // create a gpio synchronization trigger on the input pin; when the input changes, also set gpio // pin #05 to same state myButton.addTrigger(new GpioSyncStateTrigger(myLed[1])); // create a gpio pulse trigger on the input pin; when the input goes HIGH, also pulse gpio pin // #06 to the HIGH state for 1 second myButton.addTrigger(new GpioPulseStateTrigger(PinState.HIGH, myLed[2], 1000)); // create a gpio callback trigger on gpio pin#4; when #4 changes state, perform a callback // invocation on the user defined 'Callable' class instance myButton.addTrigger( new GpioCallbackTrigger( new Callable<Void>() { public Void call() throws Exception { System.out.println(" --> GPIO TRIGGER CALLBACK RECEIVED "); return null; } })); // keep program running until user aborts (CTRL-C) for (; ; ) { Thread.sleep(500); } // stop all GPIO activity/threads by shutting down the GPIO controller // (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks) // gpio.shutdown(); <--- implement this method call if you wish to terminate the Pi4J GPIO // controller }
@RequestMapping("/shutdown.html") public String shutdown() { gpio.shutdown(); leftBackMotor.low(); leftFrontMotor.low(); rightBackMotor.low(); rightFrontMotor.low(); gpio.unprovisionPin(leftBackMotor); gpio.unprovisionPin(rightBackMotor); gpio.unprovisionPin(rightFrontMotor); gpio.unprovisionPin(leftFrontMotor); return "Program was shutdown correctly"; }
// default constructor public PiFaceBase(byte spiAddress, SpiChannel spiChannel) throws IOException { // create Pi-Face GPIO provider gpioProvider = new PiFaceGpioProvider(spiAddress, spiChannel); // provision gpio input pins for the Pi-Face board inputPins = new GpioPinDigitalInput[] { gpio.provisionDigitalInputPin(gpioProvider, PiFacePin.INPUT_00), gpio.provisionDigitalInputPin(gpioProvider, PiFacePin.INPUT_01), gpio.provisionDigitalInputPin(gpioProvider, PiFacePin.INPUT_02), gpio.provisionDigitalInputPin(gpioProvider, PiFacePin.INPUT_03), gpio.provisionDigitalInputPin(gpioProvider, PiFacePin.INPUT_04), gpio.provisionDigitalInputPin(gpioProvider, PiFacePin.INPUT_05), gpio.provisionDigitalInputPin(gpioProvider, PiFacePin.INPUT_06), gpio.provisionDigitalInputPin(gpioProvider, PiFacePin.INPUT_07) }; // provision gpio output pins for the Pi-Face board outputPins = new GpioPinDigitalOutput[] { gpio.provisionDigitalOutputPin(gpioProvider, PiFacePin.OUTPUT_00), gpio.provisionDigitalOutputPin(gpioProvider, PiFacePin.OUTPUT_01), gpio.provisionDigitalOutputPin(gpioProvider, PiFacePin.OUTPUT_02), gpio.provisionDigitalOutputPin(gpioProvider, PiFacePin.OUTPUT_03), gpio.provisionDigitalOutputPin(gpioProvider, PiFacePin.OUTPUT_04), gpio.provisionDigitalOutputPin(gpioProvider, PiFacePin.OUTPUT_05), gpio.provisionDigitalOutputPin(gpioProvider, PiFacePin.OUTPUT_06), gpio.provisionDigitalOutputPin(gpioProvider, PiFacePin.OUTPUT_07) }; // create relay components for the first two output pins on the Pi-Face board relays = new Relay[] {new GpioRelayComponent(outputPins[0]), new GpioRelayComponent(outputPins[1])}; // create switch components for the first four input pins on the Pi-Face board switches = new Switch[] { new GpioSwitchComponent(inputPins[0], PinState.HIGH, PinState.LOW), new GpioSwitchComponent(inputPins[1], PinState.HIGH, PinState.LOW), new GpioSwitchComponent(inputPins[2], PinState.HIGH, PinState.LOW), new GpioSwitchComponent(inputPins[3], PinState.HIGH, PinState.LOW) }; // create LED components for the eight output pins on the Pi-Face board leds = new LED[] { new GpioLEDComponent(outputPins[0]), new GpioLEDComponent(outputPins[1]), new GpioLEDComponent(outputPins[2]), new GpioLEDComponent(outputPins[3]), new GpioLEDComponent(outputPins[4]), new GpioLEDComponent(outputPins[5]), new GpioLEDComponent(outputPins[6]), new GpioLEDComponent(outputPins[7]) }; }
@Override public void setShutdownOptions( Boolean unexport, PinState state, PinPullResistance resistance, PinMode mode, GpioPin... pin) { delegate.setShutdownOptions(unexport, state, resistance, mode, pin); }
@Before public void setup() { // create a mock gpio provider and controller provider = MockGpioFactory.getMockProvider(); gpio = MockGpioFactory.getInstance(); // provision pins for testing inputPin = gpio.provisionDigitalInputPin(MockPin.DIGITAL_INPUT_PIN, "digitalInputPin"); outputPin = gpio.provisionDigitalOutputPin(MockPin.DIGITAL_OUTPUT_PIN, "digitalOutputPin"); // create triggers triggerHigh = new GpioSetStateTrigger(PinState.HIGH, outputPin, PinState.HIGH); triggerLow = new GpioSetStateTrigger(PinState.LOW, outputPin, PinState.LOW); // add triggers to input pin inputPin.addTrigger(triggerHigh); inputPin.addTrigger(triggerLow); }
public static void main(String[] args) { System.out.println("<--Pi4J--> GPIO Frequency Example ... started."); // create gpio controller final GpioController gpio = GpioFactory.getInstance(); // provision gpio pin #01 as an output pin and turn on final GpioPinDigitalOutput pin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01, PinState.LOW); // continuous loop while (true) { pin.setState(true); pin.setState(false); } // stop all GPIO activity/threads by shutting down the GPIO controller // (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks) // gpio.shutdown(); <--- implement this method call if you wish to terminate the Pi4J GPIO // controller }
private GpioPinPwmOutput[] provisionPwmOutputs(final PCA9685GpioProvider gpioProvider) { GpioController gpio = GpioFactory.getInstance(); GpioPinPwmOutput myOutputs[] = { gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_00, "Servo 00"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_01, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_02, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_03, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_04, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_05, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_06, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_07, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_08, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_09, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_10, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_11, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_12, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_13, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_14, "not used"), gpio.provisionPwmOutputPin(gpioProvider, PCA9685Pin.PWM_15, "not used") }; return myOutputs; }
private void provisionPins() { System.out.println(gpio.toString()); dataIn = gpio.provisionDigitalOutputPin( new PinImpl( "RaspberryPi GPIO Provider", pins[0], "Pin1", EnumSet.of(PinMode.DIGITAL_INPUT, PinMode.DIGITAL_OUTPUT), PinPullResistance.all()), "MyLED", PinState.LOW); outputEnable = gpio.provisionDigitalOutputPin( new PinImpl( "RaspberryPi GPIO Provider", pins[1], "Pin4", EnumSet.of(PinMode.DIGITAL_INPUT, PinMode.DIGITAL_OUTPUT), PinPullResistance.all()), "MyLED", PinState.LOW); latch = gpio.provisionDigitalOutputPin( new PinImpl( "RaspberryPi GPIO Provider", pins[2], "Pin5", EnumSet.of(PinMode.DIGITAL_INPUT, PinMode.DIGITAL_OUTPUT), PinPullResistance.all()), "MyLED", PinState.LOW); clear = gpio.provisionDigitalOutputPin( new PinImpl( "RaspberryPi GPIO Provider", pins[3], "Pin3", EnumSet.of(PinMode.DIGITAL_INPUT, PinMode.DIGITAL_OUTPUT), PinPullResistance.all()), "MyLED", PinState.HIGH); clock = gpio.provisionDigitalOutputPin( new PinImpl( "RaspberryPi GPIO Provider", pins[4], "Pin2", EnumSet.of(PinMode.DIGITAL_INPUT, PinMode.DIGITAL_OUTPUT), PinPullResistance.all()), "MyLED", PinState.LOW); }
public LelandPrototype() { fonaClient = this; data = new LevelMaterial[NB_CHANNELS]; for (int i = 0; i < data.length; i++) { data[i] = new LevelMaterial<Float, SevenADCChannelsManager.Material>( 0f, SevenADCChannelsManager.Material.UNKNOWN); } oilThicknessValues = new ArrayList<Double>(windowWidth); final GpioPinDigitalInput resetButton = gpio.provisionDigitalInputPin(RESET_PI, PinPullResistance.PULL_DOWN); resetButton.addListener( new GpioPinListenerDigital() { @Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { if (event.getState().isHigh()) onButtonPressed(); } }); }
@BeforeClass public static void setup() { // create a mock gpio provider and controller provider = MockGpioFactory.getMockProvider(); gpio = MockGpioFactory.getInstance(); // provision pins for testing inputPin = gpio.provisionDigitalInputPin(MockPin.DIGITAL_INPUT_PIN, "digitalInputPin"); // create trigger trigger = new GpioCallbackTrigger( new Callable<Void>() { @Override public Void call() throws Exception { callbackCounter++; return null; } }); // add trigger to input pin inputPin.addTrigger(trigger); }
public static void main(String[] args) throws InterruptedException { System.out.println("<--Pi4J--> GPIO Cylon Example ... started."); // create gpio controller final GpioController gpio = GpioFactory.getInstance(); // provision gpio pin #01 as an output pin and turn on final GpioPinDigitalOutput[] pins = { gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, PinState.LOW), gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01, PinState.LOW), gpio.provisionDigitalOutputPin(RaspiPin.GPIO_02, PinState.LOW), gpio.provisionDigitalOutputPin(RaspiPin.GPIO_03, PinState.LOW), gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, PinState.LOW), gpio.provisionDigitalOutputPin(RaspiPin.GPIO_05, PinState.LOW), gpio.provisionDigitalOutputPin(RaspiPin.GPIO_06, PinState.LOW), gpio.provisionDigitalOutputPin(RaspiPin.GPIO_07, PinState.LOW) }; System.out.println("--> GPIO state should be: ON"); // set shutdown options on all pins gpio.setShutdownOptions(true, PinState.LOW, pins); // infinite loop while (true) { for (int index = 0; index <= 6; index++) { pins[index].pulse(50); Thread.sleep(50); } for (int index = 6; index >= 0; index--) { pins[index].pulse(50); Thread.sleep(50); } } // stop all GPIO activity/threads by shutting down the GPIO controller // (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks) // gpio.shutdown(); <--- implement this method call if you wish to terminate the Pi4J GPIO // controller }
public RCSwitchReceiver(Pin receiverPin) { final GpioController gpio = GpioFactory.getInstance(); this.receiverPin = gpio.provisionDigitalInputPin(receiverPin); this.receiverPin.addListener(new ReceiverListener()); }
/** * [ARGUMENT/OPTION "--pin (#)" | "-p (#)" ] This example program accepts an optional argument for * specifying the GPIO pin (by number) to use with this GPIO listener example. If no argument is * provided, then GPIO #1 will be used. -- EXAMPLE: "--pin 4" or "-p 0". * * <p>[ARGUMENT/OPTION "--pull (up|down|off)" | "-l (up|down|off)" | "--up" | "--down" ] This * example program accepts an optional argument for specifying pin pull resistance. Supported * values: "up|down" (or simply "1|0"). If no value is specified in the command argument, then the * pin pull resistance will be set to PULL_UP by default. -- EXAMPLES: "--pull up", "-pull down", * "--pull off", "--up", "--down", "-pull 0", "--pull 1", "-l up", "-l down". * * @param args * @throws InterruptedException * @throws PlatformAlreadyAssignedException */ public static void main(String[] args) throws InterruptedException, PlatformAlreadyAssignedException { // #################################################################### // // since we are not using the default Raspberry Pi platform, we should // explicitly assign the platform as the BananaPro platform. // // #################################################################### PlatformManager.setPlatform(Platform.BANANAPRO); // create Pi4J console wrapper/helper // (This is a utility class to abstract some of the boilerplate code) final Console console = new Console(); // print program title/header console.title("<-- The Pi4J Project -->", "GPIO Input Example"); // allow for user to exit program using CTRL-C console.promptForExit(); // create gpio controller final GpioController gpio = GpioFactory.getInstance(); // #################################################################### // // When provisioning a pin, use the BananaProPin class. // // #################################################################### // by default we will use gpio pin #01; however, if an argument // has been provided, then lookup the pin by address Pin pin = CommandArgumentParser.getPin( BananaProPin.class, // pin provider class to obtain pin instance from BananaProPin.GPIO_01, // default pin if no pin argument found args); // argument array to search in // by default we will use gpio pin PULL-UP; however, if an argument // has been provided, then use the specified pull resistance PinPullResistance pull = CommandArgumentParser.getPinPullResistance( PinPullResistance.PULL_UP, // default pin pull resistance if no pull argument found args); // argument array to search in // provision gpio pin as an input pin final GpioPinDigitalInput input = gpio.provisionDigitalInputPin(pin, "MyInput", pull); // set shutdown state for this pin: unexport the pin input.setShutdownOptions(true); // prompt user that we are ready console.println("Successfully provisioned [" + pin + "] with PULL resistance = [" + pull + "]"); console.emptyLine(); console.box("The GPIO input pin states will be displayed below."); console.emptyLine(); // display pin state console.emptyLine(); console.println( " [" + input.toString() + "] digital state is: " + ConsoleColor.conditional( input.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color input.getState())); console.emptyLine(); // stop all GPIO activity/threads by shutting down the GPIO controller // (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks) gpio.shutdown(); }
public static void main(String[] args) throws InterruptedException { // START SNIPPET: usage-create-controller-snippet // create gpio controller instance final GpioController gpio = GpioFactory.getInstance(); // END SNIPPET: usage-create-controller-snippet // START SNIPPET: usage-provision-input-pin-snippet // provision gpio pin #02 as an input pin with its internal pull down resistor enabled // (configure pin edge to both rising and falling to get notified for HIGH and LOW state // changes) GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin( RaspiPin.GPIO_02, // PIN NUMBER "MyButton", // PIN FRIENDLY NAME (optional) PinPullResistance.PULL_DOWN); // PIN RESISTANCE (optional) // END SNIPPET: usage-provision-input-pin-snippet // START SNIPPET: usage-provision-output-pin-snippet // provision gpio pins #04 as an output pin and make sure is is set to LOW at startup GpioPinDigitalOutput myLed = gpio.provisionDigitalOutputPin( RaspiPin.GPIO_04, // PIN NUMBER "My LED", // PIN FRIENDLY NAME (optional) PinState.LOW); // PIN STARTUP STATE (optional) // END SNIPPET: usage-provision-output-pin-snippet // START SNIPPET: usage-shutdown-pin-snippet // configure the pin shutdown behavior; these settings will be // automatically applied to the pin when the application is terminated // ensure that the LED is turned OFF when the application is shutdown myLed.setShutdownOptions(true, PinState.LOW, PinPullResistance.OFF); // END SNIPPET: usage-shutdown-pin-snippet // START SNIPPET: usage-control-pin-snippet // explicitly set a state on the pin object myLed.setState(PinState.HIGH); // use convenience wrapper method to set state on the pin object myLed.low(); myLed.high(); // use toggle method to apply inverse state on the pin object myLed.toggle(); // use pulse method to set the pin to the HIGH state for // an explicit length of time in milliseconds myLed.pulse(1000); // END SNIPPET: usage-control-pin-snippet // START SNIPPET: usage-read-pin-snippet // get explicit state enumeration for the GPIO pin associated with the button PinState myButtonState = myButton.getState(); // use convenience wrapper method to interrogate the button state boolean buttonPressed = myButton.isHigh(); // END SNIPPET: usage-read-pin-snippet // START SNIPPET: usage-register-listener-snippet // create and register gpio pin listener myButton.addListener(new GpioUsageExampleListener()); // END SNIPPET: usage-register-listener-snippet // START SNIPPET: usage-trigger-snippet // create a gpio synchronization trigger on the input pin // when the input state changes, also set LED controlling gpio pin to same state myButton.addTrigger(new GpioSyncStateTrigger(myLed)); // END SNIPPET: usage-trigger-snippet // keep program running until user aborts (CTRL-C) while (true) { Thread.sleep(500); } // stop all GPIO activity/threads by shutting down the GPIO controller // (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks) // gpio.shutdown(); <--- implement this method call if you wish to terminate the Pi4J GPIO // controller }
@Override public GpioPin provisionPin( GpioProvider provider, Pin pin, String name, PinMode mode, PinState defaultState) { return delegate.provisionPin(provider, pin, name, mode, defaultState); }
@Override public GpioPin provisionPin(Pin pin, String name, PinMode mode) { return delegate.provisionPin(pin, name, mode); }
@Override public void addListener(GpioPinListener listener, GpioPinInput... pin) { delegate.addListener(listener, pin); }
@Override public double getValue(GpioPinAnalog pin) { return delegate.getValue(pin); }
public GpioPinDigitalOutput getOutputPin(Integer pinNumber) { switch (pinNumber) { case 0: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00); case 1: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01); case 2: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_02); case 3: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_03); case 4: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04); case 5: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_05); case 6: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_06); case 7: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_07); case 8: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_08); case 9: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_09); case 10: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_10); case 11: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_11); case 12: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_12); case 13: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_13); case 14: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_14); case 15: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_15); case 16: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_16); case 17: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_17); case 18: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_18); case 19: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_19); case 20: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_20); case 21: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_21); case 22: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_22); case 23: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_23); case 24: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_24); case 25: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_25); case 26: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_26); case 27: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_27); case 28: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_28); case 29: return gpio.provisionDigitalOutputPin(RaspiPin.GPIO_29); default: return null; } }
@Override public void removeTrigger(GpioTrigger[] triggers, GpioPinInput... pin) { delegate.removeTrigger(triggers, pin); }
@Override public void addTrigger(GpioTrigger trigger, GpioPinInput... pin) { delegate.addTrigger(trigger, pin); }
@Override public void removeAllListeners() { delegate.removeAllListeners(); }
@Override public void removeListener(GpioPinListener[] listeners, GpioPinInput... pin) { delegate.removeListener(listeners, pin); }
public GpioPinDigitalInput getInputPin(Integer pinNumber, PinPullResistance ppr) { switch (pinNumber) { case 0: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_00, ppr); case 1: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_01, ppr); case 2: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, ppr); case 3: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_03, ppr); case 4: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_04, ppr); case 5: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_05, ppr); case 6: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_06, ppr); case 7: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_07, ppr); case 8: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_08, ppr); case 9: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_09, ppr); case 10: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_10, ppr); case 11: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_11, ppr); case 12: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_12, ppr); case 13: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_13, ppr); case 14: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_14, ppr); case 15: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_15, ppr); case 16: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_16, ppr); case 17: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_17, ppr); case 18: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_18, ppr); case 19: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_19, ppr); case 20: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_20, ppr); case 21: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_21, ppr); case 22: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_22, ppr); case 23: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_23, ppr); case 24: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_24, ppr); case 25: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_25, ppr); case 26: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_26, ppr); case 27: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_27, ppr); case 28: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_28, ppr); case 29: return gpio.provisionDigitalInputPin(RaspiPin.GPIO_29, ppr); default: return null; } }
@Override public Collection<GpioPin> getProvisionedPins() { return delegate.getProvisionedPins(); }
@Override public void removeAllTriggers() { delegate.removeAllTriggers(); }
@Override public GpioPin provisionPin(GpioProvider provider, Pin pin, PinMode mode) { return delegate.provisionPin(provider, pin, mode); }