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

Method close

java/libraries/io/src/processing/io/PWM.java:112–130  ·  view source on GitHub ↗

Gives ownership of a channel back to the operating system @webref

()

Source from the content-addressed store, hash-verified

110 * @webref
111 */
112 public void close() {
113 if (NativeInterface.isSimulated()) {
114 return;
115 }
116
117 // XXX: implicit clear()?
118 // XXX: also check GPIO
119
120 String fn = "/sys/class/pwm/" + chip + "/unexport";
121 int ret = NativeInterface.writeFile(fn, Integer.toString(channel));
122 if (ret < 0) {
123 if (ret == -2) { // ENOENT
124 System.err.println("Make sure your kernel is compiled with PWM_SYSFS enabled and you have the necessary PWM driver for your platform");
125 }
126 // XXX: check
127 // EINVAL is also returned when trying to unexport pins that weren't exported to begin with
128 throw new RuntimeException(NativeInterface.getError(ret));
129 }
130 }
131
132
133 /**

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected