MCPcopy Index your code
hub / github.com/processing/processing / releasePin

Method releasePin

java/libraries/io/src/processing/io/GPIO.java:440–458  ·  view source on GitHub ↗

Gives ownership of a pin back to the operating system @param pin GPIO pin @see pinMode @webref

(int pin)

Source from the content-addressed store, hash-verified

438 * @webref
439 */
440 public static void releasePin(int pin) {
441 checkValidPin(pin);
442
443 if (NativeInterface.isSimulated()) {
444 return;
445 }
446
447 String fn = "/sys/class/gpio/unexport";
448 int ret = NativeInterface.writeFile(fn, Integer.toString(pin));
449 if (ret < 0) {
450 if (ret == -2) { // ENOENT
451 System.err.println("Make sure your kernel is compiled with GPIO_SYSFS enabled");
452 }
453 // EINVAL is returned when trying to unexport pins that weren't exported to begin with, ignore this case
454 if (ret != -22) {
455 throw new RuntimeException(NativeInterface.getError(ret));
456 }
457 }
458 }
459
460
461 /**

Callers

nothing calls this directly

Calls 6

checkValidPinMethod · 0.95
isSimulatedMethod · 0.95
writeFileMethod · 0.95
getErrorMethod · 0.95
toStringMethod · 0.45
printlnMethod · 0.45

Tested by

no test coverage detected