From ad6986caef6738520f42c03dd3f3641f91fd113a Mon Sep 17 00:00:00 2001 From: gohai Date: Fri, 24 Feb 2017 11:12:50 +0100 Subject: [PATCH] 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. --- java/libraries/io/src/processing/io/GPIO.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/java/libraries/io/src/processing/io/GPIO.java b/java/libraries/io/src/processing/io/GPIO.java index fc86d2343..856bdb228 100644 --- a/java/libraries/io/src/processing/io/GPIO.java +++ b/java/libraries/io/src/processing/io/GPIO.java @@ -447,7 +447,18 @@ public class GPIO { * Waits for the value of an input pin to change * @param pin GPIO pin * @param mode what to wait for: GPIO.CHANGE, GPIO.FALLING or GPIO.RISING - * @param timeout don't wait more than timeout milliseconds (-1 waits indefinitely) + * @webref + */ + public static void waitFor(int pin, int mode) { + waitForInterrupt(pin, mode, -1); + } + + + /** + * Waits for the value of an input pin to change + * @param pin GPIO pin + * @param mode what to wait for: GPIO.CHANGE, GPIO.FALLING or GPIO.RISING + * @param timeout don't wait more than timeout milliseconds * @return true if the interrupt occured, false if the timeout occured * @webref */