From 45fe7a8d73d31c02cf1ee2944adf6015bc79db9c Mon Sep 17 00:00:00 2001 From: gohai Date: Wed, 22 Feb 2017 16:46:56 +0100 Subject: [PATCH] IO: Rename the (publicly listed) waitForInterrupt function to waitFor This function is used like this: GPIO.waitFor(pin number, rising/falling/change, timeout or -1) While it's using an interrupt internally, in the way it is used it doesn't relate to the interrupt functions (attachInterrupt, etc) at all. To prevent confusion, rename it to waitFor. (Another possible name would be waitForPin.) --- java/libraries/io/src/processing/io/GPIO.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/java/libraries/io/src/processing/io/GPIO.java b/java/libraries/io/src/processing/io/GPIO.java index a0b970955..fc86d2343 100644 --- a/java/libraries/io/src/processing/io/GPIO.java +++ b/java/libraries/io/src/processing/io/GPIO.java @@ -451,12 +451,17 @@ public class GPIO { * @return true if the interrupt occured, false if the timeout occured * @webref */ - public static boolean waitForInterrupt(int pin, int mode, int timeout) { + public static boolean waitFor(int pin, int mode, int timeout) { enableInterrupt(pin, mode); return waitForInterrupt(pin, timeout); } + public static boolean waitForInterrupt(int pin, int mode, int timeout) { + throw new RuntimeException("The waitForInterrupt function has been renamed to waitFor. Please update your sketch accordingly."); + } + + /** * Waits for the value of an input pin to change *