@Override public void export(Pin pin, PinMode mode, PinState defaultState) { super.export(pin, mode); //System.out.println("-- EXPORTING PIN [" + pin.getAddress() + "] to mode [" + mode.getName() + "]"); // get mode configured direction value int direction = mode.getDirection().getValue(); // if a default state was provided and the direction is OUT, then override the // pin direction to include initial state value if(defaultState != null && mode.getDirection() == PinDirection.OUT){ if(defaultState == PinState.LOW) direction = GpioUtil.DIRECTION_LOW; else if(defaultState == PinState.HIGH) direction = GpioUtil.DIRECTION_HIGH; } // if not already exported, export the pin and set the pin direction if(!GpioUtil.isExported(pin.getAddress())){ GpioUtil.export(pin.getAddress(), direction); } // if the pin is already exported, then check its current configured direction // if the direction does not match, then set the new direction for the pin else if(GpioUtil.getDirection(pin.getAddress()) != mode.getDirection().getValue()){ GpioUtil.setDirection(pin.getAddress(), direction); } // set the pin input/output mode setMode(pin, mode); }
"\",\"provider\":\"" + pin.getPin().getProvider() + "\",\"mode\":\"" + pin.getMode().getName() + "\",\"direction\":\"" + pin.getMode().getDirection() + "\",\"pull\":\"" + pin.getPullResistance().getName() + "\"},\"state\":{" +
@Override public void export(Pin pin, PinMode mode, PinState defaultState) { super.export(pin, mode); //System.out.println("-- EXPORTING PIN [" + pin.getAddress() + "] to mode [" + mode.getName() + "]"); // get mode configured direction value int direction = mode.getDirection().getValue(); // if a default state was provided and the direction is OUT, then override the // pin direction to include initial state value if(defaultState != null && mode.getDirection() == PinDirection.OUT){ if(defaultState == PinState.LOW) direction = GpioUtil.DIRECTION_LOW; else if(defaultState == PinState.HIGH) direction = GpioUtil.DIRECTION_HIGH; } // if not already exported, export the pin and set the pin direction if(!GpioUtil.isExported(pin.getAddress())){ GpioUtil.export(pin.getAddress(), direction); } // if the pin is already exported, then check its current configured direction // if the direction does not match, then set the new direction for the pin else if(GpioUtil.getDirection(pin.getAddress()) != mode.getDirection().getValue()){ GpioUtil.setDirection(pin.getAddress(), direction); } // set the pin input/output mode setMode(pin, mode); }
"\",\"provider\":\"" + pin.getPin().getProvider() + "\",\"mode\":\"" + pin.getMode().getName() + "\",\"direction\":\"" + pin.getMode().getDirection() + "\",\"pull\":\"" + pin.getPullResistance().getName() + "\"},\"state\":{" +