Esempio n. 1
0
 @Override
 public void setState(PinState state, GpioPinDigitalOutput... pin) {
   if (pin == null || pin.length == 0) {
     throw new IllegalArgumentException("Missing pin argument.");
   }
   for (GpioPinDigitalOutput p : pin) {
     // ensure the requested pin has been provisioned
     if (!pins.contains(p)) {
       throw new GpioPinNotProvisionedException(p.getPin());
     }
     // set pin state
     p.setState(state);
   }
 }
Esempio n. 2
0
 @Override
 public void pulse(long milliseconds, GpioPinDigitalOutput... pin) {
   if (pin == null || pin.length == 0) {
     throw new IllegalArgumentException("Missing pin argument.");
   }
   for (GpioPinDigitalOutput p : pin) {
     // ensure the requested pin has been provisioned
     if (!pins.contains(p)) {
       throw new GpioPinNotProvisionedException(p.getPin());
     }
     // toggle pin state
     p.pulse(milliseconds);
   }
 }