@Override public void setMode(Pin pin, PinMode mode) { // ALL PIN MODES ARE PREDEFINED // // an exception will be throw by the base impl // if an alternate mode is selected for a pin // instance super.setMode(pin, mode); }
@Override public void setMode(Pin pin, PinMode mode) { super.setMode(pin, mode); }
@Override public void setMode(Pin pin, PinMode mode) { super.setMode(pin, mode); // determine A or B port based on pin address try { if (pin.getAddress() < GPIO_B_OFFSET) { setModeA(pin, mode); } else { setModeB(pin, mode); } } catch (IOException ex) { throw new RuntimeException(ex); } // if any pins are configured as input pins, then we need to start the interrupt monitoring // thread if (currentDirectionA > 0 || currentDirectionB > 0) { // if the monitor has not been started, then start it now if (monitor == null) { // start monitoring thread monitor = new GpioStateMonitor(this); monitor.start(); } } else { // shutdown and destroy monitoring thread since there are no input pins configured if (monitor != null) { monitor.shutdown(); monitor = null; } } }
@Override public void setMode(Pin pin, PinMode mode) { super.setMode(pin, mode); // determine A or B port based on pin address try { if (pin.getAddress() < GPIO_B_OFFSET) { setModeA(pin, mode); } else { setModeB(pin, mode); } } catch (IOException ex) { throw new RuntimeException(ex); } // if any pins are configured as input pins, then we need to start the interrupt monitoring // thread if (currentDirectionA > 0 || currentDirectionB > 0) { // if the monitor has not been started, then start it now if (monitor == null) { // start monitoring thread monitor = new GpioStateMonitor(device); monitor.start(); } } else { // shutdown and destroy monitoring thread since there are no input pins configured if (monitor != null) { monitor.shutdown(); monitor = null; } } }
@Override public void setMode(Pin pin, PinMode mode) { super.setMode(pin, mode); // determine A or B port based on pin address try { if (pin.getAddress() < GPIO_B_OFFSET) { setModeA(pin, mode); } else { setModeB(pin, mode); } } catch (IOException ex) { throw new RuntimeException(ex); } // if any pins are configured as input pins, then we need to start the interrupt monitoring // thread if (currentDirectionA > 0 || currentDirectionB > 0) { // if the monitor has not been started, then start it now if (monitor == null) { // start monitoring thread monitor = new GpioStateMonitor(this); monitor.start(); } } else { // shutdown and destroy monitoring thread since there are no input pins configured if (monitor != null) { monitor.shutdown(); monitor = null; } } }
@Override public void setMode(Pin pin, PinMode mode) { super.setMode(pin, mode);
@Override public void setMode(Pin pin, PinMode mode) { super.setMode(pin, mode); // local pin mode cache pinModeCache[pin.getAddress()] = mode; if (!pin.getSupportedPinModes().contains(mode)) { throw new InvalidPinModeException(pin, "Invalid pin mode [" + mode.getName() + "]; pin [" + pin.getName() + "] does not support this mode."); } if (!pin.getSupportedPinModes().contains(mode)) { throw new UnsupportedPinModeException(pin, mode); } // cache mode getPinCache(pin).setMode(mode); // set pin mode on hardware com.pi4j.wiringpi.Gpio.pinMode(pin.getAddress(), mode.getValue()); }
@Override public void setMode(Pin pin, PinMode mode) { super.setMode(pin, mode); // local pin mode cache pinModeCache[pin.getAddress()] = mode; if (!pin.getSupportedPinModes().contains(mode)) { throw new InvalidPinModeException(pin, "Invalid pin mode [" + mode.getName() + "]; pin [" + pin.getName() + "] does not support this mode."); } if (!pin.getSupportedPinModes().contains(mode)) { throw new UnsupportedPinModeException(pin, mode); } // cache mode getPinCache(pin).setMode(mode); // set pin mode on hardware com.pi4j.wiringpi.Gpio.pinMode(pin.getAddress(), mode.getValue()); }