@Override public void setState(Pin pin, PinState state) { super.setState(pin, state); LOG.info("State {} {}", pin, state); }
@Override public void export(Pin pin, PinMode mode, PinState defaultState) { // export the pin and set it's mode export(pin, mode); // apply default state if one was provided and only if this pin is a digital output if(defaultState != null && mode == PinMode.DIGITAL_OUTPUT) { setState(pin, defaultState); } }
@Override public void export(Pin pin, PinMode mode, PinState defaultState) { // export the pin and set it's mode export(pin, mode); // apply default state if one was provided and only if this pin is a digital output if(defaultState != null && mode == PinMode.DIGITAL_OUTPUT) { setState(pin, defaultState); } }
@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 setState(Pin pin, PinState state) { super.setState(pin, state); try { // determine A or B port based on pin address if (pin.getAddress() < GPIO_B_OFFSET) { setStateA(pin, state); } else { setStateB(pin, state); } } catch (IOException ex) { throw new RuntimeException(ex); } }
@Override public void setState(Pin pin, PinState state) { super.setState(pin, state); try { // determine A or B port based on pin address if (pin.getAddress() < GPIO_B_OFFSET) { setStateA(pin, state); } else { setStateB(pin, state); } } catch (IOException ex) { throw new RuntimeException(ex); } }
@Override public void setState(Pin pin, PinState state) { super.setState(pin, state); try { // determine A or B port based on pin address if (pin.getAddress() < GPIO_B_OFFSET) { setStateA(pin, state); } else { setStateB(pin, state); } } catch (IOException ex) { throw new RuntimeException(ex); } }
@Override public void setState(Pin pin, PinState state) { super.setState(pin, state); try { // determine pin address int pinAddress = pin.getAddress(); // determine state value for pin bit if (state.isHigh()) { currentStates |= pinAddress; } else { currentStates &= ~pinAddress; } // update state value device.write(REGISTER_GPIO, (byte) currentStates); } catch (IOException ex) { throw new RuntimeException(ex); } }
@Override public void setState(Pin pin, PinState state) { super.setState(pin, state); // turn ON/OFF relay pins if (state == PinState.HIGH) { queue.put("+" + pin.getAddress()); } else { queue.put("-" + pin.getAddress()); } }