MCPcopy Index your code
hub / github.com/benfry/processing4 / releasePin

Method releasePin

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

Gives ownership of a pin back to the operating system Without calling this function, the pin will remain in the current state even after the sketch has been closed. @param pin GPIO pin @see pinMode @webref GPIO @webBrief Gives ownership of a pin back to the operating system

(int pin)

Source from the content-addressed store, hash-verified

506 * @webBrief Gives ownership of a pin back to the operating system
507 */
508 public static void releasePin(int pin) {
509 checkValidPin(pin);
510
511 if (NativeInterface.isSimulated()) {
512 return;
513 }
514
515 String fn = "/sys/class/gpio/unexport";
516 int ret = NativeInterface.writeFile(fn, Integer.toString(pin));
517 if (ret < 0) {
518 if (ret == -2) { // ENOENT
519 System.err.println("Make sure your kernel is compiled with GPIO_SYSFS enabled");
520 }
521 // EINVAL is returned when trying to unexport pins that weren't exported to begin with, ignore this case
522 if (ret != -22) {
523 throw new RuntimeException(NativeInterface.getError(ret));
524 }
525 }
526 }
527
528
529 /**

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