Skip to content

Commit 1d1232c

Browse files
committed
IO: Introduce a variant of waitFor that doesn't take a timeout
This simplifies the semantic of the variant with three arguments, since we now don't have the "-1 means wait forever" case any longer.
1 parent 5177d48 commit 1d1232c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

java/libraries/io/src/processing/io/GPIO.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,18 @@ public static void releasePin(int pin) {
447447
* Waits for the value of an input pin to change
448448
* @param pin GPIO pin
449449
* @param mode what to wait for: GPIO.CHANGE, GPIO.FALLING or GPIO.RISING
450-
* @param timeout don't wait more than timeout milliseconds (-1 waits indefinitely)
450+
* @webref
451+
*/
452+
public static void waitFor(int pin, int mode) {
453+
waitForInterrupt(pin, mode, -1);
454+
}
455+
456+
457+
/**
458+
* Waits for the value of an input pin to change
459+
* @param pin GPIO pin
460+
* @param mode what to wait for: GPIO.CHANGE, GPIO.FALLING or GPIO.RISING
461+
* @param timeout don't wait more than timeout milliseconds
451462
* @return true if the interrupt occured, false if the timeout occured
452463
* @webref
453464
*/

0 commit comments

Comments
 (0)