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.)
This commit is contained in:
gohai
2017-02-22 16:46:56 +01:00
parent d0707b5fd6
commit 45fe7a8d73

View File

@@ -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
*