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.
This commit is contained in:
gohai
2017-02-24 11:12:50 +01:00
parent 5b4be31a28
commit ad6986caef

View File

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