@Converter public static boolean pinStateToBoolean(PinState state) { return state.isHigh(); }
private void setStateA(Pin pin, PinState state) throws IOException { // determine pin address int pinAddress = pin.getAddress() - GPIO_A_OFFSET; // determine state value for pin bit if (state.isHigh()) { currentStatesA |= pinAddress; } else { currentStatesA &= ~pinAddress; } // update state value device.write(REGISTER_GPIO_A, (byte) currentStatesA); }
private void setStateB(Pin pin, PinState state) throws IOException { // determine pin address int pinAddress = pin.getAddress() - GPIO_B_OFFSET; // determine state value for pin bit if (state.isHigh()) { currentStatesB |= pinAddress; } else { currentStatesB &= ~pinAddress; } // update state value write(REGISTER_GPIO_B, (byte) currentStatesB); }
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { long nano_time = System.nanoTime(); valueChanged(new DigitalInputEvent(gpio, System.currentTimeMillis(), nano_time, event.getState().isHigh())); }
private void setStateB(Pin pin, PinState state) throws IOException { // determine pin address int pinAddress = pin.getAddress() - GPIO_B_OFFSET; // determine state value for pin bit if (state.isHigh()) { currentStatesB |= pinAddress; } else { currentStatesB &= ~pinAddress; } // update state value write(REGISTER_GPIO_B, (byte) currentStatesB); }
private void setStateA(Pin pin, PinState state) throws IOException { // determine pin address int pinAddress = pin.getAddress() - GPIO_A_OFFSET; // determine state value for pin bit if (state.isHigh()) { currentStatesA |= pinAddress; } else { currentStatesA &= ~pinAddress; } // update state value write(REGISTER_GPIO_A, (byte) currentStatesA); }
@Override public void setState(Pin pin, PinState state) { super.setState(pin, state); try { // set state value for pin bit currentStates.set(pin.getAddress(), state.isHigh()); // update state value device.write(currentStates.isEmpty() ? 0 : currentStates.toByteArray()[0]); } catch (IOException ex) { throw new RuntimeException(ex); } }
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display } });
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display } });
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display }
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display }
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display }
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE (EVENT): " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display } }, event_pins);
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display }
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE (EVENT): " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display } }, pins);
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE (EVENT): " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display } };
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display } });
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE (EVENT): " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display } };
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE (EVENT): " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display } }, provisionedPins.toArray(new GpioPinDigitalInput[0]));
@Override public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) { // display pin state on console console.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + ConsoleColor.conditional( event.getState().isHigh(), // conditional expression ConsoleColor.GREEN, // positive conditional color ConsoleColor.RED, // negative conditional color event.getState())); // text to display }